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


PHP Piwik\Date类代码示例

本文整理汇总了PHP中Piwik\Date的典型用法代码示例。如果您正苦于以下问题:PHP Date类的具体用法?PHP Date怎么用?PHP Date使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getTranslatedRange

 /**
  * @param string $format
  * @param \Piwik\Date $dateStart
  * @param \Piwik\Date $dateEnd
  *
  * @return mixed
  */
 protected static function getTranslatedRange($format, $dateStart, $dateEnd)
 {
     $string = str_replace('From%', '%', $format);
     $string = $dateStart->getLocalized($string);
     $string = str_replace('To%', '%', $string);
     $string = $dateEnd->getLocalized($string);
     return $string;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:15,代码来源:Week.php

示例2: getTable

 protected static function getTable(Date $date, $type)
 {
     $tableNamePrefix = "archive_" . $type;
     $tableName = $tableNamePrefix . "_" . $date->toString('Y_m');
     $tableName = Common::prefixTable($tableName);
     self::createArchiveTablesIfAbsent($tableName, $tableNamePrefix);
     return $tableName;
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:8,代码来源:ArchiveTableCreator.php

示例3: test_deleteAlertsForWebsite

 public function test_deleteAlertsForWebsite()
 {
     $this->createAlert('Initial1', array(), array(2));
     $this->createAlert('Initial2', array(), array(1, 2, 3));
     $this->createAlert('Initial3', array(), array(1));
     $this->createAlert('Initial4', array(), array(1, 3));
     $this->createAlert('Initial5', array(), array(2));
     $this->createAlert('Initial6', array(), array(2));
     $this->model->triggerAlert(1, 1, 99, 48, Date::now()->getDatetime());
     $this->model->triggerAlert(1, 2, 99, 48, Date::now()->getDatetime());
     $this->model->triggerAlert(2, 3, 99, 48, Date::now()->getDatetime());
     $this->model->triggerAlert(3, 2, 99, 48, Date::now()->getDatetime());
     $alerts = $this->model->getTriggeredAlerts(array(1, 2, 3), 'superUserLogin');
     $this->assertCount(4, $alerts);
     $this->plugin->deleteAlertsForSite(2);
     $alerts = $this->model->getAllAlerts();
     $this->assertCount(6, $alerts);
     $this->assertEquals($alerts[0]['id_sites'], array());
     $this->assertEquals($alerts[1]['id_sites'], array(1, 3));
     $this->assertEquals($alerts[2]['id_sites'], array(1));
     $this->assertEquals($alerts[3]['id_sites'], array(1, 3));
     $this->assertEquals($alerts[4]['id_sites'], array());
     $this->assertEquals($alerts[5]['id_sites'], array());
     $alerts = $this->model->getTriggeredAlerts(array(1, 2, 3), 'superUserLogin');
     $this->assertCount(2, $alerts);
 }
开发者ID:andrzejewsky,项目名称:plugin-CustomAlerts,代码行数:26,代码来源:CustomAlertsTest.php

示例4: getAnnotationManager

 /**
  * Controller action that returns HTML displaying annotations for a site and
  * specific date range.
  *
  * Query Param Input:
  *  - idSite: The ID of the site to get annotations for. Only one allowed.
  *  - date: The date to get annotations for. If lastN is not supplied, this is the start date,
  *          otherwise the start date in the last period.
  *  - period: The period type.
  *  - lastN: If supplied, the last N # of periods will be included w/ the range specified
  *           by date + period.
  *
  * Output:
  *  - HTML displaying annotations for a specific range.
  *
  * @param bool $fetch True if the annotation manager should be returned as a string,
  *                    false if it should be echo-ed.
  * @param bool|string $date Override for 'date' query parameter.
  * @param bool|string $period Override for 'period' query parameter.
  * @param bool|string $lastN Override for 'lastN' query parameter.
  * @return string|void
  */
 public function getAnnotationManager($fetch = false, $date = false, $period = false, $lastN = false)
 {
     $idSite = Common::getRequestVar('idSite');
     if ($date === false) {
         $date = Common::getRequestVar('date', false);
     }
     if ($period === false) {
         $period = Common::getRequestVar('period', 'day');
     }
     if ($lastN === false) {
         $lastN = Common::getRequestVar('lastN', false);
     }
     // create & render the view
     $view = new View('@Annotations/getAnnotationManager');
     $allAnnotations = Request::processRequest('Annotations.getAll', array('date' => $date, 'period' => $period, 'lastN' => $lastN));
     $view->annotations = empty($allAnnotations[$idSite]) ? array() : $allAnnotations[$idSite];
     $view->period = $period;
     $view->lastN = $lastN;
     list($startDate, $endDate) = API::getDateRangeForPeriod($date, $period, $lastN);
     $view->startDate = $startDate->toString();
     $view->endDate = $endDate->toString();
     if ($startDate->toString() !== $endDate->toString()) {
         $view->selectedDate = Date::today()->toString();
     } else {
         $view->selectedDate = $endDate->toString();
     }
     $dateFormat = Piwik::translate('CoreHome_ShortDateFormatWithYear');
     $view->startDatePretty = $startDate->getLocalized($dateFormat);
     $view->endDatePretty = $endDate->getLocalized($dateFormat);
     $view->canUserAddNotes = AnnotationList::canUserAddNotesFor($idSite);
     return $view->render();
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:54,代码来源:Controller.php

示例5: setUp

 public function setUp()
 {
     // add one site
     Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/");
     // add two goals
     $goals = API::getInstance();
     $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5);
     $goals->addGoal($this->idSite, 'all', 'url', 'thing2', 'contains');
     $start = Date::factory($this->date);
     $dates = array();
     for ($day = 0; $day != 31; ++$day) {
         $dates[] = $start->addDay($day);
     }
     $t = BenchmarkTestCase::getLocalTracker($this->idSite);
     $actionNum = 0;
     foreach ($dates as $date) {
         for ($visitNum = 0; $visitNum != 1000; ++$visitNum) {
             if ($visitNum % 2 == 0) {
                 $url = "http://whatever.com/{$actionNum}/0/1/2/3/4/5/6/7/8/9";
                 $referrerUrl = "http://google.com/?q={$actionNum}";
             } else {
                 $url = "http://whatever.com/thing2/{$actionNum}/0/1/2/3/4/5/6/7/8/9";
                 $referrerUrl = "http://";
             }
             $title = "A page title / {$actionNum} / 0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 /9";
             $t->setNewVisitorId();
             $t->setForceVisitDateTime($date);
             $t->setUrl($url);
             $t->setUrlReferrer($referrerUrl);
             Fixture::checkResponse($t->doTrackPageView($title));
             ++$actionNum;
         }
     }
 }
开发者ID:Abine,项目名称:piwik,代码行数:34,代码来源:OneSiteThousandsOfDistinctUrlsOverMonth.php

示例6: renderTable

 /**
  * Computes the output for the given data table
  *
  * @param DataTable $table
  * @return string
  * @throws Exception
  */
 protected function renderTable($table)
 {
     if (!$table instanceof DataTable\Map || $table->getKeyName() != 'date') {
         throw new Exception("RSS feeds can be generated for one specific website &idSite=X." . "\nPlease specify only one idSite or consider using &format=XML instead.");
     }
     $idSite = Common::getRequestVar('idSite', 1, 'int');
     $period = Common::getRequestVar('period');
     $piwikUrl = SettingsPiwik::getPiwikUrl() . "?module=CoreHome&action=index&idSite=" . $idSite . "&period=" . $period;
     $out = "";
     $moreRecentFirst = array_reverse($table->getDataTables(), true);
     foreach ($moreRecentFirst as $date => $subtable) {
         /** @var DataTable $subtable */
         $timestamp = $subtable->getMetadata(Archive\DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getDateStart()->getTimestamp();
         $site = $subtable->getMetadata(Archive\DataTableFactory::TABLE_METADATA_SITE_INDEX);
         $pudDate = date('r', $timestamp);
         $dateInSiteTimezone = Date::factory($timestamp);
         if ($site) {
             $dateInSiteTimezone = $dateInSiteTimezone->setTimezone($site->getTimezone());
         }
         $dateInSiteTimezone = $dateInSiteTimezone->toString('Y-m-d');
         $thisPiwikUrl = Common::sanitizeInputValue($piwikUrl . "&date={$dateInSiteTimezone}");
         $siteName = $site ? $site->getName() : '';
         $title = $siteName . " on " . $date;
         $out .= "\t<item>\n\t\t<pubDate>{$pudDate}</pubDate>\n\t\t<guid>{$thisPiwikUrl}</guid>\n\t\t<link>{$thisPiwikUrl}</link>\n\t\t<title>{$title}</title>\n\t\t<author>http://piwik.org</author>\n\t\t<description>";
         $out .= Common::sanitizeInputValue($this->renderDataTable($subtable));
         $out .= "</description>\n\t</item>\n";
     }
     $header = $this->getRssHeader();
     $footer = $this->getRssFooter();
     return $header . $out . $footer;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:38,代码来源:Rss.php

示例7: trackVisits

 private function trackVisits()
 {
     $dateTimes = $this->dateTimes;
     $days = 0;
     $ridx = 0;
     foreach ($dateTimes as $dateTime) {
         $days++;
         // Fake the visit count cookie
         $debugStringAppend = "&_idvc={$days}";
         $visitor = $this->makeTracker($this->idSite, $dateTime, $debugStringAppend);
         // FIRST VISIT THIS DAY
         $visitor->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.1)->getDatetime());
         $visitor->setUrl('http://example.org/homepage');
         $visitor->setUrlReferrer($this->referrerUrls[$ridx++]);
         self::checkResponse($visitor->doTrackPageView('ou pas'));
         // Test change the IP, the visit should not be split but recorded to the same idvisitor
         $visitor->setIp('200.1.15.22');
         $visitor->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.2)->getDatetime());
         $urlWithThreeSubdirectories = 'http://example.org/sub1/sub2/sub3/news';
         $visitor->setUrl($urlWithThreeSubdirectories);
         self::checkResponse($visitor->doTrackPageView('ou pas'));
         // SECOND VISIT THIS DAY
         $visitor->setForceVisitDateTime(Date::factory($dateTime)->addHour(1)->getDatetime());
         $visitor->setUrl('http://example.org/news');
         $visitor->setUrlReferrer($this->referrerUrls[$ridx++]);
         self::checkResponse($visitor->doTrackPageView('ou pas'));
         if ($days <= 3) {
             $visitor = $this->makeTracker($this->idSite2, $dateTime);
             $visitor->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.1)->getDatetime());
             $visitor->setUrl('http://example.org/homepage');
             $visitor->setUrlReferrer($this->referrerUrls[$ridx - 1]);
             self::checkResponse($visitor->doTrackPageView('Second website'));
         }
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:35,代码来源:VisitsOverSeveralDays.php

