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; } }
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(); }
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; }
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')); }
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; }
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]; }
/** * 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); }
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'); }
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')); }
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; }
/** * 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(); }
/** * 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; }
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; }
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; } }
static function &getEditorPluginConfig($namspace = 'config') { static $config; if (!isset($config)) { $path = CKEDITOR_LIBRARY; require_once $path . DS . 'plugins.php'; require_once $path . DS . 'plugins' . DS . 'toolbarplugins.php'; $config = new JRegistry(); $pluginConfig = new JCKToolbarPlugins(); $config->loadObject($pluginConfig); $data = $config->toObject(); $properties = get_object_vars($data); foreach ($properties as $key => $value) { if (strpos('p' . $key, '_')) { unset($data->{$key}); } } //Forcibly remove the save plugin due to it causing the icon //to disappear in editor version 6.0.4+ unset($data->save); return $config; } return $config; }
/** * 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; }
<div class="col-md-8"> <?php echo JBMediaHelper::renderImageCarousel($row->attachment, 'service'); ?> </div> <div class="col-md-12"> <div class="clearfix"></div> <div><?php echo nl2br($row->description); ?> </div> <?php $registry = new JRegistry(); $registry->loadString($row->extras); $extras = $registry->toObject(); $a = 0; foreach ($extras as $key => $value) { if ($value->enabled) { $a++; } } if ($a > 0) { ?> <h3><?php echo JText::_('COM_JBLANCE_GET_MORE_WITH_ADD_ONS'); ?> :</h3> <?php foreach ($extras as $key => $value) { if ($value->enabled) {
/** * Search method * * The sql must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav * @param string Target search string * @param string matching option, exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category */ function onSearch($text, $phrase = '', $ordering = '', $areas = null) { $db = JFactory::getDBO(); $user = JFactory::getUser(); $groups = version_compare(JVERSION, '1.6.0', '>=') ? implode(',', $user->getAuthorisedViewLevels()) : false; $limit = version_compare(JVERSION, '1.6.0', '>=') ? $this->params->get('search_limit', 50) : $this->_params->def('search_limit', 50); $dateformat = version_compare(JVERSION, '1.6.0', ">=") ? $this->params->get('date_format', "%d %B %Y") : $this->_params->def('date_format', "%d %B %Y"); $allLanguages = $this->params->get('all_language_search', true); $limit = "\n LIMIT {$limit}"; $text = trim($text); if ($text == '') { return array(); } if (is_array($areas)) { $test = array_keys(plgSearchEventsSearchAreas()); if (!array_intersect($areas, array_keys(plgSearchEventsSearchAreas()))) { return array(); } } $params = JComponentHelper::getParams("com_jevents"); // See http://www.php.net/manual/en/timezones.php $tz = $params->get("icaltimezonelive", ""); if ($tz != "" && is_callable("date_default_timezone_set")) { $timezone = date_default_timezone_get(); date_default_timezone_set($tz); $this->jeventstimezone = $timezone; } $search_ical_attributes = array('det.summary', 'det.description', 'det.location', 'det.contact', 'det.extra_info'); // process the new plugins // get extra data and conditionality from plugins $extrawhere = array(); $extrajoin = array(); $needsgroup = false; $filterarray = array("published"); $dataModel = new JEventsDataModel(); $compparams = JComponentHelper::getParams("com_jevents"); if ($compparams->get("multicategory", 0)) { $catwhere = "\n AND catmap.catid IN(" . $dataModel->accessibleCategoryList(null, null, null, $allLanguages) . ")"; $catjoin = "\n LEFT JOIN #__jevents_catmap as catmap ON catmap.evid = rpt.eventid"; $catjoin .= "\n LEFT JOIN #__categories AS b ON catmap.catid = b.id"; } else { $catwhere = "\n AND ev.catid IN(" . $dataModel->accessibleCategoryList(null, null, null, $allLanguages) . ")"; $catjoin = "\n INNER JOIN #__categories AS b ON b.id = ev.catid"; } // If there are extra filters from the module then apply them now $reg = JFactory::getConfig(); $modparams = $reg->get("jev.modparams", false); if ($modparams && $modparams->get("extrafilters", false)) { $filterarray = array_merge($filterarray, explode(",", $modparams->get("extrafilters", false))); } $filters = jevFilterProcessing::getInstance($filterarray); $filters->setWhereJoin($extrawhere, $extrajoin); $needsgroup = $filters->needsGroupBy(); JPluginHelper::importPlugin('jevents'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onListIcalEvents', array(&$extrafields, &$extratables, &$extrawhere, &$extrajoin, &$needsgroup)); $extrajoin = count($extrajoin) ? " \n LEFT JOIN " . implode(" \n LEFT JOIN ", $extrajoin) : ''; $extrawhere = count($extrawhere) ? ' AND ' . implode(' AND ', $extrawhere) : ''; $extrasearchfields = array(); $dispatcher->trigger('onSearchEvents', array(&$extrasearchfields, &$extrajoin, &$needsgroup)); $wheres = array(); $wheres_ical = array(); switch ($phrase) { case 'exact': $text = $db->Quote('%' . $db->escape($text, true) . '%', false); // ical $wheres2 = array(); foreach ($search_ical_attributes as $search_item) { $wheres2[] = "LOWER({$search_item}) LIKE " . $text; } $where_ical = '(' . implode(') OR (', $wheres2) . ')'; break; case 'all': case 'any': default: $words = explode(' ', $text); $text = $db->Quote('%' . $db->escape($text, true) . '%', false); // ical $wheres = array(); foreach ($words as $word) { $word = $db->Quote('%' . $db->escape($word) . '%', false); $wheres2 = array(); foreach ($search_ical_attributes as $search_item) { $wheres2[] = "LOWER({$search_item}) LIKE " . $word; } $wheres[] = implode(' OR ', $wheres2); } $where_ical = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')'; break; } if (count($extrasearchfields) > 0) { $extraor = implode(" OR ", $extrasearchfields); $extraor = " OR " . $extraor; // replace the ### placeholder with the keyword // $text is already exscaped above $extraor = str_replace("###", $text, $extraor); $where_ical .= $extraor; } // some of the where statements may already be escaped $where_ical = str_replace("%'%'", "%'", $where_ical); $where_ical = str_replace("''", "'", $where_ical); $where_ical = str_replace("'%'%", "'%", $where_ical); $morder = ''; $morder_ical = ''; switch ($ordering) { case 'oldest': $order = 'a.created ASC'; $order_ical = 'det.created ASC'; break; case 'popular': $order = 'a.hits DESC'; $order_ical = 'det.created ASC'; // no hit field available break; case 'alpha': $order = 'a.title ASC'; $order_ical = 'det.summary ASC'; break; case 'category': $order = 'b.title ASC, a.title ASC'; $morder = 'a.title ASC'; $order_ical = 'b.title ASC, det.summary ASC'; $morder_ical = 'det.summary ASC'; break; case 'newest': default: $order = 'a.created DESC'; $order_ical = 'det.created DESC'; break; } $eventstitle = JText::_("Events Calendar"); // Now Search Icals $display2 = array(); foreach ($search_ical_attributes as $search_ical_attribute) { $display2[] = "{$search_ical_attribute}"; } $display = 'CONCAT(' . implode(", ' ', ", $display2) . ')'; $query = "SELECT det.evdet_id, det.summary as title," . "\n ev.created as created," . "\n {$display} as text," . "\n CONCAT('{$eventstitle}','/',det.summary) AS section," . "\n CONCAT('index.php?option=com_jevents&task=icalrepeat.detail&evid=',min(rpt.rp_id)) AS href," . "\n '2' AS browsernav ," . "\n rpt.startrepeat, rpt.rp_id " . "\n FROM (#__jevents_vevent as ev)" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . $catjoin . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id = ev.icsid" . $extrajoin . "\n WHERE ({$where_ical})" . "\n AND icsf.state = 1" . "\n AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . $groups . ')' : ' <= ' . $user->gid) . "\n AND ev.state = 1" . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . $groups . ')' : ' <= ' . $user->gid) . "\n AND b.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . $groups . ')' : ' <= ' . $user->gid) . "\n AND b.published = '1'" . $extrawhere . $catwhere . "\n GROUP BY det.evdet_id" . "\n ORDER BY " . ($morder_ical ? $morder_ical : $order_ical) . $limit; $db->setQuery($query); $list_ical = $db->loadObjectList('evdet_id'); jimport('joomla.utilities.date'); if ($list_ical) { foreach ($list_ical as $id => $item) { $user = JFactory::getUser(); $query = "SELECT ev.*, ev.state as published, rpt.*, rr.*, det.*, ev.created as created, ex_id, exception_type " . "\n , YEAR(rpt.startrepeat) as yup, MONTH(rpt.startrepeat ) as mup, DAYOFMONTH(rpt.startrepeat ) as dup" . "\n , YEAR(rpt.endrepeat ) as ydn, MONTH(rpt.endrepeat ) as mdn, DAYOFMONTH(rpt.endrepeat ) as ddn" . "\n , HOUR(rpt.startrepeat) as hup, MINUTE(rpt.startrepeat ) as minup, SECOND(rpt.startrepeat ) as sup" . "\n , HOUR(rpt.endrepeat ) as hdn, MINUTE(rpt.endrepeat ) as mindn, SECOND(rpt.endrepeat ) as sdn" . "\n FROM #__jevents_vevent as ev" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_exception as ex ON det.evdet_id = ex.eventdetail_id" . "\n WHERE ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . $groups . ')' : ' <= ' . $user->gid) . "\n AND det.evdet_id = {$id}" . "\n ORDER BY rpt.startrepeat ASC limit 1"; $db->setQuery($query); $row = $db->loadObject(); if (!$row) { continue; } $event = new jIcalEventRepeat($row); // only get the next repeat IF its not an exception if (is_null($row->ex_id)) { $event = $event->getNextRepeat(); } $startdate = new JevDate(strtotime($event->_startrepeat)); $item->title = $item->title . " (" . $startdate->toFormat($dateformat) . ")"; $item->startrepeat = $event->_startrepeat; $myitemid = $this->params->get("target_itemid", 0); if ($myitemid == 0) { // I must find the itemid that allows this event to be shown $catidsOut = $modcatids = $catidList = $modparams = $showall = ""; // Use the plugin params to ensure menu item is picked up //$modparams = new JRegistry($this->_plugin->params); $modparams = new JRegistry(null); // pretend to have category restriction $modparams->set("catid0", $row->catid); $modparams->set("ignorecatfilter", 1); $myitemid = findAppropriateMenuID($catidsOut, $modcatids, $catidList, $modparams->toObject(), $showall); } $item->href = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), false, $myitemid); $link = $item->href; $list_ical[$id] = $item; } } // Must reset the timezone back!! if ($tz && is_callable("date_default_timezone_set")) { date_default_timezone_set($timezone); } return $list_ical; }
protected static function _formHTML($field, $group, $i, $size_group, &$config) { $client = 'cck_' . $config['client']; $html_div_buttons = ''; $js = ''; $js2 = ''; $js_format = $i == 0 && $size_group == 0 ? 'raw' : 'html'; $rId = $config['rendering_id']; if ($field->bool3) { $html_div_buttons .= '<div class="cck_button cck_button_del_' . $field->name . ' cck_button_del cck_button_first"></div>'; } if ($field->bool2) { $html_div_buttons .= '<div class="cck_button cck_button_add_' . $field->name . ' cck_button_add"></div>'; } if ($field->bool4) { $html_div_buttons .= '<div class="cck_button cck_button_drag_' . $field->name . ' cck_button_drag cck_button_last"></div>'; } if ($size_group == 1) { $html = '<div id="' . $rId . '_forms_' . $field->name . '_' . $i . '" class="cck_form cck_form_group_x cck_form_group_x_first cck_form_group_x_last">'; $html .= '<aside id="' . $rId . '_button_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_button cck_cgx_button_first cck_cgx_button_last">' . $html_div_buttons . '</aside>'; $html .= '<div id="' . $rId . '_form_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_form cck_cgx_form_first cck_cgx_form_last">'; } elseif ($size_group == 0) { $html = '<div id="' . $rId . '_forms_' . $field->name . '_' . $i . '" class="cck_form cck_form_group_x">'; $html .= '<aside id="' . $rId . '_button_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_button">' . $html_div_buttons . '</aside>'; $html .= '<div id="' . $rId . '_form_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_form">'; } elseif ($i == 0) { $html = '<div id="' . $rId . '_forms_' . $field->name . '_' . $i . '" class="cck_form cck_form_group_x cck_form_group_x_first">'; $html .= '<aside id="' . $rId . '_button_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_button cck_cgx_button_first">' . $html_div_buttons . '</aside>'; $html .= '<div id="' . $rId . '_form_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_form cck_cgx_form_first">'; } elseif ($i == $size_group - 1) { $html = '<div id="' . $rId . '_forms_' . $field->name . '_' . $i . '" class="cck_form cck_form_group_x cck_form_group_x_last">'; $html .= '<aside id="' . $rId . '_button_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_button cck_cgx_button_last">' . $html_div_buttons . '</aside>'; $html .= '<div id="' . $rId . '_form_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_form cck_cgx_form_last">'; } else { $html = '<div id="' . $rId . '_forms_' . $field->name . '_' . $i . '" class="cck_form cck_form_group_x">'; $html .= '<aside id="' . $rId . '_button_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_button">' . $html_div_buttons . '</aside>'; $html .= '<div id="' . $rId . '_form_' . $field->name . '_' . $i . '" class="cck_cgx cck_cgx_form">'; } if (count($group)) { foreach ($group as $elem) { if ($elem->display > 1) { if ($elem->markup == 'none') { if ($elem->label != '') { $html .= '<label for="' . $elem->name . '">' . $elem->label . '</label>'; } } else { $html .= '<div id="' . $rId . '_' . $field->name . '_' . $i . '_' . $elem->name . '" class="cck_forms ' . $client . ' cck_' . $elem->type . ' cck_' . $elem->name . '">'; $html .= '<div id="' . $rId . '_' . $field->name . '_' . $i . '_label_' . $elem->name . '" class="cck_label cck_label_' . $elem->type . '"><label for="' . $elem->name . '">' . $elem->label . '</label></div>'; $html .= '<div id="' . $rId . '_' . $field->name . '_' . $i . '_form_' . $elem->name . '" class="cck_form cck_form_' . $elem->type . @$elem->markup_class . '">'; } } $html .= $elem->form; if ($elem->display > 1 && $elem->markup != 'none') { $html .= '</div>'; $html .= '</div>'; } // Computation & Conditional if (@$elem->computation) { $computation = new JRegistry(); $computation->loadString($elem->computation_options); $computation_options = $computation->toObject(); if ($computation_options->calc == 'custom') { $computed = ''; if (count($computation_options->fields)) { foreach ($computation_options->fields as $k => $v) { $computed .= chr(97 + $k) . ':$("#' . $field->name . '_' . $i . '_' . $v . '")' . ','; } $computed = substr($computed, 0, -1); } $event = @$computation_options->event ? $computation_options->event : 'keyup'; $targets = @$computation_options->targets ? json_encode($computation_options->targets) : '[]'; $format = ''; if ($computation_options->format == 'toFixed') { $format = '.' . $computation_options->format . '(' . $computation_options->precision . ')'; } elseif ($computation_options->format) { $format = '.' . $computation_options->format . '()'; } if (@$computation_options->recalc && $js_format != 'raw') { $config['computation'][$event][] = array('_' => str_replace('#', '#' . $field->name . '_' . $i . '_', $elem->computation), 'js' => '$("#' . $field->name . '_' . $i . '_' . $elem->name . '").calc( "' . $computation_options->custom . '", {' . $computed . '}, ' . $targets . ', function (s){return s' . $format . ';} );'); } else { $js2 .= 'JCck.Core.recalc_' . $field->name . '_' . $i . '_' . $elem->name . ' = function() {' . '$("#' . $field->name . '_' . $i . '_' . $elem->name . '").calc( "' . $computation_options->custom . '", {' . $computed . '}, ' . $targets . ', function (s){return s' . $format . ';} );' . '}'; if ($event != 'none') { $js .= '$("' . str_replace('#', '#' . $field->name . '_' . $i . '_', $elem->computation) . '").bind("' . $event . '", JCck.Core.recalc_' . $field->name . '_' . $i . '_' . $elem->name . '); JCck.Core.recalc_' . $field->name . '_' . $i . '_' . $elem->name . '();'; } if ($js_format == 'raw') { if ($event != 'none') { $js .= $js2 . '$("' . str_replace('#', '#' . $field->name . '_' . $i . '_', $elem->computation) . '").bind("' . $event . '", JCck.Core.recalc);'; } } else { JFactory::getDocument()->addScriptDeclaration('(function ($){' . $js2 . '})(jQuery);'); } } } else { $computed = str_replace('#', '#' . $field->name . '_' . $i . '_', $elem->computation); $event = @$computation_options->event ? $computation_options->event : 'keyup'; $targets = @$computation_options->targets ? ', ' . json_encode($computation_options->targets) : ''; if (@$computation_options->recalc && $js_format != 'raw') { $config['computation'][$event][] = array('_' => $computed, 'js' => '$("' . $computed . '").' . $computation_options->calc . '("' . $event . '", "#' . $field->name . '_' . $i . '_' . $elem->name . '"' . $targets . ');'); } else { $js .= '$("' . $computed . '").' . $computation_options->calc . '("' . $event . '", "#' . $field->name . '_' . $i . '_' . $elem->name . '"' . $targets . ');'; if ($js_format == 'raw') { if ($event != 'none') { $js .= '$("' . $computed . '").bind("' . $event . '", JCck.Core.recalc);'; } } } } $config['doComputation'] = 1; } if (@$elem->conditional) { $conditions = explode(',', $elem->conditional); $elem->conditional_options = str_replace('#form#', '#' . $field->name . '_' . $i . '_' . $elem->name, $elem->conditional_options); if (count($conditions) > 1) { $c_opts = $elem->conditional_options; foreach ($conditions as $c) { $c_opts = str_replace($c, $field->name . '_' . $i . '_' . $c, $c_opts); } } else { $c_opts = str_replace($conditions[0], $field->name . '_' . $i . '_' . $conditions[0], $elem->conditional_options); } $js .= '$("#' . $rId . '_' . $field->name . '_' . $i . '_' . $elem->name . '").conditionalStates(' . $c_opts . ');'; } } } $html .= '</div>'; $html .= '</div>'; if ($js) { if ($js_format == 'raw') { $html .= '<script type="text/javascript">(function ($){' . $js . '})(jQuery);</script>'; } else { JFactory::getDocument()->addScriptDeclaration('jQuery(document).ready(function($){' . $js . '});'); } } return $html; }
/** * Converts the params fields into a JSON string. * * @param string $params The source text definition for the parameter field. * * @return string A JSON encoded string representation of the parameters. * @since 0.4. * @throws Exception from the convertParamsHook. */ protected function convertParams($params) { $temp = new JRegistry($params); $object = $temp->toObject(); // Fire the hook in case this parameter field needs modification. $this->convertParamsHook($object); return json_encode($object); }
function &getItems() { if (!isset($this->_items)) { $this->_items =& parent::getItems(); foreach ($this->_items as &$item) { $parameters = new JRegistry(); $parameters->loadJSON($item->params); $item->params = $parameters->toObject(); } } return $this->_items; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Convert some fields to array. $item->ctags = explode(',', $item->ctags); $item->videos = explode(',', $item->videos); $item->audios = explode(',', $item->audios); $item->texts = explode(',', $item->texts); $item->goals = explode(',', $item->goals); $item->implementations = explode(',', $item->implementations); $item->diseases = explode(',', $item->diseases); $item->prescriptions = explode(',', $item->prescriptions); $item->errands = explode(',', $item->errands); $item->notes = explode(',', $item->notes); // Convert the breakfasts field to an array. $registry = new JRegistry(); $registry->loadString($item->breakfasts); $item->breakfasts = $registry->toArray(); // Convert the lunchs field to an array. $registry = new JRegistry(); $registry->loadString($item->lunchs); $item->lunchs = $registry->toArray(); // Convert the dinners field to an array. $registry = new JRegistry(); $registry->loadString($item->dinners); $item->dinners = $registry->toArray(); // Convert the defaults field to an array. $registry = new JRegistry(); $registry->loadString($item->defaults); $item->defaults = $registry->toArray(); // Convert the body field to an array. $registry = new JRegistry(); $registry->loadString($item->body); $item->body = $registry->toArray(); if ($item->special) { // Convert the special field to an object. $registry = new JRegistry(); $registry->loadString($item->special); $item->special = $registry->toObject(); } // load Profile if ($item->profiles_id) { $profileModel = $this->getInstance('Profile', 'SibdietModel'); $item->profile = $profileModel->getItem($item->profiles_id); // if profile do not has email and has user, we set profile email to user email if (!$item->profile->email && $item->profile->users_id) { if ($pUser = JFactory::getUser($item->profile->users_id)) { $item->profile->email = $pUser->email; } } // Fix Warning unset($item->profile->_errors); } } return $item; }
} ?> <div class="dj-item<?php echo $item_class; ?> "> <?php echo '<div class="title_top info"><h2>' . $item->name . '</h2>'; if ($user->id == $item->user_id && $user->id > 0) { echo '<a href="index.php?option=com_djclassifieds&view=additem&id=' . $item->id . $menu_newad_itemid . '" class="title_edit button">' . JText::_('COM_DJCLASSIFIEDS_EDIT') . '</a>'; } if ($par->get('show_types', '0') && $item->type_id > 0) { $registry = new JRegistry(); $registry->loadString($item->t_params); $item->t_params = $registry->toObject(); if ($item->t_params->bt_class) { $bt_class = ' ' . $item->t_params->bt_class; } else { $bt_class = ''; } if ($item->t_params->bt_use_styles) { $style = 'style="display:inline-block; border:' . (int) $item->t_params->bt_border_size . 'px solid ' . $item->t_params->bt_border_color . ';' . 'background:' . $item->t_params->bt_bg . ';' . 'color:' . $item->t_params->bt_color . ';' . $item->t_params->bt_style . '"'; echo '<span class="type_button' . $bt_class . '" ' . $style . ' >' . $item->t_name . '</span>'; } else { echo '<span class="type_label' . $bt_class . '" >' . $item->t_name . '</span>'; } } if ($item->price || $item->price_negotiable) { ?>
function getTypes() { $db = JFactory::getDBO(); $query = "SELECT * FROM #__djcf_types WHERE published=1"; $db->setQuery($query); $types = $db->loadObjectList('id'); foreach ($types as $type) { $registry = new JRegistry(); $registry->loadString($type->params); $type->params = $registry->toObject(); } //echo '<pre>';print_r($types);die(); return $types; }
public static function g_getValidation($params, $legacy = true) { if (!$params) { $validation = new stdClass(); $validation->alert = ''; return $validation; } $registry = new JRegistry(); $registry->loadString($params); if (!$legacy) { return $registry; } $validation = $registry->toObject(); return $validation; }
private static function paramsToObject($data) { $registry = new JRegistry(); $registry->loadIni($data); return $registry->toObject(); }
public function setComputationRules(&$field) { $computation = new JRegistry(); $computation->loadString($field->computation_options); $computation_options = $computation->toObject(); if ($computation_options->calc == 'custom') { $computed = ''; $computations = explode(',', $field->computation); if (count($computations)) { foreach ($computations as $k => $v) { $computed .= chr(97 + $k) . ':$("' . $v . '")' . ','; } $computed = substr($computed, 0, -1); } $event = @$computation_options->event ? $computation_options->event : 'keyup'; $targets = @$computation_options->targets ? json_encode($computation_options->targets) : '[]'; $format = ''; if ($computation_options->format == 'toFixed') { $format = '.' . $computation_options->format . '(' . $computation_options->precision . ')'; } elseif ($computation_options->format) { $format = '.' . $computation_options->format . '()'; } if (@$computation_options->recalc) { $this->config['computation'][$event][] = array('_' => $field->computation, 'js' => '$("#' . $field->name . '").calc( "' . $computation_options->custom . '", {' . $computed . '}, ' . $targets . ', function (s){return s' . $format . ';} );'); } else { $this->addScriptDeclaration('(function ($){JCck.Core.recalc_' . $field->name . ' = function() {' . '$("#' . $field->name . '").calc( "' . $computation_options->custom . '", {' . $computed . '}, ' . $targets . ', function (s){return s' . $format . ';} );}' . '})(jQuery);'); if ($event != 'none') { $this->addJS('$("' . $field->computation . '").bind("' . $event . '", JCck.Core.recalc_' . $field->name . '); JCck.Core.recalc_' . $field->name . '();'); } } } else { $event = @$computation_options->event ? $computation_options->event : 'keyup'; $targets = @$computation_options->targets ? ', ' . json_encode($computation_options->targets) : ''; if (@$computation_options->recalc) { $this->config['computation'][$event][] = array('_' => $field->computation, 'js' => '$("' . $field->computation . '").' . $computation_options->calc . '("' . $event . '", "#' . $field->name . '"' . $targets . ');'); } else { $this->addJS('$("' . $field->computation . '").' . $computation_options->calc . '("' . $event . '", "#' . $field->name . '"' . $targets . ');'); } } $this->config['doComputation'] = 1; }
public static function mergeFieldOptions($global_display_params, $listing_display_params) { $fields = new stdClass(); if (isset($global_display_params->fields)) { $fields = $global_display_params->fields; foreach ($fields as $fieldKey => $fieldOptions) { foreach ($fieldOptions as $fieldOptionKey => $fieldOptionValue) { if (isset($listing_display_params->fields->{$fieldKey}->{$fieldOptionKey}) && $listing_display_params->fields->{$fieldKey}->{$fieldOptionKey} != '-2') { $fields->{$fieldKey}->{$fieldOptionKey} = $listing_display_params->fields->{$fieldKey}->{$fieldOptionKey}; } } } } $app = JFactory::getApplication(); $activeMenuParams = new JRegistry(); if ($menu = $app->getMenu()->getActive()) { $activeMenuParams->loadString($menu->params); } $activeMenuObj = $activeMenuParams->toObject(); if (isset($activeMenuObj->listing->fields)) { foreach ($activeMenuObj->listing->fields as $fieldKey => $fieldOptions) { foreach ($fieldOptions as $fieldOptionKey => $fieldOptionValue) { if ($fieldOptionValue !== null && $fieldOptionValue !== '') { $fields->{$fieldKey}->{$fieldOptionKey} = $fieldOptionValue; } } } } $global_display_params->fields = $fields; $registry = new JRegistry($global_display_params); return $registry; }
/** * Test the JRegistry::toObject method. * * @covers JRegistry::toObject * * @return void */ public function testToObject() { $a = new JRegistry(); $a->set('foo1', 'testtoobject1'); $a->set('foo2', 'testtoobject2'); $a->set('config.foo3', 'testtoobject3'); $expected = new stdClass(); $expected->foo1 = 'testtoobject1'; $expected->foo2 = 'testtoobject2'; $expected->config = new StdClass(); $expected->config->foo3 = 'testtoobject3'; $this->assertThat($a->toObject(), $this->equalTo($expected), 'Line: ' . __LINE__ . '.'); }
<?php } ?> <br /> <?php } else { ?> <!-- since 3.1.0. Parse attributes that are saved in JSON format --> <?php if (!empty($item->orderitem_attribute_names)) { ?> <?php //first convert from JSON to array $registry = new JRegistry(); $registry->loadString(stripslashes($item->orderitem_attribute_names), 'JSON'); $product_options = $registry->toObject(); ?> <?php foreach ($product_options as $option) { ?> - <small> <?php echo JText::_($option->name); ?> : <?php echo JText::_($option->value); ?> <?php if (isset($option->option_sku) && JString::strlen($option->option_sku) > 0) { ?> (<?php