当前位置: 首页>>代码示例>>PHP>>正文


PHP Site::getIdSitesFromIdSitesString方法代码示例

本文整理汇总了PHP中Piwik\Site::getIdSitesFromIdSitesString方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getIdSitesFromIdSitesString方法的具体用法?PHP Site::getIdSitesFromIdSitesString怎么用?PHP Site::getIdSitesFromIdSitesString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Site的用法示例。


在下文中一共展示了Site::getIdSitesFromIdSitesString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCommonVisitors

 /**
  * Return the number of visitors that visited every site in the given list for the
  * given date range. Includes the number of visitors that visited at least one site
  * and the number that visited every site.
  *
  * This data is calculated on demand, and for very large tables can take a long time
  * to run.
  *
  * See {@link Model\DistinctMetricsAggregator} for more information.
  *
  * @param string $idSite comma separated list of site IDs, ie, `"1,2,3"`
  * @param string $period
  * @param string $date
  * @return array Metrics **nb_total_visitors** and **nb_shared_visitors**.
  * @throws Exception if $idSite references zero sites or just one site.
  */
 public function getCommonVisitors($idSite, $period, $date, $segment = false)
 {
     if (empty($idSite)) {
         throw new Exception("No sites to get common visitors for.");
     }
     $idSites = Site::getIdSitesFromIdSitesString($idSite);
     Piwik::checkUserHasViewAccess($idSites);
     $segment = new Segment($segment, $idSites);
     $period = PeriodFactory::build($period, $date);
     return $this->distinctMetricsAggregator->getCommonVisitorCount($idSites, $period->getDateStart(), $period->getDateEnd(), $segment);
 }
开发者ID:PiwikPRO,项目名称:plugin-InterSites,代码行数:27,代码来源:API.php

示例2: invalidateArchivedReports

 /**
  * When tracking data in the past (using Tracking API), this function
  * can be used to invalidate reports for the idSites and dates where new data
  * was added.
  * DEV: If you call this API, the UI should display the data correctly, but will process
  *      in real time, which could be very slow after large data imports.
  *      After calling this function via REST, you can manually force all data
  *      to be reprocessed by visiting the script as the Super User:
  *      http://example.net/piwik/misc/cron/archive.php?token_auth=$SUPER_USER_TOKEN_AUTH_HERE
  * REQUIREMENTS: On large piwik setups, you will need in PHP configuration: max_execution_time = 0
  *    We recommend to use an hourly schedule of the script.
  *    More information: http://piwik.org/setup-auto-archiving/
  *
  * @param string $idSites Comma separated list of idSite that have had data imported for the specified dates
  * @param string $dates Comma separated list of dates to invalidate for all these websites
  * @param string $period If specified (one of day, week, month, year, range) it will only invalidates archives for this period.
  *                      Note: because week, month, year, range reports aggregate day reports then you need to specifically invalidate day reports to see
  *                      other periods reports processed..
  * @throws Exception
  * @return array
  * @hideExceptForSuperUser
  */
 public function invalidateArchivedReports($idSites, $dates, $period = false)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     if (empty($idSites)) {
         throw new Exception("Specify a value for &idSites= as a comma separated list of website IDs, for which your token_auth has 'admin' permission");
     }
     Piwik::checkUserHasAdminAccess($idSites);
     $invalidator = new ArchiveInvalidator();
     $output = $invalidator->markArchivesAsInvalidated($idSites, $dates, $period);
     Site::clearCache();
     return $output;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:34,代码来源:API.php

示例3: checkUserHasAdminAccess

 public static function checkUserHasAdminAccess($idSites)
 {
     if (!self::$superUser) {
         $websitesAccess = self::$idSitesAdmin;
     } else {
         $websitesAccess = API::getInstance()->getAllSitesId();
     }
     $idSites = PiwikSite::getIdSitesFromIdSitesString($idSites);
     foreach ($idSites as $idsite) {
         if (!in_array($idsite, $websitesAccess)) {
             throw new NoAccessException("checkUserHasAdminAccess Fake exception // string not to be tested");
         }
     }
 }
开发者ID:GovanifY,项目名称:piwik,代码行数:14,代码来源:FakeAccess.php

