当前位置: 首页>>代码示例>>PHP>>正文


PHP JRegistry类代码示例

本文整理汇总了PHP中JRegistry的典型用法代码示例。如果您正苦于以下问题:PHP JRegistry类的具体用法?PHP JRegistry怎么用?PHP JRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getModuleParams

 private function getModuleParams($moduleId)
 {
     static $params;
     if (!isset($params)) {
         $app = JFactory::getApplication();
         $clientid = (int) $app->getClientId();
         $userAccessLevels = JoaktreeHelper::getUserAccessLevels();
         if (!isset($moduleId) || $moduleId == 0) {
             $moduleId = JoaktreeHelper::getModuleId();
         } else {
             $moduleId = (int) $moduleId;
         }
         $query = $this->_db->getQuery(true);
         $query->select(' m.id ');
         $query->select(' m.params ');
         $query->from(' #__modules AS m ');
         $query->where(' m.published =  1 ');
         $query->where(' m.access    IN ' . $userAccessLevels . ' ');
         $query->where(' m.client_id =  ' . $clientid . ' ');
         $query->where(' m.module = ' . $this->_db->Quote('mod_joaktree_todaymanyyearsago') . ' ');
         $this->_db->setQuery($query);
         $temp = $this->_db->loadObjectList();
         $params = new JRegistry();
         foreach ($temp as $module) {
             if ($module->id == $moduleId) {
                 $params->loadString($module->params, 'JSON');
             }
         }
     }
     return $params;
 }
开发者ID:Lothurm,项目名称:J3.x,代码行数:31,代码来源:todaymanyyearsago.php

