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


PHP Errors类代码示例

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


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

示例1: error

 function error()
 {
     require 'controllers/error.php';
     $controller = new Errors();
     $controller->index();
     return false;
 }
开发者ID:TianliJin,项目名称:Zietlow-Collection,代码行数:7,代码来源:bootstrap.php

示例2: addErrorObject

 /**
  * Add errors from Errors object
  * @param Errors $object
  * @param bool $saveKey
  * @return $this
  */
 public function addErrorObject(Errors $object, $saveKey = false)
 {
     $errors = $object->getErrors(true);
     foreach ($errors as $key => $error) {
         $this->addError($error['name'], $saveKey ? $key : '', $error['data']);
     }
     return $this;
 }
开发者ID:vvasystem,项目名称:errorstrait,代码行数:14,代码来源:Errors.php

示例3: testWithInvalidReservedDiapason

 /**
  * Test for invalid reserved codes
  *
  * @expectedException \RuntimeException
  * @expectedExceptionMessage The reserved codes for factory "FivePercent\Component\Error\ThirdErrorFactoryWithInvalidReservedDiapason" [15 - 30] superimposed on "FivePercent\Component\Error\SecondErrorFactory" factory [10 - 19].
  */
 public function testWithInvalidReservedDiapason()
 {
     $errors = new Errors();
     $errors->addFactory(new FirstErrorFactory());
     $errors->addFactory(new SecondErrorFactory());
     $errors->addFactory(new ThirdErrorFactoryWithInvalidReservedDiapason());
     $errors->checkReservedCodes();
 }
开发者ID:Gtvar,项目名称:FivePercent-Error,代码行数:14,代码来源:ErrorsTest.php

