1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-29 10:38:08 +01:00

Magic Shortcode added for current breadcrumb. {---BREADCRUMB---} e107::breadcrumb() method added for plugins to set/get values.

This commit is contained in:
Cameron 2019-06-14 14:32:58 -07:00
parent 5d2076a344
commit 1d311ff543
4 changed files with 71 additions and 16 deletions

View File

@ -137,7 +137,7 @@ if (varset($e107_popup) != 1)
}
if (isset($pref['displaycacheinfo']) && $pref['displaycacheinfo'])
{
$rinfo .= $cachestring.".";
// $rinfo .= $cachestring.".";
}
if ($pref['log_page_accesses'])
@ -409,6 +409,9 @@ if (!empty($pref['e_output_list']) && is_array($pref['e_output_list']))
$search = array_keys($magicSC);
$replace = array_values($magicSC);
$bread = e107::breadcrumb();
$search[] = '{---BREADCRUMB---}';
$replace[] = e107::getForm()->breadcrumb($bread);
// New - see class2.php
$ehd = new e_http_header;

View File

@ -143,6 +143,11 @@ class e107
*/
protected static $_js_enabled = true;
protected static $_breadcrumb = array();
/**
* Core handlers array
* For new/missing handler add
@ -3347,6 +3352,24 @@ class e107
}
/**
* Set or Get the current breadcrumb array.
* @param array $array
* @return array|null
*/
public static function breadcrumb($array = array())
{
if(empty($array))
{
return self::$_breadcrumb;
}
self::$_breadcrumb = $array;
return null;
}
/**
* Static (easy) sef-url creation method (works with e_url.php @see /index.php)
*

View File

@ -36,16 +36,13 @@ class download_shortcodes extends e_shortcode
{
}
function sc_download_breadcrumb($parm='')
{
$tp = e107::getParser();
$frm = e107::getForm();
public function breadcrumb()
{
$breadcrumb = array();
switch ($this->qry['action'])
switch ($this->qry['action'])
{
case 'mirror':
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download', 'index'));
@ -53,11 +50,11 @@ class download_shortcodes extends e_shortcode
$breadcrumb[] = array('text' => $this->var['download_name'], 'url' => e107::url('download', 'item', $this->var)); // 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' => e107::url('download','index'));
break;
default:
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download','index'));
@ -76,6 +73,18 @@ class download_shortcodes extends e_shortcode
break;
}
e107::breadcrumb($breadcrumb);
}
function sc_download_breadcrumb($parm='')
{
$tp = e107::getParser();
$frm = e107::getForm();
$breadcrumb = e107::breadcrumb();
return $frm->breadcrumb($breadcrumb);
}

View File

@ -59,8 +59,8 @@ class download
foreach($data as $row)
{
$id = $row['download_category_parent'];
$sub= $row['download_category_id'];
$id = (int) $row['download_category_parent'];
$sub= (int) $row['download_category_id'];
$this->subCategories[$id][$sub] = $row;
if(check_class($row['download_category_class']))
@ -70,6 +70,7 @@ class download
}
return $this;
}
@ -162,6 +163,8 @@ class download
$pref = e107::getPref();
if($this->qry['action'] == 'maincats')
{
//
@ -297,9 +300,11 @@ class download
require_once(e_PLUGIN."download/templates/".$template_name);
}
}
/** @var download_shortcodes $sc */
$sc = e107::getScBatch('download',true);
$sc->wrapper('download/categories');
$sc->breadcrumb();
$sc->qry = $this->qry;
@ -311,6 +316,7 @@ class download
if ($dlcat->down_count == 0)
{
return $ns->tablerender(LAN_PLUGIN_DOWNLOAD_NAME, "<div class='alert alert-warning' style='text-align:center'>".LAN_NO_RECORDS_FOUND."</div>",'download-categories',true);
}
@ -498,8 +504,10 @@ class download
$sql = e107::getDb();
$gen = new convert;
/** @var download_shortcodes $sc */
$sc = e107::getScBatch('download',true);
$sc->wrapper('download/view');
$sc->breadcrumb();
$sc->qry = $this->qry;
$highlight_search = FALSE;
@ -539,6 +547,8 @@ class download
$sc->setVars($dlrow);
$this->setMeta($dlrow);
$this->sc = $sc;
$this->rows = $dlrow;
@ -561,7 +571,9 @@ class download
$tp = e107::getParser();
$ns = e107::getRender();
/** @var download_shortcodes $sc */
$sc = $this->sc;
$sc->breadcrumb();
// @see: #3056 fixes fatal error in case $sc is empty (what happens, if no record was found)
$count = empty($sc) ? 0 : $sc->getVars();
@ -660,11 +672,13 @@ class download
$ns = e107::getRender();
$pref = e107::getPref();
// $sc = new download_shortcodes;
/** @var download_shortcodes $sc */
$sc = e107::getScBatch('download',true);
$sc->wrapper('download/list');
$sc->qry = $this->qry;
//if (!isset($this->qry['from'])) $this->qry['from'] = 0;
@ -686,6 +700,8 @@ class download
$sc->grandparent = $this->getParent( $sc->parent['download_category_id']);
}
$sc->breadcrumb();
// $type = $dlrow['download_category_name'];
@ -899,6 +915,8 @@ class download
$breadcrumb[] = array('text' => $dlrow['download_category_name'], 'url' => e107::url('download','category', $dlrow)); // e_SELF."?action=list&id=".$dlrow['download_category_id']);
$breadcrumb[] = array('text' => $dlrow['download_name'], 'url' => e107::url('download','item', $dlrow)); //e_SELF."?action=view&id=".$dlrow['download_id']);
$breadcrumb[] = array('text' => LAN_dl_45, 'url' => null);
e107::breadcrumb($breadcrumb);
if (isset($_POST['report_download']))
{
@ -994,9 +1012,11 @@ class download
}
}
/** @var download_shortcodes $sc */
$sc = e107::getScBatch('download',true);
$sc->wrapper('download/mirror');
$sc->breadcrumb();
$sc->qry = $this->qry;
// $load_template = 'download_template';