1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 23:26:41 +02:00

Fixed URL on {CHAPTER_BUTTON}

This commit is contained in:
Cameron
2014-06-13 04:19:09 -07:00
parent 8cf0ee152e
commit 86bf8de5bf

View File

@@ -17,8 +17,6 @@ if (!defined('e107_INIT')) { exit; }
*/ */
// XXX FIXME All shortcodes should return a value from $this->var.
class cpage_shortcodes extends e_shortcode class cpage_shortcodes extends e_shortcode
{ {
// var $var; // parsed DB values // var $var; // parsed DB values
@@ -369,18 +367,22 @@ class cpage_shortcodes extends e_shortcode
// -------------------- Chapter - specific to the current page. ------------------------- // -------------------- Chapter - specific to the current page. -------------------------
/**
* @example {CHAPTER_NAME}
*/
function sc_chapter_name() function sc_chapter_name()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$row = $this->getChapter(); $row = $this->getChapter();
return $tp->toHtml($row['chapter_name'], false, 'TITLE'); return $tp->toHtml($row['chapter_name'], false, 'TITLE');
} }
/**
* @example {CHAPTER_ANCHOR}
*/
function sc_chapter_anchor() function sc_chapter_anchor()
{ {
$frm = e107::getForm(); $frm = e107::getForm();
@@ -388,7 +390,10 @@ class cpage_shortcodes extends e_shortcode
return $frm->name2id($row['chapter_name']); return $frm->name2id($row['chapter_name']);
} }
/**
* @example {CHAPTER_ICON}
*/
function sc_chapter_icon() function sc_chapter_icon()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
@@ -396,7 +401,10 @@ class cpage_shortcodes extends e_shortcode
return $tp->toIcon($row['chapter_icon']); return $tp->toIcon($row['chapter_icon']);
} }
/**
* @example {CHAPTER_DESCRIPTION}
*/
function sc_chapter_description() function sc_chapter_description()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
@@ -404,7 +412,10 @@ class cpage_shortcodes extends e_shortcode
return $tp->toHtml($row['chapter_meta_description'], true, 'BODY'); return $tp->toHtml($row['chapter_meta_description'], true, 'BODY');
} }
/**
* @example {CHAPTER_URL}
*/
function sc_chapter_url() function sc_chapter_url()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
@@ -417,16 +428,22 @@ class cpage_shortcodes extends e_shortcode
} }
/**
* @example {CHAPTER_BUTTON: text=More&size=sm}
*/
function sc_chapter_button($options) function sc_chapter_button($options)
{ {
$text = vartrue($options['text'], LAN_READ_MORE); $text = vartrue($options['text'], LAN_READ_MORE);
$size = vartrue($options['size'], ""); $size = vartrue($options['size'], "");
$inc = ($size) ? " btn-".$size : ""; $inc = ($size) ? " btn-".$size : "";
$url = $this->sc_chapter_url();
return '<a class="cpage btn btn-primary btn-chapter'.$inc.'" href="'.$url.'">'.$text.'</a>'; return '<a class="cpage btn btn-primary btn-chapter'.$inc.'" href="'.$url.'">'.$text.'</a>';
} }
/**
* @example {CPAGERELATED: types=news}
*/
function sc_cpagerelated($array=array()) function sc_cpagerelated($array=array())
{ {
if(!varset($array['types'])) if(!varset($array['types']))