示例2: getTrans

 /**
  * Get language items and store them in an array
  *
  */
 function getTrans($lang, $item)
 {
     $app = JFactory::getApplication();
     $option = 'com_osmembership';
     $registry = new JRegistry();
     $languages = array();
     if (strpos($item, 'admin.') !== false) {
         $isAdmin = true;
         $item = substr($item, 6);
     } else {
         $isAdmin = false;
     }
     if ($isAdmin) {
         $path = JPATH_ROOT . '/administrator/language/en-GB/en-GB.' . $item . '.ini';
     } else {
         $path = JPATH_ROOT . '/language/en-GB/en-GB.' . $item . '.ini';
     }
     $registry->loadFile($path, 'INI');
     $languages['en-GB'][$item] = $registry->toArray();
     if ($isAdmin) {
         $path = JPATH_ROOT . '/administrator/language/' . $lang . '/' . $lang . '.' . $item . '.ini';
     } else {
         $path = JPATH_ROOT . '/language/' . $lang . '/' . $lang . '.' . $item . '.ini';
     }
     $search = $app->getUserStateFromRequest($option . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     if (JFile::exists($path)) {
         $registry->loadFile($path, 'INI');
         $languages[$lang][$item] = $registry->toArray();
     } else {
         $languages[$lang][$item] = array();
     }
     return $languages;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:38,代码来源:language.php

示例3: onContentPrepare

 /**
  *  Prepare content method
  *
  * Method is called by the view
  *
  * @param   string  $context  The context of the content being passed to the plugin.
  * @param   object  &$row     The article object.  Note $article->text is also available
  * @param   object  &$params  The article params
  * @param   int     $page     The 'page' number
  *
  * @return  void
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     jimport('joomla.html.parameter');
     jimport('joomla.filesystem.file');
     // Load fabrik language
     $lang = JFactory::getLanguage();
     $lang->load('com_fabrik', JPATH_BASE . '/components/com_fabrik');
     if (!defined('COM_FABRIK_FRONTEND')) {
         JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
     }
     // Get plugin info
     $plugin = JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JRegistry($plugin->params);
     // Simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($row->text, $botRegex) === false) {
         return true;
     }
     require_once COM_FABRIK_FRONTEND . '/helpers/parent.php';
     /* $$$ hugh - hacky fix for nasty issue with IE, which (for gory reasons) doesn't like having our JS content
      * wrapped in P tags.  But the default WYSIWYG editor in J! will automagically wrap P tags around everything.
      * So let's just look for obvious cases of <p>{fabrik ...}</p>, and replace the P's with DIV's.
      * Yes, it's hacky, but it'll save us a buttload of support work.
      */
     $pregex = "/<p>\\s*{" . $botRegex . "\\s*.*?}\\s*<\\/p>/i";
     $row->text = preg_replace_callback($pregex, array($this, 'preplace'), $row->text);
     // $$$ hugh - having to change this to use {[]}
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:44,代码来源:fabrik.php

示例4: getParams

 function getParams($params, $path = '', $default = '')
 {
     $xml = $this->_getXML($path, $default);
     if (!$params) {
         return (object) $xml;
     }
     if (!is_object($params)) {
         $registry = new JRegistry();
         $registry->loadString($params);
         $params = $registry->toObject();
     } elseif (method_exists($params, 'toObject')) {
         $params = $params->toObject();
     }
     if (!$params) {
         return (object) $xml;
     }
     if (!empty($xml)) {
         foreach ($xml as $key => $val) {
             if (!isset($params->{$key}) || $params->{$key} == '') {
                 $params->{$key} = $val;
             }
         }
     }
     return $params;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:25,代码来源:parameters.php

示例5: getContact

 /**
  * Gets a list of contacts
  * @param array
  * @return mixed Object or null
  */
 function getContact($pk = null)
 {
     $query = $this->_getContactQuery($pk);
     try {
         $this->_db->setQuery($query);
         $result = $this->_db->loadObject();
         if ($error = $this->_db->getErrorMsg()) {
             throw new Exception($error);
         }
         if (empty($result)) {
             throw new Exception(JText::_('Contact_Error_Contact_not_found'), 404);
         }
         // Convert parameter fields to object and merge with menu item params
         $registry = new JRegistry();
         $registry->loadJSON($result->params);
         $result->mergedParams = clone $this->getState('params');
         $result->mergedParams->merge($registry);
     } catch (Exception $e) {
         $this->setError($e);
         return false;
     }
     if ($result) {
         $user =& JFactory::getUser();
         $groups = implode(',', $user->authorisedLevels());
         //get the content by the linked user
         $query = 'SELECT id, title, state, access, created' . ' FROM #__content' . ' WHERE created_by = ' . (int) $result->user_id . ' AND access IN (' . $groups . ')' . ' ORDER BY state DESC, created DESC';
         $this->_db->setQuery($query, 0, 10);
         $articles = $this->_db->loadObjectList();
         $contact->articles = $articles;
     }
     return $result;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:37,代码来源:contact.php

示例6: 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);
 }
开发者ID:ranrolls,项目名称:php-web-offers-portal,代码行数:30,代码来源:view.html.php

示例7: bind

 /**
  * Overloaded bind function
  *
  * @param	array		$hash named array
  * @return	null|string	null is operation was satisfactory, otherwise returns an error
  * @see JTable:bind
  * @since 1.5
  */
 public function bind($array, $ignore = array())
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         if ((int) $registry->get('width', 0) < 0) {
             $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_WIDTH_LABEL')));
             return false;
         }
         if ((int) $registry->get('height', 0) < 0) {
             $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_HEIGHT_LABEL')));
             return false;
         }
         // Converts the width and height to an absolute numeric value:
         $width = abs((int) $registry->get('width', 0));
         $height = abs((int) $registry->get('height', 0));
         // Sets the width and height to an empty string if = 0
         $registry->set('width', $width ? $width : '');
         $registry->set('height', $height ? $height : '');
         $array['params'] = (string) $registry;
     }
     if (isset($array['imptotal'])) {
         $array['imptotal'] = abs((int) $array['imptotal']);
     }
     return parent::bind($array, $ignore);
 }
开发者ID:reechalee,项目名称:joomla1.6,代码行数:34,代码来源:banner.php

示例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;
 }
