function onContentPrepare($context, &$article, &$params, $limitstart = 1)
 {
     preg_match_all($this->regex, $article->text, $results, PREG_PATTERN_ORDER);
     //var_dump($results);
     if (count($results[0]) > 0) {
         for ($i = 0; $i < count($results[0]); $i++) {
             $subArray = array();
             $subArray = explode("|", $results[1][$i]);
             //var_dump($subArray);
             $contactId = $subArray[0] == '' || $subArray[0] == NULL ? 0 : $subArray[0];
             if (isset($subArray[1])) {
                 $itemId = $subArray[1] == '' || $subArray[1] == NULL ? 0 : $subArray[1];
                 //echo $itemId;
             }
             $itemId = isset($itemId) ? '&Itemid=' . $itemId : NULL;
             // Get Contact Details from Contact Component
             $query = 'SELECT * FROM #__contact_details' . ' WHERE id = ' . $contactId . ' AND published = 1';
             $contactInfo = $this->_getObject($query);
             // Set contact form link
             if (isset($contactInfo->email_to)) {
                 $contactFormLink = 'index.php?option=com_contact&view=contact&id=' . $contactId . $itemId . '&tmpl=component';
                 $contactFormLink = JFilterOutput::ampReplace($contactFormLink);
                 $contactFormOutput = '<iframe id="contact-form" onload="setIframeHeight(this.id)" src="' . $contactFormLink . '" scrolling="no" style="border:none;width:100%;"></iframe>';
                 $script = 'function setIframeHeight( iframeId ){var ifDoc, ifRef = document.getElementById( iframeId );try{ifDoc = ifRef.contentWindow.document.documentElement;}catch( e ){try{ifDoc = ifRef.contentDocument.documentElement;}catch(ee){}}if( ifDoc ){ifRef.height = 1;ifRef.height = ifDoc.scrollHeight;}}';
                 $doc =& JFactory::getDocument();
                 $doc->addScriptDeclaration($script);
                 $article->text = preg_replace($this->regex, $contactFormOutput, $article->text, 1);
             }
         }
     }
     return true;
 }
 function render($selected, $prefix = false)
 {
     $t = JFilterOutput::ampReplace($this->label);
     // ensure ampersands are encoded
     $k = $prefix !== false ? $prefix . '/' . $this->value : $this->value;
     if (count($this->items) > 0) {
         // an option group
         $html = '';
         if ($k !== false) {
             // not the root group
             $html .= '<optgroup label="' . JText::_($t) . '">';
         }
         foreach ($this->items as $option) {
             $html .= $option->render($selected, $k);
         }
         if ($k !== false) {
             // not the root group
             $html .= '</optgroup>';
         }
         return $html;
     } else {
         // a single option
         if ($k !== false) {
             $s = $selected === $k ? ' selected="selected"' : '';
             return '<option value="' . $k . '"' . $s . '>' . JText::_($t) . '</option>';
         } else {
             // no options in root group
             return '';
         }
     }
 }
示例#3
0
    /**
     * Render iconset for cpanel
     *
     * @param $link string
     * @param $image string
     * @access private
     * @return void
     */
    private function renderIcon($link, $dataSourceName, $dataSourceUserViewName, $extensionName)
    {
        $lang = JFactory::getLanguage();
        ?>
		<div style="float:<?php 
        echo $lang->isRTL() ? 'right' : 'left';
        ?>
;">
			<div class="icon hasPopover" data-content="<?php 
        echo sprintf(JText::_('COM_JMAP_CREATE_DATASOURCE'), $dataSourceUserViewName);
        ?>
">
				<a data-role="start_create_process" data-extension="<?php 
        echo $extensionName;
        ?>
" href="<?php 
        echo JFilterOutput::ampReplace($link);
        ?>
">
					<img src="components/com_jmap/images/wizard/<?php 
        echo $dataSourceName;
        ?>
/icon.png" alt="<?php 
        echo $dataSourceUserViewName;
        ?>
"/>
					<span><?php 
        echo $dataSourceUserViewName;
        ?>
</span>
				</a>
			</div>
		</div>
		<?php 
    }
示例#4
0
 /**
  *
  * @return unknown_type
  */
 public static function display($articleid)
 {
     $html = '';
     if (empty($articleid)) {
         return;
     }
     $item = self::getArticle($articleid);
     $mainframe = JFactory::getApplication();
     // Return html if the load fails
     if (!$item->id) {
         return $html;
     }
     $item->title = JFilterOutput::ampReplace($item->title);
     $item->text = '';
     $item->text = $item->introtext . chr(13) . chr(13) . $item->fulltext;
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $params = $mainframe->getParams('com_content');
     // Use param for displaying article title
     $j2store_params = JComponentHelper::getParams('com_j2store');
     $show_title = $j2store_params->get('show_title', $params->get('show_title'));
     if ($show_title) {
         $html .= "<h3>{$item->title}</h3>";
     }
     $html .= $item->introtext;
     return $html;
 }
示例#5
0
 /**
  *
  * @return unknown_type
  */
 public function display($articleid)
 {
     $html = '';
     if (empty($articleid)) {
         return;
     }
     //try loading language associations
     if (version_compare(JVERSION, '3.3', 'gt')) {
         $id = $this->getAssociatedArticle($articleid);
         if ($id && is_int($id)) {
             $articleid = $id;
         }
     }
     $item = $this->getArticle($articleid);
     $mainframe = JFactory::getApplication();
     // Return html if the load fails
     if (!$item->id) {
         return $html;
     }
     $item->title = JFilterOutput::ampReplace($item->title);
     $item->text = '';
     $item->text = $item->introtext . chr(13) . chr(13) . $item->fulltext;
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $params = $mainframe->getParams('com_content');
     $html .= $item->text;
     return $html;
 }
