mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Comment Menu: Shortcode parms {CM_COMMENT: limit=x} {CM_HEADING: limit=x}
This commit is contained in:
@@ -22,10 +22,12 @@ if (!defined('e107_INIT'))
|
|||||||
require_once (e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
|
require_once (e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
|
||||||
|
|
||||||
$cobj = e107::getObject('comment');
|
$cobj = e107::getObject('comment');
|
||||||
//require_once (e_HANDLER."comment_class.php");
|
|
||||||
//$cobj = new comment;
|
|
||||||
|
|
||||||
if (file_exists(THEME."comment_menu_template.php"))
|
if (file_exists(THEME."templates/comment_menu/comment_menu_template.php"))
|
||||||
|
{
|
||||||
|
require_once (THEME."templates/comment_menu/comment_menu_template.php");
|
||||||
|
}
|
||||||
|
elseif (file_exists(THEME."comment_menu_template.php"))
|
||||||
{
|
{
|
||||||
require_once (THEME."comment_menu_template.php");
|
require_once (THEME."comment_menu_template.php");
|
||||||
}
|
}
|
||||||
|
@@ -44,9 +44,18 @@ class comment_menu_shortcodes extends e_shortcode
|
|||||||
return e107::getParser()->toDate($this->var['comment_datestamp'], "relative");
|
return e107::getParser()->toDate($this->var['comment_datestamp'], "relative");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_cm_heading()
|
function sc_cm_heading($parm=null)
|
||||||
{
|
{
|
||||||
return $this->var['comment_title'];
|
if(!empty($parm['limit'])) // new v2.1.5
|
||||||
|
{
|
||||||
|
$text = e107::getParser()->text_truncate($this->var['comment_title'], $parm['limit']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text = $this->var['comment_title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return e107::getParser()->toHtml($text,false,'TITLE');
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_cm_url_pre()
|
function sc_cm_url_pre()
|
||||||
@@ -54,6 +63,11 @@ class comment_menu_shortcodes extends e_shortcode
|
|||||||
return ($this->var['comment_url'] ? "<a href='".$this->var['comment_url']."'>" : "");
|
return ($this->var['comment_url'] ? "<a href='".$this->var['comment_url']."'>" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sc_cm_url() // new v2.1.5
|
||||||
|
{
|
||||||
|
return (!empty($this->var['comment_url'])) ? $this->var['comment_url'] : '#';
|
||||||
|
}
|
||||||
|
|
||||||
function sc_cm_url_post()
|
function sc_cm_url_post()
|
||||||
{
|
{
|
||||||
return ($this->var['comment_url'] ? "</a>" : "");
|
return ($this->var['comment_url'] ? "</a>" : "");
|
||||||
@@ -69,19 +83,26 @@ class comment_menu_shortcodes extends e_shortcode
|
|||||||
return $this->var['comment_author'];
|
return $this->var['comment_author'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_cm_author_avatar($parm=null)
|
function sc_cm_author_avatar($parm=null) // new v2.1.5
|
||||||
{
|
{
|
||||||
$data = array('user_id'=>$this->var['comment_author_id'], 'user_image'=>$this->var['comment_author_image']);
|
$data = array('user_id'=>$this->var['comment_author_id'], 'user_image'=>$this->var['comment_author_image']);
|
||||||
return e107::getParser()->toAvatar($data, $parm);
|
return e107::getParser()->toAvatar($data, $parm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sc_cm_comment($parm='')
|
function sc_cm_comment($parm=null)
|
||||||
{
|
{
|
||||||
$menu_pref = e107::getConfig('menu')->getPref();
|
$menu_pref = e107::getConfig('menu')->getPref();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$COMMENT = '';
|
$COMMENT = '';
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($parm['limit'])) // override using shortcode parm. // new v2.1.5
|
||||||
|
{
|
||||||
|
$menu_pref['comment_characters'] = intval($parm['limit']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if($menu_pref['comment_characters'] > 0)
|
if($menu_pref['comment_characters'] > 0)
|
||||||
{
|
{
|
||||||
$COMMENT = strip_tags($tp->toHTML($this->var['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
|
$COMMENT = strip_tags($tp->toHTML($this->var['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
|
||||||
|
Reference in New Issue
Block a user