本文整理汇总了PHP中WFParameter类的典型用法代码示例。如果您正苦于以下问题:PHP WFParameter类的具体用法?PHP WFParameter怎么用?PHP WFParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WFParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: display
function display($tpl = null)
{
$db = JFactory::getDBO();
$client = JRequest::getWord('client', 'admin');
$model = $this->getModel();
$this->document->setTitle(WFText::_('WF_PREFERENCES_TITLE'));
$this->document->addStyleSheet('templates/system/css/system.css');
$component = WFExtensionHelper::getComponent();
$xml = JPATH_COMPONENT . '/models/preferences.xml';
// get params definitions
$params = new WFParameter($component->params, $xml, 'preferences');
$params->addElementPath(JPATH_COMPONENT . '/elements');
if (WFModel::authorize('admin')) {
$form = $model->getForm('permissions');
} else {
$form = null;
}
$this->assign('params', $params);
$this->assign('permissons', $form);
$this->addStyleSheet('components/com_jce/media/css/preferences.css');
$this->addScript('components/com_jce/media/js/preferences.js');
if (JRequest::getInt('close') == 1) {
$this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Preferences.close();});');
} else {
$this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Preferences.init();});');
}
parent::display($tpl);
}
示例3: getStyles
function getStyles()
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
wfimport('admin.helpers.extension');
$view = JRequest::getCmd('view', 'cpanel');
$component = WFExtensionHelper::getComponent();
$params = new WFParameter($component->params);
$theme = $params->get('preferences.theme', 'jce');
$site_path = JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'libraries' . DS . 'css';
$admin_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'media' . DS . 'css';
// Load styles
$styles = array();
if (!JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) {
$theme = 'jce';
}
if (JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) {
$files = JFolder::files($site_path . DS . 'jquery' . DS . $theme, '\\.css');
foreach ($files as $file) {
$styles[] = 'components/com_jce/editor/libraries/css/jquery/' . $theme . '/' . $file;
}
}
// admin global css
$styles = array_merge($styles, array('administrator/components/com_jce/media/css/global.css'));
if (JFile::exists($admin_path . DS . $view . '.css')) {
$styles[] = 'administrator/components/com_jce/media/css/' . $view . '.css';
}
return $styles;
}
示例4: display
function display($tpl = null)
{
wfimport('admin.models.updates');
$mainframe = JFactory::getApplication();
$model = $this->getModel();
$installer = WFInstaller::getInstance();
$version = $model->getVersion();
// Check Groups DB
if (!$installer->profiles) {
$link = JHTML::link('index.php?option=com_jce&task=repair&table=profiles', WFText::_('WF_DB_CREATE_RESTORE'));
$mainframe->enqueueMessage(WFText::_('WF_DB_PROFILES_ERROR') . ' - ' . $link, 'error');
}
$component = WFExtensionHelper::getComponent();
// get params definitions
$params = new WFParameter($component->params, '', 'preferences');
$canUpdate = WFModelUpdates::canUpdate();
$options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE')));
$this->document->addScript('components/com_jce/media/js/cpanel.js?version=' . $model->getVersion());
$this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.CPanel.init(' . json_encode($options) . ')});');
WFToolbarHelper::preferences();
WFToolbarHelper::updates($canUpdate);
WFToolbarHelper::help('cpanel.about');
$this->assignRef('icons', $icons);
$this->assignRef('model', $model);
$this->assignRef('installer', $installer);
$this->assignRef('params', $params);
$this->assignRef('version', $version);
parent::display($tpl);
}
示例5: check
/**
* Check for extension updates
* @return String JSON string of updates
*/
public function check()
{
$result = false;
// Get all extensions and version numbers
$data = array('task' => 'check', 'jversion' => WF_JOOMLA15 ? '1.5' : '2.5');
wfimport('admin.helpers.extension');
$component = WFExtensionHelper::getComponent();
$params = new WFParameter($component->params, '', 'preferences');
// get update key
$key = $params->get('updates_key', '');
$type = $params->get('updates_type', '');
// encode it
if (!empty($key)) {
$data['key'] = urlencode($key);
}
if ($type) {
$data['type'] = $type;
}
$req = array();
// create request data
foreach ($this->getVersions() as $type => $extension) {
foreach ($extension as $item => $value) {
$data[$type . '[' . urlencode($item) . ']'] = urlencode($value);
}
}
foreach ($data as $key => $value) {
$req[] = $key . '=' . urlencode($value);
}
// connect
$result = $this->connect(self::$updateURL, implode('&', $req));
return $result;
}
示例6: display
function display($tpl = null)
{
wfimport('admin.models.updates');
$mainframe = JFactory::getApplication();
$model = $this->getModel();
$version = $model->getVersion();
$component = WFExtensionHelper::getComponent();
// get params definitions
$params = new WFParameter($component->params, '', 'preferences');
$canUpdate = WFModelUpdates::canUpdate() && $model->authorize('installer');
$options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE')));
$this->document->addScript('components/com_jce/media/js/cpanel.js?version=' . $model->getVersion());
$this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.CPanel.init(' . json_encode($options) . ')});');
if ($model->authorize('preferences')) {
WFToolbarHelper::preferences();
}
if ($model->authorize('installer')) {
WFToolbarHelper::updates($canUpdate);
}
WFToolbarHelper::help('cpanel.about');
$this->assignRef('icons', $icons);
$this->assignRef('model', $model);
$this->assignRef('installer', $installer);
$this->assignRef('params', $params);
$this->assignRef('version', $version);
parent::display($tpl);
}
示例7: getParams
function getParams($data)
{
jimport('joomla.form.form');
if (class_exists('JForm')) {
//JForm::addFormPath(JPATH_PLUGINS . '/system/jcemediabox');
$xml = JPATH_PLUGINS . '/system/jcemediabox/jcemediabox.xml';
$params = new WFParameter($data, $xml, '', array('control' => 'config:fields:fieldset'));
$params->addElementPath(JPATH_PLUGINS . '/system/jcemediabox/elements');
$groups = array();
$array = array();
foreach ($params->getGroups() as $group) {
$groups[] = $params->getParams('params', $group);
}
foreach ($groups as $group) {
$array = array_merge($array, $group);
}
return $array;
} else {
// get params definitions
$params = new JParameter($data, JPATH_PLUGINS . '/system/jcemediabox.xml');
$xml = JPATH_PLUGINS . '/system/jcemediabox.xml';
$params->loadSetupFile($xml);
return $params->getParams();
}
}
示例8: display
function display($tpl = null)
{
wfimport('admin.models.updates');
$mainframe = JFactory::getApplication();
$model = $this->getModel();
$version = $model->getVersion();
$component = WFExtensionHelper::getComponent();
// get params definitions
$params = new WFParameter($component->params, '', 'preferences');
$canUpdate = WFModelUpdates::canUpdate() && WFModel::authorize('installer');
$options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE')));
JHtml::_('behavior.modal');
$this->addScript('components/com_jce/media/js/cpanel.js');
$this->addScriptDeclaration('jQuery.jce.Cpanel.options = ' . json_encode($options) . ';');
// load styles
$this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/cpanel.css');
if (WFModel::authorize('preferences')) {
WFToolbarHelper::preferences();
}
if (WFModel::authorize('installer')) {
WFToolbarHelper::updates($canUpdate);
}
WFToolbarHelper::help('cpanel.about');
$views = array('config', 'profiles', 'installer', 'browser', 'mediabox');
$icons = array();
foreach ($views as $view) {
// check if its allowed...
if (WFModel::authorize($view) === false) {
continue;
}
$attribs = array('target="_self"');
$title = 'WF_' . strtoupper($view);
$description = 'WF_' . strtoupper($view) . '_DESC';
$link = 'index.php?option=com_jce&view=' . $view;
if ($view == 'browser') {
$link = WFModel::getBrowserLink();
$component = WFExtensionHelper::getComponent();
// get params definitions
$params = new WFParameter($component->params, '', 'preferences');
$width = (int) $params->get('browser_width', 790);
$height = (int) $params->get('browser_height', 560);
if (empty($link)) {
continue;
}
$attribs = array('target="_blank"', 'class="browser"', 'onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;"');
$title = 'WF_' . strtoupper($view) . '_TITLE';
$description = 'WF_CPANEL_' . strtoupper($view);
}
// if its mediabox, check the plugin is installed and enabled
if ($view == 'mediabox' && !JPluginHelper::isEnabled('system', 'jcemediabox')) {
continue;
}
$icons[] = '<li class="cpanel-icon wf-tooltip" title="' . WFText::_($title) . '::' . WFText::_($description) . '"><a id="wf-browser-link" href="' . $link . '"' . implode(' ', $attribs) . '><span class="' . $view . '"></span>' . WFText::_($title) . '</a></li>';
}
$this->assign('icons', $icons);
$this->assign('model', $model);
$this->assign('params', $params);
$this->assign('version', $version);
parent::display($tpl);
}
示例9: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$attributes = array();
foreach ($node->attributes() as $k => $v) {
if ($v != '') {
$attributes[$k] = (string) $v;
}
}
/*
* Required to avoid a cycle of encoding &
* html_entity_decode was used in place of htmlspecialchars_decode because
* htmlspecialchars_decode is not compatible with PHP 4
*/
$value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES);
$attributes['class'] = (string) $node->attributes()->class ? (string) $node->attributes()->class . ' text_area' : 'text_area';
$control = $control_name . '[' . $name . ']';
$html = '';
$attributes['value'] = $value;
$attributes['type'] = 'text';
$attributes['name'] = $control;
$attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name);
// pattern data attribute for editable select input box
if ((string) $node->attributes()->parent) {
$prefix = preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name);
$items = array();
foreach (explode(';', (string) $node->attributes()->parent) as $item) {
$items[] = $prefix . $item;
}
$attributes['data-parent'] = implode(';', $items);
}
$filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : '';
$html .= '<input';
foreach ($attributes as $k => $v) {
if (!in_array($k, array('default', 'label', 'description'))) {
$html .= ' ' . $k . ' = "' . $v . '"';
}
}
$html .= ' />';
$component = WFExtensionHelper::getComponent();
// get params definitions
$params = new WFParameter($component->params, '', 'preferences');
$width = (int) $params->get('browser_width', 780);
$height = (int) $params->get('browser_height', 560);
wfimport('admin.models.model');
$model = new WFModel();
$link = $model->getBrowserLink($attributes['id'], $filter);
$html .= '<a href="' . $link . '" id="' . $attributes['id'] . '_browser' . '" class="browser" target="_blank" onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;" title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>';
return $html;
}
示例10: display
function display($tpl = null)
{
$model = $this->getModel();
$language = $model->getLanguage();
$lang = JFactory::getLanguage();
$section = JRequest::getWord('section');
$category = JRequest::getWord('category');
$article = JRequest::getWord('article');
$component = JComponentHelper::getComponent('com_jce');
require_once WF_ADMINISTRATOR . DS . 'classes' . DS . 'parameter.php';
$params = new WFParameter($component->params);
$url = $params->get('preferences.help.url', 'http://www.joomlacontenteditor.net');
$method = $params->get('preferences.help.method', 'reference');
$pattern = $params->get('preferences.help.pattern', '');
switch ($method) {
default:
case 'reference':
$url .= '/index.php?option=com_content&view=article&tmpl=component&print=1&mode=inline&task=findkey&lang=' . $language . '&keyref=';
break;
case 'xml':
break;
case 'sef':
break;
}
$this->assignRef('model', $model);
$this->assign('orientation', $lang->isRTL() ? 'east' : 'west');
$key = array();
if ($section) {
$key[] = $section;
if ($category) {
$key[] = $category;
if ($article) {
$key[] = $article;
}
}
}
$options = array('url' => $url, 'key' => $key, 'pattern' => $pattern);
$this->document->addStyleSheet(JURI::root(true) . '/components/com_jce/editor/libraries/css/help.css');
$this->document->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/jquery/jquery-ui-layout.js?version=' . $model->getVersion());
$this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Help.init(' . json_encode($options) . ');});');
parent::display($tpl);
}
示例11: 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];
}
示例12: getStyles
protected function getStyles()
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
wfimport('admin.helpers.extension');
$view = JRequest::getCmd('view', 'cpanel');
$component = WFExtensionHelper::getComponent();
$params = new WFParameter($component->params);
$theme = $params->get('preferences.theme', 'jce');
$site_path = JPATH_SITE . '/component/com_jce/editor/libraries/css';
// Load styles
$styles = array();
if (!JFolder::exists($site_path . '/jquery/' . $theme)) {
$theme = 'jce';
}
// admin global css
$styles = array_merge($styles, array('administrator/components/com_jce/media/css/global.css'));
return $styles;
}
示例13: download
/**
* Download update
* @return String JSON string
*/
public function download()
{
$app = JFactory::getApplication();
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
wfimport('admin.helpers.extension');
$component = WFExtensionHelper::getComponent();
$params = new WFParameter($component->params, '', 'preferences');
$config = JFactory::getConfig();
$result = array('error' => WFText::_('WF_UPDATES_DOWNLOAD_ERROR'));
$id = JRequest::getInt('id');
$key = $params->get('updates_key', '');
$data = $this->connect(self::$updateURL . '&task=download&id=' . $id . '&key=' . urlencode($key));
if ($data) {
$data = json_decode($data);
if (isset($data->error)) {
return json_encode(array('error' => $data->error));
}
// get update file
if ($data->name && $data->url && $data->hash) {
// create path for package file
$path = $app->getCfg('tmp_path') . '/' . basename($data->name);
// download file
if ($this->connect($data->url, null, $path)) {
if (JFile::exists($path) && @filesize($path) > 0) {
// check hash and file type
if ($data->hash == md5(md5_file($path)) && preg_match('/\\.(zip|tar|gz)$/', $path)) {
$result = array('file' => basename($path), 'hash' => $data->hash, 'installer' => $data->installer, 'type' => isset($data->type) ? $data->type : '');
} else {
// fail and delete file
$result = array('error' => WFText::_('WF_UPDATES_ERROR_FILE_VERIFICATION_FAIL'));
if (JFile::exists($path)) {
@JFile::delete($path);
}
}
} else {
$result = array('error' => WFText::_('WF_UPDATES_ERROR_FILE_MISSING_OR_INVALID'));
}
} else {
$result = array('error' => WFText::_('WF_UPDATES_DOWNLOAD_ERROR_DATA_TRANSFER'));
}
} else {
$result = array('error' => WFText::_('WF_UPDATES_DOWNLOAD_ERROR_MISSING_DATA'));
}
}
return json_encode($result);
}
示例14: foreach
foreach ($params->getGroups() as $group) {
$html .= $params->render('params[' . $plugin->name . '][' . $type . ']', $group);
}
}
foreach ($items as $extension) {
// get extension xml file
$file = $extension->manifest;
if ($extension->core == 0) {
// Load extension language file
$language = JFactory::getLanguage();
$language->load('com_jce_' . $extension->folder . '_' . trim($extension->extension), JPATH_SITE);
}
if (JFile::exists($file)) {
// get params for plugin
$key = $plugin->name . '.' . $type . '.' . $extension->extension;
$params = new WFParameter($this->profile->params, $file, $key);
// add element paths
$params->addElementPath(array(WF_EDITOR . '/elements'));
// render params
if (!$params->hasParent()) {
$key = array($plugin->name, $type, $extension->extension);
$enabled = (int) $params->get('enable', 1);
$checked = $enabled ? ' checked="checked"' : '';
$html .= '<h3><input type="hidden" id="params' . implode('', $key) . 'enable" name="params[' . implode('][', $key) . '][enable]" value="' . $enabled . '" /><input type="checkbox" data-name="' . $extension->extension . '" class="plugins-enable-checkbox"' . $checked . '/>' . WFText::_($extension->name) . '</h3>';
$html .= '<p>' . WFText::_($extension->description) . '</p>';
foreach ($params->getGroups() as $group) {
$html .= $params->render('params[' . implode('][', $key) . ']', $group, array('enable'));
}
}
}
}
示例15: getLayoutParams
function getLayoutParams(&$row)
{
// get params definitions
$xml = WF_EDITOR_LIBRARIES . '/xml/config/layout.xml';
// get editor params
$params = new WFParameter($row->params, $xml, 'editor');
$params->addElementPath(JPATH_COMPONENT . '/elements');
$params->addElementPath(WF_EDITOR . '/elements');
$groups = $params->getGroups();
$row->layout_params = $params;
$row->layout_groups = $groups;
}