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


PHP Logging::isDebug方法代码示例

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


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

示例1: send

 public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
 {
     if ($attachments != NULL) {
         throw new ServiceException("INVALID_CONFIGURATION", "Default mailer does not support sending attachments");
     }
     if (Logging::isDebug()) {
         Logging::logDebug("Sending mail to [" . Util::array2str($to) . "]: [" . $message . "]");
     }
     if (!$this->enabled) {
         return;
     }
     $isHtml = stripos($message, "<html>") !== FALSE;
     $f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
     $validRecipients = $this->getValidRecipients($to);
     if (count($validRecipients) === 0) {
         Logging::logDebug("No valid recipient email addresses, no mail sent");
         return;
     }
     $toAddress = '';
     $headers = $isHtml ? 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" : 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n";
     $headers .= 'From:' . $f;
     if (count($validRecipients) == 1) {
         $toAddress = $this->getRecipientString($validRecipients[0]);
     } else {
         $headers .= PHP_EOL . $this->getBccHeaders($validRecipients);
     }
     mail($toAddress, $subject, $isHtml ? $message : str_replace("\n", "\r\n", wordwrap($message)), $headers);
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:28,代码来源:MailSender.class.php

示例2: processPost

 public function processPost()
 {
     $data = $this->request->data;
     if (!isset($data['to']) or !isset($data['title']) or !isset($data['msg']) or !isset($data['items'])) {
         throw $this->invalidRequestException("Data missing");
     }
     $to = $data['to'];
     $message = $data['msg'];
     $title = $data['title'];
     $items = $this->items($data['items']);
     if (count($items) == 0) {
         throw $this->invalidRequestException("Items missing");
     }
     if (Logging::isDebug()) {
         Logging::logDebug("SENDVIAEMAIL: Sending mail " . $to . ":" . Util::array2str($items));
     }
     $attachments = array();
     foreach ($items as $i) {
         $attachments[] = $i->internalPath();
     }
     //TODO stream
     if ($this->env->mailer()->send(array($to), $title, $message, NULL, $attachments)) {
         $this->response()->success(array());
     } else {
         $this->response()->error("REQUEST_FAILED", NULL);
     }
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:27,代码来源:SendViaEmailServices.class.php

示例3: log

 function log()
 {
     if (!Logging::isDebug()) {
         return;
     }
     Logging::logDebug("PLUGIN (" . get_class($this) . ")");
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:7,代码来源:PluginBase.class.php

示例4: send

 public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
 {
     if (!$this->enabled) {
         return;
     }
     $isHtml = stripos($message, "<html>") !== FALSE;
     $f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
     $validRecipients = $this->getValidRecipients($to);
     if (count($validRecipients) === 0) {
         Logging::logDebug("No valid recipient email addresses, no mail sent");
         return;
     }
     if (Logging::isDebug()) {
         Logging::logDebug("Sending mail from [" . $f . "] to [" . Util::array2str($validRecipients) . "]: [" . $message . "]");
     }
     set_include_path("vendor/PHPMailer" . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path());
     require 'class.phpmailer.php';
     $mailer = new PHPMailer();
     $smtp = $this->env->settings()->setting("mail_smtp");
     if ($smtp != NULL and isset($smtp["host"])) {
         $mailer->isSMTP();
         $mailer->Host = $smtp["host"];
         if (isset($smtp["username"]) and isset($smtp["password"])) {
             $mailer->SMTPAuth = true;
             $mailer->Username = $smtp["username"];
             $mailer->Password = $smtp["password"];
         }
         if (isset($smtp["secure"])) {
             $mailer->SMTPSecure = $smtp["secure"];
         }
     }
     $mailer->From = $f;
     foreach ($validRecipients as $recipient) {
         $mailer->addBCC($recipient["email"], $recipient["name"]);
     }
     if (!$isHtml) {
         $mailer->WordWrap = 50;
     } else {
         $mailer->isHTML(true);
     }
     if ($attachments != NULL) {
         //TODO use stream
         foreach ($attachments as $attachment) {
             $mailer->addAttachment($attachment);
         }
     }
     $mailer->Subject = $subject;
     $mailer->Body = $message;
     try {
         if (!$mailer->send()) {
             Logging::logError('Message could not be sent: ' . $mailer->ErrorInfo);
             return FALSE;
         }
         return TRUE;
     } catch (Exception $e) {
         Logging::logError('Message could not be sent: ' . $e);
         return FALSE;
     }
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:59,代码来源:PHPMailerSender.class.php

示例5: retrieve

 public function retrieve($url)
 {
     if (Logging::isDebug()) {
         Logging::logDebug("Retrieving [{$url}]");
     }
     $h = curl_init();
     if (!$h) {
         throw new ServiceException("INVALID_CONFIGURATION", "Failed to initialize curl: " . curl_errno() . " " . curl_error());
     }
     if (!curl_setopt($h, CURLOPT_URL, $url)) {
         curl_close($h);
         throw new ServiceException("INVALID_CONFIGURATION", "Failed to initialize curl: " . curl_errno() . " " . curl_error());
     }
     $tempFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('Kloudspeaker', true);
     $fh = @fopen($tempFile, "wb");
     if (!$fh) {
         curl_close($h);
         throw new ServiceException("INVALID_CONFIGURATION", "Could not open temporary file for writing: " . $tempFile);
     }
     if (!curl_setopt($h, CURLOPT_FILE, $fh) or !curl_setopt($h, CURLOPT_HEADER, 0)) {
         fclose($fh);
         curl_close($h);
         throw new ServiceException("INVALID_CONFIGURATION", "Failed to initialize curl: " . curl_errno() . " " . curl_error());
     }
     set_time_limit(0);
     $success = curl_exec($h);
     $status = FALSE;
     $errorNo = 0;
     $error = NULL;
     if ($success) {
         $status = curl_getinfo($h, CURLINFO_HTTP_CODE);
     } else {
         $errorNo = curl_errno($h);
         $error = curl_error($h);
         Logging::logDebug("Failed to retrieve url: {$errorNo} {$error}");
     }
     fclose($fh);
     curl_close($h);
     if (!$success) {
         if ($errorNo === 6) {
             return array("success" => false, "result" => 404);
         }
         throw new ServiceException("REQUEST_FAILED", $error);
     }
     if ($status !== 200) {
         if (file_exists($tempFile)) {
             unlink($tempFile);
         }
         return array("success" => false, "result" => $status);
     }
     return array("success" => true, "file" => $tempFile, "stream" => @fopen($tempFile, "rb"), "name" => $this->getName($url));
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:52,代码来源:UrlRetriever.class.php

示例6: setup

 private function setup()
 {
     $this->environment->addService("authentication", "AuthenticationServices");
     $this->environment->addService("session", "SessionServices");
     $this->environment->addService("configuration", "ConfigurationServices");
     $this->environment->addService("filesystem", "FilesystemServices");
     $this->environment->addService("events", "EventServices");
     $this->environment->addService("permissions", "PermissionServices");
     if (Logging::isDebug()) {
         $this->environment->addService("debug", "DebugServices");
         $this->environment->response()->addListener($this);
     }
     UserEvent::register($this->environment->events());
     $this->environment->permissions()->registerPermission("change_password");
     $this->environment->plugins()->setup();
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:16,代码来源:KloudspeakerBackend.class.php

示例7: log

 function log()
 {
     if (!Logging::isDebug()) {
         return;
     }
     $logged = array_merge(array(), $this->settings);
     // remove db password
     if (Util::isArrayKey($logged, "db") and is_array($logged["db"])) {
         if (Util::isArrayKey($logged["db"], "pw")) {
             $logged["db"]["pw"] = "";
         }
         if (Util::isArrayKey($logged["db"], "password")) {
             $logged["db"]["password"] = "";
         }
     }
     Logging::logDebug("SETTINGS: " . Util::array2str($logged));
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:17,代码来源:Settings.class.php

示例8: globalErrorHandler

function globalErrorHandler($errno, $errstr, $errfile, $errline)
{
    global $responseHandler;
    $info = "PHP error #" . $errno . ", " . $errstr . " (" . $errfile . ":" . $errline . ")";
    if (Logging::isDebug()) {
        $data = debug_backtrace();
    } else {
        $msg = "Backtrace disabled as it may contain passwords. ";
        $msg .= "Enable 'debug' setting in configuration.php to see ";
        $msg .= "backtrace.";
        $data = array("NOTE" => $msg);
    }
    Logging::logError($info . "\n" . Util::array2str($data));
    if ($responseHandler == NULL) {
        $responseHandler = new ResponseHandler(new OutputHandler());
    }
    $responseHandler->unknownServerError($info);
    die;
}
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:19,代码来源:r.php

示例9: onEvent

 public function onEvent($e)
 {
     if ($this->env->authentication()->isAuthenticated()) {
         $e->setUser(array('user_id' => $this->env->session()->userId(), 'username' => $this->env->session()->username()));
     } else {
         $e->setUser(NULL);
     }
     $e->setIp($this->env->request()->ip());
     if (Logging::isDebug()) {
         Logging::logDebug("EVENT HANDLER: onEvent: '" . $e->type() . "'");
     }
     foreach ($this->listeners as $type => $listeners) {
         if (strcasecmp($type, '*') == 0 or strpos($e->typeId(), $type) === 0) {
             foreach ($listeners as $listener) {
                 $listener->onEvent($e);
             }
         }
     }
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:19,代码来源:EventHandler.class.php

示例10: onEvent

 public function onEvent($e)
 {
     if ($this->env->authentication()->isAuthenticated()) {
         $user = $this->env->session()->user();
         $e->setUser(array('id' => $user["id"], 'name' => $user["name"], 'email' => $user["email"]));
     } else {
         $e->setUser(NULL);
     }
     $e->setIp($this->env->request()->ip());
     if (Logging::isDebug()) {
         Logging::logDebug("EVENT HANDLER: onEvent: " . $e->type() . "/" . $e->subType());
     }
     foreach ($this->listeners as $type => $listeners) {
         if (strcasecmp($type, '*') == 0 or strpos($e->typeId(), $type) === 0) {
             foreach ($listeners as $listener) {
                 $listener->onEvent($e);
             }
         }
     }
 }
开发者ID:mobas,项目名称:mollify,代码行数:20,代码来源:EventHandler.class.php

示例11: is_devurandom

 function is_devurandom()
 {
     if (Logging::isDebug()) {
         Logging::logDebug("/dev/urandom: " . ($this->no_devurandom ? "0" : "1"));
     }
     if ($this->no_devurandom) {
         return FALSE;
     }
     if (Logging::isDebug()) {
         Logging::logDebug("Trying /dev/urandom");
     }
     try {
         if (@is_readable('/dev/urandom')) {
             return TRUE;
         }
     } catch (Exception $e) {
     }
     if (Logging::isDebug()) {
         Logging::logDebug("/dev/urandom not accessible");
     }
     return FALSE;
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:22,代码来源:PasswordHash.php

示例12: sendNotification

 private function sendNotification($notification, $e)
 {
     $values = $e->values($this->env->formatter());
     $title = $this->getTitle($notification, $values);
     $message = $this->getMessage($notification, $values);
     if (Logging::isDebug()) {
         Logging::logDebug("NOTIFICATOR: Sending notification " . $notification->id() . ":" . $message);
     }
     $this->env->mailer()->send($notification->getRecipients(), $title, $message);
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:10,代码来源:NotificatorHandler.class.php

示例13: getErrorResponse

 private function getErrorResponse($err, $details, $data = NULL)
 {
     if (Logging::isDebug()) {
         Logging::logDebug("RESPONSE error " . Util::toString($err) . " " . Util::toString($details) . " " . Util::toString($data));
         return array("code" => $err[0], "error" => $err[1], "details" => $details, "data" => $data, "trace" => Logging::getTrace());
     }
     return array("code" => $err[0], "error" => $err[1], "details" => $details, "data" => $data);
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:8,代码来源:ResponseHandler.class.php

示例14: rollback

 public function rollback()
 {
     try {
         $result = @mysqli_query($this->db, "ROLLBACK;");
     } catch (mysqli_sql_exception $e) {
         if (Logging::isDebug()) {
             Logging::logDebug("ERROR: " . $e);
         }
         throw new ServiceException("INVALID_CONFIGURATION", "Error rollbacking transaction: " . mysqli_error($this->db));
     }
     if (!$result) {
         throw new ServiceException("INVALID_CONFIGURATION", "Error rollbacking transaction: " . mysqli_error($this->db));
     }
     $this->transaction = FALSE;
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:15,代码来源:MySQLIDatabase.class.php

示例15: queries

 public function queries($query)
 {
     if (Logging::isDebug()) {
         Logging::logDebug("DB: " . $query);
     }
     @sqlite_query($query, $this->db, SQLITE_NUM, $err);
     if ($err) {
         throw new ServiceException("INVALID_CONFIGURATION", "Error executing query (" . $query . "): " . $err);
     }
     return TRUE;
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:11,代码来源:SQLiteDatabase.class.php


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