示例#6
0
    function fetchElement($name, $value, &$node, $control_name)
    {
        if ($node['secret'] && !JRequest::getBool($node['secret'])) {
            return null;
        }
        $order = $node['order'] == 'after' ? 'after' : 'before';
        $label = $node['label'] ? $node['label'] : 'Layout Parameters';
        $doc =& JFactory::getDocument();
        $style = "\n\t\t#{$control_name}{$name}-tabs {\n\t\t\tborder-top-width: 0px;\n\t\t\tborder-right-width: 0px;\n\t\t\tborder-bottom-width: 0px;\n\t\t\tborder-left-width: 0px;\n\t\t}";
        $doc->addStyleDeclaration($style);
        $id = JRequest::getInt('id');
        if (!$id) {
            $id = reset(JRequest::getVar('cid', array()));
        }
        $db =& JFactory::getDBO();
        $query = 'SELECT params' . ' FROM #__modules' . ' WHERE id =' . $id;
        $db->setQuery($query);
        $values = $db->loadResult();
        //Get the module name, in a slightly hacky way.
        $module = JRequest::getWord('module');
        $mod =& JTable::getInstance('Module', 'JTable');
        if ($id) {
            $mod->load($id);
            $modname = $mod->module;
        } elseif ($module) {
            $modname = $module;
        }
        nimport('napi.html.parameter');
        $load = new NParameter($values, JPATH_ROOT . DS . 'modules' . DS . $modname . DS . $modname . '.xml');
        if (!$node->children()) {
            $content = $load->renderFieldset('params', $value, $node['suffix']);
            $container = $node['panel'] ? "\n\t\t\t<div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>\n\t\t\t\t<h3 class='title jpane-toggler' id='{$name}-page'>\n\t\t\t\t\t<span>" . JFilterOutput::ampReplace($label) . "</span>\n\t\t\t\t</h3>\n\t\t\t\t<div class='jpane-slider ui-widget-content content' style='background:transparent;'>{$content}</div>\n\t\t\t</div>" : " <div id='{$control_name}{$name}'>{$content}</div>";
            $script = "\n\t\t\t\tjQuery.noConflict();\n\t \n\t\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t\t\t});\n\t\t\t\t";
            $doc->addScriptDeclaration($script);
        } else {
            $content = null;
            $panel = null;
            $title = null;
            $container = $node['panel'] ? " <div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>" : " <div id='{$control_name}{$name}'>";
            $opt['useCookie'] = $node['cookie'] ? '\'' . $node['cookie'] . '\'' : null;
            JHTML::script('tabs.js');
            $panel .= JPaneTabs::startPane($control_name . $name . 'tabs');
            foreach ($node->children() as $group) {
                $content = $load->renderFieldset('params', $group['value'], $node['suffix']);
                $title .= $node['panel'] ? ' <span>' . JFilterOutput::ampReplace($group->data()) . '</span>' : JFilterOutput::ampReplace($group->data());
                $panel .= $node['panel'] ? JPaneTabs::startPanel(JFilterOutput::ampReplace($group->data()), $group['value']) . $content . JPaneTabs::endPanel() : $content;
            }
            $panel .= JPaneTabs::endPane();
            $container .= $node['panel'] ? '<h3 class="title jpane-toggler" id="' . $value . '-page"><span>' . JFilterOutput::ampReplace($label) . '</span></h3>
					<div class="jpane-slider jpane-current ui-widget-content content" style="background:transparent;">' . $panel . '</div>
				</div>' : $panel . '</div>';
            JHTML::script('accordion.fix.js', 'media/napi/js/');
            JHTML::script('tabs.fix.js', 'media/napi/js/');
            $script = "\n\t\tjQuery.noConflict();\n \n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t});";
            $doc->addScriptDeclaration($script);
            $doc->addStyleDeclaration('.jpane-current div.current { padding: 0px 0px; border-width:0px; border-top-width:1px;}');
        }
        return $container;
    }
	/**
	 * Tests replacing single ampersands with the entity, but leaving double ampersands
	 * and ampsersand-octothorpe combinations intact.
	 *
	 * @return void
	 */
	public function testAmpReplace()
	{
		$this->assertEquals(
			'&&george&amp;mary&#3son',
			$this->object->ampReplace('&&george&mary&#3son'),
			'Should replace single ampersands with HTML entity'
		);
	}
    function fetchElement($name, $value, &$node, $control_name)
    {
        if ($node['secret'] && !JRequest::getBool($node['secret'])) {
            return null;
        }
        $order = $node['order'] == 'after' ? 'after' : 'before';
        $label = $node['label'] ? $node['label'] : 'Layout Parameters';
        $doc =& JFactory::getDocument();
        $style = "\n\t\t#{$control_name}{$name}-tabs {\n\t\t\tborder-top-width: 0px;\n\t\t\tborder-right-width: 0px;\n\t\t\tborder-bottom-width: 0px;\n\t\t\tborder-left-width: 0px;\n\t\t}";
        $doc->addStyleDeclaration($style);
        $id = JRequest::getInt('id');
        if (!$id) {
            $id = reset(JRequest::getVar('cid', array()));
        }
        $db =& JFactory::getDBO();
        $query = 'SELECT params' . ' FROM #__modules' . ' WHERE id =' . $id;
        $db->setQuery($query);
        $values = $db->loadResult();
        //Get the module name, in a slightly hacky way.
        $module = JRequest::getWord('module');
        $mod =& JTable::getInstance('Module', 'JTable');
        if ($id) {
            $mod->load($id);
            $modname = $mod->module;
        } elseif ($module) {
            $modname = $module;
        }
        nimport('napi.html.parameter');
        $load = new NParameter($values, JPATH_ROOT . DS . 'modules' . DS . $modname . DS . $modname . '.xml');
        if (!$node->children()) {
            $content = $load->renderFieldset('params', $value, $node['suffix']);
            $container = $node['panel'] ? "\n\t\t\t<div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>\n\t\t\t\t<h3 class='title jpane-toggler' id='{$name}-page'>\n\t\t\t\t\t<span>" . JFilterOutput::ampReplace($label) . "</span>\n\t\t\t\t</h3>\n\t\t\t\t<div class='jpane-slider ui-widget-content content' style='background:transparent;'>{$content}</div>\n\t\t\t</div>" : " <div id='{$control_name}{$name}'>{$content}</div>";
            $script = "\n\t\t\t\tjQuery.noConflict();\n\t \n\t\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t\t\t});\n\t\t\t\t";
            $doc->addScriptDeclaration($script);
        } else {
            $content = null;
            $panel = null;
            $title = null;
            $container = $node['panel'] ? " <div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>" : " <div id='{$control_name}{$name}'>";
            $opt['useCookie'] = $node['cookie'] ? '\'' . $node['cookie'] . '\'' : null;
            JHTML::script('tabs.js');
            $panel .= JPaneTabs::startPane($control_name . $name . 'tabs');
            foreach ($node->children() as $group) {
                $content = $load->renderFieldset('params', $group['value'], $node['suffix']);
                $title .= $node['panel'] ? ' <span>' . JFilterOutput::ampReplace($group->data()) . '</span>' : JFilterOutput::ampReplace($group->data());
                $panel .= $node['panel'] ? JPaneTabs::startPanel(JFilterOutput::ampReplace($group->data()), $group['value']) . $content . JPaneTabs::endPanel() : $content;
            }
            $panel .= JPaneTabs::endPane();
            $container .= $node['panel'] ? '<h3 class="title jpane-toggler" id="' . $value . '-page"><span>' . JFilterOutput::ampReplace($label) . '</span></h3>
					<div class="jpane-slider jpane-current ui-widget-content content" style="background:transparent;">' . $panel . '</div>
				</div>' : $panel . '</div>';
            $script = "\n\t\tjQuery.noConflict();\n \n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t});\n\t\t\t\t\n\t\t\t\t\n\t\twindow.addEvent('domready', function(){ \n\t\t\t\n\t\t\tvar dur = 600;\n\t\t\tvar trans = Fx.Transitions.Quad.easeInOut;\n\t\t\tvar el = \$\$('#{$control_name}{$name} div.jpane-slider').getFirst();\n\t\t\tvar fx = new Fx.Styles(el, {duration: dur, transition: trans});\n\t\t\t\n\t\t\t\$\$('dl.tabs').each(function(tabs){ new JTabs(tabs, {\n\t\t\tonActive: function(title, description){\n                description.effects({duration: dur, transition: trans}).start({'opacity': 1, 'height': description.getSize().scrollSize.y});\n                title.addClass('open').removeClass('closed');\n\t            el.effects({duration: dur, transition: trans}).start({'height': description.getSize().scrollSize.y + title.getParent().getSize().scrollSize.y + title.getParent().getStyle('margin-top').toInt()});\n            },\n            onBackground: function(title, description){\n            \tdescription.effects({duration: dur, transition: trans}).start({'opacity': 0});\n            \tdescription.effects({duration: dur, transition: trans}).start({'height': 0});\n                title.addClass('closed').removeClass('open');\n            },\n            cookie: 'showcase'}); }); \n        });";
            $doc->addScriptDeclaration($script);
            $doc->addStyleDeclaration('.jpane-current div.current { padding: 0px 0px; border-width:0px; border-top-width:1px;}');
        }
        return $container;
    }
