mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Renamed class naming standard within e_sitelink.php addon. Use xxxx_sitelink (not xxxx_sitelinks)
This commit is contained in:
@@ -524,7 +524,7 @@ class links_admin_form_ui extends e_admin_form_ui
|
|||||||
{
|
{
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$tmp = e107::getAddonConfig('e_sitelink','sitelinks');
|
$tmp = e107::getAddonConfig('e_sitelink','sitelink');
|
||||||
|
|
||||||
foreach($tmp as $cat=> $array)
|
foreach($tmp as $cat=> $array)
|
||||||
{
|
{
|
||||||
|
@@ -51,7 +51,7 @@ class sitelinks
|
|||||||
list($path,$method) = explode("::",$row['link_function']);
|
list($path,$method) = explode("::",$row['link_function']);
|
||||||
if(file_exists(e_PLUGIN.$path."/e_sitelink.php") && include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
if(file_exists(e_PLUGIN.$path."/e_sitelink.php") && include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
||||||
{
|
{
|
||||||
$class = $path."_sitelinks";
|
$class = $path."_sitelink";
|
||||||
$sublinkArray = e107::callMethod($class,$method); //TODO Cache it.
|
$sublinkArray = e107::callMethod($class,$method); //TODO Cache it.
|
||||||
if(vartrue($sublinkArray))
|
if(vartrue($sublinkArray))
|
||||||
{
|
{
|
||||||
@@ -1252,179 +1252,6 @@ class e_navigation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// UNUSED
|
|
||||||
protected function retrieveAddon($id, $function, $orderStart = 0)
|
|
||||||
{
|
|
||||||
list($path, $method) = explode('::', $function);
|
|
||||||
$path = preg_replace('[^\w]', '', $path);
|
|
||||||
|
|
||||||
if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
|
||||||
{
|
|
||||||
$class = $path."_sitelinks";
|
|
||||||
$sublinkArray = e107::callMethod($class, $method);
|
|
||||||
if(!is_array($sublinkArray) || empty($sublinkArray))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$i = $orderStart;
|
|
||||||
foreach ($sublinkArray as $addonLink)
|
|
||||||
{
|
|
||||||
$i++;
|
|
||||||
/*if(!isset($addonLinks['link_parent']))*/ $addonLink['link_parent'] = $id;
|
|
||||||
/*if(!isset($addonLinks['link_id']))*/ $addonLink['link_id'] = $id.'-'.$i;
|
|
||||||
/*if(!isset($addonLinks['link_id']))*/ $addonLink['link_order'] = $i;
|
|
||||||
$this->data[$category][$addonLink['link_parent']][$addonLink['link_id']] = $link;
|
|
||||||
$this->indeces['flat'][$addonLink['link_id']] = $addonLink['link_parent'];
|
|
||||||
$this->indeces['ordered'][$addonLink['link_id']] = $addonLink['link_order'];
|
|
||||||
if(isset($addonLink['link_function']) && !empty($addonLink['link_function']))
|
|
||||||
{
|
|
||||||
$this->indeces['dynamic'][$addonLink['link_id']] = $addonLink['link_function'];
|
|
||||||
$this->retrieveAddon($addonLink['link_id'], $addonLink['link_function'], $addonLink['link_order']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME syscache
|
|
||||||
/*
|
|
||||||
protected function initData($category)
|
|
||||||
{
|
|
||||||
$sql = e107::getDb('sqlSiteLinks');
|
|
||||||
$cache = e107::getCache();
|
|
||||||
|
|
||||||
if(null === $this->data) $this->data = array();
|
|
||||||
elseif(!isset($this->data[$category])) $this->data[$category] = array();
|
|
||||||
|
|
||||||
if(null === $this->indeces) $this->indeces = array('flat' => array(), 'parents' => array(), 'ordered' => array(), 'dynamic' => array());
|
|
||||||
|
|
||||||
$where = $category > 0 ? "link_category=".(int) $category.' AND ' : '';
|
|
||||||
$query = "SELECT * FROM `#links` WHERE ".$where." link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
|
|
||||||
|
|
||||||
if($sql->gen($query))
|
|
||||||
{
|
|
||||||
while($link = $sql->fetch())
|
|
||||||
{
|
|
||||||
$this->data[$category][$link['link_parent']][$link['link_id']] = $link;
|
|
||||||
$this->indeces['flat'][$link['link_id']] = $link['link_parent'];
|
|
||||||
$this->indeces['ordered'][$link['link_id']] = $link['link_order'];
|
|
||||||
|
|
||||||
if(!empty($link['link_function']))
|
|
||||||
{
|
|
||||||
$this->indeces['dynamic'][$link['link_id']] = $link['link_function'];
|
|
||||||
$this->retrieveAddon($link['link_id'], $link['link_function'], $link['link_order']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->data[$category] = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
// cache it
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Retrive link data
|
|
||||||
* We retrieve ALWAYS the whole data if there is missing cached data
|
|
||||||
* FIXME syscache
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
public function retrieve($category = 1, $parent = 0)
|
|
||||||
{
|
|
||||||
$cache = e107::getCache();
|
|
||||||
|
|
||||||
if(null === $this->data || !isset($this->data[$category])) $this->initData($category);
|
|
||||||
|
|
||||||
// runtime cached
|
|
||||||
if(isset($this->data[$category][$parent]))
|
|
||||||
{
|
|
||||||
$this->data[$category][$parent];
|
|
||||||
}
|
|
||||||
|
|
||||||
$uclist = e107::getUser()->getClassList();
|
|
||||||
sort($uclist, SORT_NUMERIC);
|
|
||||||
$cachestr = md5($category.$parent.$uclist);
|
|
||||||
|
|
||||||
$cached = $cache->retrieve_sys($this->cacheString($category, 'sys'));
|
|
||||||
if(false !== $cached)
|
|
||||||
{
|
|
||||||
// apply runtime cache and indices
|
|
||||||
return $this->data[$category][$parent];
|
|
||||||
}
|
|
||||||
|
|
||||||
// init data and indeces per category
|
|
||||||
|
|
||||||
return $this->data[$category][$parent];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Prepare site links data for the renderer
|
|
||||||
* @todo maybe some kind of dead loop protection
|
|
||||||
*
|
|
||||||
* Returned array structure: index key is item ID, containing array same as #links table,
|
|
||||||
* additonal 'link_sub' array, containing current row children (same structure, recursive,
|
|
||||||
* no sub-level restrictions)
|
|
||||||
*
|
|
||||||
* @param int $category render type
|
|
||||||
* @param int $parent starting from parent node
|
|
||||||
* @param bool $flat if true, sub-levels wont be processed
|
|
||||||
* @return array milti-level or flat navigation data
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
public function collection($category = 1, $parent = 0, $flat = false)
|
|
||||||
{
|
|
||||||
$this->initData($category);
|
|
||||||
if(!vartrue($this->data[$category]) || !vartrue($this->data[$category][$parent])) return array();
|
|
||||||
|
|
||||||
$ret = array();
|
|
||||||
|
|
||||||
// re-order, required only when there is dynamic (3rd party) data available
|
|
||||||
if(!empty($this->indeces['dynamic']))
|
|
||||||
{
|
|
||||||
$ids = array_keys($this->data[$category][$parent]);
|
|
||||||
$index = array();
|
|
||||||
|
|
||||||
foreach ($ids as $id)
|
|
||||||
{
|
|
||||||
$index[$id] = $this->indeces['ordered'][$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
asort($index, SORT_NUMERIC);
|
|
||||||
$ids = array_keys($index);
|
|
||||||
foreach ($ids as $id)
|
|
||||||
{
|
|
||||||
$ret[$id] = $this->data[$category][$parent][$id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ret = $this->data[$category][$parent];
|
|
||||||
}
|
|
||||||
|
|
||||||
//only current node needed
|
|
||||||
if($flat) return $ret;
|
|
||||||
|
|
||||||
// process subs - recursion
|
|
||||||
foreach ($ret as $id => $_data)
|
|
||||||
{
|
|
||||||
$ret[$id]['link_sub'] = $this->collection($category, $_data['link_id'], false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Cache
|
* TODO Cache
|
||||||
*/
|
*/
|
||||||
@@ -1501,7 +1328,7 @@ class e_navigation
|
|||||||
list($path,$method) = explode("::",$row['link_function']);
|
list($path,$method) = explode("::",$row['link_function']);
|
||||||
if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
||||||
{
|
{
|
||||||
$class = $path."_sitelinks";
|
$class = $path."_sitelink";
|
||||||
if($sublinkArray = e107::callMethod($class,$method)) //TODO Cache it.
|
if($sublinkArray = e107::callMethod($class,$method)) //TODO Cache it.
|
||||||
{
|
{
|
||||||
return $sublinkArray;
|
return $sublinkArray;
|
||||||
|
@@ -22,7 +22,7 @@ if (!defined('e107_INIT')) { exit; }
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
class faqs_sitelinks // include plugin-folder in the name.
|
class faqs_sitelink // include plugin-folder in the name.
|
||||||
{
|
{
|
||||||
function config()
|
function config()
|
||||||
{
|
{
|
||||||
|
@@ -17,7 +17,7 @@ if (!defined('e107_INIT')) { exit; }
|
|||||||
|
|
||||||
//TODO Lans
|
//TODO Lans
|
||||||
|
|
||||||
class news_sitelinks // include plugin-folder in the name.
|
class news_sitelink // include plugin-folder in the name.
|
||||||
{
|
{
|
||||||
function config()
|
function config()
|
||||||
{
|
{
|
||||||
|
@@ -15,7 +15,7 @@ class page_shortcodes extends e_shortcode
|
|||||||
function sc_page_navigation($parm) // TODO when No $parm provided, auto-detect based on URL which book/chapters to display.
|
function sc_page_navigation($parm) // TODO when No $parm provided, auto-detect based on URL which book/chapters to display.
|
||||||
{
|
{
|
||||||
// FIXME sitelink class should be page_sitelink
|
// FIXME sitelink class should be page_sitelink
|
||||||
$links = e107::getAddon('page', 'e_sitelink', 'page_sitelinks');
|
$links = e107::getAddon('page', 'e_sitelink', 'page_sitelink');
|
||||||
|
|
||||||
$data = $links->pageNav($parm);
|
$data = $links->pageNav($parm);
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
class page_sitelinks // include plugin-folder in the name.
|
class page_sitelink // include plugin-folder in the name.
|
||||||
{
|
{
|
||||||
function config()
|
function config()
|
||||||
{
|
{
|
||||||
|
@@ -38,7 +38,7 @@ if(empty($parm))
|
|||||||
}
|
}
|
||||||
|
|
||||||
### Retrieve
|
### Retrieve
|
||||||
$links = e107::getAddon('page', 'e_sitelink', 'page_sitelinks');
|
$links = e107::getAddon('page', 'e_sitelink', 'page_sitelink');
|
||||||
$data = $links->pageNav($parm);
|
$data = $links->pageNav($parm);
|
||||||
if(isset($data['title']) && !vartrue($template['noAutoTitle']))
|
if(isset($data['title']) && !vartrue($template['noAutoTitle']))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user