示例4: getSitesToInvalidateFor

 private function getSitesToInvalidateFor(InputInterface $input)
 {
     $sites = $input->getOption('sites');
     $siteIds = Site::getIdSitesFromIdSitesString($sites);
     if (empty($siteIds)) {
         throw new \InvalidArgumentException("Invalid --sites value: '{$sites}'.");
     }
     $allSiteIds = SitesManagerAPI::getInstance()->getAllSitesId();
     foreach ($siteIds as $idSite) {
         if (!in_array($idSite, $allSiteIds)) {
             throw new \InvalidArgumentException("Invalid --sites value: '{$sites}', there are no sites with IDs = {$idSite}");
         }
     }
     return $siteIds;
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:15,代码来源:InvalidateReportData.php

示例5: isSiteSearchEnabled

 public function isSiteSearchEnabled($idSites, $idSite)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites, true);
     if (!empty($idSite)) {
         $idSites[] = $idSite;
     }
     if (empty($idSites)) {
         return false;
     }
     foreach ($idSites as $idSite) {
         if (!Site::isSiteSearchEnabledFor($idSite)) {
             return false;
         }
     }
     return true;
 }
开发者ID:cemo,项目名称:piwik,代码行数:16,代码来源:Actions.php

示例6: invalidateArchivedReports

 /**
  * When tracking data in the past (using Tracking API), this function
  * can be used to invalidate reports for the idSites and dates where new data
  * was added.
  * DEV: If you call this API, the UI should display the data correctly, but will process
  *      in real time, which could be very slow after large data imports.
  *      After calling this function via REST, you can manually force all data
  *      to be reprocessed by visiting the script as the Super User:
  *      http://example.net/piwik/misc/cron/archive.php?token_auth=$SUPER_USER_TOKEN_AUTH_HERE
  * REQUIREMENTS: On large piwik setups, you will need in PHP configuration: max_execution_time = 0
  *    We recommend to use an hourly schedule of the script.
  *    More information: http://piwik.org/setup-auto-archiving/
  *
  * @param string $idSites Comma separated list of idSite that have had data imported for the specified dates
  * @param string $dates Comma separated list of dates to invalidate for all these websites
  * @param string $period If specified (one of day, week, month, year, range) it will only invalidates archives for this period.
  *                      Note: because week, month, year, range reports aggregate day reports then you need to specifically invalidate day reports to see
  *                      other periods reports processed..
  * @throws Exception
  * @return array
  * @hideExceptForSuperUser
  */
 public function invalidateArchivedReports($idSites, $dates, $period = false)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     if (empty($idSites)) {
         throw new Exception("Specify a value for &idSites= as a comma separated list of website IDs, for which your token_auth has 'admin' permission");
     }
     Piwik::checkUserHasAdminAccess($idSites);
     list($dateObjects, $invalidDates) = $this->getDatesToInvalidateFromString($dates);
     $invalidator = new ArchiveInvalidator();
     $output = $invalidator->markArchivesAsInvalidated($idSites, $dateObjects, $period);
     if ($invalidDates) {
         $output[] = 'Warning: some of the Dates to invalidate were invalid: ' . implode(", ", $invalidDates) . ". Piwik simply ignored those and proceeded with the others.";
     }
     Site::clearCache();
     return $output;
 }
开发者ID:jniebuhr,项目名称:piwik,代码行数:38,代码来源:API.php