示例#9
0
    public static function getVMComponent($authCheck = true)
    {
        $lang = JFactory::getLanguage();
        $user = JFactory::getUser();
        $db = JFactory::getDBO();
        $q = 'SELECT m.id, m.title, m.alias, m.link, m.parent_id, m.img, e.element FROM `#__menu` as m
				LEFT JOIN #__extensions AS e ON m.component_id = e.extension_id
		         WHERE m.client_id = 1 AND e.enabled = 1 AND m.id > 1 AND e.element = \'com_virtuemart\'
		         AND (m.parent_id=1 OR m.parent_id =
			                        (SELECT m.id FROM `#__menu` as m
									LEFT JOIN #__extensions AS e ON m.component_id = e.extension_id
			                        WHERE m.parent_id=1 AND m.client_id = 1 AND e.enabled = 1 AND m.id > 1 AND e.element = \'com_virtuemart\'))
		         ORDER BY m.lft';
        $db->setQuery($q);
        $vmComponentItems = $db->loadObjectList();
        $result = new stdClass();
        if ($vmComponentItems) {
            if (!class_exists('VmConfig')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
            }
            VmConfig::loadJLang('com_virtuemart.sys');
            // Parse the list of extensions.
            foreach ($vmComponentItems as &$vmComponentItem) {
                $vmComponentItem->link = trim($vmComponentItem->link);
                $vmComponentItem->link = JFilterOutput::ampReplace($vmComponentItem->link);
                if ($vmComponentItem->parent_id == 1) {
                    if ($authCheck == false || $authCheck && $user->authorise('core.manage', $vmComponentItem->element)) {
                        $result = $vmComponentItem;
                        if (!isset($result->submenu)) {
                            $result->submenu = array();
                        }
                        if (empty($vmComponentItem->link)) {
                            $vmComponentItem->link = 'index.php?option=' . $vmComponentItem->element;
                        }
                        $vmComponentItem->text = $lang->hasKey($vmComponentItem->title) ? JText::_($vmComponentItem->title) : $vmComponentItem->alias;
                    }
                } else {
                    // Sub-menu level.
                    if (isset($result)) {
                        // Add the submenu link if it is defined.
                        if (isset($result->submenu) && !empty($vmComponentItem->link)) {
                            $vmComponentItem->text = $lang->hasKey($vmComponentItem->title) ? JText::_($vmComponentItem->title) : $vmComponentItem->alias;
                            $class = preg_replace('#\\.[^.]*$#', '', basename($vmComponentItem->img));
                            $class = preg_replace('#\\.\\.[^A-Za-z0-9\\.\\_\\- ]#', '', $class);
                            $vmComponentItem->class = "icon-16-" . $class;
                            $result->submenu[] =& $vmComponentItem;
                        }
                    }
                }
            }
            return $result;
        } else {
            return NULL;
        }
    }
示例#10
0
 function display($tpl = null)
 {
     global $mainframe;
     $this->_layout = 'default';
     /*
      * Set toolbar items for the page
      */
     $menutype = $mainframe->getUserStateFromRequest('com_menus.menutype', 'menutype', 'mainmenu', 'menutype');
     JToolBarHelper::title(JText::_('MENU ITEM MANAGER'), 'menu.png');
     JToolBarHelper::addNewX('newItem');
     JToolBarHelper::spacer();
     JToolBarHelper::trash();
     JToolBarHelper::spacer();
     JToolBarHelper::customX('move', 'move.png', 'move_f2.png', 'Move', true);
     JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', 'Copy', true);
     JToolBarHelper::spacer();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::spacer();
     JToolBarHelper::makeDefault('setdefault');
     JSubMenuHelper::addEntry(JText::_('Items'), 'index.php?option=com_menus&task=view', true);
     JSubMenuHelper::addEntry(JText::_('Menus'), 'index.php?option=com_menus');
     if (JFactory::getUser()->authorize('com_trash', 'manage')) {
         JSubMenuHelper::addEntry(JText::_('Trash'), 'index.php?option=com_trash&task=viewMenu');
     }
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('View Menu Items'));
     $limitstart = JRequest::getVar('limitstart', '0', '', 'int');
     $items =& $this->get('Items');
     $pagination =& $this->get('Pagination');
     $lists =& $this->_getViewLists();
     $user =& JFactory::getUser();
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'helper.php';
     $menus = MenusHelper::getMenuTypelist();
     // Ensure ampersands and double quotes are encoded in item titles
     foreach ($items as $i => $item) {
         $treename = $item->treename;
         $treename = JFilterOutput::ampReplace($treename);
         $treename = str_replace('"', '&quot;', $treename);
         $items[$i]->treename = $treename;
     }
     //Ordering allowed ?
     $ordering = $lists['order'] == 'm.ordering';
     JHTML::_('behavior.tooltip');
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('lists', $lists);
     $this->assignRef('user', $user);
     $this->assignRef('menutype', $menutype);
     $this->assignRef('ordering', $ordering);
     $this->assignRef('limitstart', $limitstart);
     $this->assignRef('menus', $menus);
     parent::display($tpl);
 }
示例#11
0
    function showContent($option, $rows)
    {
        ?>
		
		<form action="index.php" method="post" name="adminForm">
		  <table class="adminlist">
		    <thead>
		      <tr>
			<th width="20">&nbsp;</th>
			<th class="title">Title</th>
		      </tr>
		    </thead>
		<?php 
        jimport('joomla.filter.output');
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $checked = JHTML::_("grid.id", $i, $row->id);
            $link = JFilterOutput::ampReplace('index.php?option=' . $option . '&task=edit&cid[]=' . $row->id);
            ?>
			<tr class="<?php 
            echo "row{$k}";
            ?>
">
			  <td><?php 
            echo $checked;
            ?>
</td>
			  <td><a href="<?php 
            echo $link;
            ?>
"><?php 
            echo $row->title;
            ?>
</a></td>
			</tr>
			<?php 
        }
        ?>
		</table>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
"/>
		<input type="hidden" name="task" value=""/>
		<input type="hidden" name="boxchecked" value="0"/>
		</form>
		<?php 
    }
示例#12
0
 function get()
 {
     global $mainframe;
     // Lets get some variables we are going to need
     $menu = JToolBar::getInstance('submenu');
     $list = $menu->_bar;
     if (!is_array($list) || !count($list)) {
         $option = JRequest::getCmd('option');
         if ($option == 'com_categories') {
             $section = JRequest::getCmd('section');
             if ($section) {
                 if ($section != 'content') {
                     // special handling for specific core components
                     $map['com_contact_details'] = 'com_contact';
                     $map['com_banner'] = 'com_banners';
                     $option = isset($map[$section]) ? $map[$section] : $section;
                 }
             }
         }
         $list = JAdminSubMenu::_loadDBList($option);
     }
     if (!is_array($list) || !count($list)) {
         return null;
     }
     $hide = JRequest::getInt('hidemainmenu');
     $txt = "<ul id=\"submenu\">\n";
     /*
      * Iterate through the link items for building the menu items
      */
     foreach ($list as $item) {
         $txt .= "<li>\n";
         if ($hide) {
             if (isset($item[2]) && $item[2] == 1) {
                 $txt .= "<span class=\"nolink active\">" . $item[0] . "</span>\n";
             } else {
                 $txt .= "<span class=\"nolink\">" . $item[0] . "</span>\n";
             }
         } else {
             if (isset($item[2]) && $item[2] == 1) {
                 $txt .= "<a class=\"active\" href=\"" . JFilterOutput::ampReplace($item[1]) . "\">" . $item[0] . "</a>\n";
             } else {
                 $txt .= "<a href=\"" . JFilterOutput::ampReplace($item[1]) . "\">" . $item[0] . "</a>\n";
             }
         }
         $txt .= "</li>\n";
     }
     $txt .= "</ul>\n";
     return $txt;
 }
 /**
 * Link the content to the menu
 * @param id The id of the content to insert
 * @param title: The  title of the menu element
 * @param menuselect: The menu where to create the link
 * @param contentType:  to know the kind of content (static content or not)
 */
 function menuLink($id, $title, $menuselect, $contentType, $parent)
 {
     global $mainframe;
     $database =& JFactory::getDBO();
     $menu = strval($menuselect);
     $link = strval($title);
     $link = stripslashes(JFilterOutput::ampReplace($link));
     //find what kind of link needs to be created in $row->link
     switch ($contentType) {
         case "content_section":
             $taskLink = "section";
             break;
         case "content_blog_section":
             $taskLink = "section&layout=blog";
             break;
         case "content_category":
             $taskLink = "category";
             break;
         case "content_blog_category":
             $taskLink = "category&layout=blog";
             break;
         default:
             $taskLink = "article";
     }
     $row =& JTable::getInstance('menu');
     $row->menutype = $menu;
     $row->name = $link;
     $row->alias = JFilterOutput::stringURLSafe($link);
     $row->parent = $parent == -1 ? 0 : $parent;
     $row->type = 'component';
     $row->link = 'index.php?option=com_content&view=' . $taskLink . '&id=' . $id;
     $row->published = 1;
     //$row->componentid	= $id;
     $row->componentid = 20;
     $row->ordering = 9999;
     $row->params = "display_num=10\nshow_headings=1\nshow_date=0\ndate_format=\nfilter=1\nfilter_type=title\norderby_sec=\nshow_pagination=1\nshow_pagination_limit=1\nshow_feed_link=1\nshow_noauth=\nshow_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_item_navigation=\nshow_readmore=\nshow_vote=\nshow_icons=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nshow_hits=\nfeed_summary=\npage_title=\nshow_page_title=1\npageclass_sfx=\nmenu_image=-1\nsecure=0\n\n";
     if (!$row->check()) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     if (!$row->store()) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     $row->reorder("menutype = " . $database->Quote($row->menutype) . " AND parent = " . (int) $row->parent);
     // clean any existing cache files
     //mosCache::cleanCache( 'com_content' );
 }
