本文整理汇总了PHP中WFEditor::params方法的典型用法代码示例。如果您正苦于以下问题:PHP WFEditor::params方法的具体用法?PHP WFEditor::params怎么用?PHP WFEditor::params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WFEditor
的用法示例。
在下文中一共展示了WFEditor::params方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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];
}
示例2: 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 component
$component = WFExtensionHelper::getComponent();
// get params data for this profile
$profile = $this->getProfile($plugin);
$profile_params = array();
$component_params = array();
if (!empty($component->params)) {
$component_params = json_decode($component->params, true);
// set null as array
if (!$component_params) {
$component_params = array();
}
}
if ($profile) {
$profile_params = json_decode($profile->params, true);
// set null as array
if (!$profile_params) {
$profile_params = array();
}
}
// merge data and convert to json string
$data = WFParameter::mergeParams($component_params, $profile_params);
self::$params[$signature] = new WFParameter($data, $options['path'], $options['key']);
}
return self::$params[$signature];
}