示例7: isSiteSearchEnabled

 public function isSiteSearchEnabled()
 {
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     $idSites = Common::getRequestVar('idSites', '', 'string');
     $idSites = Site::getIdSitesFromIdSitesString($idSites, true);
     if (!empty($idSite)) {
         $idSites[] = $idSite;
     }
     if (empty($idSites)) {
         return false;
     }
     foreach ($idSites as $idSite) {
         if (!Site::isSiteSearchEnabledFor($idSite)) {
             return false;
         }
     }
     return true;
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:18,代码来源:Actions.php

示例8: getGoals

 /**
  * Returns all Goals for a given website, or list of websites
  *
  * @param string|array $idSite Array or Comma separated list of website IDs to request the goals for
  * @return array Array of Goal attributes
  */
 public function getGoals($idSite)
 {
     $cacheId = self::getCacheId($idSite);
     $cache = $this->getGoalsInfoStaticCache();
     if (!$cache->contains($cacheId)) {
         $idSite = Site::getIdSitesFromIdSitesString($idSite);
         if (empty($idSite)) {
             return array();
         }
         Piwik::checkUserHasViewAccess($idSite);
         $goals = $this->getModel()->getActiveGoals($idSite);
         $cleanedGoals = array();
         foreach ($goals as &$goal) {
             $cleanedGoals[$goal['idgoal']] = $this->formatGoal($goal);
         }
         $cache->save($cacheId, $cleanedGoals);
     }
     return $cache->fetch($cacheId);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:25,代码来源:API.php

示例9: getGoals

 /**
  * Returns all Goals for a given website, or list of websites
  *
  * @param string|array $idSite Array or Comma separated list of website IDs to request the goals for
  * @return array Array of Goal attributes
  */
 public function getGoals($idSite)
 {
     //TODO calls to this function could be cached as static
     // would help UI at least, since some UI requests would call this 2-3 times..
     $idSite = Site::getIdSitesFromIdSitesString($idSite);
     if (empty($idSite)) {
         return array();
     }
     Piwik::checkUserHasViewAccess($idSite);
     $goals = $this->getModel()->getActiveGoals($idSite);
     $cleanedGoals = array();
     foreach ($goals as &$goal) {
         if ($goal['match_attribute'] == 'manually') {
             unset($goal['pattern']);
             unset($goal['pattern_type']);
             unset($goal['case_sensitive']);
         }
         $cleanedGoals[$goal['idgoal']] = $goal;
     }
     return $cleanedGoals;
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:27,代码来源:API.php

示例10: getGoals

 /**
  * Returns all Goals for a given website, or list of websites
  *
  * @param string|array $idSite Array or Comma separated list of website IDs to request the goals for
  * @return array Array of Goal attributes
  */
 public function getGoals($idSite)
 {
     //TODO calls to this function could be cached as static
     // would help UI at least, since some UI requests would call this 2-3 times..
     $idSite = Site::getIdSitesFromIdSitesString($idSite);
     if (empty($idSite)) {
         return array();
     }
     Piwik::checkUserHasViewAccess($idSite);
     $goals = Db::fetchAll("SELECT *\n\t\t\t\t\t\t\t\tFROM " . Common::prefixTable('goal') . "\n\t\t\t\t\t\t\t\tWHERE idsite IN (" . implode(", ", $idSite) . ")\n\t\t\t\t\t\t\t\t\tAND deleted = 0");
     $cleanedGoals = array();
     foreach ($goals as &$goal) {
         if ($goal['match_attribute'] == 'manually') {
             unset($goal['pattern']);
             unset($goal['pattern_type']);
             unset($goal['case_sensitive']);
         }
         $cleanedGoals[$goal['idgoal']] = $goal;
     }
     return $cleanedGoals;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:27,代码来源:API.php

示例11: invalidateArchivedReports

 /**
  * Invalidates report data, forcing it to be recomputed during the next archiving run.
  *
  * Note: This is done automatically when tracking or importing visits in the past.
  *
  * @param string $idSites Comma separated list of site IDs to invalidate reports for.
  * @param string $dates Comma separated list of dates of periods to invalidate reports for.
  * @param string|bool $period The type of period to invalidate: either 'day', 'week', 'month', 'year', 'range'.
  *                            The command will automatically cascade up, invalidating reports for parent periods as
  *                            well. So invalidating a day will invalidate the week it's in, the month it's in and the
  *                            year it's in, since those periods will need to be recomputed too.
  * @param string|bool $segment Optional. The segment to invalidate reports for.
  * @param bool $cascadeDown If true, child periods will be invalidated as well. So if it is requested to invalidate
  *                          a month, then all the weeks and days within that month will also be invalidated. But only
  *                          if this parameter is set.
  * @throws Exception
  * @return array
  * @hideExceptForSuperUser
  */
 public function invalidateArchivedReports($idSites, $dates, $period = false, $segment = false, $cascadeDown = false)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     if (empty($idSites)) {
         throw new Exception("Specify a value for &idSites= as a comma separated list of website IDs, for which your token_auth has 'admin' permission");
     }
     Piwik::checkUserHasAdminAccess($idSites);
     if (!empty($segment)) {
         $segment = new Segment($segment, $idSites);
     } else {
         $segment = null;
     }
     list($dateObjects, $invalidDates) = $this->getDatesToInvalidateFromString($dates);
     $invalidationResult = $this->invalidator->markArchivesAsInvalidated($idSites, $dateObjects, $period, $segment, (bool) $cascadeDown);
     $output = $invalidationResult->makeOutputLogs();
     if ($invalidDates) {
         $output[] = 'Warning: some of the Dates to invalidate were invalid: ' . implode(", ", $invalidDates) . ". Piwik simply ignored those and proceeded with the others.";
     }
     Site::clearCache();
     // TODO: is this needed? it shouldn't be needed...
     return $invalidationResult->makeOutputLogs();
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:41,代码来源:API.php

示例12: getGoals

 /**
  * Returns all Goals for a given website, or list of websites
  *
  * @param string|array $idSite Array or Comma separated list of website IDs to request the goals for
  * @return array Array of Goal attributes
  */
 public function getGoals($idSite)
 {
     $cacheId = self::getCacheId($idSite);
     $cache = $this->getGoalsInfoStaticCache();
     if (!$cache->contains($cacheId)) {
         $idSite = Site::getIdSitesFromIdSitesString($idSite);
         if (empty($idSite)) {
             return array();
         }
         Piwik::checkUserHasViewAccess($idSite);
         $goals = $this->getModel()->getActiveGoals($idSite);
         $cleanedGoals = array();
         foreach ($goals as &$goal) {
             if ($goal['match_attribute'] == 'manually') {
                 unset($goal['pattern']);
                 unset($goal['pattern_type']);
                 unset($goal['case_sensitive']);
             }
             $cleanedGoals[$goal['idgoal']] = $goal;
         }
         $cache->save($cacheId, $cleanedGoals);
     }
     return $cache->fetch($cacheId);
 }
开发者ID:drabberhorizon,项目名称:ActiveNative,代码行数:30,代码来源:API.php

示例13: updateSiteCreatedTime

 /**
  * Updates the field ts_created for the specified websites.
  *
  * @param $idSites int Id Site to update ts_created
  * @param $minDate Date to set as creation date. To play it safe it will substract one more day.
  *
  * @ignore
  */
 public function updateSiteCreatedTime($idSites, Date $minDate)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     Piwik::checkUserHasAdminAccess($idSites);
     $minDateSql = $minDate->subDay(1)->getDatetime();
     $this->getModel()->updateSiteCreatedTime($idSites, $minDateSql);
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:15,代码来源:API.php

示例14: getIdSites

 /**
  * @param int|array|string $idSites
  * @return array
  * @throws \Piwik\NoAccessException
  */
 protected function getIdSites($idSites)
 {
     if ($idSites === 'all') {
         $idSites = $this->getSitesIdWithAtLeastViewAccess();
     }
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     if (empty($idSites)) {
         throw new NoAccessException("The parameter 'idSite=' is missing from the request.");
     }
     return $idSites;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:16,代码来源:Access.php

示例15: initStateFromParameters

 /**
  * Initializes the various parameters to the script, based on input parameters.
  *
  */
 private function initStateFromParameters()
 {
     $this->todayArchiveTimeToLive = Rules::getTodayArchiveTimeToLive();
     $this->acceptInvalidSSLCertificate = $this->getParameterFromCli("accept-invalid-ssl-certificate");
     $this->processPeriodsMaximumEverySeconds = $this->getDelayBetweenPeriodsArchives();
     $this->shouldArchiveAllSites = (bool) $this->getParameterFromCli("force-all-websites");
     $this->shouldStartProfiler = (bool) $this->getParameterFromCli("xhprof");
     $restrictToIdSites = $this->getParameterFromCli("force-idsites", true);
     $skipIdSites = $this->getParameterFromCli("skip-idsites", true);
     $this->shouldArchiveSpecifiedSites = \Piwik\Site::getIdSitesFromIdSitesString($restrictToIdSites);
     $this->shouldSkipSpecifiedSites = \Piwik\Site::getIdSitesFromIdSitesString($skipIdSites);
     $this->lastSuccessRunTimestamp = Option::get(self::OPTION_ARCHIVING_FINISHED_TS);
     $this->shouldArchiveOnlySitesWithTrafficSince = $this->isShouldArchiveAllSitesWithTrafficSince();
     $this->shouldArchiveOnlySpecificPeriods = $this->getPeriodsToProcess();
     if ($this->shouldArchiveOnlySitesWithTrafficSince === false) {
         // force-all-periods is not set here
         if (empty($this->lastSuccessRunTimestamp)) {
             // First time we run the script
             $this->shouldArchiveOnlySitesWithTrafficSince = self::ARCHIVE_SITES_WITH_TRAFFIC_SINCE;
         } else {
             // there was a previous successful run
             $this->shouldArchiveOnlySitesWithTrafficSince = time() - $this->lastSuccessRunTimestamp;
         }
     } else {
         // force-all-periods is set here
         $this->archiveAndRespectTTL = false;
         if ($this->shouldArchiveOnlySitesWithTrafficSince === true) {
             // force-all-periods without value
             $this->shouldArchiveOnlySitesWithTrafficSince = self::ARCHIVE_SITES_WITH_TRAFFIC_SINCE;
         }
     }
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:36,代码来源:CronArchive.php


注:本文中的Piwik\Site::getIdSitesFromIdSitesString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。