示例#14
0
    function display($tpl=null) {


        $app = JFactory::getApplication();
        $uri = JFactory::getURI();
        $params = $app->getParams();

        $model = $this->getModel('users');

        $items = $model->get('users');
        if ($items)
            for ($key = 0; $key < count($items); $key++) {
                $user = $items[$key];
                $user->rownr = $key;
                $user->link = JRoute::_("index.php?option=com_bids&task=userdetails&id={$user->id}");
                $items[$key] = $user;
            }

        //add alternate feed link
        if ($params->get('show_feed_link', 1) == 1) {
            $document = JFactory::getDocument();
            $link = '&format=feed&limitstart=';
            $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
            $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
            $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
            $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
        }

        $filters = $model->getFilters();
        $pagination = $model->getPagination();

        $this->assign("action", JRoute::_(JFilterOutput::ampReplace($uri->toString())));
        $this->assign("users", $items);
        $this->assign("sfilters", $filters);

        $this->assign("pagination", $pagination);

        if ($params->get('show_page_title', 1)) {
            $page_title = $this->escape($params->get('page_title', "Show users"));
            $this->assign("page_title", $page_title);
        }
        $this->assign("pageclass_sfx", $params->get('pageclass_sfx'));

        JHTML::_("behavior.modal");
        JHTML::script( JURI::root().'components/com_bids/js/startup.js' );

        parent::display($tpl);
    }
示例#15
0
文件: k2item.php 项目: A-Bush/pprod
 /**
  *
  * @return unknown_type
  */
 public static function display($articleid)
 {
     $html = '';
     $item = K2StoreItem::_getK2Item($articleid);
     // Return html if the load fails
     if (!$item->id) {
         return $html;
     }
     $item->title = JFilterOutput::ampReplace($item->title);
     //import plugins
     $item->text = '';
     $item->text = $item->introtext . chr(13) . chr(13) . $item->fulltext;
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $params = JComponentHelper::getParams('com_k2');
     $dispatcher = JDispatcher::getInstance();
     // process k2 plugins
     //Init K2 plugin events
     $item->event = new JObject();
     $item->event->K2BeforeDisplay = '';
     $item->event->K2AfterDisplay = '';
     $item->event->K2AfterDisplayTitle = '';
     $item->event->K2BeforeDisplayContent = '';
     $item->event->K2AfterDisplayContent = '';
     $item->event->K2CommentsCounter = '';
     JPluginHelper::importPlugin('k2');
     $results = $dispatcher->trigger('onK2BeforeDisplay', array(&$item, &$params, $limitstart));
     $item->event->K2BeforeDisplay = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onK2AfterDisplay', array(&$item, &$params, $limitstart));
     $item->event->K2AfterDisplay = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onK2AfterDisplayTitle', array(&$item, &$params, $limitstart));
     $item->event->K2AfterDisplayTitle = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onK2BeforeDisplayContent', array(&$item, &$params, $limitstart));
     $item->event->K2BeforeDisplayContent = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onK2AfterDisplayContent', array(&$item, &$params, $limitstart));
     $item->event->K2AfterDisplayContent = trim(implode("\n", $results));
     $dispatcher->trigger('onK2PrepareContent', array(&$item, &$params, $limitstart));
     $item->introtext = $item->text;
     // Use param for displaying article title
     $k2store_params = JComponentHelper::getParams('com_k2store');
     $show_title = $k2store_params->get('show_title', $params->get('show_title'));
     if ($show_title) {
         $html .= "<h3>{$item->title}</h3>";
     }
     $html .= $item->introtext;
     return $html;
 }
 function display($tpl = null)
 {
     global $mainframe;
     $this->_layout = 'default';
     /*
      * Set toolbar items for the page
      */
     $menutype = $mainframe->getUserStateFromRequest('com_menus.menutype', 'menutype', 'mainmenu', 'menutype');
     JToolBarHelper::title(JText::_('MENU ITEM MANAGER') . ': <small><small>[' . $menutype . ']</small></small>', 'menu.png');
     $bar =& JToolBar::getInstance('toolbar');
     $bar->appendButton('Link', 'menus', 'Menus', "index.php?option=com_menus");
     JToolBarHelper::makeDefault('setdefault');
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::customX('move', 'move.png', 'move_f2.png', 'Move', true);
     JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', 'Copy', true);
     JToolBarHelper::trash();
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX('newItem');
     JToolBarHelper::help('screen.menus');
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('View Menu Items'));
     $limitstart = JRequest::getVar('limitstart', '0', '', 'int');
     $items =& $this->get('Items');
     $pagination =& $this->get('Pagination');
     $lists =& $this->_getViewLists();
     $user =& JFactory::getUser();
     // Ensure ampersands and double quotes are encoded in item titles
     foreach ($items as $i => $item) {
         $treename = $item->treename;
         $treename = JFilterOutput::ampReplace($treename);
         $treename = str_replace('"', '&quot;', $treename);
         $items[$i]->treename = $treename;
     }
     //Ordering allowed ?
     $ordering = $lists['order'] == 'm.ordering';
     JHTML::_('behavior.tooltip');
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('lists', $lists);
     $this->assignRef('user', $user);
     $this->assignRef('menutype', $menutype);
     $this->assignRef('ordering', $ordering);
     $this->assignRef('limitstart', $limitstart);
     parent::display($tpl);
 }
 function get()
 {
     global $mainframe;
     // Lets get some variables we are going to need
     $menu = JToolBar::getInstance('submenu');
     $list = $menu->_bar;
     if (!is_array($list) || !count($list)) {
         $option = JRequest::getCmd('option');
         $list = JAdminSubMenu::_loadDBList($option);
     }
     if (!is_array($list) || !count($list)) {
         return null;
     }
     $hide = JRequest::getInt('hidemainmenu');
     $txt = "<ul id=\"submenu\">\n";
     /*
      * Iterate through the link items for building the menu items
      */
     foreach ($list as $item) {
         $txt .= "<li>\n";
         if ($hide) {
             if (isset($item[2]) && $item[2] == 1) {
                 $txt .= "<span class=\"nolink active\">" . $item[0] . "</span>\n";
             } else {
                 $txt .= "<span class=\"nolink\">" . $item[0] . "</span>\n";
             }
         } else {
             if (isset($item[2]) && $item[2] == 1) {
                 $txt .= "<a class=\"active\" href=\"" . JFilterOutput::ampReplace($item[1]) . "\">" . $item[0] . "</a>\n";
             } else {
                 $txt .= "<a href=\"" . JFilterOutput::ampReplace($item[1]) . "\">" . $item[0] . "</a>\n";
             }
         }
         $txt .= "</li>\n";
     }
     $txt .= "</ul>\n";
     return $txt;
 }
