本文整理汇总了PHP中WFExtensionHelper::getPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP WFExtensionHelper::getPlugin方法的具体用法?PHP WFExtensionHelper::getPlugin怎么用?PHP WFExtensionHelper::getPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WFExtensionHelper
的用法示例。
在下文中一共展示了WFExtensionHelper::getPlugin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
// Check for request forgeries
JRequest::checkToken() or die('RESTRICTED');
$row = WFExtensionHelper::getPlugin(null, 'jcemediabox', 'system');
$task = $this->getTask();
// remove id for Joomla! 2.5+
if ($row->extension_id) {
unset($row->id);
}
if (!$row->bind(JRequest::get('post'))) {
JError::raiseError(500, $row->getError());
}
if (!$row->check()) {
JError::raiseError(500, $row->getError());
}
if (!$row->store()) {
JError::raiseError(500, $row->getError());
}
$row->checkin();
$msg = JText::sprintf('WF_MEDIABOX_SAVED');
switch ($task) {
case 'apply':
$this->setRedirect('index.php?option=com_jce&view=mediabox', $msg);
break;
case 'save':
default:
$this->setRedirect('index.php?option=com_jce&view=cpanel', $msg);
break;
}
}
示例2: display
function display($tpl = null)
{
$language = JFactory::getLanguage();
$language->load('plg_editors_jce', JPATH_ADMINISTRATOR);
$client = JRequest::getWord('client', 'site');
$model = $this->getModel();
$plugin = WFExtensionHelper::getPlugin();
$xml = WF_EDITOR_LIBRARIES . '/xml/config/editor.xml';
$data = null;
// get params from editor plugin
if ($plugin->params && $plugin->params !== "{}") {
$data = json_decode($plugin->params);
} else {
$component = WFExtensionHelper::getComponent();
// get params from component "params" field (legacy)
if ($component->params) {
$data = json_decode($component->params);
}
}
// get params definitions
$params = new WFParameter($data, $xml, 'editor');
$params->addElementPath(JPATH_COMPONENT . '/elements');
$this->assign('model', $model);
$this->assign('params', $params);
$this->assign('client', $client);
WFToolbarHelper::apply();
WFToolbarHelper::save();
WFToolbarHelper::help('config.about');
parent::display($tpl);
}
示例3: fetchElement
public function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.plugin.helper');
wfimport('admin.helpers.extension');
$language = JFactory::getLanguage();
$plugins = JPluginHelper::getPlugin('search');
// use tested defaults
if (!$value) {
$value = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks');
} else {
$value = (array) $value;
}
//$html = '<span style="display:inline-block;"><input class="checkbox-list-toggle-all" type="checkbox"'. $checked .' /><label>'. WFText::_('WF_PROFILES_TOGGLE_ALL') . '</label>';
$html = '<span style="display:inline-block;" data-parent="' . preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name) . $node->attributes()->parent . '"><ul class="checkbox-list">';
foreach ($plugins as $item) {
$plugin = WFExtensionHelper::getPlugin(null, $item->name, 'search');
$extension = 'plg_' . $plugin->folder . '_' . $plugin->element;
$language->load($extension) || $language->load($extension, JPATH_ADMINISTRATOR);
$language->load($extension . '.sys') || $language->load($extension . '.sys', JPATH_ADMINISTRATOR);
$checked = in_array($plugin->element, $value) ? ' checked="checked"' : '';
$html .= '<li><input type="checkbox" name="' . $control_name . '[' . $name . '][]" value="' . $plugin->element . '"' . $checked . ' /><label>' . JText::_($plugin->name) . '</label></li>';
}
$html .= '</ul></span>';
return $html;
}
示例4: fetchElement
public function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.plugin.helper');
wfimport('admin.helpers.extension');
$language = JFactory::getLanguage();
$plugins = JPluginHelper::getPlugin('search');
if (!$value) {
$value = array();
} else {
$value = (array) $value;
}
//$html = '<span style="display:inline-block;"><input class="checkbox-list-toggle-all" type="checkbox"'. $checked .' /><label>'. WFText::_('WF_PROFILES_TOGGLE_ALL') . '</label>';
$html = '<span><ul class="checkbox-list">';
foreach ($plugins as $item) {
$plugin = WFExtensionHelper::getPlugin(null, $item->name, 'search');
$extension = 'plg_' . $plugin->folder . '_' . $plugin->element;
$language->load($extension) || $language->load($extension, JPATH_ADMINISTRATOR);
$language->load($extension . '.sys') || $language->load($extension . '.sys', JPATH_ADMINISTRATOR);
$checked = in_array($plugin->element, $value) || empty($value) ? ' checked="checked"' : '';
$html .= '<li><input type="checkbox" name="' . $control_name . '[' . $name . '][]" value="' . $plugin->element . '"' . $checked . ' /><label>' . JText::_($plugin->name) . '</label></li>';
}
$html .= '</ul></span>';
return $html;
}
示例5: save
public function save()
{
// Check for request forgeries
JRequest::checkToken() or die('RESTRICTED');
$db = JFactory::getDBO();
$task = $this->getTask();
// get plugin
$plugin = WFExtensionHelper::getPlugin();
// get params data
$data = JRequest::getVar('params', '', 'POST', 'ARRAY');
// clean input data
$data = $this->cleanInput($data);
// store data
$plugin->params = json_encode($data);
// remove "id"
if (isset($plugin->extension_id)) {
unset($plugin->id);
}
if (!$plugin->check()) {
JError::raiseError(500, $plugin->getError());
}
if (!$plugin->store()) {
JError::raiseError(500, $plugin->getError());
}
$plugin->checkin();
$msg = JText::sprintf('WF_CONFIG_SAVED');
switch ($task) {
case 'apply':
$this->setRedirect('index.php?option=com_jce&view=config', $msg);
break;
case 'save':
default:
$this->setRedirect('index.php?option=com_jce&view=cpanel', $msg);
break;
}
}
示例6: getParams
/**
* Get editor parameters
* @access public
* @param array $options
* @return object
*/
public function getParams($options = array())
{
if (!isset(self::$params)) {
self::$params = array();
}
// set blank key if not set
if (!isset($options['key'])) {
$options['key'] = '';
}
// set blank path if not set
if (!isset($options['path'])) {
$options['path'] = '';
}
$plugin = JRequest::getCmd('plugin');
if ($plugin) {
$options['plugin'] = $plugin;
}
$signature = serialize($options);
if (empty(self::$params[$signature])) {
wfimport('admin.helpers.extension');
// get plugin
$editor_plugin = WFExtensionHelper::getPlugin();
// get params data for this profile
$profile = $this->getProfile($plugin);
$profile_params = array();
$editor_params = array();
// get params from editor plugin
if ($editor_plugin->params && $editor_plugin->params !== "{}") {
$editor_params['editor'] = json_decode($editor_plugin->params, true);
} else {
// get component
$component = WFExtensionHelper::getComponent();
// get params from component "params" field (legacy)
if ($component->params && $component->params !== "{}") {
$data = json_decode($component->params, true);
if (isset($data['editor'])) {
$editor_params['editor'] = $data['editor'];
}
}
}
if ($profile) {
$profile_params = json_decode($profile->params, true);
}
// make sure we have an empty array if null or false
if (empty($editor_params)) {
$editor_params = array();
}
// make sure we have an empty array if null or false
if (empty($profile_params)) {
$profile_params = array();
}
// merge data and convert to json string
$data = WFParameter::mergeParams($editor_params, $profile_params, true, false);
self::$params[$signature] = new WFParameter($data, $options['path'], $options['key']);
}
return self::$params[$signature];
}
示例7: removeEditor
/**
* Uninstall the editor
* @return boolean
*/
function removeEditor()
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
// load extension helper
require_once dirname(dirname(__FILE__)) . DS . 'helpers' . DS . 'extension.php';
$plugin = WFExtensionHelper::getPlugin();
if (isset($plugin->id)) {
jimport('joomla.installer.installer');
$installer = new JInstaller();
if (!$installer->uninstall('plugin', $plugin->id)) {
$mainframe->enqueueMessage(WFText::_('WF_EDITOR_REMOVE_ERROR'));
return false;
} else {
$mainframe->enqueueMessage(WFText::_('WF_EDITOR_REMOVE_SUCCESS'));
return true;
}
$mainframe->enqueueMessage($msg);
return $ret;
} else {
$mainframe->enqueueMessage(WFText::_('WF_EDITOR_REMOVE_NOT_FOUND'), 'error');
return false;
}
}