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


PHP ErrorHandler::getInstance方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     AuthController::getInstance()->requireLogin();
     ErrorHandler::getInstance()->getUrlErrorMessage();
     $this->setSmarty();
 }
开发者ID:ecuation,项目名称:Control-de-stock,代码行数:7,代码来源:Shop_selectionController.php

示例2: sendEmail

function sendEmail($recipient, $content, $subject = 'Notification', $includeStandardFooter = true)
{
    $subject = 'lanlist.org - ' . $subject;
    if (empty($content)) {
        throw new Exception('Cannot send a blank email');
    }
    $content = wordwrap($content);
    if ($includeStandardFooter) {
        $content .= "\n\n- lanlist.org";
    }
    ErrorHandler::getInstance()->beLazy();
    require_once 'Mail.php';
    require_once 'Mail/smtp.php';
    $host = 'ssl://smtp.gmail.com';
    $username = 'xconspirisist@lanlist.org';
    $password = 'ionicflame312';
    $smtp = new Mail_smtp(array('host' => $host, 'port' => 465, 'auth' => true, 'username' => $username, 'password' => $password));
    $headers = array('From' => '"lanlist.org" <mailer@lanlist.org>', 'To' => '<' . $recipient . '>', 'Subject' => $subject, 'Content-Type' => 'text/html');
    $smtp->send('<' . $recipient . '>', $headers, $content);
    ErrorHandler::getInstance()->beGreedy();
    Logger::messageDebug('Sending email to ' . $recipient . ', subject: ' . $subject);
    $sql = 'INSERT INTO email_log (subject, emailAddress, sent) VALUES (:subject, :emailAddress, now())';
    $stmt = DatabaseFactory::getInstance()->prepare($sql);
    $stmt->bindValue(':emailAddress', $recipient);
    $stmt->bindValue(':subject', $subject);
    $stmt->execute();
}
开发者ID:jamesread,项目名称:lanlist.org,代码行数:27,代码来源:misc.php

