mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 17:39:46 +01:00
allow classes within core shortcodes (.php) + sitelinks duplication fix.
This commit is contained in:
parent
510bda0f68
commit
8d0028afe1
@ -4,15 +4,23 @@
|
||||
| e107 website system
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/sitelinks_alt.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2009-11-21 11:36:04 $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-11-23 10:27:35 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
function sitelinks_alt_shortcode($parm)
|
||||
|
||||
|
||||
class sitelinks_alt
|
||||
{
|
||||
global $sql,$pref;
|
||||
function sitelinks_alt_shortcode($parm)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
|
||||
global $pref;
|
||||
|
||||
$params = explode('+', $parm);
|
||||
|
||||
if (isset($params[0]) && $params[0] && $params[0] != 'no_icons' && $params[0] != 'default')
|
||||
{
|
||||
$icon = $params[0];
|
||||
@ -22,9 +30,66 @@ function sitelinks_alt_shortcode($parm)
|
||||
$icon = e_IMAGE."generic/arrow.png";
|
||||
}
|
||||
|
||||
$js_file = ($params[1] == 'noclick') ? 'nav_menu_alt.js' : 'nav_menu.js';
|
||||
|
||||
if (file_exists(THEME.$js_file))
|
||||
{
|
||||
$text = "<script type='text/javascript' src='".THEME_ABS.$js_file."'></script>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = "<script type='text/javascript' src='".e_FILE_ABS.$js_file."'></script>";
|
||||
}
|
||||
$text .= "<div class='menuBar' style='width:100%; white-space: nowrap'>";
|
||||
|
||||
// Setup Parent/Child Arrays ---->
|
||||
|
||||
$lnk = e107::getSitelinks();
|
||||
$lnk->getlinks(1);
|
||||
$linklist = $lnk->getLinkArray();
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
// Loops thru parents.
|
||||
|
||||
|
||||
|
||||
foreach ($linklist['head_menu'] as $lk)
|
||||
{
|
||||
$lk['link_url'] = $tp->replaceConstants($lk['link_url'], TRUE, TRUE);
|
||||
if ($params[0] == 'no_icons')
|
||||
{
|
||||
$link_icon = 'no_icons';
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_icon = $lk['link_button'] ? e_IMAGE.'icons/'.$lk['link_button'] : $icon;
|
||||
}
|
||||
|
||||
$main_linkid = $lk['link_id'];
|
||||
if (isset($linklist['sub_'.$main_linkid])) // Has Children.
|
||||
{
|
||||
|
||||
$text .= self::adnav_cat($lk['link_name'], '', $link_icon, 'l_'.$main_linkid);
|
||||
$text .= self::render_sub($linklist, $main_linkid, $params, $icon);
|
||||
}
|
||||
else // Display Parent only.
|
||||
{
|
||||
$text .= self::adnav_cat($lk['link_name'], $lk['link_url'], $link_icon, FALSE, $lk['link_open']);
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "</div>";
|
||||
|
||||
return $text;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function adnav_cat($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $cat_open = FALSE)
|
||||
{
|
||||
global $tp;
|
||||
$tp = e107::getParser();
|
||||
|
||||
$cat_link = (strpos($cat_link, '://') === FALSE && strpos($cat_link, 'mailto:') !== 0 ? e_HTTP.$cat_link : $cat_link);
|
||||
|
||||
@ -57,7 +122,8 @@ function sitelinks_alt_shortcode($parm)
|
||||
|
||||
function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $params, $cat_open = FALSE)
|
||||
{
|
||||
global $tp;
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
$cat_link = (strpos($cat_link, '://') === FALSE) ? e_HTTP.$cat_link : $cat_link;
|
||||
$cat_link = $tp->replaceConstants($cat_link, TRUE, TRUE);
|
||||
@ -134,11 +200,11 @@ function sitelinks_alt_shortcode($parm)
|
||||
if (isset($linklist['sub_'.$sub['link_id']]))
|
||||
{ // Has Children.
|
||||
$sub_ids[] = $sub['link_id'];
|
||||
$text .= adnav_main($subname, $sub['link_url'], $sub_icon, 'l_'.$sub['link_id'], $params, $sub['link_open']);
|
||||
$text .= self::adnav_main($subname, $sub['link_url'], $sub_icon, 'l_'.$sub['link_id'], $params, $sub['link_open']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= adnav_main($subname, $sub['link_url'], $sub_icon, null, $params, $sub['link_open']);
|
||||
$text .= self::adnav_main($subname, $sub['link_url'], $sub_icon, null, $params, $sub['link_open']);
|
||||
}
|
||||
|
||||
}
|
||||
@ -148,70 +214,10 @@ function sitelinks_alt_shortcode($parm)
|
||||
{
|
||||
foreach ($sub_ids as $sub_id)
|
||||
{
|
||||
$text .= render_sub($linklist, $sub_id, $params, $icon);
|
||||
$text .= self::render_sub($linklist, $sub_id, $params, $icon);
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
$js_file = ($params[1] == 'noclick') ? 'nav_menu_alt.js' : 'nav_menu.js';
|
||||
if (file_exists(THEME.$js_file))
|
||||
{
|
||||
$text = "<script type='text/javascript' src='".THEME_ABS.$js_file."'></script>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = "<script type='text/javascript' src='".e_FILE_ABS.$js_file."'></script>";
|
||||
}
|
||||
$text .= "<div class='menuBar' style='width:100%; white-space: nowrap'>";
|
||||
|
||||
// Setup Parent/Child Arrays ---->
|
||||
|
||||
$lnk = e107::getSitelinks();
|
||||
$lnk->getlinks(1);
|
||||
$linklist = $lnk->getLinkArray();
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
// Loops thru parents.
|
||||
|
||||
|
||||
|
||||
foreach ($linklist['head_menu'] as $lk)
|
||||
{
|
||||
$lk['link_url'] = $tp->replaceConstants($lk['link_url'], TRUE, TRUE);
|
||||
if ($params[0] == 'no_icons')
|
||||
{
|
||||
$link_icon = 'no_icons';
|
||||
}
|
||||
else
|
||||
{
|
||||
$link_icon = $lk['link_button'] ? e_IMAGE.'icons/'.$lk['link_button'] : $icon;
|
||||
}
|
||||
|
||||
$main_linkid = $lk['link_id'];
|
||||
if (isset($linklist['sub_'.$main_linkid]))
|
||||
{ // Has Children.
|
||||
|
||||
$text .= adnav_cat($lk['link_name'], '', $link_icon, 'l_'.$main_linkid);
|
||||
$text .= render_sub($linklist, $main_linkid, $params, $icon);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Display Parent only.
|
||||
|
||||
$text .= adnav_cat($lk['link_name'], $lk['link_url'], $link_icon, FALSE, $lk['link_open']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "</div>";
|
||||
|
||||
return $text;
|
||||
|
||||
|
||||
}
|
@ -9,9 +9,9 @@
|
||||
* e107 Shortcode handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||
* $Revision: 1.37 $
|
||||
* $Date: 2009-11-20 22:23:02 $
|
||||
* $Author: e107steved $
|
||||
* $Revision: 1.38 $
|
||||
* $Date: 2009-11-23 10:27:42 $
|
||||
* $Author: e107coders $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -443,6 +443,7 @@ class e_shortcode
|
||||
if($this->registered_codes[$code]['path'])
|
||||
{
|
||||
include_once($this->registered_codes[$code]['path'].strtolower($code).'.php');
|
||||
|
||||
}
|
||||
if(function_exists($_function))
|
||||
{
|
||||
@ -471,8 +472,15 @@ class e_shortcode
|
||||
if(is_readable(e_FILE.'shortcode/'.strtolower($code).'.php'))
|
||||
{
|
||||
$_function = strtolower($code).'_shortcode';
|
||||
$_class = strtolower($code);
|
||||
|
||||
include_once(e_FILE.'shortcode/'.strtolower($code).'.php');
|
||||
if(function_exists($_function))
|
||||
|
||||
if(class_exists($_class))
|
||||
{
|
||||
$ret = call_user_func(array($_class,$_function), $parm);
|
||||
}
|
||||
elseif(function_exists($_function))
|
||||
{
|
||||
$ret = call_user_func($_function, $parm);
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/sitelinks_class.php,v $
|
||||
* $Revision: 1.25 $
|
||||
* $Date: 2009-11-22 14:10:07 $
|
||||
* $Revision: 1.26 $
|
||||
* $Date: 2009-11-23 10:27:43 $
|
||||
* $Author: e107coders $
|
||||
*/
|
||||
|
||||
@ -21,10 +21,12 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
|
||||
class sitelinks
|
||||
{
|
||||
|
||||
var $eLinkList;
|
||||
var $eLinkList = array();
|
||||
|
||||
function getlinks($cat=1)
|
||||
{
|
||||
$this->eLinkList = array(); // clear the array in case getlinks is called 2x on the same page.
|
||||
|
||||
$sql = e107::getDb('sqlSiteLinks');
|
||||
|
||||
$query = "SELECT * FROM #links WHERE link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
|
||||
|
Loading…
x
Reference in New Issue
Block a user