public function display() { $this->resetDocumentType(); jimport('joomla.plugin.helper'); $name = JRequest::getCmd('app'); try { echo JMPlugin::getInstance($name)->fetchResource(); } catch (Exception $e) { echo $this->sendError($e); } }
public final function getInstance($name, JMPlugin $plugin, $prefix = null) { if (is_null($prefix)) { $prefix = $plugin->get('component') . 'JMResource'; } $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) { parent::__construct($subject, $config); $this->loadLanguage(); JMResource::addIncludePath(JPATH_PLUGINS . DS . 'jm' . DS . 'core' . DS . 'resources'); }
public function register_api_plugin() { return parent::register_api_plugin(array('title' => 'K2')); }