1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 05:09:05 +01:00
php-e107/e107_plugins/comment_menu/comment_menu_shortcodes.php

164 lines
4.0 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
2009-10-08 10:53:02 +00:00
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright (C) 2008-2009 e107 Inc (e107.org)
2009-10-08 10:53:02 +00:00
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Comment menu shortcodes
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_shortcodes.php,v $
2010-02-10 18:18:01 +00:00
* $Revision$
* $Date$
* $Author$
2006-12-02 04:36:16 +00:00
*/
2009-10-08 10:53:02 +00:00
2006-12-02 04:36:16 +00:00
if (!defined('e107_INIT')) { exit; }
2013-04-29 19:36:05 -07:00
//$comment_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
//e107::getRegistry('plugin/comment_menu/current');
class comment_menu_shortcodes extends e_shortcode
{
/**
* @DEPRECATED - use css styling instead.
*/
function sc_cm_icon()
{
//TODO review bullet
$bullet = '';
if(defined('BULLET'))
{
$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" class="icon" />';
}
elseif(file_exists(THEME.'images/bullet2.gif'))
{
$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" class="icon" />';
}
return $bullet;
}
function sc_cm_datestamp()
{
$gen = new convert;
return $gen->convert_date($this->var['comment_datestamp'], "relative");
}
function sc_cm_heading()
{
return $this->var['comment_title'];
}
function sc_cm_url_pre()
{
return ($this->var['comment_url'] ? "<a href='".$this->var['comment_url']."'>" : "");
}
function sc_cm_url_post()
{
return ($this->var['comment_url'] ? "</a>" : "");
}
function sc_cm_type()
{
return $this->var['comment_type'];
}
function sc_cm_author()
{
return $this->var['comment_author'];
}
function sc_cm_comment($parm='')
{
$menu_pref = e107::getConfig('menu')->getPref();
$tp = e107::getParser();
$COMMENT = '';
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')));
if ($tp->ustrlen($COMMENT) > $menu_pref['comment_characters'])
{
$COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'],'').($this->var['comment_url'] ? " <a href='".$this->var['comment_url']."'>" : "").defset($menu_pref['comment_postfix'], $menu_pref['comment_postfix']).($this->var['comment_url'] ? "</a>" : "");
}
}
return $COMMENT;
}
}
2006-12-02 04:36:16 +00:00
/*
SC_BEGIN CM_ICON
2009-07-25 07:54:36 +00:00
//TODO review bullet
2009-08-23 10:57:51 +00:00
$bullet = '';
if(defined('BULLET'))
{
$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" class="icon" />';
}
elseif(file_exists(THEME.'images/bullet2.gif'))
{
$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" class="icon" />';
}
return $bullet;
2006-12-02 04:36:16 +00:00
SC_END
SC_BEGIN CM_DATESTAMP
2009-10-08 10:53:02 +00:00
$row = e107::getRegistry('plugin/comment_menu/current');
2006-12-02 04:36:16 +00:00
$gen = new convert;
2013-04-29 19:36:05 -07:00
return $gen->convert_date($row['comment_datestamp'], "relative");
2006-12-02 04:36:16 +00:00
SC_END
SC_BEGIN CM_HEADING
2009-10-08 10:53:02 +00:00
$row = e107::getRegistry('plugin/comment_menu/current');
2006-12-02 04:36:16 +00:00
return $row['comment_title'];
SC_END
SC_BEGIN CM_URL_PRE
2009-10-08 10:53:02 +00:00
$row = e107::getRegistry('plugin/comment_menu/current');
2006-12-02 04:36:16 +00:00
return ($row['comment_url'] ? "<a href='".$row['comment_url']."'>" : "");
SC_END
SC_BEGIN CM_URL_POST
2009-10-08 10:53:02 +00:00
$row = e107::getRegistry('plugin/comment_menu/current');
2006-12-02 04:36:16 +00:00
return ($row['comment_url'] ? "</a>" : "");
SC_END
SC_BEGIN CM_TYPE
2009-10-08 10:53:02 +00:00
$row = e107::getRegistry('plugin/comment_menu/current');
2006-12-02 04:36:16 +00:00
return $row['comment_type'];
SC_END
SC_BEGIN CM_AUTHOR
2009-10-08 10:53:02 +00:00
$row = e107::getRegistry('plugin/comment_menu/current');
2006-12-02 04:36:16 +00:00
return $row['comment_author'];
SC_END
SC_BEGIN CM_COMMENT
2009-10-08 10:53:02 +00:00
$row = e107::getRegistry('plugin/comment_menu/current');
2009-10-08 14:53:37 +00:00
$menu_pref = e107::getConfig('menu')->getPref();
$tp = e107::getParser();
2006-12-02 04:36:16 +00:00
$COMMENT = '';
2013-04-29 19:36:05 -07:00
2009-10-08 14:53:37 +00:00
if($menu_pref['comment_characters'] > 0)
{
2009-10-08 14:53:37 +00:00
$COMMENT = strip_tags($tp->toHTML($row['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
if ($tp->ustrlen($COMMENT) > $menu_pref['comment_characters'])
{
2009-10-08 14:53:37 +00:00
$COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'],'').($row['comment_url'] ? " <a href='".$row['comment_url']."'>" : "").defset($menu_pref['comment_postfix'], $menu_pref['comment_postfix']).($row['comment_url'] ? "</a>" : "");
}
2006-12-02 04:36:16 +00:00
}
return $COMMENT;
SC_END
*/
?>