本文整理汇总了PHP中JRegistry::loadString方法的典型用法代码示例。如果您正苦于以下问题:PHP JRegistry::loadString方法的具体用法?PHP JRegistry::loadString怎么用?PHP JRegistry::loadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRegistry
的用法示例。
在下文中一共展示了JRegistry::loadString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param object &$subject The object to observe
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'group', 'params', 'language'
* (this list is not meant to be comprehensive).
*
* @since 11.1
*/
public function __construct(&$subject, $config = array())
{
// Get the parameters.
if (isset($config['params'])) {
if ($config['params'] instanceof JRegistry) {
$this->params = $config['params'];
} else {
$this->params = new JRegistry();
$this->params->loadString($config['params']);
}
}
// Get the plugin name.
if (isset($config['name'])) {
$this->_name = $config['name'];
}
// Get the plugin type.
if (isset($config['type'])) {
$this->_type = $config['type'];
}
// Load the language files if needed.
if ($this->autoloadLanguage) {
$this->loadLanguage();
}
parent::__construct($subject);
}
示例2: __construct
/**
* Constructor
*
* @access public
* @param object &$subject The object to observe
*/
public function __construct(&$subject)
{
if (isset($_GET['sgCacheCheck']) && $_GET['sgCacheCheck'] == md5('joomlaCheck')) {
die('OK');
}
parent::__construct($subject);
$plugin = JPluginHelper::getPlugin('system', 'jSGCache');
$this->params = new JRegistry();
$this->params->loadString($plugin->params, 'JSON');
$this->_cacheEnabled = $this->params->get('cache_enabled');
if ($this->_cacheEnabled === null) {
$this->_cacheEnabled == 1;
}
$this->_autoflush = $this->params->get('autoFlush');
if ($this->_autoflush === null) {
$this->_autoflush = 1;
}
$this->_autoflush3rdParty = $this->params->get('autoFlush-ThirdParty');
if ($this->_autoflush3rdParty === null) {
$this->_autoflush3rdParty = 1;
}
$this->_autoflushClientSide = $this->params->get('autoFlush-ClientSide');
if ($this->_autoflushClientSide === null) {
$this->_autoflushClientSide = 0;
}
}
示例3: loadParams
/**
* Merge params with layoutsettings params
* @return JRegistry object
*/
public function loadParams()
{
$mainframe = JFactory::getApplication();
$mixed_params = new JRegistry();
if (trim($this->db_params->get('layoutsettings', '')) != '') {
//Load params from layout params
$mixed_params->loadString($this->db_params->get('layoutsettings', ''));
}
//Overwrite it by database params, by this way, DB params have higher priority, if DB params and layout params have the same param name, DB params will overwrite all
$mixed_params->loadString($this->db_params->toString());
//Remove layout setttings
$mixed_params->set('layoutsettings', '');
return $mixed_params;
}
示例4: getItem
public function getItem($pk = null)
{
// Initialise variables.
$pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id');
$table = $this->getTable();
if ($pk > 0) {
// Attempt to load the row.
$return = $table->load($pk);
// Check for a table object error.
if ($return === false && $table->getError()) {
$this->setError($table->getError());
return false;
}
}
// Convert to the JObject before adding other data.
$properties = $table->getProperties(1);
$item = JArrayHelper::toObject($properties, 'JObject');
$item->title = htmlspecialchars(strip_tags($item->title));
if (property_exists($item, 'params')) {
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if ($item) {
$arr = str_replace('[', '', $item->value);
$arr = str_replace(']', '', $arr);
if (preg_match('/.*\\},{\\.*?/s', $arr, $match)) {
//var_dump($match);
$values = str_replace('},', '}///', $arr);
$values = explode('///', $values);
} else {
$values = (array) $arr;
}
// $artOptFields = $this -> _checkArticleFields($item -> id);
if (count($values) > 0) {
$list = array();
$i = 0;
foreach ($values as $value) {
$list[$i] = new stdClass();
$param = new JRegistry($value);
$list[$i]->type = $item->type;
if (!empty($item->default_value)) {
$list[$i]->default_value = explode(',', $item->default_value);
} else {
$list[$i]->default_value = array();
}
$list[$i]->name = $param->get('name');
$list[$i]->value = $param->get('value');
$list[$i]->target = $param->get('target');
$list[$i]->editor = $param->get('editor');
$list[$i]->image = $param->get('image');
$list[$i]->ordering = $param->get('ordering');
$i++;
}
$item->defvalue = $list;
}
$item->groups = $this->getGroups();
}
return $item;
}
示例5: display
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
$state = $this->get('State');
$items = $this->get('Items');
$pagination = $this->get('Pagination');
// Prepare the data.
// Compute the weblink slug & link url.
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$temp = new JRegistry();
$temp->loadString($item->params);
$item->params = clone $params;
$item->params->merge($temp);
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
$this->state =& $state;
$this->items =& $items;
$this->params =& $params;
$this->pagination =& $pagination;
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->_prepareDocument();
parent::display($tpl);
}
示例6: getData
/**
* Loading the table data
*/
public function getData()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('*'));
$query->from('#__jem_settings');
$query->where(array('id = 1 '));
$db->setQuery($query);
$data = $db->loadObject();
// Convert the params field to an array.
$registry = new JRegistry;
$registry->loadString($data->globalattribs);
$data->globalattribs = $registry->toArray();
// Convert Css settings to an array
$registryCss = new JRegistry;
$registryCss->loadString($data->css);
$data->css = $registryCss->toArray();
return $data;
}
示例7: getUserLang
function getUserLang($formName = 'language')
{
$user =& JFactory::getUser();
$paramsC = JComponentHelper::getParams('com_phocagallery');
$userLang = $paramsC->get('user_ucp_lang', 1);
$o = array();
switch ($userLang) {
case 2:
$registry = new JRegistry();
$registry->loadString($user->params);
$o['lang'] = $registry->get('language', '*');
$o['langinput'] = '<input type="hidden" name="' . $formName . '" value="' . $o['lang'] . '" />';
break;
case 3:
$o['lang'] = JFactory::getLanguage()->getTag();
$o['langinput'] = '<input type="hidden" name="' . $formName . '" value="' . $o['lang'] . '" />';
break;
default:
case 1:
$o['lang'] = '*';
$o['langinput'] = '<input type="hidden" name="' . $formName . '" value="*" />';
break;
}
return $o;
}
示例8: getCurrentTemplate
static function getCurrentTemplate()
{
$cache = JFactory::getCache('com_rokcandy', '');
if (!($templates = $cache->get('templates'))) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, home, template, params');
$query->from('#__template_styles');
$query->where('client_id = 0');
$db->setQuery($query);
$templates = $db->loadObjectList('id');
foreach ($templates as &$template) {
$registry = new JRegistry();
$registry->loadString($template->params);
$template->params = $registry;
// Create home element
if ($template->home == '1' && !isset($templates[0])) {
$templates[0] = clone $template;
}
}
$cache->store($templates, 'templates');
}
$template = $templates[0];
return $template->template;
}
示例9: getInstance
public static function getInstance($name)
{
if (isset(self::$instances[$name])) {
return self::$instances[$name];
}
$plugin = JPluginHelper::getPlugin('api', $name);
if (empty($plugin)) {
throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
}
jimport('joomla.filesystem.file');
$plgfile = JPATH_BASE . self::$plg_path . $name . DS . $name . '.php';
$param_path = JPATH_BASE . self::$plg_path . $name . DS . $name . '.xml';
if (!JFile::exists($plgfile)) {
throw new Exception(JText::_('COM_API_FILE_NOT_FOUND'), 400);
}
include $plgfile;
$class = self::$plg_prefix . ucwords($name);
if (!class_exists($class)) {
throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
}
$handler = new $class();
$cparams = JComponentHelper::getParams('com_api');
$params = new JRegistry();
$params->loadString($plugin->params);
$cparams->merge($params);
$handler->set('params', $cparams);
$handler->set('component', JRequest::getCmd('app'));
$handler->set('resource', JRequest::getCmd('resource'));
$handler->set('format', $handler->negotiateContent(JRequest::getCmd('output', null)));
$handler->set('request_method', JRequest::getMethod());
self::$instances[$name] = $handler;
return self::$instances[$name];
}
示例10: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 11.1
*/
public function getOptions()
{
$options = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('code As value, title As `text`, print_title')->from('#__sibdiet_countries')->order('title')->where('published = 1');
$db->setQuery($query);
try {
$options = $db->loadObjectList();
} catch (RuntimeException $e) {
JError::raiseWarning(500, $e->getMessage());
}
$lang_tag = JFactory::getLanguage()->get('tag');
foreach ($options as $option) {
// Convert the print_title field to an array.
$registry = new JRegistry();
$registry->loadString($option->print_title);
$print_title = $registry->toArray();
if (array_key_exists($lang_tag, $print_title)) {
$option->text = $print_title[$lang_tag];
}
}
// Sort Options
usort($options, function ($a, $b) {
return strcmp($a->text, $b->text);
});
return array_merge(parent::getOptions(), $options);
}
示例11: migrate
protected function migrate($row)
{
$this->project = $row;
$registry = new JRegistry();
$registry->loadString($row->attribs);
$repo_root_id = (int) $registry->get('repo_dir');
$query = $this->_db->getQuery(true);
$query->select('a.*, t.parent_id')->from('#__pf_folders_tmp AS a')->join('INNER', '#__pf_folder_tree_tmp AS t ON t.folder_id = a.id')->where('a.project = ' . $row->id)->order('a.id ASC');
$this->_db->setQuery($query);
$this->items = $this->_db->loadObjectList();
if (empty($this->items) || !is_array($this->items)) {
return true;
}
$this->items = $this->sortItems();
// Start migrating from the top
foreach ($this->items as $item) {
if ($item->parent_id == 0) {
$item->parent_id = $repo_root_id;
}
if (!$this->store($item)) {
return false;
}
}
return true;
}
示例12: getAjax
public static function getAjax()
{
jimport('joomla.application.module.helper');
$input = JFactory::getApplication()->input;
$module = JModuleHelper::getModule('hoicoi_openmeetings');
$params = new JRegistry();
$params->loadString($module->params);
$values = explode(',', rtrim($params->get('rooms'), ","));
if (self::getVerification($values, $input->get("room_id"), $input->get("password", "", 'STRING'))) {
$options = array("protocol" => $params->get('protocol'), "port" => $params->get('port'), "host" => $params->get('host'), "webappname" => $params->get('webappname'), "adminUser" => $params->get('adminUser'), "adminPass" => $params->get('adminPass'));
$access = new openmeetings_gateway($options);
if (!$access->loginuser()) {
$data = array("error" => 03, "text" => self::getErrorInfo(03));
return $data;
}
$hash = $access->setUserObjectAndGenerateRoomHash($input->get("name"), $input->get("name", "", 'STRING'), "", "", $input->get("email", "", 'STRING'), JSession::getInstance("", "")->getId(), "Joomla", $input->get("room_id"), self::$isAdmin, self::$isRecodring);
if (preg_match('/\\D/', $hash)) {
$url = $access->getUrl() . "/?secureHash=" . $hash;
//Get final URL
$data = array("url" => $url);
return $data;
} else {
$data = array("error" => $hash, "text" => self::getErrorInfo($hash));
return $data;
}
} else {
$data = array("error" => 02, "text" => self::getErrorInfo(02));
return $data;
}
$data = array("error" => 01, "text" => self::getErrorInfo(01));
return $data;
}
示例13: getInput
public function getInput()
{
$objectID = JRequest::getInt('id', 0);
// Create a new query object.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select('a.*');
$query->from('`#__autofilter_regions` AS a');
$db->setQuery($query);
$regions = $db->loadObjectList();
$loadedObject = array();
if ($objectID != 0) {
// Select the required fields from the table.
$query = $db->getQuery(true);
$query->select('a.regions_covered_ids');
$query->from('`#__autofilter_repairmans` AS a');
$query->where('(a.id = ' . $objectID . ')');
$db->setQuery($query);
$loadedObject = $db->loadObject();
$registry = new JRegistry();
$registry->loadString($loadedObject->regions_covered_ids);
$loadedObject = array_values($registry->toArray());
}
$html = '<select id="' . $this->id . '" name="' . $this->name . '" multiple="multiple">';
foreach ($regions as $region) {
$selected = in_array($region->id, $loadedObject) ? 'selected' : '';
$html .= '<option value="' . $region->id . '" ' . $selected . '>' . $region->name . '</option>';
}
$html .= '</select>';
return $html;
}
示例14: display
function display($tpl = null)
{
$option = JRequest::getCmd('option');
$mainframe = JFactory::getApplication();
$uri = JFactory::getURI();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$version = urlencode(JoomleagueHelper::getVersion());
$css = 'components/com_joomleague/assets/css/tabs.css?v=' . $version;
$document->addStyleSheet($css);
$model = $this->getModel();
$this->assignRef('club', $model->getClub());
$lists = array();
$this->club->merge_teams = explode(",", $this->club->merge_teams);
$this->assignRef('form', $this->get('Form'));
// extended club data
$xmlfile = JLG_PATH_ADMIN . DS . 'assets' . DS . 'extended' . DS . 'club.xml';
$jRegistry = new JRegistry();
$jRegistry->loadString($this->club->extended, 'ini');
$extended =& JForm::getInstance('extended', $xmlfile, array('control' => 'extended'), false, '/config');
$extended->bind($jRegistry);
$this->assignRef('extended', $extended);
$this->assignRef('lists', $lists);
$this->assign('cfg_which_media_tool', JComponentHelper::getParams('com_joomleague')->get('cfg_which_media_tool', 0));
$this->assign('cfg_be_show_merge_teams', JComponentHelper::getParams('com_joomleague')->get('cfg_be_show_merge_teams', 0));
parent::display($tpl);
}
示例15: getItem
/**
* Получаем сообщение.
*
* @param int $id Id сообщения.
*
* @return object Объект сообщения, которое отображается пользователю.
*
* @throws Exception Если сообщение не найдено.
*
*/
public function getItem($id = null)
{
// Если id не установлено, то получаем его из состояния.
$id = !empty($id) ? $id : (int) $this->getState('message.id');
if ($this->_item === null) {
$this->_item = array();
}
if (!isset($this->_item[$id])) {
// Конструируем SQL запрос.
$query = $this->_db->getQuery(true);
$query->select('h.greeting, h.params')->from('#__helloworld as h')->select('c.title as category')->leftJoin('#__categories as c ON c.id = h.catid')->where('h.id = ' . (int) $id)->where('h.state > 0');
$this->_db->setQuery($query);
$data = $this->_db->loadObject();
// Генерируем исключение, если сообщение не найдено.
if (empty($data)) {
throw new Exception(JText::_('COM_HELLOWORLD_ERROR_MESSAGE_NOT_FOUND'), 404);
}
// Загружаем JSON строку параметров.
$params = new JRegistry();
$params->loadString($data->params);
$data->params = $params;
// Объединяем глобальные параметры с индивидуальными.
$params = clone $this->getState('params');
$params->merge($data->params);
$data->params = $params;
$this->_item[$id] = $data;
}
return $this->_item[$id];
}