public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config = array()); ApiResource::addIncludePath(dirname(__FILE__) . '/akeebasubs'); // Set public resources if needed // $this->setResourceAccess('resourcename', 'public'); }
public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config = array()); ApiResource::addIncludePath(dirname(__FILE__) . '/users'); // Set the login resource to be public $this->setResourceAccess('login', 'public'); }
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'); } }
public function __construct() { parent::__construct(); // Load all required helpers. $component_path = JPATH_ROOT . DS . 'components' . DS . 'com_jticketing'; if (!file_exists($component_path)) { return; } $jticketingmainhelperPath = JPATH_ROOT . DS . 'components' . DS . 'com_jticketing' . DS . 'helpers' . DS . 'main.php'; if (!class_exists('jticketingmainhelper')) { JLoader::register('jticketingmainhelper', $jticketingmainhelperPath); JLoader::load('jticketingmainhelper'); } $jticketingfrontendhelper = JPATH_ROOT . DS . 'components' . DS . 'com_jticketing' . DS . 'helpers' . DS . 'frontendhelper.php'; if (!class_exists('jticketingfrontendhelper')) { JLoader::register('jticketingfrontendhelper', $jticketingfrontendhelper); JLoader::load('jticketingfrontendhelper'); } $jteventHelperPath = JPATH_ROOT . DS . 'components' . DS . 'com_jticketing' . DS . 'helpers' . DS . 'event.php'; if (!class_exists('jteventHelper')) { JLoader::register('jteventHelper', $jteventHelperPath); JLoader::load('jteventHelper'); } ApiResource::addIncludePath(dirname(__FILE__) . '/jticket'); }
public function __construct() { parent::__construct(); ApiResource::addIncludePath(dirname(__FILE__) . '/relate'); JLoader::register('RelateAPIHelper', dirname(__FILE__) . '/relate/helper.php'); RelateAPIHelper::setup(); }
public function __construct() { parent::__construct(); ApiResource::addIncludePath(dirname(__FILE__) . '/community'); JLoader::register('CommunityAPIHelper', dirname(__FILE__) . '/community/helper.php'); CommunityAPIHelper::setup(); $this->setResourceAccess('authenticate', 'public', 'POST'); }
public function display() { $this->resetDocumentType(); jimport('joomla.plugin.helper'); $name = JRequest::getCmd('app'); $handler = ApiPlugin::getInstance($name); $output = $handler->fetchResource(); echo $output; }
public function display($cachable = false, $urlparams = array()) { $this->resetDocumentType(); $app = JFactory::getApplication(); $name = $app->input->get('app', '', 'CMD'); try { echo ApiPlugin::getInstance($name)->fetchResource(); } catch (Exception $e) { echo $this->sendError($e); } }
public function display() { $this->resetDocumentType(); jimport('joomla.plugin.helper'); $name = JRequest::getCmd('app'); try { echo ApiPlugin::getInstance($name)->fetchResource(); } catch (Exception $e) { echo $this->sendError($e); } }
public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config = array()); //load helper file require_once JPATH_SITE . '/plugins/api/articles/articles/helper/simpleschema.php'; ApiResource::addIncludePath(dirname(__FILE__) . '/articles'); // Set resources & access $this->setResourceAccess('article', 'public', 'get'); $this->setResourceAccess('category', 'public', 'get'); $this->setResourceAccess('latest', 'public', 'get'); }
public final function getInstance($name, ApiPlugin $plugin, $prefix = null) { if (is_null($prefix)) { $prefix = $plugin->get('component') . 'ApiResource'; } $type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $name); $resourceClass = $prefix . ucfirst($type); if (!class_exists($resourceClass)) { jimport('joomla.filesystem.path'); if ($path = JPath::find(self::addIncludePath(), strtolower($type) . '.php')) { require_once $path; if (!class_exists($resourceClass)) { // Resource class not found return false; } } else { // Resource file not found return false; } } $instance = new $resourceClass($plugin); return $instance; }
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'); } }
public function __construct() { parent::__construct(); ApiResource::addIncludePath(dirname(__FILE__) . '/socialads'); }
public function register_api_plugin() { return parent::register_api_plugin(array('title' => 'K2')); }
public function __construct(&$subject, $config = array()) { parent::__construct($subject = 'api', $config = array()); ApiResource::addIncludePath(dirname(__FILE__) . '/easysocial'); $this->setResourceAccess('slogin', 'public', 'post'); }
public static function getInstance($name) { $app = JFactory::getApplication(); $param_path = JPATH_BASE . self::$plg_path . $name . '.xml'; $plugin = JPluginHelper::getPlugin('api', $name); if (isset(self::$instances[$name])) { return self::$instances[$name]; } if (version_compare(JVERSION, "3.0", "l")) { $dispatcher = JDispatcher::getInstance(); } else { $dispatcher = JEventDispatcher::getInstance(); self::$plg_path = self::$plg_path . $plugin->name . '/'; } if (empty($plugin)) { ApiError::raiseError(400, JText::sprintf('COM_API_PLUGIN_CLASS_NOT_FOUND', ucfirst($name))); } $plgfile = JPATH_BASE . self::$plg_path . $name . '.php'; if (!JFile::exists($plgfile)) { ApiError::raiseError(400, JText::sprintf('COM_API_FILE_NOT_FOUND', ucfirst($name))); } include_once $plgfile; $class = self::$plg_prefix . ucwords($name); if (!class_exists($class)) { ApiError::raiseError(400, JText::sprintf('COM_API_PLUGIN_CLASS_NOT_FOUND', ucfirst($name))); } $cparams = JComponentHelper::getParams('com_api'); $handler = new $class($dispatcher, array('params' => $cparams)); $handler->set('params', $cparams); $call_methd = $app->input->server->get('REQUEST_METHOD', '', 'STRING'); //switch case for differ calling method switch ($call_methd) { case 'GET': $handler->set('component', $app->input->get('app', '', 'CMD')); $handler->set('resource', $app->input->get('resource', '', 'CMD')); $handler->set('format', $handler->negotiateContent($app->input->get('output', null, 'CMD'))); break; case 'POST': $handler->set('component', $app->input->get('app', '', 'CMD')); $handler->set('resource', $app->input->get('resource', '', 'CMD')); $handler->set('format', $handler->negotiateContent($app->input->get('output', null, 'CMD'))); break; case 'PUT': $handler->set('component', $app->input->get('app', '', 'CMD')); $handler->set('resource', $app->input->get('resource', '', 'CMD')); $handler->set('format', $handler->negotiateContent($app->input->get('output', null, 'CMD'))); break; case 'DELETE': $handler->set('component', $app->input->get('app', '', 'CMD')); $handler->set('resource', $app->input->get('resource', '', 'CMD')); $handler->set('format', $handler->negotiateContent($app->input->get('output', null, 'CMD'))); break; case 'PATCH': $handler->set('component', $app->input->get('app', '', 'CMD')); $handler->set('resource', $app->input->get('resource', '', 'CMD')); $handler->set('format', $handler->negotiateContent($app->input->post->get('output', null, 'CMD'))); break; } $handler->set('request_method', $app->input->server->get('REQUEST_METHOD', '', 'STRING')); self::$instances[$name] = $handler; return self::$instances[$name]; }
public function __construct() { parent::__construct(); ApiResource::addIncludePath(dirname(__FILE__) . '/jreviews'); JLoader::register('JReviewsAPIHelper', dirname(__FILE__) . '/jreviews/helper.php'); }