示例8: trackVisits

 private function trackVisits()
 {
     $dateTime = $this->dateTime;
     $idSite = $this->idSite;
     // two visits to site 1 & 3
     $visitor1 = self::getTracker($idSite, $dateTime, $defaultInit = true);
     $visitor1->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
     $visitor1->setUrl('http://helios.org/alpha');
     $visitor1->doTrackPageView("page title");
     $visitor1->setIdSite($this->idSite2);
     $visitor1->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
     $visitor1->setUrl('http://taura.org/');
     $visitor1->doTrackPageView("page title");
     // one visit to site 1
     $visitor2 = self::getTracker($idSite, $dateTime, $defaultInit = true);
     $visitor2->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(2)->getDatetime());
     $visitor2->setUrl('http://helios.org/beta');
     $visitor2->doTrackPageView("page title 2");
     // two visits to site 2 and 3
     $visitor3 = self::getTracker($this->idSite1, $dateTime, $defaultInit = true);
     $visitor3->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(3)->getDatetime());
     $visitor3->setUrl('http://virgon.org/');
     $visitor3->doTrackPageView("page title 2");
     $visitor3->setIdSite($this->idSite2);
     $visitor3->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(4)->getDatetime());
     $visitor3->setUrl('http://taura.org/');
     $visitor3->doTrackPageView("page title");
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:28,代码来源:ThreeSitesWithSharedVisitors.php

