public function getItems()
 {
     if ($items = parent::getItems()) {
         $component = JComponentHelper::getComponent('com_tz_portfolio_plus');
         $menus = JMenu::getInstance('site');
         $menu_assigned = array();
         if ($menu_items = $menus->getItems(array('component_id'), $component->id)) {
             if (count($menu_items)) {
                 foreach ($menu_items as $m) {
                     if (isset($m->params)) {
                         $params = $m->params;
                         if ($tpl_style_id = $params->get('tz_template_style_id')) {
                             if (!isset($menu_assigned[$tpl_style_id])) {
                                 $menu_assigned[$tpl_style_id] = 0;
                             }
                             $menu_assigned[$tpl_style_id]++;
                         }
                     }
                 }
             }
         }
         foreach ($items as $i => &$item) {
             $item->menu_assigned = 0;
             if (isset($menu_assigned[$item->id])) {
                 $item->menu_assigned = $menu_assigned[$item->id];
             }
         }
         return $items;
     }
     return false;
 }
示例#2
0
 function display($tpl = null)
 {
     global $option, $mainframe;
     $model =& $this->getModel();
     $menu =& JMenu::getInstance('site');
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     //get controller
     $controller = new VnffhotelController();
     $cityid = $params->get('cityid', '1');
     $cityid = JRequest::getVar('cityid', $cityid);
     //if($cityid==1)
     $hotels = $model->getHotelsByCity($cityid);
     $pagination = $model->getPagination();
     for ($i = 0; $i < count($hotels); $i++) {
         $hotels[$i]->images = $model->getHotelImages($hotels[$i]->hotel_ID, 'm');
         if (count($hotels[$i]->images) == 0) {
             $image->image_Name = "noimage.png";
             $hotels[$i]->images[0] = $image;
         }
         $hotels[$i]->shortDes = $controller->cutDes($hotels[$i]->Overview, 30);
         $hotels[$i]->linkToHotel = $controller->linkToHotel($hotels[$i]->hotel_ID);
     }
     //get controller
     $mainframe->setPageTitle(JTEXT::_("HOTELS IN") . " " . $hotels[0]->city_Name);
     //echo $hotels[0]->images[0]->image_Name;
     //echo $hotels[0]->city_ID."hehehejhe";
     $this->assignRef('hotels', $hotels);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('controller', $controller);
     //echo $this->cutDes("thang nay khung qua di thoi");
     parent::display($tpl);
 }
示例#3
0
 function &getMenu()
 {
     jimport('joomla.application.menu');
     $options = array();
     $menu =& JMenu::getInstance('site', $options);
     if (JError::isError($menu)) {
         $null = null;
         return $null;
     }
     return $menu;
 }
 function __construct()
 {
     $this->alltimepoints = JRequest::getVar("points", 0);
     $menu =& JMenu::getInstance('site');
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     //$menu = &JSite::getMenu();
     $show_debug_info = JComponentHelper::getParams('com_joomleague')->get('show_debug_info', 0);
     if ($show_debug_info) {
         $this->debug_info = true;
     } else {
         $this->debug_info = false;
     }
     if ($item->id) {
         // diddipoeler
         // menueeintrag vorhanden
         $registry = new JRegistry();
         $registry->loadArray($params);
         //$newparams = $registry->toString('ini');
         $newparams = $registry->toArray();
         //echo "<b>menue newparams</b><pre>" . print_r($newparams, true) . "</pre>";
         foreach ($newparams['data'] as $key => $value) {
             $this->_params[$key] = $value;
         }
     } else {
         $strXmlFile = JLG_PATH_SITE . DS . 'settings' . DS . 'default' . DS . 'rankingalltime.xml';
         // get the JForm object
         $form =& JForm::getInstance('jlattform', $strXmlFile);
         //echo "<b>menue form</b><pre>" . print_r($form, true) . "</pre>";
         foreach ($form->getFieldset($fieldset->name) as $field) {
             //         echo ' -> '. $field->name.'<br>';
             //         echo ' -> '. $field->type.'<br>';
             //         echo ' -> '. $field->input.'<br>';
             $this->_params[$field->name] = $field->value;
         }
         /*
         $registry = new JRegistry();
         $registry->loadArray($strXmlFile);
         //$newparams = $registry->toString('ini');
         $newparams = $registry->toArray();
         
         //echo "<b>menue newparams</b><pre>" . print_r($newparams, true) . "</pre>";  
         
         foreach ($newparams['data'] as $key => $value ) {
             
             $this->_params[$key] = $value;
         }
         */
     }
     parent::__construct();
 }
 /**
  * 
  * 
  */
 public function getParams($pks)
 {
     $app = JFactory::getApplication('site');
     $siteMenu = JMenu::getInstance('site');
     $menuParams = $siteMenu->getItem($pks['Itemid']);
     if (isset($menuParams->params)) {
         $params = $menuParams->params;
     } else {
         $params = $this->getState()->get('params');
     }
     $JSNConfig = JSNFactory::getConfig();
     $JSNConfig->megreGlobalParams($pks['option'], $params);
     return $params;
 }
示例#6
0
 function display($tpl = null)
 {
     global $option, $mainframe;
     //echo $next2day["mday"];
     $menu =& JMenu::getInstance('site');
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $hotelid = $params->get('hotelid', '');
     ///echo "o".$hotelid."o";
     $model =& $this->getModel();
     $hid = JRequest::getVar('hid', $hotelid);
     //echo JPATH_COMPONENT.DS;
     $today = getdate();
     $next2day = getdate(($today["0"] / (60 * 60 * 24) + 2) * (60 * 60 * 24));
     $checkin_date = JRequest::getVar('checkin_date', $today["mday"] . '/' . $today["mon"] . '/' . $today["year"]);
     $checkout_date = JRequest::getVar('checkout_date', $next2day["mday"] . '/' . $next2day["mon"] . '/' . $next2day["year"]);
     //echo $checkout_date;
     //echo $model;
     $hotel = $model->getHotelDetails($hid);
     $rates = $model->getRatesAll($hid);
     $promotions = $model->getPromotions($hid);
     //echo $rates[0]->room_Name;
     $tab_selected = JRequest::getVar('stab', '0');
     //echo $tab_selected;
     //get controller
     $controller = new VnffhotelController();
     $mainframe->setPageTitle($hotel->hotel_Name);
     //echo $hotel->hotel_ID;
     //echo "huhuhu";
     $images->main = $model->getHotelImages($hid, 'm');
     if (count($images->main) == 0) {
         $image->image_Name = "noimage.png";
         $images->main[0] = $image;
     }
     $images->overview = $model->getHotelImages($hid, 'o');
     $images->facility = $model->getHotelImages($hid, 'f');
     $images->room = $model->getHotelImages($hid, 'r');
     $this->assignRef('hotel', $hotel);
     $this->assignRef('images', $images);
     $this->assignRef('promotions', $promotions);
     $this->assignRef('tab_selected', $tab_selected);
     $this->assignRef('controller', $controller);
     $this->assignRef('checkin_date', $checkin_date);
     $this->assignRef('checkout_date', $checkout_date);
     if ($hid == '') {
         echo "<div class='invalid_hotel'>" . JTEXT::_("INVALID HOTEL..!!") . "</div>";
     } else {
         parent::display($tpl);
     }
 }
示例#7
0
 function step1()
 {
     global $option, $mainframe;
     $mainframe->setPageTitle(JTEXT::_("STEP 1"));
     $model =& $this->getModel();
     $hid = JRequest::getVar('hid', '');
     if ($hid == '') {
         echo '<div class="invalid_hotel">' . JTEXT::_("INVALID HOTEL...!") . '</div>';
         return;
     }
     $menu =& JMenu::getInstance('site');
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     //get controller
     $controller = new VnffhotelController();
     $today = getdate();
     $next2day = getdate(($today["0"] / (60 * 60 * 24) + 2) * (60 * 60 * 24));
     $checkin_date = JRequest::getVar('checkin_date', $today["mday"] . '/' . $today["mon"] . '/' . $today["year"]);
     $checkout_date = JRequest::getVar('checkout_date', $next2day["mday"] . '/' . $next2day["mon"] . '/' . $next2day["year"]);
     $room_id = JRequest::getVar('room_id', '');
     $checkin_date_r = explode('/', $checkin_date);
     $checkout_date_r = explode('/', $checkout_date);
     //$checkin_date = getdate(mktime(0, 0, 0, $checkin_date_r[1], $checkin_date_r[0], $checkin_date_r[2]));
     $days_count = round((-mktime(0, 0, 0, $checkin_date_r[1], $checkin_date_r[0], $checkin_date_r[2]) + mktime(0, 0, 0, $checkout_date_r[1], $checkout_date_r[0], $checkout_date_r[2])) / (60 * 60 * 24), 0);
     if ($days_count < 1) {
         $checkin_date = $today["mday"] . '/' . $today["mon"] . '/' . $today["year"];
         $checkout_date = $next2day["mday"] . '/' . $next2day["mon"] . '/' . $next2day["year"];
         $days_count = 2;
     }
     //get controller
     //$controller = new VnffhotelController();
     //get rooms types of a hotel
     $roomTypes = $model->getRoomTypes($hid);
     if (count($roomTypes) == 0) {
         echo '<div class="notroom_hotel">' . JTEXT::_("HOTEL NOT YET FOR BOOKING") . '</div>';
         return;
     }
     $hotel = $model->getHotel($hid);
     //echo $roomTypes[0]->room_Name;
     //$cityid = $params->get('cityid', '32');
     $this->assignRef('controller', $controller);
     $this->assignRef('checkin_date', $checkin_date);
     $this->assignRef('checkout_date', $checkout_date);
     $this->assignRef('room_id', $room_id);
     $this->assignRef('roomTypes', $roomTypes);
     $this->assignRef('hotel', $hotel);
     $this->assignRef('days_count', $days_count);
     parent::display("step1");
 }
 /**
  * Method to get the field input markup.
  *
  * @return  string	The field input markup.
  * @since   1.6
  */
 protected function getInput()
 {
     $app = JFactory::getApplication();
     $options = array();
     $module_id = $app->input->getInt('id');
     $menus = JMenu::getInstance('site');
     $menu_id = null;
     $menuItems = array();
     foreach ($menus->getMenu() as $item) {
         if ($item->type == 'component') {
             if (isset($item->query['option']) && $item->query['option'] == 'com_j2store') {
                 if (isset($item->query['catid'])) {
                     $options[$item->id] = $item->title;
                 }
             }
         }
     }
     return JHTML::_('select.genericlist', $options, $this->name, array('class' => "input"), 'value', 'text', $this->value);
 }
 function __construct()
 {
     $comp_config =& JComponentHelper::getParams('com_imagebrowser');
     $config['root_folder'] = $comp_config->get('root_folder', 'images/stories/imagebrowser');
     $config['order_by'] = $comp_config->get('order_by', 'date_modified');
     $config['order_direction'] = $comp_config->get('order_direction', 'DESC');
     $config['show_comp_description'] = $comp_config->get('show_comp_description', 1);
     $config['comp_description'] = $comp_config->get('comp_description', '');
     $config['language'] = $comp_config->get('language', '');
     $config['max_width'] = $comp_config->get('max_width', 800);
     $config['max_height'] = $comp_config->get('max_height', 600);
     $config['thumb_width'] = $comp_config->get('thumb_width', 120);
     $config['thumb_height'] = $comp_config->get('thumb_height', 90);
     $config['imgcomp'] = $comp_config->get('imgcomp', 0);
     $config['max_upload_size'] = $comp_config->get('max_upload_size', 2);
     // The mode is read from menu item (for frontend only)
     $menu =& JMenu::getInstance('site');
     $item = $menu->getActive();
     if (is_object($item)) {
         $params =& $menu->getParams($item->id);
         $config['mode'] = $params->get('mode', false);
         $config['page_title'] = $params->get('page_title', '');
         $config['show_page_title'] = $params->get('show_page_title', 0);
         $config['pageclass_sfx'] = $params->get('pageclass_sfx', '');
         // Override global component settings with menu item settings
         $config['root_folder'] = $params->get('root_folder', $config['root_folder']);
         $config['order_by'] = $params->get('order_by', $config['order_by']);
         $config['order_direction'] = $params->get('order_direction', $config['order_direction']);
         $config['show_comp_description'] = $params->get('show_comp_description', $config['show_comp_description']);
         $config['comp_description'] = $params->get('comp_description', $config['comp_description']);
         $config['language'] = $params->get('language', $config['language']);
         $config['max_width'] = $params->get('max_width', $config['max_width']);
         $config['max_height'] = $params->get('max_height', $config['max_height']);
         $config['thumb_width'] = $params->get('thumb_width', $config['thumb_width']);
         $config['thumb_height'] = $params->get('thumb_height', $config['thumb_height']);
         $config['imgcomp'] = $params->get('imgcomp', $config['imgcomp']);
         $config['max_upload_size'] = $params->get('max_upload_size', $config['max_upload_size']);
     }
     $this->config = $config;
 }
