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


PHP Tracker::isDebugModeEnabled方法代码示例

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


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

示例1: formatException

 private function formatException(Tracker $tracker, Exception $e)
 {
     // when doing bulk tracking we return JSON so the caller will know how many succeeded
     $result = array('status' => 'error', 'tracked' => $tracker->getCountOfLoggedRequests(), 'invalid' => $this->invalidRequests);
     // send error when in debug mode
     if ($tracker->isDebugModeEnabled()) {
         $result['message'] = $this->getMessageFromException($e);
     }
     return $result;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:10,代码来源:Response.php

示例2: sendReport

 public function sendReport($reportType, $report, $contents, $filename, $prettyDate, $reportSubject, $reportTitle, $additionalFiles, Period $period = null, $force)
 {
     if (!self::manageEvent($reportType)) {
         return;
     }
     // Safeguard against sending the same report twice to the same email (unless $force is true)
     if (!$force && $this->reportAlreadySent($report, $period)) {
         Log::warning('Preventing the same scheduled report from being sent again (report #%s for period "%s")', $report['idreport'], $prettyDate);
         return;
     }
     $periods = self::getPeriodToFrequencyAsAdjective();
     $message = Piwik::translate('ScheduledReports_EmailHello');
     $subject = Piwik::translate('General_Report') . ' ' . $reportTitle . " - " . $prettyDate;
     $mail = new Mail();
     $mail->setDefaultFromPiwik();
     $mail->setSubject($subject);
     $attachmentName = $subject;
     $this->setReplyToAsSender($mail, $report);
     $displaySegmentInfo = false;
     $segmentInfo = null;
     $segment = API::getSegment($report['idsegment']);
     if ($segment != null) {
         $displaySegmentInfo = true;
         $segmentInfo = Piwik::translate('ScheduledReports_SegmentAppliedToReports', $segment['name']);
     }
     $messageFindAttached = Piwik::translate('ScheduledReports_PleaseFindAttachedFile', array($periods[$report['period']], $reportTitle));
     $messageFindBelow = Piwik::translate('ScheduledReports_PleaseFindBelow', array($periods[$report['period']], $reportTitle));
     $messageSentFrom = '';
     $piwikUrl = SettingsPiwik::getPiwikUrl();
     if (!empty($piwikUrl)) {
         $messageSentFrom = Piwik::translate('ScheduledReports_SentFromX', $piwikUrl);
     }
     switch ($report['format']) {
         case 'html':
             // Needed when using images as attachment with cid
             $mail->setType(Zend_Mime::MULTIPART_RELATED);
             $message .= "<br/>{$messageFindBelow}<br/>{$messageSentFrom}";
             if ($displaySegmentInfo) {
                 $message .= " " . $segmentInfo;
             }
             $mail->setBodyHtml($message . "<br/><br/>" . $contents);
             break;
         case 'csv':
             $message .= "\n{$messageFindAttached}\n{$messageSentFrom}";
             if ($displaySegmentInfo) {
                 $message .= " " . $segmentInfo;
             }
             $mail->setBodyText($message);
             $mail->createAttachment($contents, 'application/csv', Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64, $attachmentName . '.csv');
             break;
         default:
         case 'pdf':
             $message .= "\n{$messageFindAttached}\n{$messageSentFrom}";
             if ($displaySegmentInfo) {
                 $message .= " " . $segmentInfo;
             }
             $mail->setBodyText($message);
             $mail->createAttachment($contents, 'application/pdf', Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64, $attachmentName . '.pdf');
             break;
     }
     foreach ($additionalFiles as $additionalFile) {
         $fileContent = $additionalFile['content'];
         $at = $mail->createAttachment($fileContent, $additionalFile['mimeType'], Zend_Mime::DISPOSITION_INLINE, $additionalFile['encoding'], $additionalFile['filename']);
         $at->id = $additionalFile['cid'];
         unset($fileContent);
     }
     // Get user emails and languages
     $reportParameters = $report['parameters'];
     $emails = array();
     if (isset($reportParameters[self::ADDITIONAL_EMAILS_PARAMETER])) {
         $emails = $reportParameters[self::ADDITIONAL_EMAILS_PARAMETER];
     }
     if ($reportParameters[self::EMAIL_ME_PARAMETER] == 1) {
         if (Piwik::getCurrentUserLogin() == $report['login']) {
             $emails[] = Piwik::getCurrentUserEmail();
         } else {
             try {
                 $user = APIUsersManager::getInstance()->getUser($report['login']);
             } catch (Exception $e) {
                 return;
             }
             $emails[] = $user['email'];
         }
     }
     if (!$force) {
         $this->markReportAsSent($report, $period);
     }
     foreach ($emails as $email) {
         if (empty($email)) {
             continue;
         }
         $mail->addTo($email);
         try {
             $mail->send();
         } catch (Exception $e) {
             // If running from piwik.php with debug, we ignore the 'email not sent' error
             $tracker = new Tracker();
             if (!$tracker->isDebugModeEnabled()) {
                 throw new Exception("An error occured while sending '{$filename}' " . " to " . implode(', ', $mail->getRecipients()) . ". Error was '" . $e->getMessage() . "'");
             }
//.........这里部分代码省略.........
开发者ID:dorelljames,项目名称:piwik,代码行数:101,代码来源:ScheduledReports.php

示例3: outputApiResponse

 private function outputApiResponse(Tracker $tracker)
 {
     if ($tracker->isDebugModeEnabled()) {
         return;
     }
     if ($this->hasAlreadyPrintedOutput()) {
         return;
     }
     $request = $_GET + $_POST;
     if (array_key_exists('send_image', $request) && $request['send_image'] === '0') {
         Common::sendResponseCode(204);
         return;
     }
     $this->outputTransparentGif();
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:15,代码来源:Response.php

示例4: sendReport

 public function sendReport($idReport, $period = false, $date = false, $force = false)
 {
     Piwik::checkUserIsNotAnonymous();
     $reports = $this->getReports($idSite = false, false, $idReport);
     $report = reset($reports);
     if ($report['period'] == 'never') {
         $report['period'] = 'day';
     }
     if (!empty($period)) {
         $report['period'] = $period;
     }
     if (empty($date)) {
         $date = Date::now()->subPeriod(1, $report['period'])->toString();
     }
     $language = \Piwik\Plugins\LanguagesManager\API::getInstance()->getLanguageForUser($report['login']);
     // generate report
     list($outputFilename, $prettyDate, $reportSubject, $reportTitle, $additionalFiles) = $this->generateReport($idReport, $date, $language, self::OUTPUT_SAVE_ON_DISK, $report['period']);
     if (!file_exists($outputFilename)) {
         throw new Exception("The report file wasn't found in {$outputFilename}");
     }
     $contents = file_get_contents($outputFilename);
     if (empty($contents)) {
         Log::warning("Scheduled report file '%s' exists but is empty!", $outputFilename);
     }
     /**
      * Triggered when sending scheduled reports.
      *
      * Plugins that provide new scheduled report transport mediums should use this event to
      * send the scheduled report.
      *
      * @param string $reportType A string ID describing how the report is sent, eg,
      *                           `'sms'` or `'email'`.
      * @param array $report An array describing the scheduled report that is being
      *                      generated.
      * @param string $contents The contents of the scheduled report that was generated
      *                         and now should be sent.
      * @param string $filename The path to the file where the scheduled report has
      *                         been saved.
      * @param string $prettyDate A prettified date string for the data within the
      *                           scheduled report.
      * @param string $reportSubject A string describing what's in the scheduled
      *                              report.
      * @param string $reportTitle The scheduled report's given title (given by a Piwik user).
      * @param array $additionalFiles The list of additional files that should be
      *                               sent with this report.
      * @param \Piwik\Period $period The period for which the report has been generated.
      * @param boolean $force A report can only be sent once per period. Setting this to true
      *                       will force to send the report even if it has already been sent.
      */
     Piwik::postEvent(self::SEND_REPORT_EVENT, array($report['type'], $report, $contents, $filename = basename($outputFilename), $prettyDate, $reportSubject, $reportTitle, $additionalFiles, \Piwik\Period\Factory::build($report['period'], $date), $force));
     // Update flag in DB
     $now = Date::now()->getDatetime();
     $this->getModel()->updateReport($report['idreport'], array('ts_last_sent' => $now));
     // If running from piwik.php with debug, do not delete the PDF after sending the email
     $tracker = new Tracker();
     if (!$tracker->isDebugModeEnabled()) {
         @chmod($outputFilename, 0600);
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:59,代码来源:API.php

示例5: testPiwikTrackerDebugIsOff

 public function testPiwikTrackerDebugIsOff()
 {
     $this->assertTrue(!isset($GLOBALS['PIWIK_TRACKER_DEBUG']));
     $this->assertEquals(0, $this->globalConfig['Tracker']['debug']);
     $tracker = new Tracker();
     $this->assertFalse($tracker->isDebugModeEnabled());
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:7,代码来源:ReleaseCheckListTest.php


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