示例9: trackVisits

 private function trackVisits()
 {
     $dateTime = $this->dateTime;
     $idSite = 1;
     $idGoal_OneConversionPerVisit = $this->idGoal_OneConversionPerVisit;
     $idGoal_MultipleConversionPerVisit = $this->idGoal_MultipleConversionPerVisit;
     $t = self::getTracker($idSite, $dateTime, $defaultInit = true);
     // Record 1st goal, should only have 1 conversion
     $t->setUrl('http://example.org/index.htm');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.3)->getDatetime());
     self::checkResponse($t->doTrackPageView('Thank you mate'));
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.4)->getDatetime());
     self::checkResponse($t->doTrackGoal($idGoal_OneConversionPerVisit, $revenue = 10000000));
     // Record 2nd goal, should record both conversions
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.5)->getDatetime());
     self::checkResponse($t->doTrackGoal($idGoal_MultipleConversionPerVisit, $revenue = 300));
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.6)->getDatetime());
     self::checkResponse($t->doTrackGoal($idGoal_MultipleConversionPerVisit, $revenue = 366));
     // Update & set to not allow multiple
     $goals = API::getInstance()->getGoals($idSite);
     $goal = $goals[$idGoal_OneConversionPerVisit];
     self::assertTrue($goal['allow_multiple'] == 0);
     API::getInstance()->updateGoal($idSite, $idGoal_OneConversionPerVisit, $goal['name'], @$goal['match_attribute'], @$goal['pattern'], @$goal['pattern_type'], @$goal['case_sensitive'], $goal['revenue'], $goal['allow_multiple'] = 1);
     self::assertTrue($goal['allow_multiple'] == 1);
     // 1st goal should Now be tracked
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.61)->getDatetime());
     self::checkResponse($t->doTrackGoal($idGoal_OneConversionPerVisit, $revenue = 656));
     // few minutes later, create a new_visit
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.7)->getDatetime());
     $t->setTokenAuth($this->getTokenAuth());
     $t->setForceNewVisit();
     $t->doTrackPageView('This is tracked in a new visit.');
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:33,代码来源:SomeVisitsAllConversions.php