示例#18
0
 public function prepareItems($items)
 {
     //$source = $this->get('content_source');
     foreach ($items as $item) {
         // Clean title
         $item->title = JFilterOutput::ampReplace($item->title);
         // Category name & link
         $item->catname = $this->getCategory($item);
         $item->catlink = $this->getCategoryLink($item);
         // Link
         $item->link = $this->getLink($item);
         // Image
         $item->image = $this->getImage($item);
         // Date
         $item->date = $this->getDate($item);
         // Set image dimension
         $dimensions = array('width' => $this->get('image_width', 400), 'height' => $this->get('image_height', 300));
         // If thumbnail is enable set its property
         if ($this->get('navigation') == 'thumb' or $this->get('thumb')) {
             $thumb_dimensions = array('width' => $this->get('thumb_width', 100), 'height' => $this->get('thumb_height', 100));
             $item->thumb = XEFUtility::getResizedImage($item->image, $thumb_dimensions, $this->module, '_thumb');
         }
         // Finally re-sized image if image re-sizer is on
         if ($this->get('image_resize')) {
             $item->image = XEFUtility::getResizedImage($item->image, $dimensions, $this->module);
         }
         // Intro text
         $filter_by = $this->get('intro_limit_type');
         // Trim intro text based on filter type
         if ($filter_by == 'words') {
             $item->introtext = XEFUtility::wordLimit($item->introtext, $this->get('intro_limit', 100));
         } elseif ($filter_by == 'chars') {
             $item->introtext = XEFUtility::characterLimit($item->introtext, $this->get('intro_limit', 100));
         }
     }
     return $items;
 }
示例#19
0
    ?>
<span class="small">
	<a href="<?php 
    echo $this->escape($this->article->urls);
    ?>
" target="_blank">
		<?php 
    echo $this->escape($this->article->urls);
    ?>
</a>
</span>
<?php 
}
?>

<?php 
if (isset($this->article->toc)) {
    echo $this->article->toc;
}
?>

<?php 
echo JFilterOutput::ampReplace($this->article->text);
?>

<?php 
echo $this->article->event->afterDisplayContent;
?>