示例#10
0
 protected static function _getItemid($view = 'galleries', $id = 0, $default = 0)
 {
     $item = null;
     $menu = JMenu::getInstance('site');
     if ($id && ($items = $menu->getItems('link', 'index.php?option=com_fwgallery&view=' . $view))) {
         foreach ($items as $menuItem) {
             if (is_string($menuItem->params) && preg_match('/id\\=' . $id . '\\s/ms', $menuItem->params) || is_object($menuItem->params) && $id == $menuItem->params->get('id')) {
                 $item = $menuItem;
                 break;
             }
         }
     }
     if ($item === null) {
         $item = $menu->getItems('link', 'index.php?option=com_fwgallery&view=galleries', true);
     }
     if ($item) {
         return $item->id;
     } elseif ($default) {
         return $default;
     } elseif ($item = $menu->getActive()) {
         return $item->id;
     }
 }
 function __construct()
 {
     $this->projectid = JRequest::getInt("p", 0);
     $menu =& JMenu::getInstance('site');
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $registry = new JRegistry();
     $registry->loadArray($params);
     //$newparams = $registry->toString('ini');
     $newparams = $registry->toArray();
     //echo "<b>menue newparams</b><pre>" . print_r($newparams, true) . "</pre>";
     foreach ($newparams['data'] as $key => $value) {
         $this->_params[$key] = $value;
     }
     // 		$this->round = JRequest::getInt( "r", $this->current_round);
     // 		$this->part  = JRequest::getInt( "part", 0);
     // 		$this->from  = JRequest::getInt( 'from', $this->round );
     // 		$this->to	 = JRequest::getInt( 'to', $this->round);
     // 		$this->type  = JRequest::getInt( 'type', 0 );
     // 		$this->last  = JRequest::getInt( 'last', 0 );
     // 		$this->selDivision = JRequest::getInt( 'division', 0 );
     parent::__construct();
 }
示例#12
0
 function display($tpl = null)
 {
     global $option, $mainframe;
     $model =& $this->getModel();
     $menu =& JMenu::getInstance('site');
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     //get controller
     $controller = new VnffhotelController();
     $hotel_keywords = JRequest::getVar('hotel_keywords', '');
     $destination = JRequest::getVar('destination', '-1');
     $stars = JRequest::getVar('stars', '-1');
     $prices = JRequest::getVar('prices', '0_9999');
     //$cityid = $params->get('cityid', '32');
     $hotels = $model->getHotels($hotel_keywords, $destination, $stars, $prices);
     $pagination = $model->getPagination();
     $cities = $model->getCities();
     $mainframe->setPageTitle(JTEXT::_("SEARCH"));
     for ($i = 0; $i < count($hotels); $i++) {
         $hotels[$i]->images = $model->getHotelImages($hotels[$i]->hotel_ID, 'm');
         if (count($hotels[$i]->images) == 0) {
             $image->image_Name = "noimage.png";
             $hotels[$i]->images[0] = $image;
         }
         $hotels[$i]->shortDes = $controller->cutDes($hotels[$i]->Overview, 30);
         $hotels[$i]->linkToHotel = $controller->linkToHotel($hotels[$i]->hotel_ID);
         $hotels[$i]->hotel_Name = str_ireplace($hotel_keywords, '<span id="hightlight" >' . $hotel_keywords . '</span>', $hotels[$i]->hotel_Name);
     }
     //echo $hotels[0]->images[0]->image_Name;
     //echo $hotels[0]->city_ID."hehehejhe";
     $this->assignRef('hotels', $hotels);
     $this->assignRef('cities', $cities);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('controller', $controller);
     //echo $this->cutDes("thang nay khung qua di thoi");
     parent::display($tpl);
 }
