mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
Comment menu template now using v2.x wrappers. Template moved to templates folder.
This commit is contained in:
@@ -34,26 +34,16 @@ if (!defined('e107_INIT'))
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once (e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
|
|
||||||
|
|
||||||
$cobj = e107::getObject('comment');
|
|
||||||
|
|
||||||
if (file_exists(THEME."templates/comment_menu/comment_menu_template.php"))
|
// $cobj = e107::getObject('comment');
|
||||||
{
|
|
||||||
require_once (THEME."templates/comment_menu/comment_menu_template.php");
|
|
||||||
}
|
$cobj = e107::getComment();
|
||||||
elseif (file_exists(THEME."comment_menu_template.php"))
|
|
||||||
{
|
|
||||||
require_once (THEME."comment_menu_template.php");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
require_once(e_PLUGIN."comment_menu/comment_menu_template.php");
|
|
||||||
}
|
|
||||||
global $menu_pref;
|
global $menu_pref;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$data = $cobj->getCommentData(intval($menu_pref['comment_display']));
|
$data = $cobj->getCommentData(intval($menu_pref['comment_display']));
|
||||||
|
|
||||||
$text = '';
|
$text = '';
|
||||||
@@ -63,30 +53,47 @@ if (empty($data) || !is_array($data))
|
|||||||
$text = CM_L1;
|
$text = CM_L1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_array($COMMENT_MENU_TEMPLATE)) // Convert to v2.x standard.
|
if(!$TEMPLATE = e107::getTemplate('comment_menu'))
|
||||||
{
|
{
|
||||||
$TEMPLATE = array();
|
$COMMENT_MENU_TEMPLATE = null;
|
||||||
$TEMPLATE['start'] = "";
|
|
||||||
$TEMPLATE['item'] = $COMMENT_MENU_TEMPLATE;
|
if (file_exists(THEME."templates/comment_menu/comment_menu_template.php"))
|
||||||
$TEMPLATE['end'] = "";
|
{
|
||||||
}
|
require_once (THEME."templates/comment_menu/comment_menu_template.php");
|
||||||
else
|
}
|
||||||
{
|
elseif (file_exists(THEME."comment_menu_template.php"))
|
||||||
$TEMPLATE = $COMMENT_MENU_TEMPLATE;
|
{
|
||||||
|
require_once (THEME."comment_menu_template.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_array($COMMENT_MENU_TEMPLATE)) // Convert to v2.x standard.
|
||||||
|
{
|
||||||
|
$TEMPLATE = array();
|
||||||
|
$TEMPLATE['start'] = "";
|
||||||
|
$TEMPLATE['item'] = $COMMENT_MENU_TEMPLATE;
|
||||||
|
$TEMPLATE['end'] = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$TEMPLATE = $COMMENT_MENU_TEMPLATE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment_menu_shortcodes = new comment_menu_shortcodes;
|
require_once (e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
|
||||||
|
$sc = e107::getScBatch('comment_menu', true);
|
||||||
|
$sc->wrapper('comment_menu');
|
||||||
|
|
||||||
$text .= $tp->parseTemplate($TEMPLATE['start'], true, $comment_menu_shortcodes);
|
$text .= $tp->parseTemplate($TEMPLATE['start'], true, $sc);
|
||||||
|
|
||||||
foreach ($data as $row)
|
foreach ($data as $row)
|
||||||
{
|
{
|
||||||
//e107::setRegistry('plugin/comment_menu/current', $row);
|
//e107::setRegistry('plugin/comment_menu/current', $row);
|
||||||
$comment_menu_shortcodes->setVars($row);
|
$sc->setVars($row);
|
||||||
$text .= $tp->parseTemplate($TEMPLATE['item'], true, $comment_menu_shortcodes);
|
$text .= $tp->parseTemplate($TEMPLATE['item'], true, $sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= $tp->parseTemplate($TEMPLATE['end'], true, $comment_menu_shortcodes);
|
$text .= $tp->parseTemplate($TEMPLATE['end'], true, $sc);
|
||||||
|
|
||||||
//e107::setRegistry('plugin/comment_menu/current', null);
|
//e107::setRegistry('plugin/comment_menu/current', null);
|
||||||
|
|
||||||
|
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
//$comment_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
|
|
||||||
//e107::getRegistry('plugin/comment_menu/current');
|
|
||||||
|
|
||||||
class comment_menu_shortcodes extends e_shortcode
|
class comment_menu_shortcodes extends e_shortcode
|
||||||
{
|
{
|
||||||
@@ -88,6 +86,13 @@ class comment_menu_shortcodes extends e_shortcode
|
|||||||
function sc_cm_author_avatar($parm=null) // new v2.1.5
|
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']);
|
||||||
|
|
||||||
|
if(!empty($parm['size']))
|
||||||
|
{
|
||||||
|
$parm['w'] = $parm['size'];
|
||||||
|
$parm['h'] = $parm['size'];
|
||||||
|
}
|
||||||
|
|
||||||
return e107::getParser()->toAvatar($data, $parm);
|
return e107::getParser()->toAvatar($data, $parm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* e107 website system
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
|
||||||
* Released under the terms and conditions of the
|
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
*
|
|
||||||
* Comment menu default template
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_template.php,v $
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sc_style['CM_TYPE']['pre'] = "[";
|
|
||||||
$sc_style['CM_TYPE']['post'] = "]";
|
|
||||||
|
|
||||||
$sc_style['CM_AUTHOR']['pre'] = CM_L13." ";
|
|
||||||
$sc_style['CM_AUTHOR']['post'] = "";
|
|
||||||
|
|
||||||
$sc_style['CM_DATESTAMP']['pre'] = " ";
|
|
||||||
$sc_style['CM_DATESTAMP']['post'] = "";
|
|
||||||
|
|
||||||
$sc_style['CM_COMMENT']['pre'] = "";
|
|
||||||
$sc_style['CM_COMMENT']['post'] = "";
|
|
||||||
|
|
||||||
// $SC_WRAPPER['CM_AUTHOR'] = CM_L13."{---}"; //XXX Not working as template is loaded the old way.
|
|
||||||
|
|
||||||
if (!isset($COMMENT_MENU_TEMPLATE))
|
|
||||||
{
|
|
||||||
$COMMENT_MENU_TEMPLATE['start'] = "<ul class='comment-menu'>";
|
|
||||||
|
|
||||||
$COMMENT_MENU_TEMPLATE['item'] = "<li>
|
|
||||||
{CM_URL_PRE}{CM_TYPE} {CM_HEADING}{CM_URL_POST}
|
|
||||||
<div>{CM_COMMENT}</div>
|
|
||||||
<small class='text-muted muted'> {CM_AUTHOR} {CM_DATESTAMP}</small>
|
|
||||||
</li>";
|
|
||||||
|
|
||||||
$COMMENT_MENU_TEMPLATE['end'] = "</ul>";
|
|
||||||
|
|
||||||
// {CM_AUTHOR_AVATAR: shape=circle}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
* Comment menu default template
|
||||||
|
*
|
||||||
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu_template.php,v $
|
||||||
|
* $Revision$
|
||||||
|
* $Date$
|
||||||
|
* $Author$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Shortcode Wrappers
|
||||||
|
$COMMENT_MENU_WRAPPER['CM_DATESTAMP'] = ' {---}';
|
||||||
|
$COMMENT_MENU_WRAPPER['CM_AUTHOR'] = CM_L13.'{---}';
|
||||||
|
$COMMENT_MENU_WRAPPER['CM_TYPE'] = '<span class="label label-default badge badge-secondary bg-secondary ">{---}</span>';
|
||||||
|
|
||||||
|
|
||||||
|
// Template
|
||||||
|
$COMMENT_MENU_TEMPLATE['start'] = "<ul class='media-list list-unstyled comment-menu'>";
|
||||||
|
|
||||||
|
$COMMENT_MENU_TEMPLATE['item'] = "<li class='media d-flex mb-2' >
|
||||||
|
<div class='media-left mr-3 me-3'>{CM_AUTHOR_AVATAR: shape=circle&size=48&crop=1}</div>
|
||||||
|
<div class='media-body'>
|
||||||
|
{CM_TYPE} {CM_URL_PRE}{CM_HEADING}{CM_URL_POST}
|
||||||
|
<div>{CM_COMMENT}</div>
|
||||||
|
<small class='text-muted muted'> {CM_AUTHOR} {CM_DATESTAMP}</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>";
|
||||||
|
|
||||||
|
$COMMENT_MENU_TEMPLATE['end'] = "</ul>";
|
||||||
|
|
Reference in New Issue
Block a user