本文整理汇总了PHP中ApiError::raiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiError::raiseError方法的具体用法?PHP ApiError::raiseError怎么用?PHP ApiError::raiseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiError
的用法示例。
在下文中一共展示了ApiError::raiseError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(&$subject, $config = array())
{
parent::__construct($subject, $config = array());
$easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easysocial', true)) {
ApiError::raiseError(404, 'Easyblog not installed');
return;
}
// Load Easyblog language & bootstrap files
$language = JFactory::getLanguage();
$language->load('com_easyblog');
require_once JPATH_ROOT . '/components/com_easyblog/constants.php';
require_once EBLOG_HELPERS . '/helper.php';
// Set resources & access
ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog');
$this->setResourceAccess('latest', 'public', 'get');
$this->setResourceAccess('category', 'public', 'get');
$this->setResourceAccess('blog', 'public', 'get');
$this->setResourceAccess('blog', 'public', 'post');
$this->setResourceAccess('comments', 'public', 'get');
$this->setResourceAccess('easyblog_users', 'public', 'get');
$config = EasyBlogHelper::getConfig();
if ($config->get('main_allowguestcomment')) {
$this->setResourceAccess('comments', 'public', 'post');
}
}
示例2: invoke
public final function invoke()
{
$method_name = $this->plugin->get('request_method');
if (in_array($method_name, $this->allowed_methods) && method_exists($this, $method_name) && is_callable(array($this, $method_name))) {
$this->{$method_name}();
} else {
ApiError::raiseError(404, JText::_('COM_API_PLUGIN_METHOD_NOT_FOUND'));
}
}
示例3: __construct
public function __construct(&$subject, $config = array())
{
parent::__construct($subject, $config = array());
$easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php';
if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easyblog', true)) {
ApiError::raiseError(404, 'Easyblog not installed');
return;
}
//load helper file
require_once JPATH_SITE . '/plugins/api/easyblog/helper/simpleschema.php';
// Load Easyblog language & bootstrap files
$language = JFactory::getLanguage();
$language->load('com_easyblog');
$xml = JFactory::getXML(JPATH_ADMINISTRATOR . '/components/com_easyblog/easyblog.xml');
$version = (string) $xml->version;
if ($version < 5) {
require_once JPATH_ROOT . '/components/com_easyblog/constants.php';
require_once JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog4');
} else {
ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog5');
require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php';
require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/constants.php';
//require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/gettable/gettable.php' ;
require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes' . '/date/date.php';
require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes' . '/string/string.php';
require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes' . '/adsense/adsense.php';
}
// Set resources & access
$this->setResourceAccess('latest', 'public', 'get');
$this->setResourceAccess('category', 'public', 'get');
$this->setResourceAccess('blog', 'public', 'get');
$this->setResourceAccess('blog', 'public', 'post');
$this->setResourceAccess('comments', 'public', 'get');
$this->setResourceAccess('easyblog_users', 'public', 'get');
$config = EasyBlogHelper::getConfig();
if ($config->get('main_allowguestcomment')) {
$this->setResourceAccess('comments', 'public', 'post');
}
}
示例4: encode
/**
* Determines the method with which to encode the output based on the requested content type
* @return string
*/
public function encode()
{
$document = JFactory::getDocument();
$document->setMimeEncoding($this->format);
$format_name = $this->content_types[$this->format];
$method = 'to' . ucfirst($format_name);
if (!method_exists($this, $method)) {
ApiError::raiseError(406, JText::_('COM_API_PLUGIN_NO_ENCODER'));
}
if (!is_callable(array($this, $method))) {
ApiError::raiseError(404, JText::_('COM_API_PLUGIN_NO_ENCODER'));
}
return $this->{$method}();
}
示例5: handleSession
public function handleSession()
{
$class = JRequest::getVar('class');
// get session key and detete user
// =================================================================
$s = JFactory::getSession();
$key = JRequest::getVar('session_key');
$db = JFactory::getDbo();
$q = $db->getQuery(true);
$q->select('userid')->from('#__session')->where("session_id='{$key}'");
$db->setQuery($q, 0, 1);
$uid = $db->loadResult();
// if user has loged in, set it in session.
// =================================================================
if ($uid) {
$user = JFactory::getUser($uid);
$s->set('user', $user);
}
// Detect is login?
// =================================================================
$user = JFactory::getUser();
if ($user->guest && $class != 'user') {
ApiError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
}
}
示例6: checkInternally
private final function checkInternally($resource_name)
{
if (!method_exists($this, $resource_name)) {
ApiError::raiseError(404, JText::_('COM_API_PLUGIN_METHOD_NOT_FOUND'));
}
if (!is_callable(array($this, $resource_name))) {
ApiError::raiseError(404, JText::_('COM_API_PLUGIN_METHOD_NOT_CALLABLE'));
}
return true;
}