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


PHP JRegistry::toObject方法代码示例

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


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

示例1: save

 function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('RESTRICTED');
     $db = JFactory::getDBO();
     $task = $this->getTask();
     $client = JRequest::getWord('client', 'site');
     // get params
     $component = WFExtensionHelper::getComponent();
     // create params object from json string
     $params = json_decode($component->params);
     $registry = new JRegistry();
     $registry->loadArray(JRequest::getVar('params', '', 'POST', 'ARRAY'));
     // set preference object
     $params->editor = $registry->toObject();
     // set params as JSON string
     $component->params = json_encode($params);
     if (!$component->check()) {
         JError::raiseError(500, $component->getError());
     }
     if (!$component->store()) {
         JError::raiseError(500, $component->getError());
     }
     $component->checkin();
     $msg = JText::sprintf('WF_CONFIG_SAVED');
     switch ($task) {
         case 'apply':
             $this->setRedirect('index.php?option=com_jce&view=config', $msg);
             break;
         case 'save':
         default:
             $this->setRedirect('index.php?option=com_jce&view=cpanel', $msg);
             break;
     }
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:35,代码来源:config.php

示例2: display

 function display($cachable = false, $urlparams = array())
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if (empty(JFactory::getUser()->id)) {
         $url = JRoute::_("index.php?option=com_j2store&view=downloads");
         $redirect = "index.php?option=com_users&view=login&return=" . base64_encode($url);
         $redirect = JRoute::_($redirect, false);
         JFactory::getApplication()->redirect($redirect);
         return;
     }
     $params = JComponentHelper::getParams('com_j2store');
     $model = $this->getModel('downloads');
     $ns = 'com_j2store.downloads';
     $files = $model->getItems();
     $registry = new JRegistry();
     $registry->loadArray($files);
     $files = $registry->toObject();
     //print_r($files);
     //exit;
     //$freefiles=$model->getFreeFiles();
     //$files=$this->process($files,$freefiles);
     $view = $this->getView('downloads', 'html');
     $view->set('_controller', 'downloads');
     $view->set('_view', 'downloads');
     $view->set('_doTask', true);
     $view->set('hidemenu', false);
     $view->setModel($model, true);
     $view->assign('files', $files);
     $view->assign('params', $params);
     $view->setLayout('default');
     //	$view->display();
     parent::display();
 }
开发者ID:ForAEdesWeb,项目名称:AEW4,代码行数:34,代码来源:downloads.php

示例3: 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

示例4: save

 public function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('RESTRICTED');
     $db = JFactory::getDBO();
     $post = JRequest::getVar('params', '', 'POST', 'ARRAY');
     $registry = new JRegistry();
     $registry->loadArray($post);
     // get params
     $component = WFExtensionHelper::getComponent();
     // set preferences object
     $preferences = $registry->toObject();
     if (isset($preferences->rules)) {
         $preferences->access = $preferences->rules;
         unset($preferences->rules);
     }
     // set params as JSON string
     $component->params = json_encode($preferences);
     if (!$component->check()) {
         JError::raiseError(500, $row->getError());
     }
     if (!$component->store()) {
         JError::raiseError(500, $row->getError());
     }
     $component->checkin();
     $close = 0;
     if ($this->getTask() == 'save') {
         $close = 1;
     }
     $this->setRedirect('index.php?option=com_jce&view=preferences&tmpl=component&close=' . $close, WFText::_('WF_PREFERENCES_SAVED'));
 }
开发者ID:DanyCan,项目名称:wisten.github.io,代码行数:31,代码来源:preferences.php

示例5: 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

示例6: getItem

 public function getItem($pk = null)
 {
     $storeId = md5(__METHOD__);
     if (!isset($this->cache[$storeId])) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('config_params');
         $query->from('#__judownload_categories');
         $query->where('parent_id = 0');
         $query->where('level = 0');
         $db->setQuery($query);
         $config_params = $db->loadResult();
         $registry = new JRegistry();
         $registry->loadString($config_params);
         $globalConfig = $registry->toObject();
         foreach ($globalConfig as $key => $value) {
             if (is_object($value)) {
                 $registry = new JRegistry();
                 $registry->loadObject($value);
                 $globalConfig->{$key} = $registry->toArray();
             }
         }
         $this->cache[$storeId] = $globalConfig;
     }
     return $this->cache[$storeId];
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:26,代码来源:globalconfig.php

