From 4e138b835f1596a7cdf49ce1b08bfb8060be7a9c Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 26 Feb 2013 03:43:52 -0800 Subject: [PATCH] Renamed class naming standard within e_sitelink.php addon. Use xxxx_sitelink (not xxxx_sitelinks) --- e107_admin/links.php | 2 +- e107_handlers/sitelinks_class.php | 177 +-------------------- e107_plugins/faqs/e_sitelink.php | 2 +- e107_plugins/news/e_sitelink.php | 2 +- e107_plugins/page/e_shortcode.php | 2 +- e107_plugins/page/e_sitelink.php | 2 +- e107_plugins/page/page_navigation_menu.php | 2 +- 7 files changed, 8 insertions(+), 181 deletions(-) diff --git a/e107_admin/links.php b/e107_admin/links.php index 1c5c9738c..6e77aa2ca 100644 --- a/e107_admin/links.php +++ b/e107_admin/links.php @@ -524,7 +524,7 @@ class links_admin_form_ui extends e_admin_form_ui { $tp = e107::getParser(); - $tmp = e107::getAddonConfig('e_sitelink','sitelinks'); + $tmp = e107::getAddonConfig('e_sitelink','sitelink'); foreach($tmp as $cat=> $array) { diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 351876d19..fd2c8294b 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -51,7 +51,7 @@ class sitelinks list($path,$method) = explode("::",$row['link_function']); 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. 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 */ @@ -1501,7 +1328,7 @@ class e_navigation list($path,$method) = explode("::",$row['link_function']); if(include_once(e_PLUGIN.$path."/e_sitelink.php")) { - $class = $path."_sitelinks"; + $class = $path."_sitelink"; if($sublinkArray = e107::callMethod($class,$method)) //TODO Cache it. { return $sublinkArray; diff --git a/e107_plugins/faqs/e_sitelink.php b/e107_plugins/faqs/e_sitelink.php index 10fc5c459..c0abcf6bc 100644 --- a/e107_plugins/faqs/e_sitelink.php +++ b/e107_plugins/faqs/e_sitelink.php @@ -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() { diff --git a/e107_plugins/news/e_sitelink.php b/e107_plugins/news/e_sitelink.php index f52e74d77..6a294e251 100644 --- a/e107_plugins/news/e_sitelink.php +++ b/e107_plugins/news/e_sitelink.php @@ -17,7 +17,7 @@ if (!defined('e107_INIT')) { exit; } //TODO Lans -class news_sitelinks // include plugin-folder in the name. +class news_sitelink // include plugin-folder in the name. { function config() { diff --git a/e107_plugins/page/e_shortcode.php b/e107_plugins/page/e_shortcode.php index 4a9828d4e..2429ac61d 100644 --- a/e107_plugins/page/e_shortcode.php +++ b/e107_plugins/page/e_shortcode.php @@ -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. { // 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); diff --git a/e107_plugins/page/e_sitelink.php b/e107_plugins/page/e_sitelink.php index 22cf86744..17115489b 100644 --- a/e107_plugins/page/e_sitelink.php +++ b/e107_plugins/page/e_sitelink.php @@ -11,7 +11,7 @@ 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() { diff --git a/e107_plugins/page/page_navigation_menu.php b/e107_plugins/page/page_navigation_menu.php index 968fbd2d2..bbb571f9e 100644 --- a/e107_plugins/page/page_navigation_menu.php +++ b/e107_plugins/page/page_navigation_menu.php @@ -38,7 +38,7 @@ if(empty($parm)) } ### Retrieve -$links = e107::getAddon('page', 'e_sitelink', 'page_sitelinks'); +$links = e107::getAddon('page', 'e_sitelink', 'page_sitelink'); $data = $links->pageNav($parm); if(isset($data['title']) && !vartrue($template['noAutoTitle'])) {