本文整理汇总了PHP中JPluginHelper::getPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP JPluginHelper::getPlugin方法的具体用法?PHP JPluginHelper::getPlugin怎么用?PHP JPluginHelper::getPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPluginHelper
的用法示例。
在下文中一共展示了JPluginHelper::getPlugin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Override by loading Profile Picture parameters.
*
* @param JForm $form The form to attach to the form field object.
*
* @since 2.0
*/
public function __construct($form = null)
{
$plugin = JPluginHelper::getPlugin('user', 'profilepicture');
$this->params = new JRegistry($plugin->params);
$this->maxUploadSizeInBytes = $this->params->get('maxUploadSizeInBytes', 800000);
parent::__construct($form);
}
示例2: initialize
function initialize()
{
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'flickrAlbum');
$pluginParams = new JParameter($plugin->params);
$this->thumbsize = $pluginParams->get('thumbsizedef', 1);
$this->imagesize = $pluginParams->get('imagesizedef', 1);
$this->rows = $pluginParams->get('rowsdef', 1);
$this->cols = $pluginParams->get('colsdef', 1);
$this->type = '';
$this->photoset = '';
$this->keywords = '';
$this->user = $pluginParams->get('userdef', 1);
$this->group = '';
$this->tags = '';
$this->sort = $pluginParams->get('sortdef', 1);
$this->color = $pluginParams->get('colorthemedef', 1);
$this->title = $pluginParams->get('albumtitledef', 1);
$this->linktext = $pluginParams->get('linktextdef', 1);
$this->debug = strtolower($pluginParams->get('enabledebug', 1)) == 'yes';
$this->thumbpadding = $pluginParams->get('thumbpadding', 1);
$this->thumbborder = $pluginParams->get('thumbborder', 1);
$this->thumbmargin = $pluginParams->get('thumbmargin', 1);
$this->flickr_api_key = $pluginParams->get('flickr_api_key', 1);
$this->inc_jquery = strtolower($pluginParams->get('incjquery', 1)) == 'yes';
$this->inc_jquery_flickr = strtolower($pluginParams->get('incjqueryflickr', 1)) == 'yes';
}
示例3: plgAcymailingContentplugin
function plgAcymailingContentplugin(&$subject, $config)
{
parent::__construct($subject, $config);
if (!isset($this->params)) {
$plugin = JPluginHelper::getPlugin('acymailing', 'contentplugin');
$this->params = new acyParameter($plugin->params);
}
$this->paramsContent = JComponentHelper::getParams('com_content');
JPluginHelper::importPlugin('content');
$this->dispatcherContent = JDispatcher::getInstance();
$excludedHandlers = array('plgContentEmailCloak', 'pluginImageShow');
$excludedNames = array('system' => array('SEOGenerator', 'SEOSimple'), 'content' => array('webeecomment', 'highslide', 'smartresizer', 'phocagallery'));
$excludedType = array_keys($excludedNames);
if (!ACYMAILING_J16) {
foreach ($this->dispatcherContent->_observers as $id => $observer) {
if (is_array($observer) and in_array($observer['handler'], $excludedHandlers)) {
$this->dispatcherContent->_observers[$id]['event'] = '';
} elseif (is_object($observer)) {
if (in_array($observer->_type, $excludedType) and in_array($observer->_name, $excludedNames[$observer->_type])) {
$this->dispatcherContent->_observers[$id] = null;
}
}
}
}
if (!class_exists('JSite')) {
include_once ACYMAILING_ROOT . 'includes' . DS . 'application.php';
}
}
示例4: onDisplay
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
jimport('joomla.filesystem.file');
// return if system plugin is not installed
if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.php')) {
return;
}
// return if NoNumber! Elements plugin is not installed
if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'nonumberelements.php')) {
return;
}
// load the admin language file
$lang =& JFactory::getLanguage();
if ($lang->getTag() != 'en-GB') {
// Loads English language file as fallback (for undefined stuff in other language file)
$lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, 'en-GB');
}
$lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, null, 1);
// Load system plugin parameters
require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'parameters.php';
$parameters =& NNParameters::getParameters();
$system_params = JPluginHelper::getPlugin('system', $this->_name);
$params = $parameters->getParams($system_params->params, JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.xml');
// Include the Helper
require_once JPATH_PLUGINS . DS . $this->_type . DS . $this->_name . DS . 'helper.php';
$class = get_class($this) . 'Helper';
$this->helper = new $class($params);
return $this->helper->render($name);
}
示例5: createObserver
public static function createObserver(JObservableInterface $observableObject, $params = array())
{
$observer = new self($observableObject);
$observer->plugin = JPluginHelper::getPlugin('system', 'jds');
$observer->params = new JRegistry($observer->plugin->params);
return $observer;
}
示例6: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
// Base name of the HTML control.
$ctrl = $control_name . '[' . $name . ']';
// Construct the various argument calls that are supported.
$attribs = ' ';
if ($v = $node->attributes('size')) {
$attribs .= 'size="' . $v . '"';
}
if ($v = $node->attributes('class')) {
$attribs .= 'class="' . $v . '"';
} else {
$attribs .= 'class="inputbox"';
}
if ($m = $node->attributes('multiple')) {
$attribs .= ' multiple="multiple"';
$ctrl .= '[]';
}
//get plugin name (plugin entryfile name)
$element = $node->attributes('element');
$db =& JFactory::getDBO();
//get plugin params from #__plugins table
$plugin = JPluginHelper::getPlugin('emailalerts', $element);
if (!empty($plugin)) {
$pluginParams = new JParameter($plugin->params);
$pluginParamsDefault = $pluginParams->_raw;
//example: plugintitle=K2-Latest Items category=1|3|4|5|2 no_of_items=5 catid=1|3|4|5|2
$new1 = explode("\n", $pluginParamsDefault);
$new2 = explode("=", $new1[2]);
$cats = str_replace('|', ',', $new2[1]);
if ($cats) {
$sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman' AND id IN (" . $cats . ")";
} else {
//if no category is yet selected
$sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman'";
}
} else {
//if plugin is not yet enabled load all categories
$sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman'";
}
$db->setQuery($sql);
// Query items for list.
$key = $node->attributes('key_field') ? $node->attributes('key_field') : 'value';
$val = $node->attributes('value_field') ? $node->attributes('value_field') : $name;
$options = array();
foreach ($node->children() as $option) {
$options[] = array($key => $option->attributes('value'), $val => $option->data());
}
$rows = $db->loadAssocList();
if ($rows) {
foreach ($rows as $row) {
$options[] = array($key => $row[$key], $val => $row[$val]);
}
}
if ($options) {
return JHTML::_('select.genericlist', $options, $ctrl, $attribs, $key, $val, $value, $control_name . $name);
} else {
return JText::_('NO_CATS_USER');
}
}
示例7: plgContentCpTags
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for
* plugins because func_get_args ( void ) returns a copy of all passed arguments
* NOT references. This causes problems with cross-referencing necessary for the
* observer design pattern.
*/
function plgContentCpTags(&$subject)
{
parent::__construct($subject);
// load plugin parameters
$this->_plugin =& JPluginHelper::getPlugin('content', 'cptags');
$this->_params = new JParameter($this->_plugin->params);
}
示例8: plgContentLoadModule
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule(&$row, &$params, $page = 0)
{
$db =& JFactory::getDBO();
// simple performance check to determine whether bot should process further
if (JString::strpos($row->text, 'loadposition') === false) {
return true;
}
// Get plugin info
$plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
// expression to search for
$regex = '/{loadposition\\s*.*?}/i';
$pluginParams = new JParameter($plugin->params);
// check whether plugin has been unpublished
if (!$pluginParams->get('enabled', 1)) {
$row->text = preg_replace($regex, '', $row->text);
return true;
}
// find all instances of plugin and put in $matches
preg_match_all($regex, $row->text, $matches);
// Number of plugins
$count = count($matches[0]);
// plugin only processes if there are any instances of the plugin in the text
if ($count) {
// Get plugin parameters
$style = $pluginParams->def('style', -2);
plgContentProcessPositions($row, $matches, $count, $regex, $style);
}
}
示例9: getAbstractPlugins
/**
* get the possible list plug-ins that can be selected for use
* @return array
*/
public function getAbstractPlugins()
{
if (isset($this->abstractPlugins)) {
return $this->abstractPlugins;
}
// create a new dispatcher so that we only collect admin html for validation rules
$pluginDispatcher = new JDispatcher();
//import the validation plugins and assign them to their custom dispatcher
JPluginHelper::importPlugin('fabrik_form', null, true, $pluginDispatcher);
$rules = array();
//trigger the validation dispatcher to get hte validation rules html
$plugins = JPluginHelper::getPlugin('fabrik_form');
//JModel::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'models');
$pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
$feFormModel = JModel::getInstance('form', 'FabrikFEModel');
$feFormModel->setId($this->getState('form.id'));
foreach ($plugins as $x => $plugin) {
$data = array();
$o = $pluginManager->getPlugIn($plugin->name, 'Form');
if ($o !== false) {
$o->getJForm()->model = $feFormModel;
// $$$ rob 0 was $x below but that rendered first set of plugins with indexes 1,2,3
// think they should all be indexed 0
$str = $o->onRenderAdminSettings($data, 0);
$js = $o->onGetAdminJs($plugin->name, $plugin->name, $str);
$str = addslashes(str_replace(array("\n", "\r"), "", $str));
$attr = "class=\"inputbox elementtype\"";
$rules[$plugin->name] = array('plugin' => $plugin->name, 'html' => $str, 'js' => $js);
}
}
asort($rules);
$this->abstractPlugins = $rules;
return $rules;
}
示例10: display
function display($tpl = null) {
$db = JFactory::getDBO();
$query = "SELECT id FROM #__plugins WHERE element =".$db->quote('myApiComment');
$db->setQuery($query);
$id = $db->loadResult();
$row =& JTable::getInstance('plugin');
$row->load($id);
$plugin = & JPluginHelper::getPlugin('content', 'myApiComment');
if(is_object($plugin)){
$paramsdata = $plugin->params;
$paramsdefs = JPATH_SITE.DS.'plugins'.DS.'content'.DS.'myApiComment.xml';
$params = new JParameter( $paramsdata, $paramsdefs );
$this->assignRef('params',$params);
$this->assignRef('plugin',$row);
JToolbarHelper::save('savePlugin','save content');
JToolbarHelper::preferences('com_myapi');
}else{
global $mainframe;
$mainframe->redirect('index.php?option=com_plugins&view=plugin&task=edit&cid='.$id,'The myApiComment plugin needs to be ENABLED before you can configure it.');
}
parent::display($tpl);
}
示例11: preprocessForm
protected function preprocessForm(\JForm $form, $data, $group = 'content')
{
// if no data, grab the posted form data.
if (!$data instanceof JObject) {
$data = JFactory::getApplication()->input->get('jform', $data, 'array');
$data = JArrayHelper::toObject($data);
}
$params = new JRegistry();
$params->loadArray($data->params);
if ($params->get('discovery.url')) {
$plugin = $params->get('discovery.type');
$language = JFactory::getLanguage();
$language->load('plg_harvest_' . $plugin);
$path = JPATH_ROOT . '/plugins/harvest/' . $plugin . '/forms/harvest.xml';
$form->loadFile($path, false);
foreach (JPluginHelper::getPlugin('ingest') as $plugin) {
$language->load('plg_ingest_' . $plugin->name);
$path = JPATH_ROOT . '/plugins/ingest/' . $plugin->name . '/forms/ingest.xml';
$form->loadFile($path, false);
}
$form->removeField('originating_url');
$form->removeField('harvester');
// hide the run_once value (users cannot set it after discovery)
$form->setFieldAttribute("run_once", 'type', 'hidden');
$form->setFieldAttribute("run_once", 'class', '');
} else {
$form->removeField('state');
$form->removeField('harvested');
$form->removeField('url', 'params.discovery');
$form->removeField('type', 'params.discovery');
}
parent::preprocessForm($form, $data, $group);
}
示例12: getParams
/**
* Gets the parameter object for a plugin
*
* @param string $pluginName The plugin name
* @param string $type The plugin type, relates to the sub-directory in the plugins directory
* @return JParameter A JParameter object (mosParameters for J1.0)
*/
public static function getParams($pluginName, $type = 'content')
{
if (JCOMMENTS_JVERSION == '1.0') {
static $mambotParams = array();
$paramKey = $type . '_' . $pluginName;
if (!isset($mambotParams[$paramKey])) {
include_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
$dbo = JCommentsFactory::getDBO();
$dbo->setQuery("SELECT params FROM #__mambots WHERE element = '{$pluginName}' AND folder = '{$type}'");
$mambotParams[$paramKey] = $dbo->loadResult();
}
$data = $mambotParams[$paramKey];
$pluginParams = new mosParameters($data);
} elseif (JCOMMENTS_JVERSION == '1.5') {
$plugin = JPluginHelper::getPlugin($type, $pluginName);
if (is_object($plugin)) {
$pluginParams = new JParameter($plugin->params);
} else {
$pluginParams = new JParameter('');
}
} else {
$plugin = JPluginHelper::getPlugin($type, $pluginName);
if (is_object($plugin)) {
$pluginParams = new JRegistry($plugin->params);
} else {
$pluginParams = new JRegistry('');
}
}
return $pluginParams;
}
示例13: display
function display($tpl = null)
{
$this->canDo = JCKHelper::getActions();
$this->app = JFactory::getApplication();
$this->user = JFactory::getUser();
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JCKHelper::error(implode("\n", $errors));
return false;
}
// Check if there are no matching items
if (!count($this->items)) {
JCKHelper::error(JText::_('COM_JCK_LAYOUT_MANAGER_NO_TOOLBARS_FOUND'));
}
//now lets get default toolbars
$editor = JPluginHelper::getPlugin('editors', 'jckeditor');
$params = new JRegistry($editor->params);
$this->default = $params->get('toolbar', 'Publisher');
$this->defaultFT = $params->get('toolbar_ft', 'Basic');
$this->addToolbar();
parent::display($tpl);
}
示例14: display
function display($tpl = null)
{
// Get the url of the Alfresco repository from the Joosco plugin
// That's why the Joosco plugin needs to be installed and configured before the component
$plugin =& JPluginHelper::getPlugin('authentication', 'joosco');
$pluginParams = new JParameter($plugin->params);
// Here we connect to the Repository
$repositoryUrl = $pluginParams->get('alf-url');
$repository = new Repository($repositoryUrl);
// The ticket is created by the plugin when a user connects
$ticket = $_SESSION["ticket"];
$session = $repository->createSession($ticket);
$store = new SpacesStore($session);
$currentNode = null;
$uuid = null;
$uuid =& JRequest::getVar('uuid');
if (!isset($uuid)) {
$currentNode = $store->companyHome;
$path = 'Company Home';
} else {
$currentNode = $session->getNode($store, JRequest::getVar('uuid'));
$path = JRequest::getVar('path') . '|' . JRequest::getVar('uuid') . '|' . JRequest::getVar('name');
}
// Pass the values to the rest of the template
$this->assignRef('path', $path);
$this->assignRef('session', $session);
$this->assignRef('store', $store);
$this->assignRef('currentNode', $currentNode);
$this->assignRef('option', JRequest::getVar('option'));
$this->assignRef('view', JRequest::getVar('view'));
$this->assignRef('itemid', JRequest::getVar('Itemid'));
parent::display($tpl);
}
示例15: update
function update()
{
$currency = JRequest::getInt('hikashopcurrency', 0);
if (!empty($currency)) {
$app = JFactory::getApplication();
$app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null);
$app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null);
$app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null);
$app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null);
$url = JRequest::getString('return_url', '');
if (HIKASHOP_J30) {
$plugin = JPluginHelper::getPlugin('system', 'cache');
$params = new JRegistry(@$plugin->params);
$options = array('defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false);
$cache = JCache::getInstance('page', $options);
$cache->clean();
}
if (!empty($url)) {
if (hikashop_disallowUrlRedirect($url)) {
return false;
}
$app->redirect(urldecode($url));
}
}
return true;
}