开发者ID:enjoy2000,项目名称:smcd,代码行数:25,代码来源:rokcandy.php

示例9: get_category

 function get_category($catid)
 {
     if (!is_object($this->_item)) {
         $app = JFactory::getApplication();
         $menu = $app->getMenu();
         $active = $menu->getActive();
         $params = new JRegistry();
         if ($active) {
             $params->loadString($active->params);
         }
         $options = array();
         $options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0);
         $catid = $catid > 0 ? $catid : 'root';
         $categories = JCategories::getInstance('CommunitySurveys', $options);
         $this->_item = $categories->get($catid);
         if (is_object($this->_item)) {
             $user = JFactory::getUser();
             $userId = $user->get('id');
             $asset = 'com_content.category.' . $this->_item->id;
             if ($user->authorise('core.create', $asset)) {
                 $this->_item->getParams()->set('access-create', true);
             }
         }
     }
     return $this->_item;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:26,代码来源:categories.php

示例10: store

 /**
  * Stores a contact
  *
  * @param	boolean	True to update fields even if they are null.
  * @return	boolean	True on success, false on failure.
  * @since	1.6
  */
 public function store($updateNulls = false)
 {
     // Transform the params field
     if (is_array($this->params)) {
         $registry = new JRegistry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified = $date->toSql();
         $this->modified_by = $user->get('id');
     } else {
         // New newsfeed. A feed created and created_by field can be set by the user,
         // so we don't touch either of these if they are set.
         if (!intval($this->created)) {
             $this->created = $date->toSql();
         }
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
     }
     // Verify that the alias is unique
     $table = JTable::getInstance('Contact', 'ContactTable');
     if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_CONTACT_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     // Attempt to store the data.
     return parent::store($updateNulls);
 }
开发者ID:Nechoj23,项目名称:SVI-Homepage,代码行数:40,代码来源:contact.php

