當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JError::throwError方法代碼示例

本文整理匯總了PHP中JError::throwError方法的典型用法代碼示例。如果您正苦於以下問題:PHP JError::throwError方法的具體用法?PHP JError::throwError怎麽用?PHP JError::throwError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JError的用法示例。


在下文中一共展示了JError::throwError方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: status

 /**
  * Removes a comment.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function status()
 {
     // Check for request forgeries
     JRequest::checkToken() or JRequest::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = JRequest::getVar('cid', array(), '', 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JError::raiseWarning(500, JText::_('COM_COMMENTS_NO_COMMENTS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel('comments');
         $user = JFactory::getUser();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         try {
             switch ($this->task) {
                 // Not actually a status change but it remain here to avoid code repetition
                 case 'delete':
                     if (!$user->authorise('edit', 'com_slicomments')) {
                         throw new JException(JText::_('COM_COMMENTS_NO_AUTH'), 403, E_WARNING);
                     }
                     $model->delete($cid);
                     $message = 'COM_COMMENTS_N_COMMENTS_DELETED';
                     break;
                 case 'unflag':
                     if (!$user->authorise('manage', 'com_slicomments')) {
                         throw new JException(JText::_('COM_COMMENTS_NO_AUTH'), 403, E_WARNING);
                     }
                     $model->unflag($cid);
                     $message = 'COM_COMMENTS_N_COMMENTS_UNFLAGGED';
                     break;
                 case 'approve':
                 case 'unapprove':
                 case 'trash':
                 case 'spam':
                     if (!$user->authorise('manage', 'com_slicomments')) {
                         throw new JException(JText::_('COM_COMMENTS_NO_AUTH'), 403, E_WARNING);
                     }
                     $model->status($cid, $this->task);
                     $message = 'COM_COMMENTS_N_COMMENTS_' . strtoupper($this->task);
                     break;
             }
             JFactory::getApplication()->enqueueMessage(JText::plural($message, count($cid)));
         } catch (JException $e) {
             JError::throwError($e);
         }
     }
     $this->setRedirect('index.php?option=com_slicomments');
 }
開發者ID:rivetweb,項目名稱:old-joomla-dd-countrymap,代碼行數:58,代碼來源:comments.php

示例2: raise

 /**
  * Create a new JException object given the passed arguments
  *
  * @param   integer  $level      The error level - use any of PHP's own error levels for
  *                               this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR,
  *                               E_USER_WARNING, E_USER_NOTICE.
  * @param   string   $code       The application-internal error code for this error
  * @param   string   $msg        The error message, which may also be shown the user if need be.
  * @param   mixed    $info       Optional: Additional error information (usually only
  *                               developer-relevant information that the user should never see,
  *                               like a database DSN).
  * @param   boolean  $backtrace  Add a stack backtrace to the exception.
  *
  * @return  mixed    The JException object
  *
  * @since       11.1
  * @deprecated  12.1  Use PHP Exception
  * @see         JException
  */
 public static function raise($level, $code, $msg, $info = null, $backtrace = false)
 {
     // Deprecation warning.
     JLog::add('JError::raise() is deprecated.', JLog::WARNING, 'deprecated');
     jimport('joomla.error.exception');
     // Build error object
     $exception = new JException($msg, $code, $level, $info, $backtrace);
     return JError::throwError($exception);
 }
開發者ID:NavaINT1876,項目名稱:ccustoms,代碼行數:28,代碼來源:error.php

示例3: raise

 /**
  * Create a new JException object given the passed arguments
  *
  * @param   integer  $level     The error level - use any of PHP's own error levels for this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE.
  * @param   string   $code      The application-internal error code for this error
  * @param   string   $msg       The error message, which may also be shown the user if need be.
  * @param   mixed    $info      Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
  * @param   boolean  $backtrace
  *
  * @return  mixed    The JException object
  *
  * @deprecated
  * @see     JException
  * @since   11.1
  */
 public static function raise($level, $code, $msg, $info = null, $backtrace = false)
 {
     jimport('joomla.error.exception');
     // Build error object
     $exception = new JException($msg, $code, $level, $info, $backtrace);
     return JError::throwError($exception);
 }
開發者ID:carmerin,項目名稱:cesae-web,代碼行數:22,代碼來源:error.php

示例4: isValid

 /**
  * Check the structure of a exported/imported tables
  *
  * @param array - the list to import
  *
  * @return bool
  * @since  1.0
  */
 public function isValid()
 {
     JError::throwError('isValid should be implemented (' . $this->getName() . ')');
 }
開發者ID:Rikisha,項目名稱:proj,代碼行數:12,代碼來源:common.php


注:本文中的JError::throwError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。