From 20bb887fd01d191de3f3cb81694cd9c24f94aca9 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 9 Apr 2017 16:03:03 -0700 Subject: [PATCH] Start of e_url upgrade. --- e107_plugins/download/download_shortcodes.php | 48 +++++++++---------- e107_plugins/download/e_url.php | 17 +++++++ 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/e107_plugins/download/download_shortcodes.php b/e107_plugins/download/download_shortcodes.php index 452882ea1..dae6f6076 100644 --- a/e107_plugins/download/download_shortcodes.php +++ b/e107_plugins/download/download_shortcodes.php @@ -41,8 +41,6 @@ class download_shortcodes extends e_shortcode { $tp = e107::getParser(); $frm = e107::getForm(); - - $url = e107::getUrl(); $breadcrumb = array(); @@ -50,30 +48,30 @@ class download_shortcodes extends e_shortcode switch ($this->qry['action']) { case 'mirror': - $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => $url->create('download/index')); - $breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => $url->create('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef']))); // e_SELF."?action=list&id=".$this->var['download_category_id']); - $breadcrumb[] = array('text' => $this->var['download_name'], 'url' => $url->create('download/view/item', array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']))); // e_SELF."?action=view&id=".$this->var['download_id']); - $breadcrumb[] = array('text' => LAN_dl_67, 'url' => null); + $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download/index')); + $breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => e107::url('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef']))); // e_SELF."?action=list&id=".$this->var['download_category_id']); + $breadcrumb[] = array('text' => $this->var['download_name'], 'url' => e107::url('download/view/item', array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']))); // e_SELF."?action=view&id=".$this->var['download_id']); + $breadcrumb[] = array('text' => LAN_dl_67, 'url' => null); break; case 'maincats': - $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => $url->create('download/index')); + $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download/index')); break; default: - $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => $url->create('download/index')); + $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download/index')); if(!empty($this->grandparent)) { - $breadcrumb[] = array('text' => $this->grandparent['download_category_name'], 'url' => ($this->grandparent['download_category_id']) ? $url->create('download/list/category', array('id'=>$this->grandparent['download_category_id'],'name'=>$this->grandparent['download_category_sef'])) : null); + $breadcrumb[] = array('text' => $this->grandparent['download_category_name'], 'url' => ($this->grandparent['download_category_id']) ? e107::url('download/list/category', array('id'=>$this->grandparent['download_category_id'],'name'=>$this->grandparent['download_category_sef'])) : null); } if(!empty($this->parent)) { - $breadcrumb[] = array('text' => $this->parent['download_category_name'], 'url' => ($this->parent['download_category_id']) ? $url->create('download/list/category', array('id'=>$this->parent['download_category_id'],'name'=>$this->parent['download_category_sef'])) : null); + $breadcrumb[] = array('text' => $this->parent['download_category_name'], 'url' => ($this->parent['download_category_id']) ? e107::url('download/list/category', array('id'=>$this->parent['download_category_id'],'name'=>$this->parent['download_category_sef'])) : null); } - $breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? $url->create('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef'])) : null); + $breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? e107::url('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef'])) : null); $breadcrumb[] = array('text' => $this->var['download_name'], 'url' => null); break; } @@ -113,7 +111,7 @@ class download_shortcodes extends e_shortcode if ($this->dlsubrow['d_count']) { - $url = e107::getUrl()->create('download/list/category',array('id'=>$this->dlsubrow['download_category_id'], 'name'=> vartrue($this->dlsubrow['download_category_sef'],'--sef-not-set--'))); + $url = e107::url('download/list/category',array('id'=>$this->dlsubrow['download_category_id'], 'name'=> vartrue($this->dlsubrow['download_category_sef'],'--sef-not-set--'))); return "".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE').""; // return "".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE').""; @@ -169,7 +167,7 @@ class download_shortcodes extends e_shortcode $tp = e107::getParser(); if ($this->dlsubsubrow['d_count']) { - $url = e107::getUrl()->create('download/list/category', array('id'=>$this->dlsubsubrow['download_category_id'], 'name'=> vartrue($this->dlsubsubrow['download_category_sef'],'--sef-not-set--'))); + $url = e107::url('download/list/category', array('id'=>$this->dlsubsubrow['download_category_id'], 'name'=> vartrue($this->dlsubsubrow['download_category_sef'],'--sef-not-set--'))); // e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubsubrow['download_category_id'] return "".$tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE').""; } @@ -294,7 +292,7 @@ class download_shortcodes extends e_shortcode return $text; } - $url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); + $url = e107::url('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); return "".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT').""; // return "".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT').""; @@ -354,7 +352,7 @@ class download_shortcodes extends e_shortcode if ($parm == "link" && $this->var['download_thumb']) { - $url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); + $url = e107::url('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); return "".$img.""; // return "".$img.""; } @@ -405,7 +403,7 @@ class download_shortcodes extends e_shortcode function sc_download_request_url($parm=null) { - return e107::getUrl()->create('download/request/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); + return e107::url('download/request/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); } @@ -419,7 +417,7 @@ class download_shortcodes extends e_shortcode { if ($parm == "link") { - $url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); + $url = e107::url('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); return "".$img.""; // return "".$img.""; } @@ -442,7 +440,7 @@ class download_shortcodes extends e_shortcode if($parm == "link" && $this->var['download_image']) { - $url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); + $url = e107::url('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); return "".$img.""; // return "".$img.""; @@ -512,7 +510,7 @@ class download_shortcodes extends e_shortcode { $tp = e107::getParser(); - $viewUrl = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); + $viewUrl = e107::url('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef'])); $requestUrl = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); // $this->sc_download_request_url(); $link['view'] = "".$this->var['download_name'].""; @@ -904,7 +902,7 @@ class download_shortcodes extends e_shortcode { $dlrowrow = $sql->fetch(); - $url = e107::getUrl()->create('download/view/item',array('id'=>$dlrowrow['download_id'], 'name'=>$dlrowrow['download_sef'])); + $url = e107::url('download/view/item',array('id'=>$dlrowrow['download_id'], 'name'=>$dlrowrow['download_sef'])); $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-left') : '<<'; @@ -931,7 +929,7 @@ class download_shortcodes extends e_shortcode { $dlrowrow = $sql->fetch(); extract($dlrowrow); - $url = e107::getUrl()->create('download/view/item', array('id'=>$dlrowrow['download_id'], 'name'=>$dlrowrow['download_sef'])); + $url = e107::url('download/view/item', array('id'=>$dlrowrow['download_id'], 'name'=>$dlrowrow['download_sef'])); $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-right') : '>>'; @@ -950,7 +948,7 @@ class download_shortcodes extends e_shortcode */ function sc_download_back_to_list($parm) { - $url = e107::getUrl()->create('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef'])); + $url = e107::url('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef'])); // e_PLUGIN_ABS."download/download.php?action=list&id=".$this->var['download_category'] $title = "Back to [x]"; @@ -961,15 +959,13 @@ class download_shortcodes extends e_shortcode function sc_download_back_to_category_list() { - $url = e107::getUrl(); - if(!empty($this->parent)) { - $link = $url->create('download/list/category', array('id'=>$this->parent['download_category_id'],'name'=>$this->parent['download_category_sef'])); + $link = e107::url('download/list/category', array('id'=>$this->parent['download_category_id'],'name'=>$this->parent['download_category_sef'])); } else { - $link = ($this->var['download_category_id']) ? $url->create('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef'])) : null; + $link = ($this->var['download_category_id']) ? e107::url('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef'])) : null; } return "".LAN_dl_9.""; diff --git a/e107_plugins/download/e_url.php b/e107_plugins/download/e_url.php index 4663d2c23..2f07a6e95 100644 --- a/e107_plugins/download/e_url.php +++ b/e107_plugins/download/e_url.php @@ -21,6 +21,9 @@ if (!defined('e107_INIT')) { exit; } class download_url // plugin-folder + '_url' { + + public $alias = 'download'; + function config() { $config = array(); @@ -33,6 +36,20 @@ class download_url // plugin-folder + '_url' ); + $config['category'] = array( + + + ); + + $config['item'] = array( + + + ); + + $config['get'] = array( + + + ); return $config; }