mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Bugtracker #5114: style display:compact changed into display:block for W3C compliancy
This commit is contained in:
@@ -13,20 +13,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_sitelinks.php');
|
||||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
|
|
||||||
|
|
||||||
class sitelinks
|
class sitelinks
|
||||||
{
|
{
|
||||||
|
|
||||||
var $eLinkList = array();
|
var $eLinkList = array();
|
||||||
|
|
||||||
function getlinks($cat=1)
|
function getlinks($cat=1)
|
||||||
{
|
{
|
||||||
$this->eLinkList = array(); // clear the array in case getlinks is called 2x on the same page.
|
$this->eLinkList = array(); // clear the array in case getlinks is called 2x on the same page.
|
||||||
|
|
||||||
$sql = e107::getDb('sqlSiteLinks');
|
$sql = e107::getDb('sqlSiteLinks');
|
||||||
|
|
||||||
$query = "SELECT * FROM #links WHERE link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
|
$query = "SELECT * FROM #links WHERE link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
|
||||||
if($sql->db_Select_gen($query))
|
if($sql->db_Select_gen($query))
|
||||||
{
|
{
|
||||||
@@ -42,7 +38,6 @@ class sitelinks
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->eLinkList['head_menu'][] = $row;
|
$this->eLinkList['head_menu'][] = $row;
|
||||||
if(vartrue($row['link_function']))
|
if(vartrue($row['link_function']))
|
||||||
{
|
{
|
||||||
@@ -68,18 +63,17 @@ class sitelinks
|
|||||||
return $this->eLinkList;
|
return $this->eLinkList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get($cat=1, $style='', $css_class = false)
|
function get($cat=1, $style='', $css_class = false)
|
||||||
{
|
{
|
||||||
global $pref, $ns, $e107cache, $linkstyle;
|
global $pref, $ns, $e107cache, $linkstyle;
|
||||||
$usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
|
$usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
|
||||||
|
|
||||||
if ($usecache && !strpos(e_SELF, e_ADMIN) && ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY))))
|
if ($usecache && !strpos(e_SELF, e_ADMIN) && ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY))))
|
||||||
{
|
{
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LINKDISPLAY == 4) {
|
if (LINKDISPLAY == 4)
|
||||||
|
{
|
||||||
require_once(e_PLUGIN.'ypslide_menu/ypslide_menu.php');
|
require_once(e_PLUGIN.'ypslide_menu/ypslide_menu.php');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -87,11 +81,12 @@ class sitelinks
|
|||||||
$this->getlinks($cat);
|
$this->getlinks($cat);
|
||||||
|
|
||||||
// are these defines used at all ?
|
// are these defines used at all ?
|
||||||
|
if(!defined('PRELINKTITLE'))
|
||||||
if(!defined('PRELINKTITLE')){
|
{
|
||||||
define('PRELINKTITLE', '');
|
define('PRELINKTITLE', '');
|
||||||
}
|
}
|
||||||
if(!defined('PRELINKTITLE')){
|
if(!defined('PRELINKTITLE'))
|
||||||
|
{
|
||||||
define('POSTLINKTITLE', '');
|
define('POSTLINKTITLE', '');
|
||||||
}
|
}
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
@@ -99,7 +94,8 @@ class sitelinks
|
|||||||
// where did link alignment go?
|
// where did link alignment go?
|
||||||
if (!defined('LINKALIGN')) { define(LINKALIGN, ''); }
|
if (!defined('LINKALIGN')) { define(LINKALIGN, ''); }
|
||||||
|
|
||||||
if(!$style){
|
if(!$style)
|
||||||
|
{
|
||||||
$style['prelink'] = defined('PRELINK') ? PRELINK : '';
|
$style['prelink'] = defined('PRELINK') ? PRELINK : '';
|
||||||
$style['postlink'] = defined('POSTLINK') ? POSTLINK : '';
|
$style['postlink'] = defined('POSTLINK') ? POSTLINK : '';
|
||||||
$style['linkclass'] = defined('LINKCLASS') ? LINKCLASS : "";
|
$style['linkclass'] = defined('LINKCLASS') ? LINKCLASS : "";
|
||||||
@@ -115,15 +111,18 @@ class sitelinks
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sublink styles.- replacing the tree-menu.
|
// Sublink styles.- replacing the tree-menu.
|
||||||
if(isset($style['sublinkdisplay']) || isset($style['subindent']) || isset($style['sublinkclass']) || isset($style['sublinkstart']) || isset($style['sublinkend']) || isset($style['subpostlink'])){
|
if(isset($style['sublinkdisplay']) || isset($style['subindent']) || isset($style['sublinkclass']) || isset($style['sublinkstart']) || isset($style['sublinkend']) || isset($style['subpostlink']))
|
||||||
foreach($style as $key=>$val){
|
{
|
||||||
|
foreach($style as $key=>$val)
|
||||||
|
{
|
||||||
$aSubStyle[$key] = vartrue($style["sub".$key]) ? $style["sub".$key] : $style[$key];
|
$aSubStyle[$key] = vartrue($style["sub".$key]) ? $style["sub".$key] : $style[$key];
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$style['subindent'] = " ";
|
$style['subindent'] = " ";
|
||||||
$aSubStyle = $style;
|
$aSubStyle = $style;
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
|
$text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
|
||||||
|
|
||||||
// php warnings
|
// php warnings
|
||||||
@@ -133,24 +132,23 @@ class sitelinks
|
|||||||
}
|
}
|
||||||
$render_link = array();
|
$render_link = array();
|
||||||
|
|
||||||
if ($style['linkdisplay'] != 3) {
|
if ($style['linkdisplay'] != 3)
|
||||||
foreach ($this->eLinkList['head_menu'] as $key => $link){
|
{
|
||||||
|
foreach ($this->eLinkList['head_menu'] as $key => $link)
|
||||||
|
{
|
||||||
$main_linkid = "sub_".$link['link_id'];
|
$main_linkid = "sub_".$link['link_id'];
|
||||||
|
|
||||||
$link['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !vartrue($style['linkmainonly']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ? TRUE : FALSE;
|
$link['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !vartrue($style['linkmainonly']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ? TRUE : FALSE;
|
||||||
|
|
||||||
$render_link[$key] = $this->makeLink($link,'', $style, $css_class);
|
$render_link[$key] = $this->makeLink($link,'', $style, $css_class);
|
||||||
|
|
||||||
if(!defined("LINKSRENDERONLYMAIN") && !varset($style['linkmainonly'])) /* if this is defined in theme.php only main links will be rendered */
|
if(!defined("LINKSRENDERONLYMAIN") && !varset($style['linkmainonly'])) /* if this is defined in theme.php only main links will be rendered */
|
||||||
|
{ // if there's a submenu. :
|
||||||
|
if (isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid]))
|
||||||
{
|
{
|
||||||
|
|
||||||
// if there's a submenu. :
|
|
||||||
if (isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])){
|
|
||||||
foreach($this->eLinkList[$main_linkid] as $val) // check that something in the submenu is actually selected.
|
foreach($this->eLinkList[$main_linkid] as $val) // check that something in the submenu is actually selected.
|
||||||
{
|
{
|
||||||
if($this->hilite($val['link_url'],TRUE)== TRUE || $link['link_expand'] == FALSE)
|
if($this->hilite($val['link_url'],TRUE)== TRUE || $link['link_expand'] == FALSE)
|
||||||
{
|
{
|
||||||
$substyle = "compact";
|
$substyle = "block"; // previously (non-W3C compliant): compact
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -159,7 +157,8 @@ class sitelinks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$render_link[$key] .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
|
$render_link[$key] .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
|
||||||
foreach ($this->eLinkList[$main_linkid] as $sub){
|
foreach ($this->eLinkList[$main_linkid] as $sub)
|
||||||
|
{
|
||||||
$render_link[$key] .= $this->makeLink($sub, TRUE, $aSubStyle, $css_class);
|
$render_link[$key] .= $this->makeLink($sub, TRUE, $aSubStyle, $css_class);
|
||||||
}
|
}
|
||||||
$render_link[$key] .= "\n</div>\n\n";
|
$render_link[$key] .= "\n</div>\n\n";
|
||||||
@@ -168,7 +167,8 @@ class sitelinks
|
|||||||
}
|
}
|
||||||
$text .= implode($style['linkseparator'], $render_link);
|
$text .= implode($style['linkseparator'], $render_link);
|
||||||
$text .= $style['postlink'];
|
$text .= $style['postlink'];
|
||||||
if ($style['linkdisplay'] == 2) {
|
if ($style['linkdisplay'] == 2)
|
||||||
|
{
|
||||||
$text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks', TRUE);
|
$text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks', TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,8 +214,10 @@ class sitelinks
|
|||||||
$highlighted = FALSE;
|
$highlighted = FALSE;
|
||||||
|
|
||||||
// If submenu: Fix Name, Add Indentation.
|
// If submenu: Fix Name, Add Indentation.
|
||||||
if ($submenu == TRUE) {
|
if ($submenu == TRUE)
|
||||||
if(substr($linkInfo['link_name'],0,8) == "submenu."){
|
{
|
||||||
|
if(substr($linkInfo['link_name'],0,8) == "submenu.")
|
||||||
|
{
|
||||||
$tmp = explode('.', $linkInfo['link_name'], 3);
|
$tmp = explode('.', $linkInfo['link_name'], 3);
|
||||||
$linkInfo['link_name'] = $tmp[2];
|
$linkInfo['link_name'] = $tmp[2];
|
||||||
}
|
}
|
||||||
@@ -225,7 +227,8 @@ class sitelinks
|
|||||||
// Convert any {e_XXX} to absolute URLs (relative ones sometimes get broken by adding e_HTTP at the front)
|
// Convert any {e_XXX} to absolute URLs (relative ones sometimes get broken by adding e_HTTP at the front)
|
||||||
$linkInfo['link_url'] = $tp -> replaceConstants($linkInfo['link_url'], TRUE, TRUE); // replace {e_xxxx}
|
$linkInfo['link_url'] = $tp -> replaceConstants($linkInfo['link_url'], TRUE, TRUE); // replace {e_xxxx}
|
||||||
|
|
||||||
if(strpos($linkInfo['link_url'],"{") !== FALSE){
|
if(strpos($linkInfo['link_url'],"{") !== FALSE)
|
||||||
|
{
|
||||||
$linkInfo['link_url'] = $tp->parseTemplate($linkInfo['link_url'], TRUE); // shortcode in URL support - dynamic urls for multilanguage.
|
$linkInfo['link_url'] = $tp->parseTemplate($linkInfo['link_url'], TRUE); // shortcode in URL support - dynamic urls for multilanguage.
|
||||||
}
|
}
|
||||||
// By default links are not highlighted.
|
// By default links are not highlighted.
|
||||||
@@ -234,7 +237,8 @@ class sitelinks
|
|||||||
$linkadd = ($css_class) ? " class='".$css_class."'" : $linkadd;
|
$linkadd = ($css_class) ? " class='".$css_class."'" : $linkadd;
|
||||||
|
|
||||||
// Check for screentip regardless of URL.
|
// Check for screentip regardless of URL.
|
||||||
if (isset($pref['linkpage_screentip']) && $pref['linkpage_screentip'] && $linkInfo['link_description']){
|
if (isset($pref['linkpage_screentip']) && $pref['linkpage_screentip'] && $linkInfo['link_description'])
|
||||||
|
{
|
||||||
$screentip = " title = \"".$tp->toHTML($linkInfo['link_description'],"","value, emotes_off, defs, no_hook")."\"";
|
$screentip = " title = \"".$tp->toHTML($linkInfo['link_description'],"","value, emotes_off, defs, no_hook")."\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,11 +253,13 @@ class sitelinks
|
|||||||
$linkInfo['link_url'] = (strpos($linkInfo['link_url'], '://') === FALSE && strpos($linkInfo['link_url'], 'mailto:') !== 0 ? e_HTTP.$linkInfo['link_url'] : $linkInfo['link_url']);
|
$linkInfo['link_url'] = (strpos($linkInfo['link_url'], '://') === FALSE && strpos($linkInfo['link_url'], 'mailto:') !== 0 ? e_HTTP.$linkInfo['link_url'] : $linkInfo['link_url']);
|
||||||
|
|
||||||
// Only check if its highlighted if it has an URL
|
// Only check if its highlighted if it has an URL
|
||||||
if ($this->hilite($linkInfo['link_url'], $style['linkstart_hilite'])== TRUE) {
|
if ($this->hilite($linkInfo['link_url'], $style['linkstart_hilite'])== TRUE)
|
||||||
|
{
|
||||||
$linkstart = (isset($style['linkstart_hilite'])) ? $style['linkstart_hilite'] : "";
|
$linkstart = (isset($style['linkstart_hilite'])) ? $style['linkstart_hilite'] : "";
|
||||||
$highlighted = TRUE;
|
$highlighted = TRUE;
|
||||||
}
|
}
|
||||||
if ($this->hilite($linkInfo['link_url'], $style['linkclass_hilite'])== TRUE) {
|
if ($this->hilite($linkInfo['link_url'], $style['linkclass_hilite'])== TRUE)
|
||||||
|
{
|
||||||
$linkadd = (isset($style['linkclass_hilite'])) ? " class='".$style['linkclass_hilite']."'" : "";
|
$linkadd = (isset($style['linkclass_hilite'])) ? " class='".$style['linkclass_hilite']."'" : "";
|
||||||
$highlighted = TRUE;
|
$highlighted = TRUE;
|
||||||
}
|
}
|
||||||
@@ -286,20 +292,21 @@ class sitelinks
|
|||||||
// If its a link.. make a link
|
// If its a link.. make a link
|
||||||
$_link = "";
|
$_link = "";
|
||||||
$_link .= $accessdigit;
|
$_link .= $accessdigit;
|
||||||
if (!empty($href) && ((varset($style['hilite_nolink']) && $highlighted)!=TRUE)){
|
if (!empty($href) && ((varset($style['hilite_nolink']) && $highlighted)!=TRUE))
|
||||||
|
{
|
||||||
$_link .= "<a".$linkadd.$screentip.$href.$link_append.$accesskey.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</a>";
|
$_link .= "<a".$linkadd.$screentip.$href.$link_append.$accesskey.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</a>";
|
||||||
// If its not a link, but has a class or screentip do span:
|
}
|
||||||
}elseif (!empty($linkadd) || !empty($screentip)){
|
elseif (!empty($linkadd) || !empty($screentip))
|
||||||
|
{ // If its not a link, but has a class or screentip do span:
|
||||||
$_link .= "<span".$linkadd.$screentip.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</span>";
|
$_link .= "<span".$linkadd.$screentip.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</span>";
|
||||||
// Else just the name:
|
}
|
||||||
}else {
|
else
|
||||||
|
{ // Else just the name:
|
||||||
$_link .= $tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook");
|
$_link .= $tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook");
|
||||||
}
|
}
|
||||||
|
|
||||||
$_link = $linkstart.$indent.$_link;
|
$_link = $linkstart.$indent.$_link;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
global $SITELINKSTYLE;
|
global $SITELINKSTYLE;
|
||||||
if(!$SITELINKSTYLE)
|
if(!$SITELINKSTYLE)
|
||||||
{
|
{
|
||||||
@@ -312,13 +319,9 @@ class sitelinks
|
|||||||
$replace[1] = $tp -> toHTML($linkInfo['link_description'], true);
|
$replace[1] = $tp -> toHTML($linkInfo['link_description'], true);
|
||||||
|
|
||||||
$text = preg_replace($search, $replace, $SITELINKSTYLE);
|
$text = preg_replace($search, $replace, $SITELINKSTYLE);
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether link highlighting needs to be active
|
* Determine whether link highlighting needs to be active
|
||||||
*
|
*
|
||||||
@@ -348,7 +351,6 @@ function hilite($link,$enabled = FALSE)
|
|||||||
echo "<br />url_query= ".e_QUERY."<br />";
|
echo "<br />url_query= ".e_QUERY."<br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------- highlight overriding - set the link matching in the page itself.
|
// ----------- highlight overriding - set the link matching in the page itself.
|
||||||
if(defined('HILITE'))
|
if(defined('HILITE'))
|
||||||
{
|
{
|
||||||
@@ -358,7 +360,6 @@ function hilite($link,$enabled = FALSE)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --------------- highlighting for 'HOME'. ----------------
|
// --------------- highlighting for 'HOME'. ----------------
|
||||||
// See if we're on whatever is set as 'home' page for this user
|
// See if we're on whatever is set as 'home' page for this user
|
||||||
|
|
||||||
@@ -411,9 +412,8 @@ function hilite($link,$enabled = FALSE)
|
|||||||
// eg. news.php, news.php?list.1 or news.php?cat.2 etc
|
// eg. news.php, news.php?list.1 or news.php?cat.2 etc
|
||||||
if(substr(basename($link),0,8) == "news.php")
|
if(substr(basename($link),0,8) == "news.php")
|
||||||
{
|
{
|
||||||
|
if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE)
|
||||||
if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) {
|
{
|
||||||
|
|
||||||
$lnk = explode(".",$link_qry); // link queries.
|
$lnk = explode(".",$link_qry); // link queries.
|
||||||
$qry = explode(".",e_QUERY); // current page queries.
|
$qry = explode(".",e_QUERY); // current page queries.
|
||||||
|
|
||||||
@@ -436,16 +436,14 @@ function hilite($link,$enabled = FALSE)
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif (!e_QUERY && e_PAGE == "news.php")
|
elseif (!e_QUERY && e_PAGE == "news.php")
|
||||||
{
|
{
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------- highlight for Custom Pages.----------------
|
// --------------- highlight for Custom Pages.----------------
|
||||||
// eg. page.php?1, or page.php?5.7 [2nd parameter is page # within item]
|
// eg. page.php?1, or page.php?5.7 [2nd parameter is page # within item]
|
||||||
|
|
||||||
@@ -468,7 +466,8 @@ function hilite($link,$enabled = FALSE)
|
|||||||
if(strpos($link, '?') !== FALSE)
|
if(strpos($link, '?') !== FALSE)
|
||||||
{
|
{
|
||||||
$thelink = str_replace("../", "", $link);
|
$thelink = str_replace("../", "", $link);
|
||||||
if(!preg_match("/all|item|cat|list/", e_QUERY) && (empty($link) == false) && (strpos(e_SELF, str_replace("../", "",$link)) !== false)){
|
if(!preg_match("/all|item|cat|list/", e_QUERY) && (empty($link) == false) && (strpos(e_SELF, str_replace("../", "",$link)) !== false))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,7 +485,6 @@ function hilite($link,$enabled = FALSE)
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user