示例7: display

 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     foreach ($this->items as $i => $item) {
         $registry = new JRegistry();
         $registry->loadString($item->advancedparams);
         $this->items[$i]->params = $registry->toObject();
     }
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->getConfig();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Check if there are no matching items
     if (!count($this->items)) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_MODULES_MSG_MANAGE_NO_MODULES'), 'warning');
     }
     $this->addToolbar();
     // Include the component HTML helpers.
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
     parent::display($tpl);
 }
开发者ID:AxelFG,项目名称:ckbran-inf,代码行数:28,代码来源:view.html.php

示例8: getPluginParamValues

 function getPluginParamValues($name, $type = 'system')
 {
     jimport('joomla.plugin.plugin');
     $plugin = JPluginHelper::getPlugin($type, $name);
     $registry = new JRegistry();
     $registry->loadJSON($plugin->params);
     return $this->getParams($registry->toObject(), JPATH_PLUGINS . DS . $type . DS . $name . DS . $name . '.xml');
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:8,代码来源:parameters.php

示例9: save

 public function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('RESTRICTED');
     $db = JFactory::getDBO();
     $post = JRequest::getVar('params', '', 'POST', 'ARRAY');
     $registry = new JRegistry();
     $registry->loadArray($post);
     // get params
     $component = WFExtensionHelper::getComponent();
     // create params object from json string
     $params = json_decode($component->params);
     // set preferences object
     $preferences = $registry->toObject();
     if (isset($preferences->rules)) {
         jimport('joomla.access.rules');
         if (class_exists('JRules')) {
             $data = $this->filter($post);
             $rules = new JRules($data['rules']);
             $asset = JTable::getInstance('asset');
             $option = JRequest::getCmd('option');
             if (!$asset->loadByName($option)) {
                 $root = JTable::getInstance('asset');
                 $root->loadByName('root.1');
                 $asset->name = $option;
                 $asset->title = $option;
                 $asset->setLocation($root->id, 'last-child');
             }
             $asset->rules = (string) $rules;
             if (!$asset->check() || !$asset->store()) {
                 JError::raiseError(500, $asset->getError());
                 return false;
             }
             // Joomla! 1.5
         } else {
             $params->access = $preferences->rules;
         }
     }
     if (isset($preferences->preferences)) {
         $params->preferences = $preferences->preferences;
         // set params as JSON string
         $component->params = json_encode($params);
         if (!$component->check()) {
             JError::raiseError(500, $row->getError());
         }
         if (!$component->store()) {
             JError::raiseError(500, $row->getError());
         }
         $component->checkin();
     }
     $close = 0;
     if ($this->getTask() == 'save') {
         $close = 1;
     }
     $this->setRedirect('index.php?option=com_jce&view=preferences&tmpl=component&close=' . $close, WFText::_('WF_PREFERENCES_SAVED'));
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:56,代码来源:preferences.php

示例10: jimport

 public static function &getConfig()
 {
     static $instance;
     if (version_compare(PHP_VERSION, '5.2.0', '<')) {
         JError::raiseWarning('100', JText::sprintf('MijoSEF requires PHP 5.2.x to run, please contact your hosting company.'));
         return false;
     }
     if (!is_object($instance)) {
         jimport('joomla.application.component.helper');
         $reg = new JRegistry(JComponentHelper::getParams('com_mijosef'));
         $instance = $reg->toObject()->data;
     }
     return $instance;
 }
开发者ID:affiliatelk,项目名称:ecc,代码行数:14,代码来源:mijosef.php

示例11: getParams

 /**
  * Getting the parameters 
  *
  * @return  bool	True on success
  *
  * @since   3.0.0
  */
 public static function getParams()
 {
     // Getting the type of interface between web server and PHP
     $sapi = php_sapi_name();
     // Getting the params and Joomla version web and cli
     if ($sapi != 'cli') {
         $params = JComponentHelper::getParams('com_redmigrator');
     } else {
         if ($sapi == 'cli') {
             $params = new JRegistry(new JConfig());
         }
     }
     return $params->toObject();
 }
开发者ID:grlf,项目名称:eyedock,代码行数:21,代码来源:redmigrator.php

示例12: dataHook

 /**
  * Sets the data in the destination database.
  *
  * @return      void
  * @since       0.4.
  * @throws      Exception
  */
 public function dataHook($rows = null)
 {
     // Getting the component parameter with global settings
     $params = $this->getParams();
     // Fixing the changes between versions
     foreach ($rows as &$row) {
         $row = (array) $row;
         $temp = new JRegistry($row['params']);
         $temp->set('imageurl', 'images/banners/' . $row['imageurl']);
         $row['params'] = json_encode($temp->toObject());
         $row['language'] = '*';
         unset($row['imageurl']);
         unset($row['date']);
         unset($row['editor']);
         unset($row['tags']);
     }
     return $rows;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:25,代码来源:banners.php

示例13: getParams

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

示例14: getForm

 function getForm($formname)
 {
     global $mainframe;
     $database =& JFactory::getDBO();
     if (!trim($formname)) {
         if (JRequest::getVar('chronoformname')) {
             JRequest::setVar('chronoformname', preg_replace('/[^A-Za-z0-9_]/', '', JRequest::getVar('chronoformname')));
         }
         $formname = JRequest::getVar('chronoformname');
         if (!$formname) {
             $params =& $mainframe->getPageParameters('com_chronocontact');
             $formname = preg_replace('/[^A-Za-z0-9_]/', '', $params->get('formname'));
         }
     }
     $query = "SELECT * FROM `#__chrono_contact` WHERE `name` = '" . $formname . "'";
     $database->setQuery($query);
     $cf_rows = $database->loadObjectList();
     if (count($cf_rows)) {
         $this->formrow = $cf_rows[0];
         $this->formname = "ChronoContact_" . $this->formrow->name;
         //load titles
         $registry = new JRegistry();
         $registry->loadINI($cf_rows[0]->titlesall);
         $titlesvalues = $registry->toObject();
         //load params
         $paramsvalues = new JParameter($this->formrow->paramsall);
         $this->formparams = $paramsvalues;
         return true;
     } else {
         $emptyForm = new StdClass();
         $emptyForm->id = 0;
         $emptyForm->name = '';
         $this->formrow = $emptyForm;
         $paramsvalues = new JParameter('');
         $this->formparams = $paramsvalues;
         return false;
     }
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:38,代码来源:chronoform.php

示例15: MenuSelect

 /**
  * Legacy function, deprecated
  *
  * @deprecated	As of version 1.5
  */
 function MenuSelect($name = 'menuselect', $javascript = NULL)
 {
     $db =& JFactory::getDBO();
     $query = 'SELECT params' . ' FROM #__modules' . ' WHERE module = "mod_mainmenu"';
     $db->setQuery($query);
     $menus = $db->loadObjectList();
     $total = count($menus);
     $menuselect = array();
     $usedmenus = array();
     for ($i = 0; $i < $total; $i++) {
         $registry = new JRegistry();
         $registry->loadINI($menus[$i]->params);
         $params = $registry->toObject();
         if (!in_array($params->menutype, $usedmenus)) {
             $menuselect[$i]->value = $params->menutype;
             $menuselect[$i]->text = $params->menutype;
             $usedmenus[] = $params->menutype;
         }
     }
     // sort array of objects
     JArrayHelper::sortObjects($menuselect, 'text', 1);
     $menus = JHTML::_('select.genericlist', $menuselect, $name, 'class="inputbox" size="10" ' . $javascript, 'value', 'text');
     return $menus;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:29,代码来源:menu.php


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