本文整理汇总了PHP中JParameter::loadString方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::loadString方法的具体用法?PHP JParameter::loadString怎么用?PHP JParameter::loadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::loadString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plgContentJabookmark
/**
* 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.
*
* @param object $subject The object to observe
* @param object $params The object to observe
*/
function plgContentJabookmark(&$subject, $params = null)
{
if (!$subject) {
return;
}
parent::__construct($subject, $params);
$this->plugin = JPluginHelper::getPlugin('content', 'jabookmark');
$this->params = new JRegistry();
$this->params->loadString($this->plugin->params);
}
示例2: showPreview
/**
* Display Preview content
* @return void
*/
public function showPreview()
{
$db = JFactory::getDBO();
$user = JFactory::getUser();
$dispatcher = JDispatcher::getInstance();
$language = JFactory::getLanguage();
// reset document type
$document =& JFactory::getDocument();
$document->setType('html');
// required by module loadposition
jimport('joomla.application.module.helper');
// load paramter class
jimport('joomla.html.parameter');
wfimport('admin.helpers.extension');
// Get variables
$component_id = JRequest::getInt('component_id');
// get post data
$data = JRequest::getVar('data', '', 'POST', 'STRING', JREQUEST_ALLOWRAW);
// cleanup data
$data = preg_replace(array('#<!DOCTYPE([^>]+)>#i', '#<(head|title|meta)([^>]*)>([\\w\\W]+)<\\/1>#i', '#<\\/?(html|body)([^>]*)>#i'), '', rawurldecode($data));
$component = WFExtensionHelper::getComponent($component_id);
// create params registry object
$params = new JRegistry();
// create empty params string
if (!isset($component->params)) {
$component->params = '';
}
// process attribs (com_content etc.)
if ($component->attribs) {
$params->loadString($component->attribs);
} else {
if (class_exists('JParameter')) {
$params = new JParameter($component->params);
} else {
$params->loadString($component->params);
}
}
$article = JTable::getInstance('content');
$article->id = 0;
$article->created_by = $user->get('id');
$article->parameters = new JRegistry();
$article->text = $data;
// allow this to be skipped as some plugins can cause FATAL errors.
if ((bool) $this->getParam('process_content', 1)) {
$limitstart = 0;
JPluginHelper::importPlugin('content');
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
// set error reporting to error only
error_reporting(E_ERROR);
$dispatcher->trigger('onPrepareContent', array(&$article, &$params, $limitstart));
}
$this->processURLS($article);
return $article->text;
}