示例3: verify

 /**
  * Verifies a recaptcha
  *
  * @param $priv_key private recaptcha key
  * @return true on success
  */
 public function verify()
 {
     $error = ErrorHandler::getInstance();
     $conf = RecaptchaConfig::getInstance();
     if (empty($_POST['recaptcha_challenge_field']) || empty($_POST['recaptcha_response_field'])) {
         $error->add('No captcha answer given.');
         return false;
     }
     if (!$conf->getPublicKey() || !$conf->getPrivateKey()) {
         die('ERROR - Get Recaptcha API key at http://recaptcha.net/api/getkey');
     }
     $params = array('privatekey' => $conf->getPrivateKey(), 'remoteip' => client_ip(), 'challenge' => $_POST['recaptcha_challenge_field'], 'response' => $_POST['recaptcha_response_field']);
     $http = new HttpClient($this->api_url_verify);
     $res = $http->post($params);
     $answers = explode("\n", $res);
     if (trim($answers[0]) == 'true') {
         return true;
     }
     switch ($answers[1]) {
         case 'incorrect-captcha-sol':
             $e = 'Incorrect captcha solution';
             break;
         default:
             $e = 'untranslated error: ' . $answers[1];
     }
     $error->add($e);
     return false;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:34,代码来源:Recaptcha.php

示例4: sendMail

 /**
  * Looks up user supplied email address / alias and sends a mail
  *
  * @param $email email address or username
  */
 function sendMail($in)
 {
     $in = trim($in);
     if (is_email($in)) {
         $user_id = UserFinder::byEmail($in);
     } else {
         $user_id = UserFinder::byUsername($in);
     }
     $error = ErrorHandler::getInstance();
     if (!$user_id) {
         $error->add('Invalid email address or username');
         return false;
     }
     $email = UserSetting::getEmail($user_id);
     if (!$email) {
         throw new \Exception('entered email not found');
     }
     $code = Token::generate($user_id, 'activation_code');
     $pattern = array('/@USERNAME@/', '/@IP@/', '/@URL@/', '/@EXPIRETIME@/');
     $user = User::get($user_id);
     $page = XmlDocumentHandler::getInstance();
     $url = $page->getUrl() . 'u/reset_pwd/' . $code;
     $replacement = array($user->getName(), client_ip(), $url, shortTimePeriod($this->expire_time_email));
     $msg = preg_replace($pattern, $replacement, $this->password_msg);
     //d($msg);
     $mail = SendMail::getInstance();
     $mail->addRecipient($email);
     $mail->setSubject('Forgot password');
     $mail->send($msg);
     return true;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:36,代码来源:ForgotPasswordHandler.php

示例5: onSubmit

 function onSubmit($p)
 {
     $error = ErrorHandler::getInstance();
     $res = base64_decode($p['data'], true);
     if ($res === false) {
         $error->add('Input is not base64 encoded');
         return false;
     }
     echo dh($res);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:10,代码来源:decode.php

示例6: uploadSubmit

 function uploadSubmit($p)
 {
     if (!is_url($p['url'])) {
         $error = ErrorHandler::getInstance();
         $error->add('Not an url');
         return false;
     }
     $eventId = TaskQueue::addTask(TASK_FETCH, $p['url']);
     echo '<div class="okay">URL to process has been enqueued.</div><br/>';
     echo ahref('queue/show/' . $eventId, 'Click here') . ' to perform further actions on this file.';
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:11,代码来源:queue.php

示例7: register

 function register($username, $pwd1, $pwd2)
 {
     $error = ErrorHandler::getInstance();
     $username = trim($username);
     $pwd1 = trim($pwd1);
     if (strlen($username) < $this->username_minlen) {
         $error->add('Username must be at least ' . $this->username_minlen . ' characters long');
         return false;
     }
     if (strlen($username) > $this->username_maxlen) {
         $error->add('Username cant be longer than ' . $this->username_maxlen . ' characters long');
         return false;
     }
     if (strlen($pwd1) < $this->password_minlen) {
         $error->add('Password must be at least ' . $this->password_minlen . ' characters long');
         return false;
     }
     if ($pwd1 != $pwd2) {
         $error->add('Passwords dont match');
         return false;
     }
     if ($username == $pwd1) {
         $error->add('Username and password must be different');
         return false;
     }
     if (User::getByName($username)) {
         $error->add('Username taken');
         return false;
     }
     if (ReservedWord::isReservedUsername($username)) {
         $error->add('Username is reserved');
         return false;
     }
     if (Password::isForbidden($pwd1)) {
         $error->add('Your password is a very weak one and is forbidden to use');
         return false;
     }
     $user_id = self::create($username, $pwd1);
     if (!$user_id) {
         $error->add('Failed to create user');
         return false;
     }
     if ($this->post_reg_callback) {
         call_user_func($this->post_reg_callback, $user_id);
     }
     return $user_id;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:47,代码来源:UserHandler.php

示例8: init

 /**
  * Initialize the application
  */
 public function init()
 {
     // Load the application configuration
     $this->singleton('conf', Conf::getInstance());
     // Load the application error Handler
     $this->singleton('errorHandler', ErrorHandler::getInstance());
     // Load the application logger
     $this->singleton('logger', Logger::getInstance());
     // Load the filesystem library
     $this->singleton('fs', FileSystem::getInstance());
     // Load the application session
     $this->singleton('session', Session::getInstance());
     // Load the application router
     $this->singleton('router', Router::getInstance());
     // Load the application HTTP request
     $this->singleton('request', Request::getInstance());
     // Load the application HTTP response
     $this->singleton('response', Response::getInstance());
     // Load the application cache
     $this->singleton('cache', Cache::getInstance());
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:24,代码来源:App.php

示例9: handleSubmit

function handleSubmit($p)
{
    $session = SessionHandler::getInstance();
    $error = ErrorHandler::getInstance();
    if (empty($p['comment'])) {
        return false;
    }
    if (!$session->id) {
        $error->add('Unauthorized submit');
        return false;
    }
    $c = new Comment();
    $c->type = $p['type'];
    $c->msg = $p['comment'];
    $c->private = 0;
    $c->time_created = sql_datetime(time());
    $c->owner = $p['owner'];
    $c->creator = $session->id;
    $c->creator_ip = client_ip();
    $c->store();
    redir($_SERVER['REQUEST_URI']);
}
开发者ID:martinlindhe,项目名称:core_dev,代码行数:22,代码来源:comments.php

示例10: render

 public function render()
 {
     //available variables in the scope of the view
     if (class_exists('\\cd\\ErrorHandler')) {
         $error = ErrorHandler::getInstance();
     }
     if (class_exists('\\cd\\SessionHandler')) {
         $session = SessionHandler::getInstance();
     }
     if (class_exists('\\cd\\SqlHandler')) {
         $db = SqlHandler::getInstance();
     }
     if (class_exists('\\cd\\XhtmlHeader')) {
         $header = XhtmlHeader::getInstance();
     }
     if (class_exists('\\cd\\XmlDocumentHandler')) {
         $page = XmlDocumentHandler::getInstance();
     }
     if (class_exists('\\cd\\LocaleHandler')) {
         $locale = LocaleHandler::getInstance();
     }
     if (class_exists('\\cd\\TempStore')) {
         $temp = TempStore::getInstance();
     }
     // make reference to calling object available in the namespace of the view
     $caller = $this->caller;
     $file = $page->getCoreDevPath() . $this->template;
     if (!file_exists($file)) {
         // if not built in view, look in app dir
         $file = $this->template;
         if (!file_exists($file)) {
             throw new \Exception('cannot find ' . $this->template);
         }
     }
     ob_start();
     require $file;
     return ob_get_clean();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:38,代码来源:ViewModel.php

示例11: loadSettings

 /**
  * Retrieve main settings for application
  * @return array
  */
 public function loadSettings()
 {
     $cache = Cacher::getInstance();
     if (($settings = $cache->load("settings")) === null) {
         $settings = array();
         foreach ($this->setting->findAll(new Criteria(), "`key`, `value`") as $row) {
             $settings[$row['key']] = $row['value'];
         }
         $cache->save($settings, null, null, array("setting"));
     }
     foreach ($settings as $key => $value) {
         Config::set($key, $value);
     }
     $rawUrl = parse_url(Config::get("siteRootUrl"));
     Config::set("siteDomainUrl", "http://" . $rawUrl['host']);
     $errorHandler = ErrorHandler::getInstance();
     if (!Config::get('errorHandlerSaveToFileEnabled')) {
         $errorHandler->setOption('saveToFile', false);
     }
     if (!Config::get('errorHandlerDisplayErrorEnabled')) {
         $errorHandler->setOption('displayError', false);
     }
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:27,代码来源:FrontController.php

示例12: writeDebug

 /**
  * Added informations for debug purposes only. In case the error it will showed and the result a node called "debug" will be added.
  *
  * @param string $key
  * @param mixed $string
  */
 public function writeDebug($key, $string)
 {
     if (is_null($this->responseDebug)) {
         $this->responseDebug = new ResponseBag();
         $this->response->add($this->responseDebug);
     }
     $this->responseDebug->add(['debug' => [$key => $string]]);
     ErrorHandler::getInstance()->addExtraInfo($key, serialize($string));
 }
开发者ID:byjg,项目名称:restserver,代码行数:15,代码来源:HttpResponse.php

示例13: microtime

<?php

/**
 * Arfooo
 * 
 * @package    Arfooo
 * @copyright  Copyright (c) Arfooo Annuaire (fr) and Arfooo Directory (en)
 *             by Guillaume Hocine (c) 2007 - 2010
 *             http://www.arfooo.com/ (fr) and http://www.arfooo.net/ (en)
 * @author     Guillaume Hocine & Adrian Galewski
 * @license    http://creativecommons.org/licenses/by/2.0/fr/ Creative Commons
 */
$scriptStartTime = microtime(true);
ini_set("display_errors", "on");
ini_set("url_rewriter.tags", "");
error_reporting(E_ALL);
require_once CODE_ROOT_DIR . "config/main.php";
require_once Config::get('CORE_PATH') . "Core.php";
ErrorHandler::getInstance();
开发者ID:reinfire,项目名称:arfooo,代码行数:19,代码来源:core.php

示例14: importImage

 /**
  * Helper function that imports a image file and shrinks it to max allowed dimensions
  */
 public static function importImage($type, &$key, $category = 0, $blind = false, $max_width = 800, $max_height = 800)
 {
     $error = ErrorHandler::getInstance();
     if (!file_exists($key['tmp_name'])) {
         throw new \Exception('file ' . $key['tmp_name'] . ' dont exist!');
     }
     $info = getimagesize($key['tmp_name']);
     switch ($info['mime']) {
         case 'image/jpeg':
             break;
         case 'image/png':
             break;
         case 'image/gif':
             break;
         default:
             $error->add('Uploaded file ' . $key['name'] . ' is not an image (mimetype ' . $info['mime'] . ')');
             return false;
     }
     $fileId = self::import($type, $key, $category, $blind);
     if (!$fileId) {
         return false;
     }
     $im = new ImageResizer(File::get($fileId));
     if ($im->width >= $max_width || $im->height >= $max_height) {
         $im->resizeAspect($max_width, $max_height);
         $im->render($im->mimetype, self::getUploadPath($fileId));
         self::sync($fileId);
         //updates tblFiles.size
     }
     return $fileId;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:34,代码来源:File.php

示例15: get_hint_messages

 /**
  * return the user interface error or succes messages 
  */
 public function get_hint_messages()
 {
     $error_hints = ErrorHandler::getInstance();
     $error_hints->show_hint_messages();
 }
开发者ID:ecuation,项目名称:Control-de-stock,代码行数:8,代码来源:ControllerCore.php


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