示例11: __construct

 public function __construct()
 {
     JLoader::import('joomla.filesystem.file');
     //	$isPro = defined('ARS_PRO') ? (ARS_PRO == 1) : false;
     // Load the component parameters, not using JComponentHelper to avoid conflicts ;)
     JLoader::import('joomla.html.parameter');
     JLoader::import('joomla.application.component.helper');
     $db = JFactory::getDbo();
     $sql = $db->getQuery(true)->select($db->quoteName('params'))->from($db->quoteName('#__extensions'))->where($db->quoteName('type') . ' = ' . $db->quote('component'))->where($db->quoteName('element') . ' = ' . $db->quote('com_j2store'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params->loadString($rawparams, 'JSON');
     } else {
         $params->loadJSON($rawparams);
     }
     // Dev releases use the "newest" strategy
     if (substr($this->_currentVersion, 1, 2) == 'ev') {
         $this->_versionStrategy = 'newest';
     } else {
         $this->_versionStrategy = 'vcompare';
     }
     // Get the minimum stability level for updates
     $this->_minStability = $params->get('minstability', 'stable');
     // Do we need authorized URLs?
     $this->_requiresAuthorization = false;
     // Should I use our private CA store?
     if (@file_exists(dirname(__FILE__) . '/../assets/cacert.pem')) {
         $this->_cacerts = dirname(__FILE__) . '/../assets/cacert.pem';
     }
     parent::__construct();
 }
开发者ID:ForAEdesWeb,项目名称:AEW4,代码行数:33,代码来源:config.php

示例12: getProfile

 public static function getProfile($userid)
 {
     $db = JFactory::getDbo();
     $q = $db->getQuery(true);
     $q->select('*');
     $q->from('#__plg_slogin_profile');
     $q->where('`user_id` = ' . (int) $userid);
     $q->where('`current_profile` = 1');
     $db->setQuery($q, 0, 1);
     $profile = $db->loadObject();
     if (!$profile) {
         $q = $db->getQuery(true);
         $q->select('*');
         $q->from('#__plg_slogin_profile');
         $q->where('`user_id` = ' . (int) $userid);
         $db->setQuery($q, 0, 1);
         $profile = $db->loadObject();
     }
     if (!$profile) {
         return false;
     }
     if (!empty($profile->avatar)) {
         //Получаем папку с изображениями
         $plugin = JPluginHelper::getPlugin('slogin_integration', 'profile');
         $pluginParams = new JRegistry();
         $pluginParams->loadString($plugin->params);
         $paramFolder = $pluginParams->get('rootfolder', 'images/avatar');
         $profile->avatar = preg_replace("/.*?\\//", "", $profile->avatar);
         $profile->avatar = $paramFolder . '/' . $profile->avatar;
     }
     return $profile;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:32,代码来源:helper.php

示例13: 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;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:29,代码来源:settings.php

示例14: update

 function update()
 {
     $currency = JRequest::getInt('hikashopcurrency', 0);
     if (!empty($currency)) {
         $app = JFactory::getApplication();
         $app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null);
         $url = JRequest::getString('return_url', '');
         if (HIKASHOP_J30) {
             $plugin = JPluginHelper::getPlugin('system', 'cache');
             $params = new JRegistry(@$plugin->params);
             $options = array('defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false);
             $cache = JCache::getInstance('page', $options);
             $cache->clean();
         }
         if (!empty($url)) {
             if (hikashop_disallowUrlRedirect($url)) {
                 return false;
             }
             $app->redirect(urldecode($url));
         }
     }
     return true;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:29,代码来源:currency.php

示例15: getInput

 protected function getInput()
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $id = $app->input->getInt('id', 0);
     $attachments = array();
     if ($this->value) {
         $registry = new JRegistry();
         $registry->loadString($this->value);
         $attachments = $registry->toObject();
     }
     $token = JSession::getFormToken();
     $script = "jQuery(document).ready(function(\$){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#add_attachments').click(function() {\n\t\t\t\t\t\t\t\t\$('<tr><td><input type=\"file\" name=\"attachmentfiles[]\" multiple /></td><td><a href=\"#\" class=\"remove_attachment\" onclick=\"return false;\">" . JText::_('COM_JUDIRECTORY_REMOVE') . "</a></td></tr>').appendTo(\"#juemail table\");\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#juemail').on('click', '.remove_attachment', function() {\n\t\t\t\t\t\t\t\t\$(this).parent().parent().remove();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\$(\"#email-lists\").dragsort({ dragSelector: \"li\", dragEnd: saveOrder, placeHolderTemplate: \"<li class='placeHolder'></li>\", dragSelectorExclude: \"input, textarea, span\"});\n\t\t\t\t\t        function saveOrder() {\n\t\t\t\t\t\t\t\tvar data = \$(\"#juemail li\").map(function() { return \$(this).data(\"itemid\"); }).get();\n\t\t\t\t\t        };\n\t\t\t\t\t\t});";
     $document->addScriptDeclaration($script);
     $html = '<div id="juemail" class="juemail" style="float: left">';
     if ($attachments) {
         $html .= '<ul id="email-lists" class="email-lists">';
         foreach ($attachments as $attachment) {
             $html .= '<li>';
             $html .= '<a class="drag-icon"></a>';
             $html .= '<input type="checkbox" name="' . $this->name . '[]" checked value="' . $attachment . '" />';
             $html .= '<a href="index.php?option=com_judirectory&task=email.downloadattachment&id=' . $id . '&file=' . $attachment . '&' . $token . '=1"><span class="attachment">' . $attachment . '</span></a>';
             $html .= '</li>';
         }
         $html .= '</ul>';
     }
     $html .= '<table></table>';
     $html .= '<a href="#" class="btn btn-mini btn-primary add_attachments" id="add_attachments" onclick="return false;"><i class="icon-new"></i> ' . JText::_('COM_JUDIRECTORY_ADD_ATTACHMENT') . '</a>';
     $html .= '</div>';
     return $html;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:31,代码来源:emailattachments.php


注:本文中的JRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。