当前位置: 首页>>代码示例>>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;未经允许,请勿转载。