示例#13
0
 public function createMenu($menu, $submenu)
 {
     jimport('joomla.utilities.string');
     jimport('joomla.application.component.helper');
     $component_id = JComponentHelper::getComponent('com_judirectory')->id;
     $db = JFactory::getDbo();
     $query = "UPDATE #__menu SET component_id=" . $db->quote($component_id) . " WHERE type = 'component' AND link LIKE '%option=com_judirectory%'";
     $db->setQuery($query);
     $db->execute();
     if ($db->getErrorNum()) {
         throw new Exception($db->getErrorMsg(), $db->getErrorNum());
     }
     $table = JTable::getInstance('MenuType');
     $data = array('menutype' => 'judirectorymenu', 'title' => 'JU Directory', 'description' => '');
     if (!$table->bind($data) || !$table->check()) {
         return true;
     }
     if (!$table->store()) {
         throw new Exception($table->getError());
     }
     $table = JTable::getInstance('menu');
     $table->load(array('menutype' => 'judirectorymenu', 'link' => $menu['link']));
     $paramdata = array('menu-anchor_title' => '', 'menu-anchor_css' => '', 'menu_image' => '', 'menu_text' => 1, 'page_title' => '', 'show_page_heading' => 0, 'page_heading' => '', 'pageclass_sfx' => '', 'menu-meta_description' => '', 'menu-meta_keywords' => '', 'robots' => '', 'secure' => 0);
     $gparams = new JRegistry($paramdata);
     $params = clone $gparams;
     $params->loadArray($menu['params']);
     $data = array('menutype' => 'judirectorymenu', 'title' => $menu['name'], 'alias' => $menu['alias'], 'link' => $menu['link'], 'type' => 'component', 'published' => 1, 'parent_id' => 1, 'component_id' => $component_id, 'access' => $menu['access'], 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
     $table->setLocation(1, 'last-child');
     if (!$table->bind($data) || !$table->check() || !$table->store()) {
         $table->alias = 'joomultra-directory';
         if (!$table->check() || !$table->store()) {
             throw new Exception($table->getError());
         }
     }
     $parent = $table;
     foreach ($submenu as $menuitem) {
         $params = clone $gparams;
         $params->loadArray($menuitem['params']);
         $table = JTable::getInstance('menu');
         $table->load(array('menutype' => 'judirectorymenu', 'link' => $menuitem['link']));
         $data = array('menutype' => 'judirectorymenu', 'title' => $menuitem['name'], 'alias' => $menuitem['alias'], 'link' => $menuitem['link'], 'type' => 'component', 'published' => 1, 'parent_id' => $parent->id, 'component_id' => $component_id, 'access' => $menuitem['access'], 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
         $table->setLocation($parent->id, 'last-child');
         if (!$table->bind($data) || !$table->check() || !$table->store()) {
             throw new Exception($table->getError());
         }
     }
     $defaultmenu = JMenu::getInstance('site')->getDefault();
     if (!$defaultmenu) {
         return true;
     }
     $table = JTable::getInstance('menu');
     $table->load(array('menutype' => $defaultmenu->menutype, 'type' => 'alias', 'title' => 'JU Directory'));
     if (!$table->id) {
         $data = array('menutype' => $defaultmenu->menutype, 'title' => 'JU Directory', 'alias' => 'judirectory-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'type' => 'alias', 'published' => 0, 'parent_id' => 1, 'component_id' => 0, 'access' => 1, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}', 'home' => 0, 'language' => '*', 'client_id' => 0);
         $table->setLocation(1, 'last-child');
     } else {
         $data = array('alias' => 'judirectory-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}');
     }
     if (!$table->bind($data) || !$table->check() || !$table->store()) {
         throw new Exception($table->getError());
     }
     return true;
 }
 /**
  * Saves data to the core menu table
  *
  * @param string $title
  * @param string $description
  * @param string $keywords
  */
 private function saveDataToTableMenu($title, $description, $keywords)
 {
     $menu = JMenu::getInstance('site')->getActive();
     // Check whether menu entry for the specific item exists - e.g. do not overwrite data of blog entry
     foreach ($menu->query as $key => $value) {
         if ($value != $this->request->get($key, 'cmd')) {
             return;
         }
     }
     $menu_params_array = JMenu::getInstance('site')->getParams($menu->id)->toArray();
     $save_data_table_menu = $this->params->get('save_data_table_menu');
     $title_array = array(1, 4, 5, 7);
     $description_array = array(2, 4, 6, 7);
     $keywords_array = array(3, 5, 6, 7);
     if (in_array($save_data_table_menu, $title_array)) {
         $menu_params_array['page_title'] = $title;
     }
     if (in_array($save_data_table_menu, $description_array)) {
         $menu_params_array['menu-meta_description'] = $description;
     }
     if (in_array($save_data_table_menu, $keywords_array)) {
         $menu_params_array['menu-meta_keywords'] = $keywords;
     }
     $menu_params = json_encode($menu_params_array);
     $query = "UPDATE " . $this->db->quoteName('#__menu') . " SET " . $this->db->quoteName('params') . " = " . $this->db->quote($menu_params) . " WHERE " . $this->db->quoteName('id') . " = " . $this->db->quote((int) $this->request->get('Itemid'));
     $this->db->setQuery($query);
     $this->db->execute();
 }
示例#15
0
 protected function _setHomepage($id)
 {
     if (!$id) {
         return;
     }
     $app = JFactory::getApplication();
     $menu = JMenu::getInstance('site');
     $home = $menu->getDefault();
     $my = $menu->getItem($id);
     $path = substr(JURI::getInstance()->getPath(), 1);
     // todo: need to be improved!
     if (!(!$path || $path == 'index.php/' . @$my->alias || $path == @$my->alias . '.html')) {
         $home->title = @$my->title;
     } else {
         $home->id = @$my->id;
         $home->title = @$my->title;
         $home->type = @$my->type;
         $home->access = @$my->access;
         $home->component = @$my->component;
         $home->component_id = @$my->component_id;
         $home->link = @$my->link;
         $home->params = @$my->params;
         $home->query = @$my->query;
     }
 }
示例#16
0
 public function ajaxComments()
 {
     $input = JFactory::getApplication()->input;
     $data = json_decode(base64_decode($input->getString('url')));
     $id = json_decode(base64_decode($input->getString('id')));
     if ($data) {
         require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'phpclass' . DIRECTORY_SEPARATOR . 'http_fetcher.php';
         require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'phpclass' . DIRECTORY_SEPARATOR . 'readfile.php';
         $params = JComponentHelper::getParams('com_tz_portfolio_plus');
         $Itemid = $input->getInt('Itemid');
         $menu = JMenu::getInstance('site');
         $menuParams = $menu->getParams($Itemid);
         $params->merge($menuParams);
         $threadLink = null;
         $_id = null;
         if (is_array($data) && count($data)) {
             foreach ($data as $i => &$contentUrl) {
                 if (!preg_match('/http\\:\\/\\//i', $contentUrl)) {
                     $uri = JUri::getInstance();
                     $contentUrl = $uri->getScheme() . '://' . $uri->getHost() . $contentUrl;
                 }
                 if (preg_match('/(.*?)(\\?tmpl\\=component)|(\\&tmpl\\=component)/i', $contentUrl)) {
                     $contentUrl = preg_replace('/(.*?)(\\?tmpl\\=component)|(\\&tmpl\\=component)/i', '$1', $contentUrl);
                 }
                 $_id[$contentUrl] = $id[$i];
                 if ($params->get('tz_comment_type', 'disqus') == 'facebook') {
                     $threadLink .= '&urls[]=' . $contentUrl;
                 } elseif ($params->get('tz_comment_type', 'disqus') == 'disqus') {
                     $threadLink .= '&thread[]=link:' . $contentUrl;
                 }
             }
         }
         if (!is_array($data)) {
             $threadLink = $data;
         }
         $fetch = new Services_Yadis_Plainhttp_fetcher();
         $comments = null;
         if ($params->get('tz_show_count_comment', 1) == 1) {
             // From Facebook
             if ($params->get('tz_comment_type', 'disqus') == 'facebook') {
                 if ($threadLink) {
                     $url = 'http://api.facebook.com/restserver.php?method=links.getStats' . $threadLink;
                     $content = $fetch->get($url);
                     if ($content) {
                         if ($bodies = $content->body) {
                             if (preg_match_all('/\\<link_stat\\>(.*?)\\<\\/link_stat\\>/ims', $bodies, $matches)) {
                                 if (isset($matches[1]) && !empty($matches[1])) {
                                     foreach ($matches[1] as $val) {
                                         $match = null;
                                         if (preg_match('/\\<url\\>(.*?)\\<\\/url\\>.*?\\<comment_count\\>(.*?)\\<\\/comment_count\\>/msi', $val, $match)) {
                                             if (isset($match[1]) && isset($match[2])) {
                                                 if (in_array($match[1], $data)) {
                                                     $comments[$_id[$match[1]]] = $match[2];
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // Disqus Comment count
             if ($params->get('tz_comment_type', 'disqus') == 'disqus') {
                 $url = 'https://disqus.com/api/3.0/threads/list.json?api_secret=' . $params->get('disqusApiSecretKey', '4sLbLjSq7ZCYtlMkfsG7SS5muVp7DsGgwedJL5gRsfUuXIt6AX5h6Ae6PnNREMiB') . '&forum=' . $params->get('disqusSubDomain', 'templazatoturials') . $threadLink . '&include=open';
                 if ($_content = $fetch->get($url)) {
                     $body = json_decode($_content->body);
                     if (isset($body->response)) {
                         if ($responses = $body->response) {
                             foreach ($responses as $response) {
                                 if (in_array($response->link, $data)) {
                                     $comments[$_id[$response->link]] = $response->posts;
                                 }
                             }
                         }
                     }
                 }
             }
             if ($comments) {
                 if (is_array($comments)) {
                     return json_encode($comments);
                 }
                 return 0;
             }
             return 0;
         }
     }
 }
示例#17
0
 /**
  * Returns the application JMenu object.
  *
  * @param   string  $name     The name of the application/client.
  * @param   array   $options  An optional associative array of configuration settings.
  *
  * @return  JMenu|null
  *
  * @since   3.2
  */
 public function getMenu($name = null, $options = array())
 {
     if (!isset($name)) {
         $name = $this->getName();
     }
     // Inject this application object into the JMenu tree if one isn't already specified
     if (!isset($options['app'])) {
         $options['app'] = $this;
     }
     try {
         $menu = JMenu::getInstance($name, $options);
     } catch (Exception $e) {
         return null;
     }
     return $menu;
 }
示例#18
0
    function display($tpl = null)
    {
        JHtml::_('behavior.framework');
        $menus = JMenu::getInstance('site');
        $active = $menus->getActive();
        $state = $this->get('State');
        $_params = $state->get('params');
        $params = $this->get('Params');
        if ($params->get('fields_option_order')) {
            switch ($params->get('fields_option_order')) {
                case 'alpha':
                    $fieldsOptionOrder = 't.value ASC';
                    break;
                case 'ralpha':
                    $fieldsOptionOrder = 't.value DESC';
                    break;
                case 'ordering':
                    $fieldsOptionOrder = 't.ordering ASC';
                    break;
            }
            if (isset($fieldsOptionOrder)) {
                $this->extraFields->setState('filter.option.order', $fieldsOptionOrder);
            }
        }
        $list = $this->get('Article');
        $this->assign('listsArticle', $list);
        if ($params->get('show_all_filter', 0)) {
            $this->assign('listsTags', $this->get('AllTags'));
            $this->assign('listsCategories', $this->get('AllCategories'));
        } else {
            $this->assign('listsTags', $this->get('Tags'));
            $this->assign('listsCategories', $this->get('Categories'));
        }
        // Set value again for option tz_portfolio_redirect
        if ($_params->get('tz_portfolio_redirect') == 'default') {
            $_params->set('tz_portfolio_redirect', 'article');
        }
        //Escape strings for HTML output
        $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
        if ($active) {
            $params->def('page_heading', $params->get('page_title', $active->title));
        } else {
            $params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
        }
        $this->assign('listsCatDate', $this->get('DateCategories'));
        $this->assign('params', $_params);
        $this->assign('pagination', $this->get('Pagination'));
        $this->assign('Itemid', $active->id);
        $this->assign('limitstart', $state->get('list.start'));
        $model = JModelLegacy::getInstance('Portfolio', 'TZ_PortfolioModel', array('ignore_request' => true));
        $model->setState('params', $params);
        $this->assign('char', $state->get('char'));
        $this->assign('availLetter', $model->getAvailableLetter());
        $params = $this->get('Params');
        $csscompress = null;
        if ($params->get('css_compression', 0)) {
            $csscompress = '.min';
        }
        $jscompress = new stdClass();
        $jscompress->extfile = null;
        $jscompress->folder = null;
        if ($params->get('js_compression', 1)) {
            $jscompress->extfile = '.min';
            $jscompress->folder = '/packed';
        }
        $doc = JFactory::getDocument();
        if ($params->get('tz_timeline_layout', null) == 'classic') {
            $doc->addStyleSheet('components/com_tz_portfolio/css/timeline_classic.min.css');
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/jquery.easing.1.3.min.js"></script>');
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/modernizr.custom.11333.min.js"></script>');
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/blog.min.js"></script>');
            $doc->addCustomTag('<script type="text/javascript">
                jQuery(document).ready(function(){
                    jQuery().tzSlideScroll({
                        scollPageSpeed: ' . $params->get('classic_page_speed', 2000) . ',
                        scollPageEasing: "' . $params->get('classic_page_easing') . '",
                        hasPerspective: ' . $params->get('classic_perspective', 0) . '
                    });
                });
            </script>');
        } else {
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/jquery.infinitescroll.min.js"></script>');
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/jquery.isotope.min.js"></script>');
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/html5.js"></script>');
            $doc->addStyleSheet('components/com_tz_portfolio/css/isotope.min.css');
        }
        if ($params->get('tz_use_image_hover', 1) == 1) {
            $doc->addStyleDeclaration('
                .tz_image_hover{
                    opacity: 0;
                    position: absolute;
                    top:0;
                    left: 0;
                    transition: opacity ' . $params->get('tz_image_timeout', 0.35) . 's ease-in-out;
                   -moz-transition: opacity ' . $params->get('tz_image_timeout', 0.35) . 's ease-in-out;
                   -webkit-transition: opacity ' . $params->get('tz_image_timeout', 0.35) . 's ease-in-out;
                }
                .tz_image_hover:hover{
                    opacity: 1;
                    margin: 0;
                }
            ');
        }
        if ($params->get('tz_timeline_layout', null) != 'classic') {
            if ($params->get('tz_portfolio_layout') == 'ajaxButton' || $params->get('tz_portfolio_layout') == 'ajaxInfiScroll') {
                if ($params->get('tz_portfolio_layout') == 'ajaxButton') {
                    $doc->addStyleDeclaration('
                        #infscr-loading {
                            position: absolute;
                            padding: 0;
                            left: 35%;
                            bottom:0;
                            background:none;
                        }
                        #infscr-loading div,#infscr-loading img{
                            display:inline-block;
                        }
                    ');
                }
                if ($params->get('tz_portfolio_layout') == 'ajaxInfiScroll') {
                    $doc->addStyleDeclaration('
                        #tz_append{
                            cursor: auto;
                        }
                        #tz_append a{
                            color:#000;
                            cursor:auto;
                        }
                        #tz_append a:hover{
                            color:#000 !important;
                        }
                        #infscr-loading {
                            position: absolute;
                            padding: 0;
                            left: 38%;
                            bottom:-35px;
                        }

                    ');
                }
            }
        }
        if ($params->get('tz_use_lightbox', 1) == 1) {
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/jquery.fancybox.pack.js"></script>');
            $doc->addStyleSheet('components/com_tz_portfolio/css/fancybox.min.css');
            $width = null;
            $height = null;
            $autosize = null;
            if ($params->get('tz_lightbox_width')) {
                if (preg_match('/%|px/', $params->get('tz_lightbox_width'))) {
                    $width = 'width:\'' . $params->get('tz_lightbox_width') . '\',';
                } else {
                    $width = 'width:' . $params->get('tz_lightbox_width') . ',';
                }
            }
            if ($params->get('tz_lightbox_height')) {
                if (preg_match('/%|px/', $params->get('tz_lightbox_height'))) {
                    $height = 'height:\'' . $params->get('tz_lightbox_height') . '\',';
                } else {
                    $height = 'height:' . $params->get('tz_lightbox_height') . ',';
                }
            }
            if ($width || $height) {
                $autosize = 'fitToView: false,autoSize: false,';
            }
            $scrollHidden = null;
            if ($params->get('use_custom_scrollbar', 1)) {
                $scrollHidden = ',scrolling: "no"
                                    ,iframe: {
                                        scrolling : "no",
                                    }';
            }
            $doc->addCustomTag('<script type="text/javascript">
                jQuery(\'.fancybox\').fancybox({
                    type:\'iframe\',
                    openSpeed:' . $params->get('tz_lightbox_speed', 350) . ',
                    openEffect: "' . $params->get('tz_lightbox_transition', 'elastic') . '",
                    ' . $width . $height . $autosize . '
		            helpers:  {
                        title : {
                            type : "inside"
                        },
                        overlay : {
                            css : {background: "rgba(0,0,0,' . $params->get('tz_lightbox_opacity', 0.75) . ')"}
                        }
                    }' . $scrollHidden . '
                });
                </script>
            ');
        }
        if ($layout = $params->get('tz_timeline_layout', 'default')) {
            if ($layout == 'default') {
                $doc->addStyleSheet('components/com_tz_portfolio/css/tzportfolio.min.css');
                if ($params->get('comment_function_type', 'default') == 'js') {
                    if ($params->get('tz_show_count_comment', 1)) {
                        if ($params->get('tz_comment_type') == 'facebook' || $params->get('tz_comment_type') == 'disqus') {
                            $doc->addCustomTag('<script src="components/com_tz_portfolio/js' . '/base64.js" type="text/javascript"></script>');
                        }
                    }
                }
                $doc->addCustomTag('<script src="components/com_tz_portfolio/js' . '/tz_portfolio.min.js" type="text/javascript"></script>');
            }
            $this->setLayout($layout);
        }
        $this->_prepareDocument();
        // Add feed links
        if ($params->get('show_feed_link', 1)) {
            $link = '&format=feed&limitstart=';
            $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
            $doc->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
            $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
            $doc->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
        }
        parent::display($tpl);
    }
示例#19
0
 function createMenuJ25($menu, $submenu)
 {
     jimport('joomla.utilities.string');
     jimport('joomla.application.component.helper');
     $config = KunenaFactory::getConfig();
     $component_id = JComponentHelper::getComponent('com_kunena')->id;
     // First fix all broken menu items
     $query = "UPDATE #__menu SET component_id={$this->db->quote($component_id)} WHERE type = 'component' AND link LIKE '%option=com_kunena%'";
     $this->db->setQuery($query);
     $this->db->query();
     if ($this->db->getErrorNum()) {
         throw new KunenaInstallerException($this->db->getErrorMsg(), $this->db->getErrorNum());
     }
     $table = JTable::getInstance('menutype');
     $data = array('menutype' => 'kunenamenu', 'title' => JText::_('COM_KUNENA_MENU_TITLE'), 'description' => JText::_('COM_KUNENA_MENU_TITLE_DESC'));
     if (!$table->bind($data) || !$table->check()) {
         // Menu already exists, do nothing
         return true;
     }
     if (!$table->store()) {
         throw new KunenaInstallerException($table->getError());
     }
     $table = JTable::getInstance('menu');
     $table->load(array('menutype' => 'kunenamenu', 'link' => $menu['link']));
     $paramdata = array('menu-anchor_title' => '', 'menu-anchor_css' => '', 'menu_image' => '', 'menu_text' => 1, 'page_title' => '', 'show_page_heading' => 0, 'page_heading' => '', 'pageclass_sfx' => '', 'menu-meta_description' => '', 'menu-meta_keywords' => '', 'robots' => '', 'secure' => 0);
     $gparams = new JRegistry($paramdata);
     $params = clone $gparams;
     $params->loadArray($menu['params']);
     $data = array('menutype' => 'kunenamenu', 'title' => $menu['name'], 'alias' => $menu['alias'], 'link' => $menu['link'], 'type' => 'component', 'published' => 1, 'parent_id' => 1, 'component_id' => $component_id, 'access' => $menu['access'] + 1, 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
     if (!$table->setLocation(1, 'last-child') || !$table->bind($data) || !$table->check() || !$table->store()) {
         $table->alias = 'kunena';
         if (!$table->check() || !$table->store()) {
             throw new KunenaInstallerException($table->getError());
         }
     }
     $parent = $table;
     $defaultmenu = 0;
     foreach ($submenu as $menuitem) {
         $params = clone $gparams;
         $params->loadArray($menuitem['params']);
         $table = JTable::getInstance('menu');
         $table->load(array('menutype' => 'kunenamenu', 'link' => $menuitem['link']));
         $data = array('menutype' => 'kunenamenu', 'title' => $menuitem['name'], 'alias' => $menuitem['alias'], 'link' => $menuitem['link'], 'type' => 'component', 'published' => 1, 'parent_id' => $parent->id, 'component_id' => $component_id, 'access' => $menuitem['access'] + 1, 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
         if (!$table->setLocation($parent->id, 'last-child') || !$table->bind($data) || !$table->check() || !$table->store()) {
             throw new KunenaInstallerException($table->getError());
         }
         if (!$defaultmenu || isset($menuitem['default']) && $config->defaultpage == $menuitem['default']) {
             $defaultmenu = $table->id;
         }
     }
     // Update forum menuitem to point into default page
     $parent->link .= "&defaultmenu={$defaultmenu}";
     if (!$parent->check() || !$parent->store()) {
         throw new KunenaInstallerException($table->getError());
     }
     // Finally create alias
     $defaultmenu = JMenu::getInstance('site')->getDefault();
     if (!$defaultmenu) {
         return true;
     }
     $table = JTable::getInstance('menu');
     $table->load(array('menutype' => $defaultmenu->menutype, 'type' => 'alias', 'title' => JText::_('COM_KUNENA_MENU_ITEM_FORUM')));
     if (!$table->id) {
         $data = array('menutype' => $defaultmenu->menutype, 'title' => JText::_('COM_KUNENA_MENU_ITEM_FORUM'), 'alias' => 'kunena-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'type' => 'alias', 'published' => 0, 'parent_id' => 1, 'component_id' => 0, 'access' => 1, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}', 'home' => 0, 'language' => '*', 'client_id' => 0);
         if (!$table->setLocation(1, 'last-child')) {
             throw new KunenaInstallerException($table->getError());
         }
     } else {
         $data = array('alias' => 'kunena-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}');
     }
     if (!$table->bind($data) || !$table->check() || !$table->store()) {
         throw new KunenaInstallerException($table->getError());
     }
 }
示例#20
0
    function display($tpl = null)
    {
        $doc = JFactory::getDocument();
        $menus = JMenu::getInstance('site');
        $active = $menus->getActive();
        $state = $this->get('State');
        $params = $state->params;
        if ($params->get('fields_option_order')) {
            switch ($params->get('fields_option_order')) {
                case 'alpha':
                    $fieldsOptionOrder = 't.value ASC';
                    break;
                case 'ralpha':
                    $fieldsOptionOrder = 't.value DESC';
                    break;
                case 'ordering':
                    $fieldsOptionOrder = 't.ordering ASC';
                    break;
            }
            if (isset($fieldsOptionOrder)) {
                $this->extraFields->setState('filter.option.order', $fieldsOptionOrder);
            }
        }
        // Set value again for option tz_portfolio_redirect
        if ($params->get('tz_portfolio_redirect') == 'default') {
            $params->set('tz_portfolio_redirect', 'article');
        }
        $list = $this->get('Items');
        $csscompress = null;
        if ($params->get('css_compression', 0)) {
            $csscompress = '.min';
        }
        $jscompress = new stdClass();
        $jscompress->extfile = null;
        $jscompress->folder = null;
        if ($params->get('js_compression', 1)) {
            $jscompress->extfile = '.min';
            $jscompress->folder = '/packed';
        }
        if ($list) {
            $user = JFactory::getUser();
            $userId = $user->get('id');
            $guest = $user->get('guest');
            //Get Plugins Model
            $pmodel = JModelLegacy::getInstance('Plugins', 'TZ_PortfolioModel', array('ignore_request' => true));
            if ($params->get('comment_function_type', 'default') != 'js') {
                // Compute the article slugs and prepare introtext (runs content plugins).
                if ($params->get('tz_show_count_comment', 1) == 1) {
                    require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'HTTPFetcher.php';
                    require_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'readfile.php';
                    $fetch = new Services_Yadis_PlainHTTPFetcher();
                }
                $threadLink = null;
                $comments = null;
                if ($list) {
                    foreach ($list as $key => $item) {
                        if ($params->get('tz_show_count_comment', 1) == 1) {
                            if ($params->get('tz_comment_type', 'disqus') == 'disqus') {
                                $threadLink .= '&thread[]=link:' . $item->fullLink;
                            } elseif ($params->get('tz_comment_type', 'disqus') == 'facebook') {
                                $threadLink .= '&urls[]=' . $item->fullLink;
                            }
                        }
                    }
                    //End Foreach
                }
                // Endif
                // Get comment counts for all items(articles)
                if ($params->get('tz_show_count_comment', 1) == 1) {
                    // From Disqus
                    if ($params->get('tz_comment_type', 'disqus') == 'disqus') {
                        if ($threadLink) {
                            $url = 'https://disqus.com/api/3.0/threads/list.json?api_secret=' . $params->get('disqusApiSecretKey', '4sLbLjSq7ZCYtlMkfsG7SS5muVp7DsGgwedJL5gRsfUuXIt6AX5h6Ae6PnNREMiB') . '&forum=' . $params->get('disqusSubDomain', 'templazatoturials') . $threadLink . '&include=open';
                            $content = $fetch->get($url);
                            if ($content) {
                                if ($body = json_decode($content->body)) {
                                    if ($responses = $body->response) {
                                        if (!is_array($responses)) {
                                            JError::raiseNotice('300', JText::_('COM_TZ_PORTFOLIO_DISQUS_INVALID_SECRET_KEY'));
                                        }
                                        if (is_array($responses) && count($responses)) {
                                            foreach ($responses as $response) {
                                                $comments[$response->link] = $response->posts;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    // From Facebook
                    if ($params->get('tz_comment_type', 'disqus') == 'facebook') {
                        if ($threadLink) {
                            $url = 'http://api.facebook.com/restserver.php?method=links.getStats' . $threadLink;
                            $content = $fetch->get($url);
                            if ($content) {
                                if ($bodies = $content->body) {
                                    if (preg_match_all('/\\<link_stat\\>(.*?)\\<\\/link_stat\\>/ims', $bodies, $matches)) {
                                        if (isset($matches[1]) && !empty($matches[1])) {
                                            foreach ($matches[1] as $val) {
                                                $match = null;
                                                if (preg_match('/\\<url\\>(.*?)\\<\\/url\\>.*?\\<comment_count\\>(.*?)\\<\\/comment_count\\>/msi', $val, $match)) {
                                                    if (isset($match[1]) && isset($match[2])) {
                                                        $comments[$match[1]] = $match[2];
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                // End Get comment counts for all items(articles)
            } else {
                // Add facebook script api
                if ($params->get('tz_show_count_comment', 1) == 1) {
                    if ($params->get('tz_comment_type', 'disqus') == 'facebook') {
                        $doc->addScriptDeclaration('
                            (function(d, s, id) {
                              var js, fjs = d.getElementsByTagName(s)[0];
                              if (d.getElementById(id)) return;
                              js = d.createElement(s); js.id = id;
                              js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
                              fjs.parentNode.insertBefore(js, fjs);
                            }(document, \'script\', \'facebook-jssdk\'));
                       ');
                    }
                    // Add disqus script api
                    if ($params->get('tz_comment_type', 'disqus') == 'disqus') {
                        $doc->addScriptDeclaration('
                            /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
                            var disqus_shortname = \'templazatoturials\'; // required: replace example with your forum shortname

                            /* * * DON\'T EDIT BELOW THIS LINE * * */
                            (function () {
                            var s = document.createElement(\'script\'); s.async = true;
                            s.type = \'text/javascript\';
                            s.src = \'http://\' + disqus_shortname + \'.disqus.com/count.js\';
                            (document.getElementsByTagName(\'HEAD\')[0] || document.getElementsByTagName(\'BODY\')[0]).appendChild(s);
                            }());
                       ');
                        $doc->addCustomTag('
                        <script type="text/javascript">
                            window.addEvent("load",function(){
                                var a=document.getElementsByTagName("A");

                                for(var h=0;h<a.length;h++){
                                    if(a[h].href.indexOf("#disqus_thread")>=0){
                                    var span = document.createElement("span");
                                    span.innerHTML  = a[h].innerHTML;
                                    a[h].parentNode.appendChild(span);
                                    a[h].remove();
                                    }
                                }
                            });
                        </script>
                       ');
                    }
                }
            }
            $content_ids = array();
            if ($list) {
                for ($i = 0, $n = count($list); $i < $n; $i++) {
                    $content_ids[] = $list[$i]->id;
                }
            }
            $tags = null;
            if (count($content_ids) && $params->get('show_tags', 1)) {
                $m_tag = JModelLegacy::getInstance('Tag', 'TZ_PortfolioModel', array('ignore_request' => true));
                $m_tag->setState('params', $params);
                $m_tag->setState('article.id', $content_ids);
                $m_tag->setState('list.ordering', 'x.contentid');
                $tags = $m_tag->getArticleTags();
            }
            foreach ($list as &$row) {
                if ($tags && count($tags) && isset($tags[$row->id])) {
                    $row->tags = $tags[$row->id];
                }
                if ($params->get('comment_function_type', 'default') != 'js') {
                    if ($params->get('tz_show_count_comment', 1) == 1) {
                        if ($params->get('tz_comment_type', 'disqus') == 'disqus' || $params->get('tz_comment_type', 'disqus') == 'facebook') {
                            if ($comments) {
                                if (array_key_exists($row->fullLink, $comments)) {
                                    $row->commentCount = $comments[$row->fullLink];
                                } else {
                                    $row->commentCount = 0;
                                }
                            } else {
                                $row->commentCount = 0;
                            }
                        }
                    }
                } else {
                    $row->commentCount = 0;
                }
                // Compute the asset access permissions.
                // Technically guest could edit an article, but lets not check that to improve performance a little.
                if (!$guest) {
                    $asset = 'com_tz_portfolio.article.' . $row->id;
                    // Check general edit permission first.
                    if ($user->authorise('core.edit', $asset)) {
                        $row->params->set('access-edit', true);
                    } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
                        // Check for a valid user and that they are the owner.
                        if ($userId == $row->created_by) {
                            $row->params->set('access-edit', true);
                        }
                    }
                }
                // Old plugins: Ensure that text property is available
                if (!isset($row->text)) {
                    $row->text = $row->introtext;
                }
                if (version_compare(COM_TZ_PORTFOLIO_VERSION, '3.1.7', '<')) {
                    $row->text = null;
                    if ($params->get('show_intro', 1)) {
                        $row->text = $row->introtext;
                    }
                }
                JPluginHelper::importPlugin('content');
                $dispatcher = JDispatcher::getInstance();
                //
                // Process the content plugins.
                //
                $row->event = new stdClass();
                $results = $dispatcher->trigger('onContentPrepare', array('com_tz_portfolio.users', &$row, &$params, $state->get('offset')));
                $row->introtext = $row->text;
                $results = $dispatcher->trigger('onContentAfterTitle', array('com_tz_portfolio.users', &$row, &$params, $state->get('offset')));
                $row->event->afterDisplayTitle = trim(implode("\n", $results));
                $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_tz_portfolio.users', &$row, &$params, $state->get('offset')));
                $row->event->beforeDisplayContent = trim(implode("\n", $results));
                $results = $dispatcher->trigger('onContentAfterDisplay', array('com_tz_portfolio.users', &$row, &$params, $state->get('offset')));
                $row->event->afterDisplayContent = trim(implode("\n", $results));
                $results = $dispatcher->trigger('onContentTZPortfolioVote', array('com_tz_portfolio.users', &$row, &$params, $state->get('offset')));
                $row->event->TZPortfolioVote = trim(implode("\n", $results));
                //Get plugin Params for this article
                $pmodel->setState('filter.contentid', $row->id);
                $pluginItems = $pmodel->getItems();
                $pluginParams = $pmodel->getParams();
                $row->pluginparams = clone $pluginParams;
                JPluginHelper::importPlugin('tz_portfolio');
                $results = $dispatcher->trigger('onTZPluginPrepare', array('com_tz_portfolio.users', &$row, &$params, &$pluginParams, $state->get('offset')));
                $results = $dispatcher->trigger('onTZPluginAfterTitle', array('com_tz_portfolio.users', &$row, &$params, &$pluginParams, $state->get('offset')));
                $row->event->TZafterDisplayTitle = trim(implode("\n", $results));
                $results = $dispatcher->trigger('onTZPluginBeforeDisplay', array('com_tz_portfolio.users', &$row, &$params, &$pluginParams, $state->get('offset')));
                $row->event->TZbeforeDisplayContent = trim(implode("\n", $results));
                $results = $dispatcher->trigger('onTZPluginAfterDisplay', array('com_tz_portfolio.users', &$row, &$params, &$pluginParams, $state->get('offset')));
                $row->event->TZafterDisplayContent = trim(implode("\n", $results));
            }
        }
        //Escape strings for HTML output
        $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
        if ($active) {
            $params->def('page_heading', $params->get('page_title', $active->title));
        } else {
            $params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
        }
        $this->assign('listsUsers', $list);
        $this->assign('authorParams', $params);
        $this->assign('params', $params);
        $this->assign('mediaParams', $params);
        $this->assign('pagination', $this->get('Pagination'));
        $author = JModelLegacy::getInstance('User', 'TZ_PortfolioModel');
        $author = $author->getUserId(JRequest::getInt('created_by'));
        $this->assign('listAuthor', $author);
        $params = $this->get('state')->params;
        $model = JModelLegacy::getInstance('Portfolio', 'TZ_PortfolioModel', array('ignore_request' => true));
        $model->setState('params', $params);
        $model->setState('filter.userId', $state->get('users.id'));
        $this->assign('char', $state->get('char'));
        $this->assign('availLetter', $model->getAvailableLetter());
        if ($params->get('tz_use_image_hover', 1) == 1) {
            $doc->addStyleDeclaration('
                .tz_image_hover{
                    opacity: 0;
                    position: absolute;
                    top:0;
                    left: 0;
                    transition: opacity ' . $params->get('tz_image_timeout', 0.35) . 's ease-in-out;
                   -moz-transition: opacity ' . $params->get('tz_image_timeout', 0.35) . 's ease-in-out;
                   -webkit-transition: opacity ' . $params->get('tz_image_timeout', 0.35) . 's ease-in-out;
                }
                .tz_image_hover:hover{
                    opacity: 1;
                    margin: 0;
                }
            ');
        }
        if ($params->get('tz_use_lightbox', 1) == 1) {
            $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio/js' . '/jquery.fancybox.pack.js"></script>');
            $doc->addStyleSheet('components/com_tz_portfolio/css/fancybox.min.css');
            $width = null;
            $height = null;
            $autosize = null;
            if ($params->get('tz_lightbox_width')) {
                if (preg_match('/%|px/', $params->get('tz_lightbox_width'))) {
                    $width = 'width:\'' . $params->get('tz_lightbox_width') . '\',';
                } else {
                    $width = 'width:' . $params->get('tz_lightbox_width') . ',';
                }
            }
            if ($params->get('tz_lightbox_height')) {
                if (preg_match('/%|px/', $params->get('tz_lightbox_height'))) {
                    $height = 'height:\'' . $params->get('tz_lightbox_height') . '\',';
                } else {
                    $height = 'height:' . $params->get('tz_lightbox_height') . ',';
                }
            }
            if ($width || $height) {
                $autosize = 'fitToView: false,autoSize: false,';
            }
            $scrollHidden = null;
            if ($params->get('use_custom_scrollbar', 1)) {
                $scrollHidden = ',scrolling: "no"
                                    ,iframe: {
                                        scrolling : "no",
                                    }';
            }
            $doc->addCustomTag('<script type="text/javascript">
                jQuery(\'.fancybox\').fancybox({
                    type:\'iframe\',
                    openSpeed:' . $params->get('tz_lightbox_speed', 350) . ',
                    openEffect: "' . $params->get('tz_lightbox_transition', 'elastic') . '",
                    ' . $width . $height . $autosize . '
		            helpers:  {
                        title : {
                            type : "inside"
                        },
                        overlay : {
                            css : {background: "rgba(0,0,0,' . $params->get('tz_lightbox_opacity', 0.75) . ')"}
                        }
                    }' . $scrollHidden . '
                });
                </script>
            ');
        }
        $doc->addStyleSheet('components/com_tz_portfolio/css/tzportfolio.min.css');
        $this->_prepareDocument();
        // Add feed links
        if ($params->get('show_feed_link', 1)) {
            $link = '&format=feed&limitstart=';
            $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
            $doc->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
            $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
            $doc->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
        }
        parent::display($tpl);
    }
示例#21
0
文件: model.php 项目: rich20/Kunena
	function createMenuJ16($menu, $submenu) {
		jimport ( 'joomla.utilities.string' );
		jimport ( 'joomla.application.component.helper' );
		kimport('kunena.factory');

		$config = KunenaFactory::getConfig ();

		$component_id = JComponentHelper::getComponent ( 'com_kunena' )->id;

		// First fix all broken menu items
		$query = "UPDATE #__menu SET component_id={$this->db->quote($component_id)} WHERE type = 'component' AND link LIKE '%option=com_kunena%'";
		$this->db->setQuery ( $query );
		$this->db->query ();
		if ($this->db->getErrorNum ())
			throw new KunenaInstallerException ( $this->db->getErrorMsg (), $this->db->getErrorNum () );

		$table = JTable::getInstance ( 'menutype' );
		$data = array (
			'menutype' => 'kunenamenu',
			'title' => JText::_ ( 'COM_KUNENA_MENU_TITLE' ),
			'description' => JText::_ ( 'COM_KUNENA_MENU_TITLE_DESC' )
		);
		if (! $table->bind ( $data ) || ! $table->check ()) {
			// Menu already exists, do nothing
			return true;
		}
		if (! $table->store ()) {
			throw new KunenaInstallerException ( $table->getError () );
		}

		$table = JTable::getInstance ( 'menu' );
		$table->load(array('menutype'=>'kunenamenu', 'link'=>$menu ['link']));
		$params = '{"menu-anchor_title":"","menu-anchor_css":"","menu_image":"","menu_text":1,"page_title":"","show_page_heading":0,"page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}';
		// FIXME: Joomla 1.6: add menu params for current item, too
		$data = array (
			'menutype' => 'kunenamenu',
			'title' => $menu ['name'],
			'alias' => $menu ['alias'],
			'link' => $menu ['link'],
			'type' => 'component',
			'published' => 1,
			'parent_id' => 1,
			'component_id' => $component_id,
			'access' => $menu ['access'] + 1,
			'params' => $params,
			'home' => 0,
			'language' => '*',
			'client_id' => 0
		);
		if (! $table->setLocation ( 1, 'last-child' ) || ! $table->bind ( $data ) || ! $table->check () || ! $table->store ()) {
			throw new KunenaInstallerException ( $table->getError () );
		}
		$parent = $table;
		$defaultmenu = 0;
		foreach ( $submenu as $menuitem ) {
			$table = JTable::getInstance ( 'menu' );
			$table->load(array('menutype'=>'kunenamenu', 'link'=>$menuitem ['link']));
			$data = array (
				'menutype' => 'kunenamenu',
				'title' => $menuitem ['name'],
				'alias' => $menuitem ['alias'],
				'link' => $menuitem ['link'],
				'type' => 'component',
				'published' => 1,
				'parent_id' => $parent->id,
				'component_id' => $component_id,
				'access' => $menuitem ['access'] + 1,
				'params' => $params,
				'home' => 0,
				'language' => '*',
				'client_id' => 0
			);

			if (! $table->setLocation ( $parent->id, 'last-child' ) || ! $table->bind ( $data ) || ! $table->check () || ! $table->store ()) {
				throw new KunenaInstallerException ( $table->getError () );
			}
			if (! $defaultmenu || (isset ( $menuitem ['default'] ) && $config->fbdefaultpage == $menuitem ['default'])) {
				$defaultmenu = $table->id;
			}
		}

		// Update forum menuitem to point into default page
		$parent->link .= "&defaultmenu={$defaultmenu}";
		if (! $parent->check () || ! $parent->store ()) {
			throw new KunenaInstallerException ( $table->getError () );
		}

		$module = JTable::getInstance ( 'module' );
		$data = array (
			'title' => JText::_ ( 'COM_KUNENA_MENU_TITLE' ),
			'ordering' => 1,
			'position' => 'kunena_menu',
			'published' => 1,
			'module' => 'mod_menu',
			'access' => 1,
			'showtitle' => 0,
			'params' => '{"menutype":"kunenamenu","startLevel":"2","endLevel":"3","showAllChildren":"0","tag_id":"","class_sfx":"","window_open":"","layout":"_:default","moduleclass_sfx":"","cache":"1","cache_time":"900","cachemode":"itemid"}',
			'client_id' => 0,
			'language' => '*' );
		if (! $module->bind ( $data ) || ! $module->check ()) {
			// Menu already exists, do nothing
			return true;
		}
		if (! $module->store ()) {
			throw new KunenaInstallerException ( $module->getError () );
		}
		$moduleid = $module->id;

		// Now publish the module
		$query = "REPLACE INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES ($moduleid, 0);";
		$this->db->setQuery ( $query );
		$this->db->query ();
		if ($this->db->getErrorNum ())
			throw new KunenaInstallerException ( $this->db->getErrorMsg (), $this->db->getErrorNum () );

		// Finally create alias
		// TODO: contains workaround for J1.6.1 bug:
		$defaultmenu = JMenu::getInstance('site')->getDefault('workaround');
		if (!$defaultmenu) return true;
		$table = JTable::getInstance ( 'menu' );
		$table->load(array('menutype'=>$defaultmenu->menutype, 'type'=>'alias', 'title'=>JText::_ ( 'COM_KUNENA_MENU_FORUM' )));
		if (!$table->id) {
			$data = array (
				'menutype' => $defaultmenu->menutype,
				'title' => JText::_ ( 'COM_KUNENA_MENU_FORUM' ),
				'link' => 'index.php?Itemid='.$parent->id,
				'type' => 'alias',
				'published' => 0,
				'parent_id' => 1,
				'component_id' => 0,
				'access' => 1,
				'params' => '{"aliasoptions":"'.(int)$parent->id.'","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}',
				'home' => 0,
				'language' => '*',
				'client_id' => 0
			);
			if (! $table->setLocation ( 1, 'last-child' )) {
				throw new KunenaInstallerException ( $table->getError () );
			}
		} else {
			$data = array (
				'link' => 'index.php?Itemid='.$parent->id,
				'params' => '{"aliasoptions":"'.(int)$parent->id.'","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}',
			);
		}
		if (! $table->bind ( $data ) || ! $table->check () || ! $table->store ()) {
			throw new KunenaInstallerException ( $table->getError () );
		}
	}
示例#22
0
文件: router.php 项目: afend/RULug
 public function parse(&$segments)
 {
     //var_dump($segments);
     $query = array();
     $menus = JMenu::getInstance('site');
     $menu = $menus->getActive();
     $vars = array();
     $total = count($segments);
     for ($i = 0; $i < $total; $i++) {
         $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1);
     }
     if (is_null($menu) && count($segments)) {
         if ($segments[0] == 'cart' || $segments[0] == 'carts') {
             $vars['view'] = $segments[0];
             if (isset($segments[1])) {
                 $vars['task'] = $segments[1];
             }
         }
         if ($segments[0] == 'checkout' || $segments[0] == 'checkouts') {
             $vars['view'] = $segments[0];
             if (isset($segments[1])) {
                 $vars['task'] = $segments[1];
             }
         }
         if ($segments[0] == 'myprofile') {
             $vars['view'] = $segments[0];
             if (isset($segments[1])) {
                 $vars['task'] = $segments[1];
             }
         }
         if ($segments[0] == 'products') {
             $vars['view'] = $segments[0];
             if (isset($segments[1])) {
                 $vars['task'] = $segments[1];
             }
             if (isset($segments[2])) {
                 $vars['id'] = $segments[2];
             }
         }
     } else {
         if (count($segments)) {
             $mView = $menu->query['view'];
             if (isset($mView) && ($mView == 'cart' || $mView == 'carts')) {
                 $vars['view'] = $mView;
                 if (isset($segments[0])) {
                     $vars['task'] = $segments[0];
                 }
             } elseif ($segments[0] == 'cart' || $segments[0] == 'carts') {
                 $vars['view'] = $segments[0];
                 if (isset($segments[1])) {
                     $vars['task'] = $segments[1];
                 }
             }
             if (isset($mView) && ($mView == 'checkout' || $mView == 'checkouts')) {
                 $vars['view'] = $mView;
                 if (isset($segments[0])) {
                     $vars['task'] = $segments[0];
                 }
             } elseif ($segments[0] == 'checkout' || $segments[0] == 'checkouts') {
                 $vars['view'] = $segments[0];
                 if (isset($segments[1])) {
                     $vars['task'] = $segments[1];
                 }
             }
             if (isset($mView) && $mView == 'myprofile') {
                 $vars['view'] = $mView;
                 if (isset($segments[0])) {
                     $vars['task'] = $segments[0];
                 }
             } elseif ($segments[0] == 'myprofile') {
                 $vars['view'] = $segments[0];
                 if (isset($segments[1])) {
                     $vars['task'] = $segments[1];
                 }
             }
             if (isset($mView) && $mView == 'products') {
                 $vars['view'] = 'products';
                 if (isset($segments[0])) {
                     $vars['task'] = $segments[0];
                 }
                 if (isset($segments[1])) {
                     $vars['id'] = $segments[1];
                 }
             } elseif ($segments[0] == 'products') {
                 $vars['view'] = $segments[0];
                 if (isset($segments[1])) {
                     $vars['task'] = $segments[1];
                 }
                 if (isset($segments[2])) {
                     $vars['id'] = $segments[2];
                 }
             }
         }
     }
     return $vars;
 }
<?php

/**
 * Articles Newsflash Advanced
 *
 * @author    TemplateMonster http://www.templatemonster.com
 * @copyright Copyright (C) 2012 - 2013 Jetimpex, Inc.
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 
 * Parts of this software are based on Articles Newsflash standard module
 * 
*/
defined('_JEXEC') or die;
// Include the syndicate functions only once
require_once __DIR__ . '/helper.php';
$menu = JMenu::getInstance('site');
$app = JFactory::getApplication();
$document =& JFactory::getDocument();
$list = modArticlesNewsHelper::getList($params);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$columns = (int) $params->get('columns');
$bootstrap_layout = $params->get('bootstrap_layout');
switch ($bootstrap_layout) {
    case 0:
        $row_class = 'row';
        break;
    case 1:
        $row_class = 'row-fluid';
        break;
    default:
        $row_class = 'row';
        break;
示例#24
0
    /**
     * Control panel display
     *        	
     * @access public
     * @param string $tpl
     * @return void
     */
    public function display($tpl = null)
    {
        $doc = $this->document;
        $componentParams = $this->getModel()->getState('cparams');
        $base = JUri::root();
        $this->loadJQuery($doc);
        $this->loadBootstrap($doc);
        $doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/cpanel.css');
        $doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/jquery.fancybox.css');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/chart.js');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/cpanel.js');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/analyzer.js');
        $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/metainfo.js');
        if ($componentParams->get('seostats_enabled', 1)) {
            $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/seostats.js');
        }
        if ($componentParams->get('enable_precaching', 0)) {
            $doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/xmlprecaching.js');
        }
        $doc->addCustomTag('<script type="text/javascript" src="' . JURI::root(true) . '/administrator/components/com_jmap/js/jquery.fancybox.pack.js' . '"></script>');
        // Inject js translations
        $translations = array('COM_JMAP_ROBOTSPROGRESSTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLESUCCESS', 'COM_JMAP_ROBOTSPROGRESSSUBTITLEERROR', 'COM_JMAP_PRECACHING_TITLE', 'COM_JMAP_START_PRECACHING_PROCESS', 'COM_JMAP_PRECACHING_NO_DATASOURCES_FOUND', 'COM_JMAP_PRECACHING_PROCESS_RUNNING', 'COM_JMAP_PRECACHING_PROCESS_COMPLETED', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE_TYPE', 'COM_JMAP_PRECACHING_REPORT_LINKS', 'COM_JMAP_PRECACHING_DATA_SOURCE_COMPLETED', 'COM_JMAP_PRECACHING_DATASOURCES_RETRIEVED', 'COM_JMAP_PRECACHING_PROCESS_FINALIZING', 'COM_JMAP_PRECACHING_INTERRUPT', 'COM_JMAP_PRECACHING_CACHED', 'COM_JMAP_PRECACHING_NOT_CACHED', 'COM_JMAP_PRECACHING_CLEARING', 'COM_JMAP_PRECACHING_CLEAR_CACHE', 'COM_JMAP_PUBLISHED_DATA_SOURCE_CHART', 'COM_JMAP_TOTAL_DATA_SOURCE_CHART', 'COM_JMAP_DATASETS_CHART', 'COM_JMAP_MENU_DATA_SOURCE_CHART', 'COM_JMAP_USER_DATA_SOURCE_CHART', 'COM_JMAP_ANALYZER_TITLE', 'COM_JMAP_ANALYZER_PROCESS_RUNNING', 'COM_JMAP_ANALYZER_STARTED_SITEMAP_GENERATION', 'COM_JMAP_ANALYZER_ERROR_STORING_FILE', 'COM_JMAP_ANALYZER_GENERATION_COMPLETE', 'COM_JMAP_METAINFO_TITLE', 'COM_JMAP_METAINFO_PROCESS_RUNNING', 'COM_JMAP_METAINFO_STARTED_SITEMAP_GENERATION', 'COM_JMAP_METAINFO_ERROR_STORING_FILE', 'COM_JMAP_METAINFO_GENERATION_COMPLETE', 'COM_JMAP_SEOSTATS_LOADING', 'COM_JMAP_ALEXA_GRAPH', 'COM_JMAP_NULL_RESPONSEDATA', 'COM_JMAP_ERROR_HTTP');
        $this->injectJsTranslations($translations, $doc);
        // Check for custom link domain
        $customDomain = trim($componentParams->get('custom_sitemap_domain', ''));
        $livesite = $customDomain ? rtrim($customDomain, '/') : substr_replace(JURI::root(), "", -1, 1);
        $user = JFactory::getUser();
        $lists = $this->get('Lists');
        $infoData = $this->get('Data');
        $doc->addScriptDeclaration('var jmapChartData = ' . json_encode($infoData));
        $doc->addScriptDeclaration("var jmap_baseURI='{$base}';");
        $doc->addScriptDeclaration("var jmap_linksRandom=" . $componentParams->get('sitemap_links_random', 0) . ";");
        $doc->addScriptDeclaration("var jmap_forceFormat=" . $componentParams->get('sitemap_links_forceformat', 0) . ";");
        // Assign SEF mode
        $this->siteRouter = JRouterSite::getInstance('site', array('mode' => JROUTER_MODE_SEF));
        $this->showSefLinks = $componentParams->get('sitemap_links_sef', false);
        $this->joomlaSefLinks = JFactory::getConfig()->get('sef', true);
        $this->siteItemid = null;
        if ($this->showSefLinks && $this->joomlaSefLinks) {
            $siteItemid = trim($componentParams->get('site_itemid', null));
            if ($siteItemid && is_numeric($siteItemid)) {
                $menuItem = JMenu::getInstance('site')->getItem((int) $siteItemid);
                if (isset($menuItem->alias)) {
                    $menuAlias = $menuItem->alias;
                    $doc->addScriptDeclaration("var jmap_sef_alias_links='{$menuAlias}';");
                    $this->siteItemid = '&Itemid=' . (int) $siteItemid;
                }
            }
        }
        // Buffer delle icons
        ob_start();
        $this->getIcon('index.php?option=com_jmap&task=sources.display', 'icon-48-data.png', JText::_('COM_JMAP_SITEMAP_SOURCES'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_SOURCES') . '"');
        $this->getIcon('index.php?option=com_jmap&task=wizard.display', 'icon-48-wizard.png', JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE'), '', 'title="' . JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE') . '"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap', 'icon-48-html_sitemap.png', JText::_('COM_JMAP_SHOW_HTML_MAP'), 'target="_blank"', 'title="' . JText::_('COM_JMAP_SHOW_HTML_MAP') . '"', 'data-role="torefresh"');
        $this->getIcon('#xmlsitemap', 'icon-48-xml_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP') . '"', 'class="fancybox"');
        $this->getIcon('#xmlsitemap_xslt', 'icon-48-xsl_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP_XSLT'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP_XSLT') . '"', 'class="fancybox"');
        $this->getIcon('#xmlsitemap_export', 'icon-48-xml_export.png', JText::_('COM_JMAP_EXPORT_XML_SITEMAP'), '', 'title="' . JText::_('COM_JMAP_EXPORT_XML_SITEMAP') . '"', 'class="fancybox"');
        $this->getIcon(substr_replace(JURI::root(), "", -1, 1) . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-analyze.png', JText::_('COM_JMAP_ANALYZE_MAP'), '', 'title="' . JText::_('COM_JMAP_ANALYZE_MAP') . '"', 'class="jmap_analyzer"');
        $this->getIcon(substr_replace(JURI::root(), "", -1, 1) . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-metainfo.png', JText::_('COM_JMAP_METAINFO'), '', 'title="' . JText::_('COM_JMAP_METAINFO') . '"', 'class="jmap_metainfo"');
        $this->getIcon('index.php?option=com_jmap&task=indexing.display', 'icon-48-indexing.png', JText::_('COM_JMAP_SITEMAP_INDEXING'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_INDEXING') . '"');
        $this->getIcon('index.php?option=com_jmap&task=datasets.display', 'icon-48-datasets.png', JText::_('COM_JMAP_SITEMAP_DATASETS'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_DATASETS') . '"');
        if ($user->authorise('core.edit', 'com_jmap')) {
            $this->getIcon('index.php?option=com_jmap&task=cpanel.editEntity', 'icon-48-robots.png', JText::_('COM_JMAP_ROBOTS_EDITOR'), '', 'title="' . JText::_('COM_JMAP_ROBOTS_EDITOR') . '"', 'class="fancybox_iframe"');
            $this->getIcon('index.php?option=com_jmap&task=htaccess.editEntity', 'icon-48-htaccess.png', JText::_('COM_JMAP_HTACCESS_EDITOR'), '', 'title="' . JText::_('COM_JMAP_HTACCESS_EDITOR') . '"', 'class="fancybox_iframe"');
        }
        $this->getIcon('index.php?option=com_jmap&task=pingomatic.display', 'icon-48-pingomatic.png', JText::_('COM_JMAP_PINGOMATIC_LINKS'), '', 'title="' . JText::_('COM_JMAP_PINGOMATIC_LINKS') . '"');
        $this->getIcon('#rssfeed', 'icon-48-rss-feed.png', JText::_('COM_JMAP_SHOW_RSS_FEED'), '', 'title="' . JText::_('COM_JMAP_SHOW_RSS_FEED') . '"', 'class="fancybox rss"');
        // Access check.
        if ($user->authorise('jmap.google', 'com_jmap')) {
            $this->getIcon('index.php?option=com_jmap&task=google.display', 'icon-48-google.png', JText::_('COM_JMAP_GOOGLE'), '', 'title="' . JText::_('COM_JMAP_GOOGLE_ANALYTICS') . '"');
        }
        // Access check.
        if ($user->authorise('core.admin', 'com_jmap')) {
            $this->getIcon('index.php?option=com_jmap&task=config.display', 'icon-48-config.png', JText::_('COM_JMAP_CONFIG'), '', 'title="' . JText::_('COM_JMAP_CONFIG') . '"');
        }
        $this->getIcon('http://storejextensions.org/jsitemap_professional_documentation.html', 'icon-48-help.png', JText::_('COM_JMAP_HELPTITLE'), '', 'title="' . JText::_('COM_JMAP_HELPTITLE') . '"');
        echo '<div style="display:none" id="xmlsitemap">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=xml', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_SHOW_XML_STANDARD_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=images', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_SHOW_XML_IMAGES_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=gnews', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_SHOW_XML_GNEWS_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=mobile', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_SHOW_XML_MOBILE_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=videos', 'icon-48-xml_sitemap_videos.png', JText::_('COM_JMAP_SHOW_XML_VIDEOS_MAP'), 'target="_blank"');
        echo '</div>';
        echo '<div style="display:none" id="xmlsitemap_xslt">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=xml&xslt=1', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_SHOW_XML_STANDARD_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=images&xslt=1', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_SHOW_XML_IMAGES_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=gnews&xslt=1', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_SHOW_XML_GNEWS_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=mobile&xslt=1', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_SHOW_XML_MOBILE_MAP'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=videos&xslt=1', 'icon-48-xml_sitemap_videos.png', JText::_('COM_JMAP_SHOW_XML_VIDEOS_MAP'), 'target="_blank"');
        echo '</div>';
        echo '<div style="display:none" id="xmlsitemap_export">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-xml_sitemap_standard.png', JText::_('COM_JMAP_EXPORT_XML_STANDARD_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=images', 'icon-48-xml_sitemap_images.png', JText::_('COM_JMAP_EXPORT_XML_IMAGES_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=gnews', 'icon-48-xml_sitemap_gnews.png', JText::_('COM_JMAP_EXPORT_XML_GNEWS_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=mobile', 'icon-48-xml_sitemap_mobile.png', JText::_('COM_JMAP_EXPORT_XML_MOBILE_MAP'));
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=videos', 'icon-48-xml_sitemap_videos.png', JText::_('COM_JMAP_EXPORT_XML_VIDEOS_MAP'));
        echo '</div>';
        echo '<div style="display:none" id="rssfeed">';
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss', 'icon-48-xml_sitemap.png', JText::_('COM_JMAP_SHOW_RSS_FEED'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss&xslt=1', 'icon-48-xsl_sitemap.png', JText::_('COM_JMAP_SHOW_RSS_FEED_FORMATTED'), 'target="_blank"');
        $this->getIcon($livesite . '/index.php?option=com_jmap&task=sitemap.exportxml&format=rss', 'icon-48-xml_export.png', JText::_('COM_JMAP_EXPORT_RSS_FEED'));
        echo '<label class="label label-primary">' . JText::_('COM_JMAP_RSS_FEED_LINK') . '</label>';
        if (!$this->showSefLinks || !$this->joomlaSefLinks) {
            ?>
		<input data-role="sitemap_links" class="sitemap_links" type="text" value="<?php 
            echo JFilterOutput::ampReplace($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss');
            ?>
" />
		<?php 
        } else {
            ?>
		<input data-role="sitemap_links_sef" class="sitemap_links" type="text" data-valuenosef="<?php 
            echo JFilterOutput::ampReplace($livesite . '/index.php?option=com_jmap&view=sitemap&format=rss');
            ?>
" value="<?php 
            echo $livesite . preg_replace('/(\\/[A-Za-z0-9_-~]*)*\\/administrator\\//i', '/', $this->siteRouter->build('index.php?option=com_jmap&view=sitemap&format=rss' . $this->siteItemid));
            ?>
"/>
		<?php 
        }
        echo '</div>';
        $contents = ob_get_clean();
        // Assign reference variables
        $this->icons = $contents;
        $this->livesite = $livesite;
        $this->componentParams = $componentParams;
        $this->infodata = $infoData;
        $this->lists = $lists;
        $this->updatesData = $this->getModel()->getUpdates($this->get('httpclient'));
        $this->currentVersion = strval(simplexml_load_file(JPATH_COMPONENT_ADMINISTRATOR . '/jmap.xml')->version);
        // Aggiunta toolbar
        $this->addDisplayToolbar();
        // Output del template
        parent::display();
    }
示例#25
0
 /**
  * Returns the application JMenu object.
  *
  * @param   string  $name     The name of the application/client.
  * @param   array   $options  An optional associative array of configuration settings.
  *
  * @return  JMenu
  *
  * @since   3.2
  */
 public function getMenu($name = null, $options = array())
 {
     if (!isset($name)) {
         $name = $this->getName();
     }
     try {
         $menu = JMenu::getInstance($name, $options);
     } catch (Exception $e) {
         return null;
     }
     return $menu;
 }
示例#26
0
 /**
  *
  * Get params of menu item
  *
  * @param Number $id
  */
 public static function getMenuParams($id)
 {
     $menuSite = JMenu::getInstance('site');
     $Item = $menuSite->getItem($id);
     if (isset($Item->params)) {
         if ($Item->params instanceof JRegistry) {
             return $Item->params;
         }
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select("params");
     $query->from("#__menu");
     $query->where("id = " . $db->quote($id));
     $db->setQuery($query);
     $paramsString = $db->loadResult();
     $jParams = new JRegistry();
     $jParams->loadObject(json_decode($paramsString));
     return $jParams;
 }
示例#27
0
 /**
  * Get a list of the menu items.
  *
  * @param	JRegistry	$params	The module options.
  *
  * @return	array
  * @since	1.5
  */
 static function getList($disabled = false)
 {
     $user = JFactory::getUser();
     $levels = $user->getAuthorisedViewLevels();
     asort($levels);
     $key = 'menu_items' . implode(',', $levels);
     $cache = JFactory::getCache('mod_menu', '');
     $lang = JFactory::getLanguage();
     if (!($items = $cache->get($key))) {
         // Initialise variables.
         $list = array();
         $db = JFactory::getDbo();
         $user = JFactory::getUser();
         $app = JFactory::getApplication();
         $menu = JMenu::getInstance('administrator');
         // If no active menu, use default
         $active = $menu->getActive() ? $menu->getActive() : $menu->getDefault();
         $path = $active->tree;
         $start = 0;
         $end = $disabled ? false : true;
         $showAll = $disabled ? false : true;
         $maxdepth = false;
         $items = $menu->getItems('menutype', 'admin');
         $lastitem = 0;
         if ($items) {
             foreach ($items as $i => $item) {
                 if (isset($item->component) && !$user->authorise('core.manage', $item->component)) {
                     unset($items[$i]);
                     continue;
                 }
                 // Need to run a few hard checks because Joomla does
                 if (isset($item->component) && ($item->component == 'com_config' || $item->component == 'com_admin')) {
                     if (!$user->authorise('core.admin', 'com_admin')) {
                         unset($items[$i]);
                         continue;
                     }
                 }
                 if ($start && $start > $item->level || $end && $item->level > $end || !$showAll && $item->level > 1 && !in_array($item->parent_id, $path) || $maxdepth && $item->level > $maxdepth || $start > 1 && !in_array($item->tree[$start - 2], $path)) {
                     unset($items[$i]);
                     continue;
                 }
                 if ($item->component) {
                     $lang->load($item->component . '.sys', JPATH_ADMINISTRATOR);
                     $lang->load($item->component . '.sys', JPATH_ADMINISTRATOR . '/components/' . $item->component);
                     $lang->load($item->component . '.menu', JPATH_ADMINISTRATOR);
                     $lang->load($item->component . '.menu', JPATH_ADMINISTRATOR . '/components/' . $item->component);
                 }
                 $item->deeper = false;
                 $item->shallower = false;
                 $item->level_diff = 0;
                 if (isset($items[$lastitem])) {
                     $items[$lastitem]->deeper = $item->level > $items[$lastitem]->level;
                     $items[$lastitem]->shallower = $item->level < $items[$lastitem]->level;
                     $items[$lastitem]->level_diff = $items[$lastitem]->level - $item->level;
                 }
                 $item->parent = (bool) $menu->getItems('parent_id', (int) $item->id, true);
                 $lastitem = $i;
                 $item->active = false;
                 $item->flink = $item->link;
                 if (strcasecmp(substr($item->flink, 0, 4), 'http') && strpos($item->flink, 'index.php?') !== false) {
                     $item->flink = JRoute::_($item->flink, true, $item->params->get('secure'));
                 } else {
                     $item->flink = JRoute::_($item->flink);
                 }
                 $item->title = htmlspecialchars($item->title);
                 $item->anchor_css = htmlspecialchars($item->params->get('menu-anchor_css', ''));
                 $item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''));
                 $item->menu_image = $item->params->get('menu_image', '') ? htmlspecialchars($item->params->get('menu_image', '')) : '';
             }
             if (isset($items[$lastitem])) {
                 $items[$lastitem]->deeper = ($start ? $start : 1) > $items[$lastitem]->level;
                 $items[$lastitem]->shallower = ($start ? $start : 1) < $items[$lastitem]->level;
                 $items[$lastitem]->level_diff = $items[$lastitem]->level - ($start ? $start : 1);
             }
         }
         $cache->store($items, $key);
     } else {
         foreach ($items as $item) {
             if ($item->component) {
                 $lang->load($item->component . '.sys', JPATH_ADMINISTRATOR);
                 $lang->load($item->component . '.sys', JPATH_ADMINISTRATOR . '/components/' . $item->component);
                 $lang->load($item->component . '.menu', JPATH_ADMINISTRATOR);
                 $lang->load($item->component . '.menu', JPATH_ADMINISTRATOR . '/components/' . $item->component);
             }
         }
     }
     return $items;
 }
示例#28
0
 function loadMenu_15()
 {
     $menu = @JMenu::getInstance();
     if (strtolower(get_class($menu)) == 'jexception') {
         $menu = @JMenu::getInstance('site');
     }
     $user =& JFactory::getUser();
     $children = array();
     // Get Menu Items
     $items =& JSite::getMenu();
     $rows = $items->getItems('menutype', $this->getParam('menutype'));
     // first pass - collect children
     $cacheIndex = array();
     $this->items = array();
     foreach ($rows as $index => $v) {
         if ($v->access <= $user->get('aid', 0)) {
             $pt = $v->parent;
             $list = @$children[$pt] ? $children[$pt] : array();
             switch ($v->type) {
                 case 'url':
                     if (strpos($v->link, 'index.php?') !== false && strpos($v->link, 'Itemid=') === false) {
                         $v->url = $v->link . '&amp;Itemid=' . $v->id;
                     } else {
                         $v->url = $v->link;
                     }
                     break;
                 default:
                     $router = JSite::getRouter();
                     $v->url = $router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid=' . $v->id : $v->link . '&Itemid=' . $v->id;
                     break;
             }
             // Handle SSL links
             $iParams = $this->createParameterObject($v->params);
             $iSecure = $iParams->def('secure', 0);
             if ($v->home == 1) {
                 $v->url = JURI::base();
             } elseif (strcasecmp(substr($v->url, 0, 4), 'http') && strpos($v->link, 'index.php?') !== false) {
                 $v->url = JRoute::_($v->url, true, $iSecure);
             } else {
                 $v->url = str_replace('&', '&amp;', $v->url);
             }
             $v->_idx = count($list);
             array_push($list, $v);
             $children[$pt] = $list;
         }
         $cacheIndex[$v->id] = $index;
         $this->items[$v->id] = $v;
     }
     $this->children = $children;
     // second pass - collect 'open' menus
     $open = array($this->Itemid);
     $count = 20;
     // maximum levels - to prevent runaway loop
     $id = $this->Itemid;
     while (--$count) {
         if (isset($cacheIndex[$id])) {
             $index = $cacheIndex[$id];
             if (isset($rows[$index]) && $rows[$index]->parent > 0) {
                 $id = $rows[$index]->parent;
                 $open[] = $id;
             } else {
                 break;
             }
         }
     }
     $this->open = $open;
     // $this->items = $rows;
 }
 /**
  * Returns the application JPathway object.
  *
  * @param   string  $name     The name of the application/client.
  * @param   array   $options  An optional associative array of configuration settings.
  *
  * @return  JMenu  JMenu object.
  *
  * @since   11.1
  */
 public function getMenu($name = null, $options = array())
 {
     if (!isset($name)) {
         $name = $this->_name;
     }
     jimport('joomla.application.menu');
     $menu = JMenu::getInstance($name, $options);
     if ($menu instanceof Exception) {
         return null;
     }
     return $menu;
 }
示例#30
0
 /**
  * Retrieve parameter pageclass_sfx from active menu
  *
  * @return string
  */
 private function _getPageClass()
 {
     $pageClass = '';
     $notHomePage = true;
     $menus = $this->_document->app->getMenu();
     $menu = $menus->getActive();
     $this->_document->activeMenu = $menu;
     if (is_object($menu)) {
         // Set page class suffix
         $params = JMenu::getInstance('site')->getParams($menu->id);
         $pageClass = $params->get('pageclass_sfx', '');
         // Set homepage flag
         $lang = JFactory::getLanguage();
         $defaultMenu = $menus->getDefault($lang->getTag());
         if (is_object($defaultMenu)) {
             $notHomePage = $menu->id != $defaultMenu->id;
         }
     }
     return explode(' ', $pageClass);
 }