</div>
示例#20
0
} else {
    // fa icons
    $yj_menu_icon_prefix = $item->params->get('yj_menu_icon_prefix', '');
    $yj_menu_icon_suffix = $item->params->get('yj_menu_icon_suffix', '');
    $show_menu_icon_prefix = '';
    $show_menu_icon_suffix = '';
    if (!empty($yj_menu_icon_prefix)) {
        $show_menu_icon_prefix = '<i class="' . $yj_menu_icon_prefix . '"></i> ';
    }
    if (!empty($yj_menu_icon_suffix)) {
        $show_menu_icon_suffix = ' <i class="' . $yj_menu_icon_suffix . '"></i>';
    }
    $linktype = $show_menu_icon_prefix . $item->title . $show_menu_icon_suffix;
}
$flink = $item->flink;
$flink = JFilterOutput::ampReplace(htmlspecialchars($flink));
switch ($item->browserNav) {
    default:
    case 0:
        ?>
<a <?php 
        echo $class;
        ?>
href="<?php 
        echo $flink;
        ?>
" <?php 
        echo $title;
        ?>
><?php 
        echo $linktype;
示例#21
0
<?php

defined('_JEXEC') or die('Restricted access');
?>
<script language="javascript" type="text/javascript">
	function tableOrdering( order, dir, task ) {
	var form = document.adminForm;

	form.filter_order.value 	= order;
	form.filter_order_Dir.value	= dir;
	document.adminForm.submit( task );
}
</script>

<form action="<?php 
echo JFilterOutput::ampReplace($this->action);
?>
" method="post" name="adminForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td align="right" colspan="4">
	<?php 
echo JText::_('DISPLAY_NUM') . '&nbsp;';
echo $this->pagination->getLimitBox();
?>
	</td>
</tr>
<?php 
if ($this->params->def('show_headings', 1)) {
    ?>
<tr>
示例#22
0
 public static function getList(&$params)
 {
     jimport('joomla.filesystem.file');
     $mainframe = JFactory::getApplication();
     $limit = $params->get('itemCount', 5);
     $cid = $params->get('category_id', NULL);
     $ordering = $params->get('itemsOrdering', '');
     $componentParams = JComponentHelper::getParams('com_k2');
     $limitstart = JRequest::getInt('limitstart');
     $user = JFactory::getUser();
     $aid = $user->get('aid');
     $db = JFactory::getDBO();
     $jnow = JFactory::getDate();
     $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
     $nullDate = $db->getNullDate();
     if ($params->get('source') == 'specific') {
         $value = $params->get('items');
         $current = array();
         if (is_string($value) && !empty($value)) {
             $current[] = $value;
         }
         if (is_array($value)) {
             $current = $value;
         }
         $items = array();
         foreach ($current as $id) {
             $query = "SELECT i.*, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams \n\t\t\t\tFROM #__k2_items as i \n\t\t\t\tLEFT JOIN #__k2_categories c ON c.id = i.catid \n\t\t\t\tWHERE i.published = 1 ";
             if (K2_JVERSION != '15') {
                 $query .= " AND i.access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ") ";
             } else {
                 $query .= " AND i.access<={$aid} ";
             }
             $query .= " AND i.trash = 0 AND c.published = 1 ";
             if (K2_JVERSION != '15') {
                 $query .= " AND c.access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ") ";
             } else {
                 $query .= " AND c.access<={$aid} ";
             }
             $query .= " AND c.trash = 0 \n\t\t\t\tAND ( i.publish_up = " . $db->Quote($nullDate) . " OR i.publish_up <= " . $db->Quote($now) . " ) \n\t\t\t\tAND ( i.publish_down = " . $db->Quote($nullDate) . " OR i.publish_down >= " . $db->Quote($now) . " ) \n\t\t\t\tAND i.id={$id}";
             if (K2_JVERSION != '15') {
                 if ($mainframe->getLanguageFilter()) {
                     $languageTag = JFactory::getLanguage()->getTag();
                     $query .= " AND c.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ") AND i.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ")";
                 }
             }
             $db->setQuery($query);
             $item = $db->loadObject();
             if ($item) {
                 $items[] = $item;
             }
         }
     } else {
         $query = "SELECT i.*, CASE WHEN i.modified = 0 THEN i.created ELSE i.modified END as lastChanged, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams";
         if ($ordering == 'best') {
             $query .= ", (r.rating_sum/r.rating_count) AS rating";
         }
         if ($ordering == 'comments') {
             $query .= ", COUNT(comments.id) AS numOfComments";
         }
         $query .= " FROM #__k2_items as i RIGHT JOIN #__k2_categories c ON c.id = i.catid";
         if ($ordering == 'best') {
             $query .= " LEFT JOIN #__k2_rating r ON r.itemID = i.id";
         }
         if ($ordering == 'comments') {
             $query .= " LEFT JOIN #__k2_comments comments ON comments.itemID = i.id";
         }
         if (K2_JVERSION != '15') {
             $query .= " WHERE i.published = 1 AND i.access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ") AND i.trash = 0 AND c.published = 1 AND c.access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ")  AND c.trash = 0";
         } else {
             $query .= " WHERE i.published = 1 AND i.access <= {$aid} AND i.trash = 0 AND c.published = 1 AND c.access <= {$aid} AND c.trash = 0";
         }
         $query .= " AND ( i.publish_up = " . $db->Quote($nullDate) . " OR i.publish_up <= " . $db->Quote($now) . " )";
         $query .= " AND ( i.publish_down = " . $db->Quote($nullDate) . " OR i.publish_down >= " . $db->Quote($now) . " )";
         if ($params->get('catfilter')) {
             if (!is_null($cid)) {
                 if (is_array($cid)) {
                     if ($params->get('getChildren')) {
                         $itemListModel = K2Model::getInstance('Itemlist', 'K2Model');
                         $categories = $itemListModel->getCategoryTree($cid);
                         $sql = @implode(',', $categories);
                         $query .= " AND i.catid IN ({$sql})";
                     } else {
                         JArrayHelper::toInteger($cid);
                         $query .= " AND i.catid IN(" . implode(',', $cid) . ")";
                     }
                 } else {
                     if ($params->get('getChildren')) {
                         $itemListModel = K2Model::getInstance('Itemlist', 'K2Model');
                         $categories = $itemListModel->getCategoryTree($cid);
                         $sql = @implode(',', $categories);
                         $query .= " AND i.catid IN ({$sql})";
                     } else {
                         $query .= " AND i.catid=" . (int) $cid;
                     }
                 }
             }
         }
         if ($params->get('FeaturedItems') == '0') {
             $query .= " AND i.featured != 1";
         }
         if ($params->get('FeaturedItems') == '2') {
             $query .= " AND i.featured = 1";
         }
         if ($params->get('videosOnly')) {
             $query .= " AND (i.video IS NOT NULL AND i.video!='')";
         }
         if ($ordering == 'comments') {
             $query .= " AND comments.published = 1";
         }
         if (K2_JVERSION != '15') {
             if ($mainframe->getLanguageFilter()) {
                 $languageTag = JFactory::getLanguage()->getTag();
                 $query .= " AND c.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ") AND i.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ")";
             }
         }
         switch ($ordering) {
             case 'date':
                 $orderby = 'i.created ASC';
                 break;
             case 'rdate':
                 $orderby = 'i.created DESC';
                 break;
             case 'alpha':
                 $orderby = 'i.title';
                 break;
             case 'ralpha':
                 $orderby = 'i.title DESC';
                 break;
             case 'order':
                 if ($params->get('FeaturedItems') == '2') {
                     $orderby = 'i.featured_ordering';
                 } else {
                     $orderby = 'i.ordering';
                 }
                 break;
             case 'rorder':
                 if ($params->get('FeaturedItems') == '2') {
                     $orderby = 'i.featured_ordering DESC';
                 } else {
                     $orderby = 'i.ordering DESC';
                 }
                 break;
             case 'hits':
                 if ($params->get('popularityRange')) {
                     $datenow = JFactory::getDate();
                     $date = K2_JVERSION == '15' ? $datenow->toMySQL() : $datenow->toSql();
                     $query .= " AND i.created > DATE_SUB('{$date}',INTERVAL " . $params->get('popularityRange') . " DAY) ";
                 }
                 $orderby = 'i.hits DESC';
                 break;
             case 'rand':
                 $orderby = 'RAND()';
                 break;
             case 'best':
                 $orderby = 'rating DESC';
                 break;
             case 'comments':
                 if ($params->get('popularityRange')) {
                     $datenow = JFactory::getDate();
                     $date = K2_JVERSION == '15' ? $datenow->toMySQL() : $datenow->toSql();
                     $query .= " AND i.created > DATE_SUB('{$date}',INTERVAL " . $params->get('popularityRange') . " DAY) ";
                 }
                 $query .= " GROUP BY i.id ";
                 $orderby = 'numOfComments DESC';
                 break;
             case 'modified':
                 $orderby = 'lastChanged DESC';
                 break;
             case 'publishUp':
                 $orderby = 'i.publish_up DESC';
                 break;
             default:
                 $orderby = 'i.id DESC';
                 break;
         }
         $query .= " ORDER BY " . $orderby;
         // $sql = str_replace('#__','jos_',$query);
         // echo $sql;die;
         //var_dump($limit);
         $db->setQuery($query, 0, $limit);
         $items = $db->loadObjectList();
     }
     $model = K2Model::getInstance('Item', 'K2Model');
     $show_introtext = $params->get('item_desc_display', 0);
     $introtext_limit = $params->get('item_desc_max_characs', 100);
     $show_title = $params->get('item_title_display', 1);
     $title_limit = $params->get('item_title_max_characs', 20);
     $item_title_ending_char = $params->get('item_title_ending_char', '');
     $item_desc_ending_char = $params->get('item_desc_ending_char', '');
     if (count($items)) {
         foreach ($items as $item) {
             //Clean title
             $item->title = JFilterOutput::ampReplace($item->title);
             $item->displaytitle = $show_title ? self::truncate($item->title, $title_limit, $item_title_ending_char) : '';
             //Read more link
             $item->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . urlencode($item->alias), $item->catid . ':' . urlencode($item->categoryalias))));
             //Tags
             $item->tags = '';
             if ($params->get('item_tags_display')) {
                 $tags = $model->getItemTags($item->id);
                 for ($i = 0; $i < sizeof($tags); $i++) {
                     $tags[$i]->link = JRoute::_(K2HelperRoute::getTagRoute($tags[$i]->name));
                 }
                 $item->tags = $tags;
             } else {
                 $item->tags = '';
             }
             // Restore the intotext variable after plugins execution
             self::getK2Images($item, $params);
             //Clean the plugin tags
             $item->introtext = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext);
             if ($item->fulltext != '') {
                 $item->fulltext = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->fulltext);
                 $item->introtext = self::_cleanText($item->introtext . $item->fulltext);
             } else {
                 $item->introtext = self::_cleanText($item->introtext);
             }
             $item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit, $item_desc_ending_char) : '';
             $rows[] = $item;
         }
         return $rows;
     }
 }