示例4: __construct

 /**
  * Constructs a validation exception
  *
  * @param Errors $errors The validation errors
  */
 public function __construct(Errors $errors)
 {
     $this->errors = $errors;
     if (!$errors->hasErrors()) {
         parent::__construct('No errors');
     } else {
         parent::__construct($errors->toString());
     }
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:14,代码来源:ValidationException.php

示例5: colSelect

 /**
  * 带有col布局的select (后台使用).
  *
  * @param string $name    表单name
  * @param array  $list    值列表 (值 => 标签)
  * @param Errors $errors  错误对象
  * @param string $label   label
  * @param mixed  $value   默认值
  * @param array  $options 其他附属参数
  */
 public function colSelect($name, $list = array(), $errors, $label = '', $selected = null, $options = [])
 {
     $attributes = array_merge(['class' => 'form-control'], $options);
     $hasError = $errors->has($name) ? 'has-error' : '';
     $label = $label ? $this->label($name, $label, ['class' => 'col-sm-2 control-label']) : '';
     $string = '<div class ="form-group ' . $hasError . '">';
     $string .= $label;
     $string .= '<div class="col-sm-6">';
     $string .= call_user_func_array(['Form', 'select'], [$name, $list, $selected, $attributes]);
     $string .= $errors->first($name, '<small class="help-block">:message</small>');
     $string .= '</div></div>';
     return $string;
 }
开发者ID:renyang9876,项目名称:viease,代码行数:23,代码来源:FormBuilder.php

示例6: __call

 /**
  * Ставим хук на вызов неизвестного метода
  * @param string [component|module]_[method]
  * @param array $aArgs
  * @return unknown
  */
 public function __call($sName, $aArgs = array())
 {
     //Ищем среди прикрепленный компонентов
     if ($this->_c !== null) {
         $aArgsRef = array();
         foreach ($aArgs as $key => $v) {
             $aArgsRef[] =& $aArgs[$key];
         }
         //$sName == [component name]_[method name]
         $aName = explode("_", $sName, 2);
         if (sizeof($aName) == 2) {
             $sComponent = mb_strtolower($aName[0]);
             $sMethod = $aName[1];
             if (!empty($sMethod) && isset($this->_c[$sComponent])) {
                 if (method_exists($this->_c[$sComponent], $sMethod)) {
                     return call_user_func_array(array($this->_c[$sComponent], $sMethod), $aArgsRef);
                 }
                 Errors::i()->set("Компонент не имеет требуемого метода <b>{$sComponent}" . '->' . $sMethod . '()</b>')->autohide(false);
                 return null;
             }
         }
         //$sName == [method name]
         foreach ($this->_c as $name => $component) {
             if (method_exists($component, $sName)) {
                 return call_user_func_array(array($component, $sName), $aArgsRef);
             }
         }
     }
     return null;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:36,代码来源:module.php

示例7: process_single

 /**
  * Process a single feed
  *
  * @param array $feed Feed information (required elements are 'name' for error reporting, 'feed' for the feed URL and 'id' for the feed's unique internal ID)
  * @return int Number of items added
  */
 public static function process_single($feed)
 {
     do_action('iu-feed-start', $feed);
     $sp =& self::load_feed($feed);
     if ($error = $sp->error()) {
         self::log(sprintf(_r('An error occurred with "%2$s": %1$s'), $error, $feed['name']), Errors::get_code('api.itemupdater.itemerror'));
         do_action('iu-feed-finish', $feed);
         return -1;
     }
     $count = 0;
     $items = $sp->get_items();
     foreach ($items as $item) {
         $new_item = self::normalise($item, $feed['id']);
         $new_item = apply_filters('item_data_precache', $new_item, $feed);
         if (Items::get_instance()->check_item($new_item)) {
             $count++;
             do_action('iu-item-add', $new_item, $feed);
         } else {
             do_action('iu-item-noadd', $new_item, $feed);
         }
     }
     $sp->__destruct();
     unset($sp);
     do_action('iu-feed-finish', $feed);
     return $count;
 }
开发者ID:JocelynDelalande,项目名称:Lilina,代码行数:32,代码来源:class-itemupdater.php

示例8: _sortArgs

 /**
  * Sort parameters by order specified in method declaration
  *
  * Takes a callback and a list of available params, then filters and sorts
  * by the parameters the method actually needs, using the reflection APIs
  *
  * @author Morten Fangel <fangel@sevengoslings.net>
  * @param callback $callback
  * @param array $params
  * @return array
  */
 protected function _sortArgs($callback, $params)
 {
     // Takes a callback and a list or params and filter and
     // sort the list by the parameters the method actually needs
     if (is_array($callback)) {
         $ref_func = new ReflectionMethod($callback[0], $callback[1]);
     } else {
         $ref_func = new ReflectionFunction($callback);
     }
     // Create a reflection on the method
     $ref_parameters = $ref_func->getParameters();
     // finds the parameters needed for the function via Reflections
     $ordered_parameters = array();
     foreach ($ref_parameters as $ref_parameter) {
         // Run through all the parameters we need
         if (isset($params[$ref_parameter->getName()])) {
             // We have this parameters in the list to choose from
             $ordered_parameters[] = $params[$ref_parameter->getName()];
         } elseif ($ref_parameter->isDefaultValueAvailable()) {
             // We don't have this parameter, but it's optional
             $ordered_parameters[] = $ref_parameter->getDefaultValue();
         } else {
             // We don't have this parameter and it wasn't optional, abort!
             throw new Exception('Missing parameter ' . $ref_parameter->getName() . '', Errors::get_code('admin.ajax.missing_param'));
             $ordered_parameters[] = null;
         }
     }
     return $ordered_parameters;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:40,代码来源:class-ajaxhandler.php

示例9: post

 public function post($request)
 {
     // to Receive POST Params (use $this->params)
     parent::post($request);
     $folderID = $this->getParam('folderID');
     $msgID = $this->getParam('msgID');
     $attachmentID = $this->getParam('attachmentID');
     if ($this->isLoggedIn()) {
         if ($folderID && $msgID && $attachmentID) {
             $dir = PHPGW_INCLUDE_ROOT . "/expressoMail/inc";
             if ($this->getExpressoVersion() != "2.2") {
                 $_GET['msgFolder'] = $folderID;
                 $_GET['msgNumber'] = $msgID;
                 $_GET['indexPart'] = $attachmentID;
                 include "{$dir}/get_archive.php";
             } else {
                 $_GET['msg_folder'] = $folderID;
                 $_GET['msg_number'] = $msgID;
                 $_GET['msg_part'] = $attachmentID;
                 $_GET['idx_file'] = $this->getParam('attachmentIndex');
                 $_GET['newfilename'] = $this->getParam('attachmentName');
                 $_GET['encoding'] = $this->getParam('attachmentEncoding');
                 include "{$dir}/gotodownload.php";
             }
             // Dont modify header of Response Method to 'application/json'
             $this->setCannotModifyHeader(true);
             return $this->getResponse();
         } else {
             Errors::runException("MAIL_ATTACHMENT_NOT_FOUND");
         }
     }
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:32,代码来源:AttachmentResource.php

示例10: setNewServer

 public function setNewServer($host, $user, $password, $database, $faild = self::EXCEPTION_FAILD_MODE)
 {
     //$this->server=null;
     //
     if ($host == "" and $user == "" and $database == "") {
         throw new DatabaseArgumentsException();
     } else {
         Database::$server = mysqli_connect($host, $user, $password, $database);
         //
         if (!Database::$server) {
             if ($faild == 2 && Config::get('panel.configured')) {
                 throw new DatabaseConnectionException();
             } else {
                 if ($faild == 1) {
                     \Errors::r_db();
                 }
             }
         }
         //
         mysqli_query(Database::$server, "SET NAMES " . Config::get("database.charset"));
         //
         Database::$serverData = ['host' => $host, "username" => $user, "password" => $password, "database" => $database];
         //
         //
         return Database::$server;
     }
 }
开发者ID:ar-framework-labs,项目名称:kernel,代码行数:27,代码来源:MySql.php

示例11: process

 public static function process()
 {
     header('Content-Type: text/plain; charset=utf-8');
     require_once LILINA_INCPATH . '/contrib/simplepie.class.php';
     $updated = false;
     foreach (self::$feeds as $feed) {
         do_action('iu-feed-start', $feed);
         $sp = self::load_feed($feed);
         if ($error = $sp->error()) {
             self::log(sprintf(_r('An error occurred with "%2$s": %1$s'), $error, $feed['name']), Errors::get_code('api.itemupdater.itemerror'));
             continue;
         }
         $count = 0;
         $items = $sp->get_items();
         foreach ($items as $item) {
             $new_item = self::normalise($item, $feed['id']);
             $new_item = apply_filters('item_data_precache', $new_item);
             if (Items::get_instance()->check_item($new_item)) {
                 $count++;
                 $updated = true;
             }
         }
         do_action('iu-feed-finish', $feed);
     }
     Items::get_instance()->sort_all();
     if ($updated) {
         Items::get_instance()->save_cache();
     }
 }
开发者ID:rmccue,项目名称:Lilina,代码行数:29,代码来源:class-cronupdater.php

示例12: getInfo

 /**
  * Возвращаем данные столика
  * @param $arData
  * @return CDBResult|CIBlockResult|string
  */
 function getInfo($tableID, $arData = false, $GetNext = false)
 {
     $arFilterTable = array("IBLOCK_ID" => IB_TABLE_ID, "PROPERTY_CLUB" => $this->clubID, "ID" => intval($tableID));
     $arSelectTable = array("ID");
     $arOrderTable = array();
     $arOrder = is_array($arData["arSelect"]) ? array_merge($arData["arOrder"], $arOrderTable) : $arOrderTable;
     $arGroupBy = is_array($arData["arGroupBy"]) ? array_merge($arData["arGroupBy"], array()) : false;
     $arNavStartParams = is_array($arData["arGroupBy"]) ? array_merge($arData["arNavStartParams"], array()) : false;
     $arSelect = is_array($arData["arSelect"]) ? array_merge($arData["arSelect"], $arSelectTable) : $arSelectTable;
     $arFilter = is_array($arData["arFilter"]) ? array_merge($arData["arFilter"], $arFilterTable) : $arFilterTable;
     $res = CIBlockElement::GetList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelect);
     if (!$res) {
         return Errors::run("404");
     }
     $ob = $GetNext ? $res->GetNext() : $res->Fetch();
     if (isset($ob["PREVIEW_PICTURE"])) {
         $arFile = CFile::GetFileArray($ob["PREVIEW_PICTURE"]);
         $ob["PREVIEW_PICTURE"] = $arFile["SRC"];
     }
     if (isset($ob["PROPERTY_PRICE_GROUP_VALUE"])) {
         $res = CIBlockElement::GetList(array(), array("ID" => intval($ob["PROPERTY_PRICE_GROUP_VALUE"]), "IBLOCK_ID" => IB_PRICE_GROUP), false, false, array("NAME", "ID", "PROPERTY_PRICE"));
         $ob["PROPERTY_PRICE_GROUP"] = $res->Fetch();
     }
     return $ob;
 }
开发者ID:nProfessor,项目名称:Mytb,代码行数:30,代码来源:Table.php

示例13: post

 public function post($request)
 {
     // to Receive POST Params (use $this->params)
     parent::post($request);
     if ($this->isLoggedIn()) {
         $old_id = $this->getParam('folderID');
         $new_name = $this->getParam('folderName');
         if (!$this->getImap()->folder_exists($old_id)) {
             Errors::runException("MAIL_INVALID_OLD_FOLDER");
         }
         $default_folders = array_keys($this->defaultFolders);
         if (in_array($old_id, $default_folders)) {
             Errors::runException("MAIL_INVALID_OLD_FOLDER");
         }
         if (empty($new_name) || preg_match('/[\\/\\\\!\\@\\#\\$\\%\\&\\*\\(\\)]/', $new_name)) {
             Errors::runException("MAIL_INVALID_NEW_FOLDER_NAME");
         }
         $old_id_arr = explode($this->getImap()->imap_delimiter, $old_id);
         $new_id = implode($this->getImap()->imap_delimiter, array_slice($old_id_arr, 0, count($old_id_arr) - 1)) . $this->getImap()->imap_delimiter . $new_name;
         $params['current'] = $old_id;
         $params['rename'] = $new_id;
         $result = $this->getImap()->ren_mailbox($params);
         if ($result != 'Ok') {
             Errors::runException("MAIL_FOLDER_NOT_RENAMED");
         }
     }
     $this->setResult(array('folderID' => $new_id));
     //to Send Response (JSON RPC format)
     return $this->getResponse();
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:30,代码来源:RenameFolderResource.php

示例14: addError

 public function addError($errorCode, array $params = [], $subReports = null, $schemaDescription = null)
 {
     $errorMessage = vsprintf(Errors::getMessage($errorCode), $params);
     $error = ['code' => $errorCode, 'params' => $params, 'message' => $errorMessage, 'path' => $this->getPath()];
     if ($schemaDescription !== null) {
         if (is_object($schemaDescription)) {
             if (isset($schemaDescription->description)) {
                 $error['description'] = $schemaDescription->description;
             } else {
                 if (isset($schemaDescription->id)) {
                     $error['description'] = $schemaDescription->id;
                 }
             }
         } else {
             if (is_string($schemaDescription)) {
                 $error['description'] = $schemaDescription;
             }
         }
     }
     if ($subReports !== null) {
         if (!is_array($subReports)) {
             $subReports = [$subReports];
         }
         $error['inner'] = [];
         foreach ($subReports as $subReport) {
             foreach ($subReport->errors as $subError) {
                 $error['inner'][] = $subError;
             }
         }
         if (empty($error['inner'])) {
             unset($error['inner']);
         }
     }
     $this->errors[] = $error;
 }
开发者ID:phindmarsh,项目名称:statham,代码行数:35,代码来源:Report.php

示例15: post

 public function post($request)
 {
     // to Receive POST Params (use $this->params)
     parent::post($request);
     if ($this->isLoggedIn()) {
         $msgBody = $this->getParam("message");
         $params['input_to'] = $GLOBALS['phpgw_info']['server']['sugestoes_email_to'];
         $params['input_cc'] = $GLOBALS['phpgw_info']['server']['sugestoes_email_cc'];
         $params['input_cc'] = $GLOBALS['phpgw_info']['server']['sugestoes_email_bcc'];
         $params['input_subject'] = lang("Suggestions");
         $params['body'] = $msgBody;
         $params['type'] = 'textplain';
         $GLOBALS['phpgw']->preferences->read_repository();
         $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
         $boemailadmin = CreateObject('emailadmin.bo');
         $emailadmin_profile = $boemailadmin->getProfileList();
         $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
         $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server'];
         $_SESSION['phpgw_info']['expressomail']['user']['email'] = $GLOBALS['phpgw']->preferences->values['email'];
         $expressoMail = CreateObject('expressoMail.imap_functions');
         $returncode = $expressoMail->send_mail($params);
         if (!$returncode || !(is_array($returncode) && $returncode['success'] == true)) {
             Errors::runException("MAIL_NOT_SENT");
         }
     }
     $this->setResult(true);
     //to Send Response (JSON RPC format)
     return $this->getResponse();
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:29,代码来源:SendSupportFeedbackResource.php


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