示例10: index

 public function index()
 {
     Piwik::checkUserHasSuperUserAccess();
     $view = new View('@TasksTimetable/index.twig');
     $this->setGeneralVariablesView($view);
     $tasks = Option::get('TaskScheduler.timetable');
     if (!empty($tasks)) {
         $tasks = unserialize($tasks);
     }
     if (empty($tasks)) {
         $tasks = array();
     } else {
         asort($tasks);
     }
     $tsNow = Date::now()->getTimestamp();
     $dateFormat = Piwik::translate(Date::DATE_FORMAT_LONG) . ' h:mm:ss';
     $formatter = new Formatter();
     $tasksFormatted = array();
     foreach ($tasks as $name => $timestamp) {
         $tasksFormatted[] = array('name' => $name, 'executionDate' => Date::factory($timestamp)->getLocalized($dateFormat), 'ts_difference' => $formatter->getPrettyTimeFromSeconds($timestamp - $tsNow));
     }
     $view->currentTime = Date::now()->getLocalized($dateFormat);
     $view->tasks = $tasksFormatted;
     return $view->render();
 }
开发者ID:diosmosis,项目名称:plugin-TasksTimetable,代码行数:25,代码来源:Controller.php

示例11: trackVisits

 private function trackVisits()
 {
     $dateTime = $this->dateTime;
     $idSite = $this->idSite;
     $t = self::getTracker($idSite, $dateTime, $defaultInit = true);
     $t->setUrlReferrer('http://www.google.com/search?q=piwik');
     $t->setUrl('http://example.org/foo/bar.html');
     self::checkResponse($t->doTrackPageView('http://incredible.title/'));
     $t->setUrl('https://example.org/foo/bar.html');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.2)->getDatetime());
     self::checkResponse($t->doTrackPageView('https://incredible.title/'));
     $t->setUrl('https://wWw.example.org/foo/bar2.html');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.3)->getDatetime());
     self::checkResponse($t->doTrackPageView('http://www.incredible.title/'));
     $t->setUrl('http://WwW.example.org/foo/bar2.html');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.4)->getDatetime());
     self::checkResponse($t->doTrackPageView('https://www.incredible.title/'));
     $t->setUrl('http://www.example.org/foo/bar3.html');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.5)->getDatetime());
     self::checkResponse($t->doTrackPageView('incredible.title/'));
     $t->setUrl('http://www.my.url/ꟽ碌㒧䊶亄ﶆⅅขκもኸόσशμεޖृ');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.7)->getDatetime());
     self::checkResponse($t->doTrackPageView('Valid URL, although strange looking'));
     $t->setUrl('https://make.wordpress.org/?emoji=😎l&param=test');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.8)->getDatetime());
     self::checkResponse($t->doTrackPageView('Emoji here: %F0%9F%98%8E'));
     // this pageview should be last
     $t->setUrl('https://example.org/foo/bar4.html');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.6)->getDatetime());
     self::checkResponse($t->doTrackPageView('incredible.title/'));
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:31,代码来源:OneVisitWithAbnormalPageviewUrls.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     $this->archiveTableDao = self::$fixture->piwikEnvironment->getContainer()->get('Piwik\\DataAccess\\ArchiveTableDao');
     ArchiveTableCreator::getBlobTable(Date::factory('2015-01-01'));
     ArchiveTableCreator::getNumericTable(Date::factory('2015-01-01'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:ArchiveTableDaoTest.php

示例13: trackVisits

 private function trackVisits()
 {
     $dateTime = $this->dateTime;
     $idSite = $this->idSite;
     $t = self::getTracker($idSite, $dateTime, $defaultInit = true, $useThirdPartyCookie = 1);
     $t->setUrlReferrer('http://www.google.com.vn/url?sa=t&rct=j&q=%3C%3E%26%5C%22the%20pdo%20extension%20is%20required%20for%20this%20adapter%20but%20the%20extension%20is%20not%20loaded&source=web&cd=4&ved=0FjAD&url=http%3A%2F%2Fforum.piwik.org%2Fread.php%3F2%2C1011&ei=y-HHAQ&usg=AFQjCN2-nt5_GgDeg&cad=rja');
     $t->setUrl('http://example.org/%C3%A9%C3%A9%C3%A9%22%27...%20%3Cthis%20is%20cool%3E!');
     $t->setGenerationTime(523);
     self::checkResponse($t->doTrackPageView('incredible title! <>,;'));
     $t->setUrl('http://example.org/dir/file.php?foo=bar&foo2=bar');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.2)->getDatetime());
     $t->setGenerationTime(123);
     self::checkResponse($t->doTrackPageView('incredible title! <>,;'));
     $t->setUrl('http://example.org/dir/file.php?foo=bar&foo2=bar2');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.3)->getDatetime());
     $t->setGenerationTime(153);
     self::checkResponse($t->doTrackPageView('incredible parent title! <>,; / subtitle <>,;'));
     $t->setUrl('http://example.org/dir/file.php?foo=bar&foo2=bar2');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.31)->getDatetime());
     $t->setGenerationTime(153);
     self::checkResponse($t->doTrackEvent('Category', 'Action', 'Name', 11111));
     $t->setUrl('http://example.org/dir2/file.php?foo=bar&foo2=bar');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.4)->getDatetime());
     $t->setGenerationTime(1233);
     self::checkResponse($t->doTrackPageView('incredible title! <>,;'));
     $t->setUrl('http://example.org/dir2/sub/0/file.php');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.4)->getDatetime());
     // Very high Generation time should be ignored
     $t->setGenerationTime(6350000);
     self::checkResponse($t->doTrackPageView('incredible title! <>,;'));
     $t->setUrl('http://example.org/0');
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.4)->getDatetime());
     $t->setGenerationTime(635);
     self::checkResponse($t->doTrackPageView('I am URL zero!'));
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:35,代码来源:OneVisitSeveralPageViews.php