示例#23
0
                        $liFirstChild->removeChild($span);
                    }
                }
            }
        }
        modMainMenuXMLCallback($node, $args);
        if ($node->name() == 'li') {
            $class = $node->attributes('class');
            if ($class && false !== strpos(' ' . $class, ' active')) {
                $itemChildren =& $node->_children;
                $itemChildren[0]->addAttribute('class', 'active');
            }
        }
    }
    define('modMainMenuArtXMLCallbackDefined', true);
}
if ($attribs['name'] == 'user3') {
    $GLOBALS['menu_showSubmenus'] = false && 1 == $params->get('showAllChildren');
    $xml = modMainMenuHelper::getXML($params->get('menutype'), $params, 'modMainMenuArtXMLCallback');
    if ($xml) {
        $xml->addAttribute('class', 'artmenu');
        if ($tagId = $params->get('tag_id')) {
            $xml->addAttribute('id', $tagId);
        }
        $result = JFilterOutput::ampReplace($xml->toString((bool) $params->get('show_whitespace')));
        $result = str_replace(array('<ul/>', '<ul />'), '', $result);
        echo '<div class="nav"><div class="l"></div><div class="r"></div>' . $result . '</div>';
    }
} else {
    modMainMenuHelper::render($params, 'modMainMenuXMLCallback');
}
示例#24
0
    /**
     * Render menu instance(s) by ID.
     *
     * @param   mixed  $id  Menu instance ID or array of Menu instance ID to be rendered.
     *
     * @return  string
     */
    public static function renderMenu($id)
    {
        $app = JFactory::getApplication();
        $menu = $app->getMenu();
        $active = $menu->getActive();
        $active_id = isset($active) ? $active->id : $menu->getDefault()->id;
        $path = isset($active) ? $active->tree : array();
        $db = JFactory::getDbo();
        $query = $db->getQuery(true)->select('menutype')->from('#__menu_types')->where('id = ' . $db->Quote($id));
        $db->setQuery($query);
        $menuType = $db->loadResult();
        $items = $menu->getItems('menutype', $menuType);
        $lastitem = 0;
        $start = 1;
        $end = 0;
        $showAll = 1;
        if ($items) {
            foreach ($items as $i => $item) {
                if ($start && $start > $item->level || $end && $item->level > $end || !$showAll && $item->level > 1 && !in_array($item->parent_id, $path) || $start > 1 && !in_array($item->tree[$start - 2], $path)) {
                    unset($items[$i]);
                    continue;
                }
                $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;
                // Reverted back for CMS version 2.5.6
                switch ($item->type) {
                    case 'separator':
                        // No further action needed.
                        continue;
                    case 'url':
                        if (strpos($item->link, 'index.php?') === 0 && strpos($item->link, 'Itemid=') === false) {
                            // If this is an internal Joomla link, ensure the Itemid is set.
                            $item->flink = $item->link . '&Itemid=' . $item->id;
                        }
                        break;
                    case 'alias':
                        // If this is an alias use the item id stored in the parameters to make the link.
                        $item->flink = 'index.php?Itemid=' . $item->params->get('aliasoptions');
                        break;
                    default:
                        $router = JSite::getRouter();
                        if ($router->getMode() == JROUTER_MODE_SEF) {
                            $item->flink = 'index.php?Itemid=' . $item->id;
                        } else {
                            $item->flink .= '&Itemid=' . $item->id;
                        }
                        break;
                }
                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, ENT_COMPAT, 'UTF-8', false);
                $item->anchor_css = htmlspecialchars($item->params->get('menu-anchor_css', ''), ENT_COMPAT, 'UTF-8', false);
                $item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''), ENT_COMPAT, 'UTF-8', false);
                $item->menu_image = $item->params->get('menu_image', '') ? htmlspecialchars($item->params->get('menu_image', ''), ENT_COMPAT, 'UTF-8', false) : '';
            }
            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);
            }
        }
        echo "<ul class=\"menu jsn-menu jsn-menu-mobile jsn-toggle menu-stickymenu\">";
        foreach ($items as $i => &$item) {
            $class = 'item-' . $item->id;
            if ($item->id == $active_id) {
                $class .= ' current';
            }
            if (in_array($item->id, $path)) {
                $class .= ' active';
            } elseif ($item->type == 'alias') {
                $aliasToId = $item->params->get('aliasoptions');
                if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) {
                    $class .= ' active';
                } elseif (in_array($aliasToId, $path)) {
                    $class .= ' alias-parent-active';
                }
            }
            if (!empty($item->deeper)) {
                $class .= ' deeper';
            }
            if (!empty($item->parent)) {
                $class .= ' parent';
            }
            if (!empty($class)) {
                $class = ' class="' . trim($class) . '"';
            }
            echo '<li' . $class . '>';
            // Render the menu item.
            // Note. It is important to remove spaces between elements.
            $class = !empty($item->anchor_css) ? 'class="' . $item->anchor_css . '" ' : '';
            $title = !empty($item->anchor_title) ? 'title="' . $item->anchor_title . '" ' : '';
            if (!empty($item->menu_image)) {
                $item->params->get('menu_text', 1) ? $linktype = '<img src="' . $item->menu_image . '" alt="' . $item->title . '" /><span class="image-title">' . $item->title . '</span> ' : ($linktype = '<img src="' . $item->menu_image . '" alt="' . $item->title . '" />');
            } else {
                $linktype = $item->title;
            }
            $flink = !empty($item->flink) ? $item->flink : "";
            $flink = JFilterOutput::ampReplace(htmlspecialchars($flink));
            switch ($item->browserNav) {
                default:
                case 0:
                    ?>
				<a <?php 
                    echo $class;
                    ?>
href="<?php 
                    echo $flink;
                    ?>
" <?php 
                    echo $title;
                    ?>
><?php 
                    echo $linktype;
                    ?>
</a><?php 
                    break;
                case 1:
                    // _blank
                    ?>
				<a <?php 
                    echo $class;
                    ?>
href="<?php 
                    echo $flink;
                    ?>
" target="_blank" <?php 
                    echo $title;
                    ?>
><?php 
                    echo $linktype;
                    ?>
</a><?php 
                    break;
            }
            // The next item is deeper.
            if (!empty($item->deeper)) {
                echo '<ul>';
            } elseif (!empty($item->shallower)) {
                echo '</li>';
                echo str_repeat('</ul></li>', $item->level_diff);
            } else {
                echo '</li>';
            }
        }
        echo "</ul>";
    }
示例#25
0
文件: Menu.php 项目: nmsde/gantry5
 /**
  * Get a list of the menu items.
  *
  * Logic was originally copied from Joomla 3.4 mod_menu/helper.php (joomla-cms/staging, 2014-11-12).
  * We should keep the contents of the function similar to Joomla in order to review it against any changes.
  *
  * @param  array  $params
  * @param  array  $items
  */
 public function getList(array $params, array $items)
 {
     // Get base menu item for this menu (defaults to active menu item).
     $this->base = $this->calcBase($params['base']);
     // Make sure that the menu item exists.
     if (!$this->base) {
         return;
     }
     $levels = \JFactory::getUser()->getAuthorisedViewLevels();
     asort($levels);
     // FIXME: need to create collection class to gather the sibling data, otherwise caching cannot work.
     //$key = 'gantry_menu_items.' . json_encode($params) . '.' . json_encode($levels) . '.' . $this->base->id;
     //$cache = \JFactory::getCache('mod_menu', '');
     //try {
     //    $this->items = $cache->get($key);
     //} catch (\Exception $e) {
     //    $this->items = false;
     //}
     if (1) {
         $tree = $this->base->tree;
         $start = $params['startLevel'];
         $max = $params['maxLevels'];
         $end = $max ? $start + $max - 1 : 0;
         $menuItems = $this->getItemsFromPlatform($params);
         $itemMap = [];
         foreach ($items as $path => &$itemRef) {
             if (isset($itemRef['id']) && is_numeric($itemRef['id'])) {
                 $itemMap[$itemRef['id']] =& $itemRef;
             }
         }
         foreach ($menuItems as $menuItem) {
             if ($start && $start > $menuItem->level || $end && $menuItem->level > $end || $start > 1 && !in_array($menuItem->tree[$start - 2], $tree)) {
                 continue;
             }
             // These params always come from Joomla and cannot be overridden.
             $itemParams = ['id' => $menuItem->id, 'type' => $menuItem->type, 'alias' => $menuItem->alias, 'path' => $menuItem->route, 'link' => $menuItem->link];
             // Rest of the items will come from saved configuration.
             if (isset($itemMap[$menuItem->id])) {
                 // ID found, use it.
                 $itemParams += $itemMap[$menuItem->id];
             } elseif (isset($items[$menuItem->route])) {
                 // ID not found, try to use route.
                 $itemParams += $items[$menuItem->route];
             }
             // Get default target from Joomla.
             switch ($menuItem->browserNav) {
                 default:
                 case 0:
                     // Target window: Parent.
                     $target = '_self';
                     break;
                 case 1:
                 case 2:
                     // Target window: New with navigation.
                     $target = '_blank';
                     break;
             }
             // And if not available in configuration, default to Joomla.
             $itemParams += ['title' => $menuItem->title, 'subtitle' => $menuItem->params->get('menu-anchor_title', ''), 'anchor_class' => $menuItem->params->get('menu-anchor_css', ''), 'image' => $menuItem->params->get('menu_image', ''), 'icon_only' => !$menuItem->params->get('menu_text', 1), 'target' => $target];
             $item = new Item($this, $menuItem->route, $itemParams);
             $this->add($item);
             $link = $item->link;
             switch ($item->type) {
                 case 'separator':
                 case 'heading':
                     // These types have no link.
                     $link = null;
                     break;
                 case 'url':
                     if (strpos($item->link, 'index.php?') === 0 && strpos($item->link, 'Itemid=') === false) {
                         // If this is an internal Joomla link, ensure the Itemid is set.
                         $link = $item->link . '&Itemid=' . $item->id;
                     }
                     break;
                 case 'alias':
                     // If this is an alias use the item id stored in the parameters to make the link.
                     $link = 'index.php?Itemid=' . $menuItem->params->get('aliasoptions', 0);
                     break;
                 default:
                     $app = $this->app;
                     $router = $app::getRouter();
                     if ($router->getMode() == JROUTER_MODE_SEF) {
                         $link = 'index.php?Itemid=' . $item->id;
                         if (isset($menuItem->query['format']) && $app->get('sef_suffix')) {
                             $link .= '&format=' . $menuItem->query['format'];
                         }
                     } else {
                         $link .= '&Itemid=' . $item->id;
                     }
                     break;
             }
             if (!$link) {
                 $item->url(false);
             } elseif (strcasecmp(substr($link, 0, 4), 'http') && strpos($link, 'index.php?') !== false) {
                 $item->url(\JRoute::_($link, false, $menuItem->params->get('secure')));
             } else {
                 $item->url(\JRoute::_($link, false));
             }
             if ($item->type == 'url') {
                 // Moved from modules/mod_menu/tmpl/default_url.php, not sure why Joomla had application logic in there.
                 // Keep compatibility to Joomla menu module, but we need non-encoded version of the url.
                 $item->url(htmlspecialchars_decode(\JFilterOutput::ampReplace(htmlspecialchars($item->link))));
             }
         }
         // FIXME: need to create collection class to gather the sibling data, otherwise caching cannot work.
         // $cache->store($this->items, $key);
     }
 }
