protected function _initObject($object) { // init vars $params = new YParameter(); $params->loadString($object->params); $group = $object->application_group; $class = $group . 'Application'; // load application class if (!class_exists($class)) { $path = ZOO_APPLICATION_PATH . "/{$group}/application.php"; if (is_file($path)) { require_once $path; } } if (class_exists($class)) { $data = get_object_vars($object); // create application instance $object = new $class(); // set data if (is_array($data)) { foreach ($data as $name => $value) { $object->{$name} = $value; } } } return $object; }
public function render($params = array()) { // init vars $this->_uri = JURI::base(); $this->_path = JPATH_ROOT . DS . trim($this->_config->get('directory'), '/') . DS . trim($this->_data->get('value'), '/'); // set params $parameter = new YParameter(); $parameter->loadArray($this->_config->toArray())->loadArray($params); $parameter->set('title', $this->_data->get('title')); // get thumbnails $thumbs = $this->_getThumbnails($parameter); // no thumbnails found if (!count($thumbs)) { return JText::_('No thumbnails found'); } // sort thumbnails $this->_sortThumbnails($thumbs, $parameter->get('order', 'asc')); // limit thumbnails to count $count = intval($parameter->get('count', 0)); if ($count > 0 && $count < count($thumbs)) { $thumbs = array_slice($thumbs, 0, $count); } // add css and javascript JHTML::script('gallery.js', 'administrator/components/com_zoo/elements/gallery/assets/js/'); JHTML::stylesheet('style.css', 'administrator/components/com_zoo/elements/gallery/assets/css/'); // load lightbox if ($parameter->get('load_lightbox', 0)) { // add javascript and css if (JPluginHelper::isEnabled('system', 'mtupgrade')) { JHTML::script('slimbox_packed.js', 'administrator/components/com_zoo/elements/gallery/assets/lightbox/'); JHTML::stylesheet('slimbox.css', 'administrator/components/com_zoo/elements/gallery/assets/lightbox/css/'); } else { JHTML::script('slimbox_packed.js', 'administrator/components/com_zoo/elements/gallery/assets/mootools_old/lightbox/'); JHTML::stylesheet('slimbox.css', 'administrator/components/com_zoo/elements/gallery/assets/mootools_old/lightbox/css/'); } } // init template vars static $gallery_count = 1; $gallery_id = 'zoo-gallery-' . $gallery_count++; // render layout $mode = $parameter->get('mode', 'lightbox'); $thumb = $parameter->get('thumb', 'default'); $spotlight = $parameter->get('spotlight', 0); $effect = $parameter->get('effect', 'fade'); $rel = $parameter->get('rel', ''); if ($layout = $this->getLayout($mode . '.php')) { return self::renderLayout($layout, compact('thumbs', 'gallery_id', 'mode', 'thumb', 'spotlight', 'effect', 'rel')); } return null; }
public function render($params = array()) { // get modules $modules = self::_load(); $value = $this->_data->get('value'); if ($value && isset($modules[$value])) { if ($modules[$value]->published) { $rendered = JModuleHelper::renderModule($modules[$value]); if (isset($modules[$value]->params)) { $module_params = new YParameter(); $module_params->loadString($modules[$value]->params); if ($moduleclass_sfx = $module_params->get('moduleclass_sfx')) { $html[] = '<div class="' . $moduleclass_sfx . '">'; $html[] = $rendered; $html[] = '</div>'; return implode("\n", $html); } } return $rendered; } } return null; }
public function getParams($for = null) { // get params if (empty($this->_params)) { $this->_params = new YParameter(); $this->_params->loadString($this->params); } // get site params and inherit globals if ($for == 'site') { $site_params = new YParameter(); $site_params->set('config.', $this->getApplication()->getParams()->get('global.config.')); $site_params->set('template.', $this->getApplication()->getParams()->get('global.template.')); $site_params->loadArray($this->_params->toArray()); return $site_params; } return $this->_params; }
protected function _setMenuItems() { if (self::$_menu_items == null) { $component = JComponentHelper::getComponent('com_zoo'); $menus = JSite::getMenu(); $menu_items = $menus->getItems('componentid', $component->id); $menu_items = $menu_items ? $menu_items : array(); self::$_menu_items = array('frontpage' => array(), 'category' => array(), 'item' => array()); $params = new YParameter(); foreach ($menu_items as $menu_item) { switch (@$menu_item->query['view']) { case 'frontpage': self::$_menu_items['frontpage'][$params->loadString($menu_item->params)->get('application')] = $menu_item; break; case 'category': self::$_menu_items['category'][$params->loadString($menu_item->params)->get('category')] = $menu_item; break; case 'item': self::$_menu_items['item'][$params->loadString($menu_item->params)->get('item_id')] = $menu_item; break; } } } return self::$_menu_items; }
if ($name = JFactory::getUser($this->item->created_by)->name) { echo $name; } else { echo JText::_('Guest'); } } ?> </td> </tr> </table> <?php // get item xml form $form = new YParameterFormDefault(dirname(__FILE__) . '/params.xml'); // set details parameter $details = new YParameter(); $details->set('created_by', $this->item->created_by == '' ? JFactory::getUser()->id : 'NO_CHANGE'); $details->set('access', $this->item->access); $details->set('created_by_alias', $this->item->created_by_alias); $details->set('created', JHTML::_('date', $this->item->created, '%Y-%m-%d %H:%M:%S')); $details->set('publish_up', JHTML::_('date', $this->item->publish_up, '%Y-%m-%d %H:%M:%S')); $details->set('publish_down', JHTML::_('date', $this->item->publish_down, '%Y') <= 1969 || $this->item->publish_down == $this->db->getNullDate() ? JText::_('Never') : JHTML::_('date', $this->item->publish_down, '%Y-%m-%d %H:%M:%S')); ?> <div id="parameter-accordion"> <h3 class="toggler"><?php echo JText::_('Details'); ?> </h3> <div class="content"> <?php
public static function getTwitterClient() { // get comment params $params = new YParameter(); $params->loadArray(Zoo::getApplication()->getParams()->get('global.comments.')); if (!function_exists('curl_init')) { return null; } // load twitter classes JLoader::register('TwitterOAuth', ZOO_ADMIN_PATH . '/libraries/twitter/twitteroauth.php'); $oauth_token = null; $oauth_token_secret = null; if (isset($_SESSION['twitter_oauth_token']) && isset($_SESSION['twitter_oauth_token_secret'])) { $oauth_token = $_SESSION['twitter_oauth_token']; $oauth_token_secret = $_SESSION['twitter_oauth_token_secret']; } // Build TwitterOAuth object with client credentials. return new TwitterOAuth($params->get('twitter_consumer_key'), $params->get('twitter_consumer_secret'), $oauth_token, $oauth_token_secret); }