1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-09 16:17:14 +02:00

Issue #2486 - Downloads templatea fix. Breadcrumb fix. Replacement e_url profile added.

This commit is contained in:
Cameron
2017-04-10 13:29:05 -07:00
parent 630a5aa147
commit 1b1de9cda7
4 changed files with 81 additions and 16 deletions

View File

@@ -55,11 +55,11 @@ class download_shortcodes extends e_shortcode
break; break;
case 'maincats': case 'maincats':
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download/index')); $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download','index'));
break; break;
default: default:
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download/index')); $breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download','index'));
if(!empty($this->grandparent)) if(!empty($this->grandparent))
{ {

View File

@@ -24,39 +24,95 @@ class download_url // plugin-folder + '_url'
public $alias = 'download'; public $alias = 'download';
/**
* Support for different URL profiles (optional)
* @return array
*/
public $profiles = array(
'default' => array('label' => 'Friendly Default', 'examples' => array('{SITEURL}download/category/3/my-category-name')),
'non-numeric' => array('label' => 'Friendly (experimental)', 'examples' => array('{SITEURL}download/my-category/my-sub-category/my-file-name')),
);
function config($profile=null) function config($profile=null)
{ {
$config = $this->profile1();
switch($profile)
{
case "non-numeric":
$config = $this->profile2();
break;
case "default":
default:
$config = $this->profile1();
}
return $config; return $config;
} }
function profile1()
private function profile2()
{
$config = $this->profile1();
$config['subcategory'] = array(
'regex' => '^{alias}/([^\/]*)/([^\/]*)/?$',
'redirect' => '{e_PLUGIN}vstore/vstore.php?catsef=$2',
'sef' => '{alias}/{cat_sef}/{subcat_sef}'
);
$config['category'] = array(
'regex' => '^{alias}/category/([\d]*)/(.*)$',
'redirect' => '{e_PLUGIN}download/download.php?action=list&id=$1',
'sef' => '{alias}/{download_category_sef}',
);
return $config;
}
private function profile1()
{ {
$config = array(); $config = array();
$config['category'] = array( /*
'sef' => '{alias}/category/{download_category_id}/{download_category_sef}/', $config['subcategory'] = array(
'regex' => '^{alias}/([^\/]*)/([^\/]*)/?$',
'redirect' => '{e_PLUGIN}vstore/vstore.php?catsef=$2',
'sef' => '{alias}/{cat_sef}/{subcat_sef}'
);
*/
$config['category'] = array(
'regex' => '^{alias}/category/([\d]*)/(.*)$',
'redirect' => '{e_PLUGIN}download/download.php?action=list&id=$1',
'sef' => '{alias}/category/{download_category_id}/{download_category_sef}/',
); );
$config['item'] = array( $config['item'] = array(
'sef' => '{alias}/{download_id}/{download_sef}' 'regex' => '^{alias}/([\d]*)/(.*)$',
'redirect' => '{e_PLUGIN}download/download.php?action=view&id=$1',
'sef' => '{alias}/{download_id}/{download_sef}'
); );
$config['get'] = array( $config['get'] = array(
'regex' => '^{alias}/get/([\d]*)/(.*)$', 'regex' => '^{alias}/get/([\d]*)/(.*)$',
'sef' => '{alias}/get/{download_id}/{download_sef}', 'sef' => '{alias}/get/{download_id}/{download_sef}',
'redirect' => '{e_PLUGIN}download/request.php?id=$1', // file-path of what to load when the regex returns true. 'redirect' => '{e_PLUGIN}download/request.php?id=$1', // file-path of what to load when the regex returns true.
); );
$config['index'] = array( $config['index'] = array(
// 'regex' => '^download/?$', 'regex' => '{alias}/?$',
'alias' => 'download', 'sef' => '{alias}',
'sef' => '{alias}', 'redirect' => '{e_PLUGIN}download/download.php',
'redirect' => '{e_PLUGIN}download/download.php',
); );

View File

@@ -412,6 +412,15 @@ class download
} }
$dlrow = $sql->fetch(); $dlrow = $sql->fetch();
$sc->parent = $this->getParent($dlrow['download_category_id']);
if(!empty( $sc->parent['download_category_parent']))
{
$sc->grandparent = $this->getParent( $sc->parent['download_category_id']);
}
$sc->setVars($dlrow); $sc->setVars($dlrow);
$this->setMeta($dlrow); $this->setMeta($dlrow);

View File

@@ -401,8 +401,8 @@ $DOWNLOAD_TEMPLATE['categories']['subchild'] = "
{DOWNLOAD_CAT_SUBSUB_ICON} {DOWNLOAD_CAT_SUBSUB_ICON}
</td> </td>
<td > <td >
<div class='offset1'> <div class='col-md-offset-1'>
{DOWNLOAD_CAT_SUBSUB_NEW_ICON} {DOWNLOAD_CAT_SUBSUB_NAME}<br/> {DOWNLOAD_CAT_SUBSUB_NEW_ICON} {DOWNLOAD_CAT_SUBSUB_NAME}<br/>
<small class='muted text-muted'> <small class='muted text-muted'>
{DOWNLOAD_CAT_SUBSUB_DESCRIPTION} {DOWNLOAD_CAT_SUBSUB_DESCRIPTION}
</small> </small>