示例#26
0
            ?>
					<li>
				<?php 
        }
        if ($displayData->hide) {
            ?>
					<a class="nolink"><?php 
            echo $item[0];
            ?>
</a>
				<?php 
        } else {
            if (strlen($item[1])) {
                ?>
						<a href="<?php 
                echo JFilterOutput::ampReplace($item[1]);
                ?>
"><?php 
                echo $item[0];
                ?>
</a>
					<?php 
            } else {
                ?>
						<?php 
                echo $item[0];
                ?>
					<?php 
            }
        }
        ?>
示例#27
0
      <th width="10%">Defense</th>
      <th width="10%">nbr attacks</th>
      <th width="10%">nbr kills  </th>  
      <th width="10%">active  </th> 
      <th width="10%">time killled  </th>  
      <th width="10%">strength   </th>   
    </tr>
  </thead>
<?php 
jimport('joomla.filter.output');
$k = 0;
for ($i = 0, $n = count($this->rows); $i < $n; $i++) {
    $row =& $this->rows[$i];
    $checked = JHTML::_('grid.id', $i, $row->id);
    $published = JHTML::_('grid.published', $row, $i);
    $link = JFilterOutput::ampReplace('index.php?option=com_battle&task=edit&controller=players&cid[]=' . $row->id);
    ?>
    <tr class="<?php 
    echo "row{$k}";
    ?>
">
      <td>
	<?php 
    echo $checked;
    ?>
      </td>
	    <td>
       <?php 
    echo $row->id;
    ?>
      </td>
示例#28
0
    echo $this->escape($this->item->urls);
    ?>
</a>
</span>
<?php 
}
?>

<?php 
if (isset($this->item->toc)) {
    echo $this->item->toc;
}
?>

<?php 
echo JFilterOutput::ampReplace($this->item->text);
?>

<?php 
if ($this->item->params->get('show_readmore') && $this->item->readmore) {
    ?>
<p>
	<a href="<?php 
    echo $this->item->readmore_link;
    ?>
" class="readon<?php 
    echo $this->escape($this->item->params->get('pageclass_sfx'));
    ?>
">
		<?php 
    if ($this->item->readmore_register) {
示例#29
0
    }
    ?>
</h4>
<?php 
}
?>

<?php 
if (!$params->get('intro_only')) {
    echo $item->afterDisplayTitle;
}
?>

<?php 
echo $item->beforeDisplayContent;
echo JFilterOutput::ampReplace($item->text);
if (isset($item->linkOn) && $item->readmore) {
    ?>
<a href="<?php 
    $item->linkOn;
    ?>
" class="readon">
	<?php 
    echo JText::_('Read more');
    ?>
</a>
<?php 
}
?>
<span class="article_separator">&nbsp;</span>
示例#30
0
/**
 * Render Juikit standard menu
 */
function juikitMenuHelper($list, $active_id, $path)
{
    foreach ($list as $i => $item) {
        // default values
        $data = '';
        $class = 'tm-menu-item-' . $item->id;
        // current
        if ($item->id == $active_id or $item->type == 'alias' and $item->params->get('aliasoptions') == $active_id) {
            $class .= ' tm-current';
        }
        // active
        if (in_array($item->id, $path)) {
            $class .= ' uk-active tm-active';
        } elseif ($item->type == 'alias') {
            $aliasToId = $item->params->get('aliasoptions');
            if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) {
                $class .= ' uk-active tm-active';
            } elseif (in_array($aliasToId, $path)) {
                $class .= ' uk-active tm-active tm-alias-parent-active';
            }
        }
        // deeper
        if ($item->deeper && $item->level == 1) {
            $class .= ' ';
            $data .= ' ';
        }
        if ($item->deeper && $item->level > 1) {
            $class .= ' ';
        }
        if ($item->parent && $item->level == 1) {
            $class .= ' uk-parent';
        }
        if (!empty($class)) {
            $class = ' class="' . trim($class) . '"';
        }
        if ($item->type == 'separator') {
            $class = ' class="tm-menu-separator"';
        }
        echo '<li' . $class . $data . '>';
        // render the item link
        if ($item->type == 'separator') {
            echo '<li class="uk-nav-divider"></li>';
        } else {
            $item_class = $item->anchor_css ? 'class="' . $item->anchor_css . '" ' : '';
            $item_title = $item->anchor_title ? 'title="' . $item->anchor_title . '" ' : '';
            $item_link = $item->type == 'component' ? $item->flink : JFilterOutput::ampReplace(htmlspecialchars($item->flink));
            switch ($item->browserNav) {
                default:
                case 0:
                    echo '<a ' . $item_class . ' href="' . $item_link . '"' . $item_title . '>' . $item->title . '</a>';
                    break;
                case 1:
                    // _blank
                    echo '<a ' . $item_class . ' href="' . $item_link . '" target="_blank"' . $item_title . '>' . $item->title . '</a>';
                    break;
                case 2:
                    // window.open
                    echo '<a ' . $item_class . ' href="' . $item_link . '" onclick="window.open(this.href,\'targetWindow\',\'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes\');return false;"' . $item_title . '>' . $item->title . '</a>';
                    break;
            }
        }
        // The next item is deeper
        if ($item->deeper) {
            $ul_class = $item->level == 1 ? ' class="uk-nav-sub"' : '';
            echo "\n<ul{$ul_class}>\n";
        } elseif ($item->shallower) {
            echo "</li>\n";
            for ($i = $item->level_diff; $i--; $i == 0) {
                echo "</li></ul>\n";
            }
        } else {
            echo "</li>\n";
        }
    }
}