1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

BC Fix for icons in sitelinks.

This commit is contained in:
Cameron
2019-04-30 14:01:05 -07:00
parent e087dc52a2
commit 7dea524e8a
2 changed files with 34 additions and 21 deletions

View File

@@ -245,12 +245,12 @@ class sitelinks
/**
* Manage Sublink Rendering
* @param string $main_linkid
* @param string $aSubStyle
* @param array $aSubStyle
* @param string $css_class
* @param object $level [optional]
* @return
*/
function subLink($main_linkid,$aSubStyle,$css_class='',$level=0)
function subLink($main_linkid,$aSubStyle=array(),$css_class='',$level=0)
{
global $pref;
@@ -294,7 +294,7 @@ class sitelinks
function makeLink($linkInfo, $submenu = FALSE, $style='', $css_class = false)
function makeLink($linkInfo=array(), $submenu = FALSE, $style=array(), $css_class = false)
{
global $pref,$tp;
@@ -403,15 +403,17 @@ class sitelinks
if ($linkInfo['link_button'])
{
$linkstart = preg_replace('/\<img.*\>/si', '', $linkstart);
$linkstart .= $tp->toIcon($linkInfo['link_button'],array('legacy'=> "{e_IMAGE}icons/"));
if($linkInfo['link_button'][0]=='{')
/* if($linkInfo['link_button'][0]=='{')
{
$linkstart .= "<img src='".$tp->replaceConstants($linkInfo['link_button'],'abs')."' alt='' style='vertical-align:middle' />";
}
else
{
$linkstart .= "<img src='".e_IMAGE_ABS."icons/".$linkInfo['link_button']."' alt='' style='vertical-align:middle' />";
}
$linkstart .= "<img src='".e_IMAGE_ABS."icons/".$linkInfo['link_button']."' alt='' style='vertical-align:middle' />";
}*/
}
// mobile phone support.
@@ -460,9 +462,11 @@ class sitelinks
*/
function hilite($link,$enabled = FALSE)
{
global $PLUGINS_DIRECTORY,$tp,$pref;
global $PLUGINS_DIRECTORY;
if(!$enabled){ return FALSE; }
$tp = e107::getParser();
$link = $tp->replaceConstants($link, '', TRUE); // The link saved in the DB
$tmp = explode('?',$link);
$link_qry = (isset($tmp[1])) ? $tmp[1] : '';
@@ -492,7 +496,9 @@ class sitelinks
// See if we're on whatever is set as 'home' page for this user
// Although should be just 'index.php', allow for the possibility that there might be a query part
global $pref;
// global $pref;
$pref = e107::pref();
if (($link_slf == e_HTTP."index.php") && count($pref['frontpage']))
{ // Only interested if the displayed page is index.php - see whether its the user's home (front) page
$full_url = 'news.php'; // Set a default in case
@@ -1671,7 +1677,8 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
{
if(empty($data) || empty($template) || !is_array($template)) return '';
$sc = e107::getScBatch('navigation');
/** @var navigation_shortcodes $sc */
$sc = e107::getScBatch('navigation');
$sc->template = $template;
$head = e107::getParser()->parseTemplate($template['start'],true);
$foot = e107::getParser()->parseTemplate($template['end'],true);
@@ -1854,9 +1861,9 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
* TODO Extensive Active Link Detection;
*
*/
public function isActive(&$data='', $removeOnly = false, $exactMatch = false)
public function isActive(&$data=array(), $removeOnly = false, $exactMatch = false)
{
if(empty($data)) return;
if(empty($data)) return null;
### experimental active match added to the URL (and removed after parsing)
@@ -1868,7 +1875,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
if($removeOnly)
{
$data['link_url'] = array_shift(explode('#?', $data['link_url'], 2));
return;
return null;
}
$_temp = explode('#?', $data['link_url'], 2);
@@ -1884,7 +1891,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
}
// No need of further checks
if($removeOnly) return;
if($removeOnly) return null;
// already checked by compile() or external source
if(isset($data['link_active'])) return $data['link_active'];
@@ -1983,13 +1990,14 @@ class navigation_shortcodes extends e_shortcode
* Return the primary_id number for the current link
* @return integer
*/
function sc_link_id($parm='')
function sc_link_id($parm=null)
{
return intval($this->var['link_id']);
}
function sc_link_depth($parm='')
function sc_link_depth($parm=null)
{
unset($parm);
return isset($this->var['link_depth']) ? intval($this->var['link_depth']) : $this->depth;
}
@@ -2005,7 +2013,7 @@ class navigation_shortcodes extends e_shortcode
* @return string
* @example {LINK_NAME}
*/
function sc_link_name($parm='')
function sc_link_name($parm=null)
{
if(empty($this->var['link_name']))
{
@@ -2014,7 +2022,8 @@ class navigation_shortcodes extends e_shortcode
if(substr($this->var['link_name'],0,8) == 'submenu.') // BC Fix.
{
list($tmp,$tmp2,$link) = explode('.',$this->var['link_name'],3);
list($tmp,$tmp2,$link) = explode('.',$this->var['link_name'],3);
unset($tmp,$tmp2);
}
else
{
@@ -2029,13 +2038,13 @@ class navigation_shortcodes extends e_shortcode
* Return the parent of the current link
* @return integer
*/
function sc_link_parent($parm='')
function sc_link_parent($parm=null)
{
return intval($this->var['link_parent']);
}
function sc_link_identifier($parm='')
function sc_link_identifier($parm=null)
{
return isset($this->var['link_identifier']) ? $this->var['link_identifier'] : '';
}
@@ -2044,7 +2053,7 @@ class navigation_shortcodes extends e_shortcode
* Return the URL of the current link
* @return string
*/
function sc_link_url($parm='')
function sc_link_url($parm=null)
{
$tp = e107::getParser();
@@ -2093,7 +2102,7 @@ class navigation_shortcodes extends e_shortcode
/**
* Returns only the anchor target in the URL if one is found.
* @param null $parm
* @param array $parm
* @return null|string
*/
function sc_link_target($parm=null)

View File

@@ -367,6 +367,10 @@ class e_user_model extends e_admin_model
return $this;
}
/**
* @param bool $toString
* @return string|array
*/
final public function getClassList($toString = false)
{
if (null === $this->_class_list)