示例14: purgeOutdatedArchives

 /**
  * @return bool `true` if the purge was executed, `false` if it was skipped.
  * @throws \Exception
  */
 public function purgeOutdatedArchives()
 {
     if ($this->willPurgingCausePotentialProblemInUI()) {
         $this->logger->info("Purging temporary archives: skipped (browser triggered archiving not enabled & not running after core:archive)");
         return false;
     }
     $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
     $this->logger->info("Purging archives in {tableCount} archive tables.", array('tableCount' => count($archiveTables)));
     // keep track of dates we purge for, since getTablesArchivesInstalled() will return numeric & blob
     // tables (so dates will appear two times, and we should only purge once per date)
     $datesPurged = array();
     foreach ($archiveTables as $table) {
         $date = ArchiveTableCreator::getDateFromTableName($table);
         list($year, $month) = explode('_', $date);
         // Somehow we may have archive tables created with older dates, prevent exception from being thrown
         if ($year > 1990) {
             if (empty($datesPurged[$date])) {
                 $dateObj = Date::factory("{$year}-{$month}-15");
                 $this->archivePurger->purgeOutdatedArchives($dateObj);
                 $this->archivePurger->purgeArchivesWithPeriodRange($dateObj);
                 $datesPurged[$date] = true;
             } else {
                 $this->logger->debug("Date {date} already purged.", array('date' => $date));
             }
         } else {
             $this->logger->info("Skipping purging of archive tables *_{year}_{month}, year <= 1990.", array('year' => $year, 'month' => $month));
         }
     }
     return true;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:34,代码来源:Tasks.php

示例15: trackVisits

 private function trackVisits()
 {
     // tests run in UTC, the Tracker in UTC
     $dateTime = $this->dateTime;
     $idSite = $this->idSite;
     $t = self::getTracker($idSite, $dateTime, $defaultInit = true);
     // Also testing to record this as a bot while specifically allowing bots
     $t->setUserAgent('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
     $t->DEBUG_APPEND_URL .= '&bots=1';
     $t->DEBUG_APPEND_URL .= '&forceIpAnonymization=1';
     // VISIT 1 = Referrer is "Keyword not defined"
     // Alsotrigger goal to check that attribution goes to this keyword
     $t->setUrlReferrer('http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CC&url=http%3A%2F%2Fpiwik.org%2F&ei=&usg=');
     $t->setUrl('http://example.org/this%20is%20cool!?filter=<script>alert(1);</script>{"place":{"place":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5"}}');
     self::checkResponse($t->doTrackPageView('incredible title! (Page URL contains a HTML entity)'));
     $idGoal = 1;
     if (!self::goalExists($idSite, $idGoal)) {
         $idGoal = API::getInstance()->addGoal($idSite, 'triggered js', 'manually', '', '');
     }
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.3)->getDatetime());
     self::checkResponse($t->doTrackGoal($idGoal, $revenue = 42));
     // VISIT 2 = Referrer has keyword, but the URL should be rewritten
     // in Live Output to point to google search result page
     $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(2)->getDatetime());
     $t->setUrlReferrer('http://www.google.com.vn/url?sa=t&rct=j&q=%3C%3E%26%5C%22the%20pdo%20extension%20is%20required%20for%20this%20adapter%20but%20the%20extension%20is%20not%20loaded&source=web&cd=4&ved=0FjAD&url=http%3A%2F%2Fforum.piwik.org%2Fread.php%3F2%2C1011&ei=y-HHAQ&usg=AFQjCN2-nt5_GgDeg&cad=rja');
     // Test with empty title, that the output of Live is valid
     self::checkResponse($t->doTrackPageView(''));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:28,代码来源:TwoVisitsNoKeywordWithBot.php


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