1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

PHP8 Fixes and shortcode tests for chatbox_menu, download, faqs, forum and forum-post

This commit is contained in:
Cameron 2021-01-07 09:42:19 -08:00
parent 4e6347ff1b
commit 3d19db894b
8 changed files with 713 additions and 201 deletions

View File

@ -55,7 +55,7 @@
* @param string $parm
* @return string page navigation bar HTML
*/
function nextprev_shortcode($parm = '')
function nextprev_shortcode($parm = null)
{
$e107 = e107::getInstance();
$pref = e107::getPref();
@ -76,7 +76,7 @@ function nextprev_shortcode($parm = '')
}
// Calculate
$total_items = intval($parm['total']);
$total_items = isset($parm['total']) ? (int) $parm['total'] : 0;
if(empty($total_items))
{

View File

@ -3480,6 +3480,7 @@ class e107
* All inputs are sanitized.
*
* Examples:
* @example
* <code><?php
* // import defeinitions from /e107_plugins/forum/languages/[CurrentLanguage]/lan_forum.php
* e107::plugLan('forum', 'lan_forum');
@ -3494,6 +3495,9 @@ class e107
* // import defeinitions from /e107_plugins/myplug/languages/[CurrentLanguage]_admin.php
* e107::plugLan('myplug', true);
*
* // import defeinitions from /e107_plugins/myplug/languages/[CurrentLanguage]/[CurrentLanguage]_front.php
* e107::plugLan('myplug', 'front', true);
*
* // import defeinitions from /e107_plugins/myplug/languages/[CurrentLanguage]/admin/common.php
* e107::plugLan('myplug', 'admin/common');
* </code>

View File

@ -9,19 +9,23 @@
* e107 chatbox_menu Plugin
*
*/
if ( ! defined('e107_INIT')) {
if(!defined('e107_INIT'))
{
exit;
}
class chatbox_menu_shortcodes extends e_shortcode
{
/**
* Initializer for chatbox_menu_shortcodes class
*/
public function init()
{
if ( ! isset($this->var['user_image'], $this->var['user_id'], $this->var['user_name']) ) {
if(!isset($this->var['user_image'], $this->var['user_id'], $this->var['user_name']))
{
$this->addVars($this->retrieveUserDataByNick());
}
@ -49,7 +53,9 @@ class chatbox_menu_shortcodes extends e_shortcode
*/
protected function getUserIdFromNick()
{
$temp = explode('.', $this->var['cb_nick']);
return $temp[0];
}
@ -61,7 +67,9 @@ class chatbox_menu_shortcodes extends e_shortcode
*/
protected function getUserNameFromNick()
{
$temp = explode('.', $this->var['cb_nick'], 2);
return $temp[1];
}
@ -75,12 +83,15 @@ class chatbox_menu_shortcodes extends e_shortcode
*/
public function sc_cb_avatar($parm = null)
{
$tp = e107::getParser();
$size = !empty($parm['size']) ? $parm['size'] : 40;
$options = array('h' => $size, 'w' => $size, 'crop' => 'C', 'shape'=>varset($parm['shape']));
$options = array('h' => $size, 'w' => $size, 'crop' => 'C', 'shape' => varset($parm['shape']));
if ( ! isset($this->var['user_image']) ) {
if(!isset($this->var['user_image']))
{
$this->init();
return $tp->toAvatar($this->var, $options);
}
@ -98,7 +109,8 @@ class chatbox_menu_shortcodes extends e_shortcode
public function sc_cb_username($parm = null)
{
if ( ! isset($this->var['user_id'], $this->var['user_name']) ) {
if(!isset($this->var['user_id'], $this->var['user_name']))
{
$userData = array(
'id' => $this->getUserIdFromNick(),
@ -149,7 +161,9 @@ class chatbox_menu_shortcodes extends e_shortcode
*/
public function sc_cb_message($parm = null)
{
if ($this->var['cb_blocked']) {
if($this->var['cb_blocked'])
{
return CHATBOX_L6;
}
@ -174,12 +188,16 @@ class chatbox_menu_shortcodes extends e_shortcode
*/
public function sc_cb_bullet($parm = null)
{
$bullet = '';
if (defined('BULLET')) {
if(defined('BULLET'))
{
$bullet =
'<img src="' . THEME_ABS . 'images/' . BULLET . '" alt="" class="icon" />';
} elseif (file_exists(THEME . 'images/bullet2.gif')) {
}
elseif(file_exists(THEME . 'images/bullet2.gif'))
{
$bullet =
'<img src="' . THEME_ABS . 'images/bullet2.gif" alt="" class="icon" />';
}
@ -197,23 +215,28 @@ class chatbox_menu_shortcodes extends e_shortcode
*/
public function sc_cb_mod($parm = null)
{
$frm = e107::getForm();
$modControls = '';
if (CB_MOD) {
if(deftrue('CB_MOD'))
{
$id = $this->var['cb_id'];
$modControls .= "<span class='checkbox'>";
$modControls .= $frm->checkbox('delete[' . $id . ']', 1, false,
array( 'inline' => true, 'label' => LAN_DELETE ));
array('inline' => true, 'label' => LAN_DELETE));
if ($this->var['cb_blocked']) {
if($this->var['cb_blocked'])
{
$modControls .= $frm->checkbox('unblock[' . $id . ']', 1, false,
array( 'inline' => true, 'label' => CHATBOX_L7 ));
} else {
array('inline' => true, 'label' => CHATBOX_L7));
}
else
{
$modControls .= $frm->checkbox('block[' . $id . ']', 1, false,
array( 'inline' => true, 'label' => CHATBOX_L9 ));
array('inline' => true, 'label' => CHATBOX_L9));
}
$modControls .= '</span>';
@ -232,6 +255,7 @@ class chatbox_menu_shortcodes extends e_shortcode
*/
public function sc_cb_blocked($parm = null)
{
return $this->var['cb_blocked'] ? '<span class="label label-warning">' . CHATBOX_L25 . '</span>' : '';
}

View File

@ -16,6 +16,8 @@
if (!defined('e107_INIT')) { exit; }
e107::plugLan('download', 'front', true);
/**
* download_shortcodes
*/
@ -28,13 +30,14 @@ class download_shortcodes extends e_shortcode
public $parent;
public $grandparent;
private $pref;
/**
* download_shortcodes constructor
*/
function __construct()
{
$this->pref = e107::getPref();
}
@ -147,22 +150,20 @@ class download_shortcodes extends e_shortcode
$tp = e107::getParser();
$class = 'category-name';
$class .= $this->isNewDownload($this->dlsubrow['d_last']) ? ' new' : '';
$class .= isset($this->dlsubrow['d_last']) && $this->isNewDownload($this->dlsubrow['d_last']) ? ' new' : '';
if($parm == 'raw')
{
return $tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE');
}
if ($this->dlsubrow['d_count'])
if (!empty($this->dlsubrow['d_count']))
{
$url = e107::url('download', 'category', $this->dlsubrow);
return "<a class='".$class."' href='".$url."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
// return "<a class='".$class."' href='".e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubrow['download_category_id']."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
}
else
elseif(isset($this->dlsubrow['download_category_name']))
{
return $tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE');
}
@ -170,32 +171,51 @@ class download_shortcodes extends e_shortcode
function sc_download_cat_sub_description()
{
$tp = e107::getParser();
return $tp->toHTML($this->dlsubrow['download_category_description'], TRUE, 'DESCRIPTION');
if(empty($this->dlsubrow['download_category_description']))
{
return null;
}
return e107::getParser()->toHTML($this->dlsubrow['download_category_description'], TRUE, 'DESCRIPTION');
}
function sc_download_cat_sub_icon()
{
if(empty($this->dlsubrow['download_category_icon']))
{
return null;
}
return $this->_sc_cat_icons($this->dlsubrow['download_category_icon'], $this->dlsubrow['d_count'], $this->dlsubrow['download_category_name']);
}
function sc_download_cat_sub_new_icon()
{
return ($this->isNewDownload($this->dlsubrow['d_last_subs'])) ? $this->renderNewIcon() : "";
return (isset($this->dlsubrow['d_last_subs']) && $this->isNewDownload($this->dlsubrow['d_last_subs'])) ? $this->renderNewIcon() : "";
}
function sc_download_cat_sub_count()
{
return $this->dlsubrow['d_count'];
return varset($this->dlsubrow['d_count'],'0');
}
function sc_download_cat_sub_size()
{
if(empty($this->dlsubrow['d_size']))
{
return null;
}
return eHelper::parseMemorySize($this->dlsubrow['d_size']);
}
function sc_download_cat_sub_downloaded()
{
if(!isset($this->dlsubrow['d_requests']))
{
return 0;
}
return intval($this->dlsubrow['d_requests']);
}
@ -209,21 +229,21 @@ class download_shortcodes extends e_shortcode
// isNewDownload
$class = 'category-name';
$class .= $this->isNewDownload($this->dlsubsubrow['d_last']) ? ' new' : '';
$class .= isset($this->dlsubsubrow['d_last']) && $this->isNewDownload($this->dlsubsubrow['d_last']) ? ' new' : '';
if($parm == 'raw')
{
return $tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE');
}
if ($this->dlsubsubrow['d_count'])
if (!empty($this->dlsubsubrow['d_count']))
{
$url = e107::url('download', 'category', $this->dlsubsubrow);
// /list/category', array('id'=>$this->dlsubsubrow['download_category_id'], 'name'=> vartrue($this->dlsubsubrow['download_category_sef'],'--sef-not-set--')));
// e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubsubrow['download_category_id']
return "<a class='".$class."' href='".$url."'>".$tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
}
else
elseif(!empty($this->dlsubsubrow['download_category_name']))
{
return $tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE');
}
@ -231,32 +251,52 @@ class download_shortcodes extends e_shortcode
function sc_download_cat_subsub_description()
{
if(empty($this->dlsubsubrow['download_category_description']))
{
return null;
}
return e107::getParser()->toHTML($this->dlsubsubrow['download_category_description'], TRUE, 'DESCRIPTION');
}
function sc_download_cat_subsub_icon()
{
if(empty($this->dlsubsubrow['download_category_icon']))
{
return null;
}
return $this->_sc_cat_icons($this->dlsubsubrow['download_category_icon'], $this->dlsubsubrow['d_count'], $this->dlsubsubrow['download_category_name']);
}
function sc_download_cat_subsub_new_icon()
{
return ($this->isNewDownload($this->dlsubsubrow['d_last'])) ? $this->renderNewIcon() : "";
return (isset($this->dlsubsubrow['d_last']) && $this->isNewDownload($this->dlsubsubrow['d_last'])) ? $this->renderNewIcon() : "";
}
function sc_download_cat_subsub_count()
{
return $this->dlsubsubrow['d_count'];
return varset($this->dlsubsubrow['d_count'], '0');
}
function sc_download_cat_subsub_size()
{
if(empty($this->dlsubsubrow['d_size']))
{
return 0;
}
return eHelper::parseMemorySize($this->dlsubsubrow['d_size']);
}
function sc_download_cat_subsub_downloaded()
{
return intval($this->dlsubsubrow['d_requests']);
if(empty($this->dlsubsubrow['d_requests']))
{
return 0;
}
return (int) $this->dlsubsubrow['d_requests'];
}
@ -268,7 +308,7 @@ class download_shortcodes extends e_shortcode
$qry = $this->qry;
$qry['sort'] = ($qry['sort'] == 'asc') ? 'desc' : 'asc'; // reverse.
$qry['sort'] = (isset($qry['sort']) && $qry['sort'] == 'asc') ? 'desc' : 'asc'; // reverse.
switch ($parm)
{
@ -319,7 +359,6 @@ class download_shortcodes extends e_shortcode
function sc_download_list_name($parm='')
{
$tp = e107::getParser();
$pref = e107::getPref();
if ($parm == "nolink")
{
@ -328,15 +367,15 @@ class download_shortcodes extends e_shortcode
if ($parm == "request")
{
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
$agreetext = $tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'));
if ($this->var['download_mirror_type'])
{
$text = ($pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
}
else
{
$text = ($pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
}
$text .= $tp->toHTML($this->var['download_name'], FALSE, 'TITLE')."</a>";
@ -367,9 +406,8 @@ class download_shortcodes extends e_shortcode
function sc_download_list_recenticon()
{
$pref = e107::getPref();
// convert "recent_download_days" to seconds
return ($this->var['download_datestamp'] > time()-($pref['recent_download_days']*86400) ? $this->renderNewIcon() : '');
return ($this->var['download_datestamp'] > time()-(varset($this->pref['recent_download_days'],0) * 86400) ? $this->renderNewIcon() : '');
}
function sc_download_list_filesize()
@ -427,11 +465,14 @@ class download_shortcodes extends e_shortcode
function sc_download_list_link($parm='')
{
$tp = e107::getParser();
$pref = e107::getPref();
$img = '';
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
$agreetext = !empty($this->pref['agree_text']) ? $tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION')) : '';
if(defined('IMAGE_DOWNLOAD'))
{
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_DOWNLOAD."' title='".LAN_DOWNLOAD."' />";
}
if(deftrue('BOOTSTRAP'))
{
@ -446,9 +487,9 @@ class download_shortcodes extends e_shortcode
else
{
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true, $this); // $this->sc_download_request_url();
return ($pref['agree_flag'] ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' >{$img}</a>");
return (!empty($this->pref['agree_flag']) ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' >{$img}</a>");
// return ($pref['agree_flag'] ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
// return ($this->pref['agree_flag'] ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
}
}
@ -465,20 +506,32 @@ class download_shortcodes extends e_shortcode
}
function sc_download_list_icon($parm='') //XXX FIXME $img.
function sc_download_list_icon($parm = '') //XXX FIXME $img.
{
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_DOWNLOAD."' title='".LAN_DOWNLOAD."' />";
$img = '';
if ($parm == "link")
if(defined('IMAGE_DOWNLOAD'))
{
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_DOWNLOAD . "' />";
}
if(deftrue('BOOTSTRAP'))
{
$img = e107::getParser()->toGlyph('fa-download', false);
}
if($parm == "link")
{
$url = e107::url('download', 'item', $this->var);
return "<a href='".$url."' >".$img."</a>";
return "<a href='" . $url . "' >" . $img . "</a>";
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."' >".$img."</a>";
}
else
{
return $img;
}
return;
}
@ -549,14 +602,17 @@ class download_shortcodes extends e_shortcode
return $this->var['download_category_name'];
}
function sc_download_category_description()
function sc_download_category_description($parm=null)
{
global $tp,$dl,$parm;
$text = $tp -> toHTML($dl['download_category_description'], TRUE,'DESCRIPTION');
if ($parm){
return substr($text,0,$parm);
}else{
$text = e107::getParser()->toHTML($this->var['download_category_description'], true, 'DESCRIPTION');
if($parm)
{
return substr($text, 0, $parm);
}
else
{
return $text;
}
}
@ -584,19 +640,19 @@ class download_shortcodes extends e_shortcode
function sc_download_view_name_linked()
{
global $dl;
$tp = e107::getParser();
$pref = e107::getPref();
$url = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); //$this->sc_download_request_url();
if ($pref['agree_flag'] == 1)
if (!empty($this->pref['agree_flag']))
{
return "<a href='".$url."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
return "<a href='".$url."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
}
else
{
return "<a href='".$url."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
return "<a href='".$url."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
}
@ -604,17 +660,17 @@ class download_shortcodes extends e_shortcode
function sc_download_view_author()
{
return ($this->var['download_author'] ? $this->var['download_author'] : "");
return !empty($this->var['download_author']) ? $this->var['download_author'] : "";
}
function sc_download_view_authoremail()
{
return ($this->var['download_author_email']) ? e107::getParser()->toHTML($this->var['download_author_email'], TRUE, 'LINKTEXT') : "";
return !empty($this->var['download_author_email']) ? e107::getParser()->toHTML($this->var['download_author_email'], TRUE, 'LINKTEXT') : "";
}
function sc_download_view_authorwebsite()
{
return ($this->var['download_author_website']) ? e107::getParser()->toHTML($this->var['download_author_website'], TRUE,'LINKTEXT') : "";
return !empty($this->var['download_author_website']) ? e107::getParser()->toHTML($this->var['download_author_website'], TRUE,'LINKTEXT') : "";
}
function sc_download_view_description($parm='')
@ -719,23 +775,25 @@ class download_shortcodes extends e_shortcode
/**
* {DOWNLOAD_VIEW_LINK: size=2x}
*/
function sc_download_view_link($parm)
function sc_download_view_link($parm=null)
{
$tp = e107::getParser();
$pref = e107::getPref();
$click = "";
$img = '';
if(defined('IMAGE_DOWNLOAD'))
{
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_DOWNLOAD."' title='".LAN_DOWNLOAD."' />";
}
if(deftrue('BOOTSTRAP'))
{
$img = e107::getParser()->toGlyph('fa-download',$parm); // '<i class="icon-download"></i>';
}
if ($pref['agree_flag'] == 1)
if(!empty($this->pref['agree_flag']))
{
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],true,'emotes, no_tags'))."\")'";
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($this->pref['agree_text'],true,'emotes, no_tags'))."\")'";
}
$url = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); //$this->sc_download_request_url();
@ -815,8 +873,8 @@ class download_shortcodes extends e_shortcode
function sc_download_report_link()
{
$pref = e107::getPref();
if(check_class($pref['download_reportbroken']))
if(isset($this->pref['download_reportbroken']) && check_class($this->pref['download_reportbroken']))
{
//$url = e_PLUGIN_ABS."download/download.php?action=report&id=".$this->var['download_id'];
$url = e107::url('download','report', $this->var);
@ -848,39 +906,55 @@ class download_shortcodes extends e_shortcode
function sc_download_mirror_name()
{
if(empty($this->mirror['dlmirror']['mirror_url']))
{
return null;
}
return "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'>".$this->mirror['dlmirror']['mirror_name']."</a>";
}
function sc_download_mirror_image()
{
$tp = e107::getParser();
return ($this->mirror['dlmirror']['mirror_image'] ? "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'><img src='".$tp->replaceConstants($this->mirror['dlmirror']['mirror_image'])."' alt='*'/></a>" : "");
return !empty($this->mirror['dlmirror']['mirror_image']) ? "<a href='{$this->mirror['dlmirror']['mirror_url']}' rel='external'><img src='".e107::getParser()->replaceConstants($this->mirror['dlmirror']['mirror_image'])."' alt='*'/></a>" : '';
}
function sc_download_mirror_location()
{
return ($this->mirror['dlmirror']['mirror_location'] ? $this->mirror['dlmirror']['mirror_location'] : "");
return !empty($this->mirror['dlmirror']['mirror_location']) ? $this->mirror['dlmirror']['mirror_location'] : '';
}
function sc_download_mirror_description()
{
return ($this->mirror['dlmirror']['mirror_description'] ? e107::getParser()->toHTML($this->mirror['dlmirror']['mirror_description'], TRUE) : "");
return !empty($this->mirror['dlmirror']['mirror_description']) ? e107::getParser()->toHTML($this->mirror['dlmirror']['mirror_description'], TRUE) : '';
}
function sc_download_mirror_filesize()
{
if(empty($this->mirror['dlmirrorfile'][3]))
{
return 0;
}
return eHelper::parseMemorySize($this->mirror['dlmirrorfile'][3]);
}
function sc_download_mirror_link()
{
if(empty($this->mirror['dlmirrorfile'][0]))
{
return null;
}
$tp = e107::getParser();
$pref = e107::getPref();
$img = '';
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."\")'";
$click = !empty($this->pref['agree_text']) ? " onclick='return confirm(\"".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."\")'" : '';
if(defined('IMAGE_DOWNLOAD'))
{
$img = "<img src='".IMAGE_DOWNLOAD."' alt='".LAN_DOWNLOAD."' title='".LAN_DOWNLOAD."' />";
}
if(deftrue('BOOTSTRAP'))
{
$img = '<i class="icon-download"></i>';
@ -891,12 +965,12 @@ class download_shortcodes extends e_shortcode
function sc_download_mirror_requests()
{
return (ADMIN ? LAN_dl_73.$this->mirror['dlmirrorfile'][2] : "");
return (ADMIN && !empty($this->mirror['dlmirrorfile'][2])) ? LAN_dl_73.$this->mirror['dlmirrorfile'][2] : "";
}
function sc_download_total_mirror_requests()
{
return (ADMIN ? LAN_dl_74.$this->mirror['dlmirror']['mirror_count'] : "");
return (ADMIN && isset($this->mirror['dlmirror']['mirror_count'])) ? LAN_dl_74.$this->mirror['dlmirror']['mirror_count'] : "";
}
@ -904,8 +978,7 @@ class download_shortcodes extends e_shortcode
function sc_download_view_author_lan()
{
return ($this->var['download_author']) ? LAN_AUTHOR : "";
return !empty($this->var['download_author']) ? LAN_AUTHOR : "";
}
function sc_download_view_authoremail_lan()
@ -1025,7 +1098,7 @@ class download_shortcodes extends e_shortcode
/**
* {DOWNLOAD_BACK_TO_LIST: x=y}
*/
function sc_download_back_to_list($parm)
function sc_download_back_to_list($parm=null)
{
$url = e107::url('download', 'category', $this->var);
// e_PLUGIN_ABS."download/download.php?action=list&id=".$this->var['download_category']
@ -1107,7 +1180,7 @@ class download_shortcodes extends e_shortcode
private function isNewDownload($last_val)
{
if (USER && ($last_val > USERLV))
if (USER && defset('USERLV') && ($last_val > USERLV))
{
return true;
}
@ -1119,6 +1192,11 @@ class download_shortcodes extends e_shortcode
private function renderNewIcon()
{
if(!defined('IMAGE_NEW'))
{
return null;
}
if(strpos(IMAGE_NEW, '<i ') !== false || strpos(IMAGE_NEW, '<span') !== false)
{
return IMAGE_NEW;
@ -1126,7 +1204,6 @@ class download_shortcodes extends e_shortcode
return e107::getParser()->toIcon(IMAGE_NEW);
// return "<img src='".IMAGE_NEW."' alt='*' style='vertical-align:middle' />";
}
}

View File

@ -10,6 +10,8 @@
if (!defined('e107_INIT')) { exit; }
e107::plugLan('faqs', 'front', true);
/**
*
* @package e107
@ -252,7 +254,7 @@ class faqs_shortcodes extends e_shortcode
}
function sc_faq_datestamp($parm)
function sc_faq_datestamp($parm=null)
{
$type = vartrue($parm, 'relative');
return e107::getParser()->toDate($this->var['faq_datestamp'], $type);
@ -268,7 +270,7 @@ class faqs_shortcodes extends e_shortcode
return e107::getParser()->toHTML($customCaption[e_LANGUAGE],true);
}
return LAN_PLUGIN_FAQS_FRONT_NAME;
return defset('LAN_PLUGIN_FAQS_FRONT_NAME');
}
@ -281,7 +283,7 @@ class faqs_shortcodes extends e_shortcode
return "<span class='faq-total'>(".($this->counter -1).")</span>";
}
return $this->var['f_count'];
return isset($this->var['f_count']) ? $this->var['f_count'] : 0;
}
function sc_faq_cat_diz()
@ -295,7 +297,7 @@ class faqs_shortcodes extends e_shortcode
return "<img src='".e_PLUGIN_ABS."faq/images/faq.png' alt='' />";
}
function sc_faq_submit_question($parms)
function sc_faq_submit_question($parms=null)
{
$faqpref = e107::pref('faqs');
@ -317,7 +319,7 @@ class faqs_shortcodes extends e_shortcode
$button = "";
}
if ($faqpref['submit_question'] != e_UC_NOBODY)
if (varset($faqpref['submit_question']) != e_UC_NOBODY)
{
$frm = e107::getForm();
@ -361,7 +363,7 @@ class faqs_shortcodes extends e_shortcode
{
$faqpref = e107::pref('faqs');
if (check_class($faqpref['submit_question']))
if (isset($faqpref['submit_question']) && check_class($faqpref['submit_question']))
{
$tp = e107::getParser();
@ -419,7 +421,7 @@ class faqs_shortcodes extends e_shortcode
{
$array = array();
// $array[0] = array('url'=> e_REQUEST_SELF, 'text'=>LAN_PLUGIN_FAQS_NAME);
$array[0] = array('url'=> e107::url('faqs','index'), 'text'=>LAN_PLUGIN_FAQS_NAME);
$array[0] = array('url'=> e107::url('faqs','index'), 'text'=>defset('LAN_PLUGIN_FAQS_NAME'));
if(!empty($_GET['srch']))
{

View File

@ -8,22 +8,27 @@
if (!defined('e107_INIT')) { exit; }
e107::plugLan('forum', 'front', true);
class forum_shortcodes extends e_shortcode
{
private $forum_rules, $gen;
private $forum_rules;
private $gen;
private $prefs;
public $newFlagList;
function __construct()
{
$this->forum_rules = forum_rules('check');
$this->gen = new convert;
$this->forum_rules = function_exists('forum_rules') ? forum_rules('check') : '';
$this->gen = e107::getDate();
$this->prefs = e107::pref('forum');
}
// START OF $FVARS
function sc_forumtitle()
{
return e107::pref('forum','title', LAN_PLUGIN_FORUM_NAME);
return e107::pref('forum','title', defset('LAN_PLUGIN_FORUM_NAME'));
}
// LEGACY shortcodes, to be deprecated & directly handled in template file???
@ -69,6 +74,16 @@ class forum_shortcodes extends e_shortcode
function sc_iconkey()
{
if(!defined('IMAGE_new_small'))
{
if(ADMIN)
{
return "<div class='alert'>IMAGE_new_small has not been defined</div>";
}
return null;
}
return "
<table class='table table-bordered' style='width:100%'>\n<tr>
<td style='width:2%'>".IMAGE_new_small."</td>
@ -83,11 +98,21 @@ class forum_shortcodes extends e_shortcode
function sc_logo()
{
if(!defined('IMAGE_e'))
{
return null;
}
return IMAGE_e;
}
function sc_newimage()
{
if(!defined('IMAGE_new_small'))
{
return null;
}
return IMAGE_new_small;
}
@ -101,7 +126,7 @@ class forum_shortcodes extends e_shortcode
{
$text .= " | <a href='".e_BASE.'userposts.php?0.forums.'.USERID."'>".LAN_FORUM_0012."</a> | <a href='".e_BASE."usersettings.php'>".LAN_FORUM_0013."</a> | <a href='".e_HTTP."user.php?id.".USERID."'>".LAN_FORUM_0014."</a>";
// To be reworked to get the $forum var
if($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
if(!empty($this->prefs['attach']) && (check_class($pref['upload_class']) || getperms('0')))
{
$text .= " | <a href='".e_PLUGIN."forum/forum_uploads.php'>".LAN_FORUM_0015."</a>";
}
@ -127,8 +152,8 @@ class forum_shortcodes extends e_shortcode
}
// To be reworked to get the $forum var
$trackPref = $forum->prefs->get('track');
//var_dump($forum->checkPerm($this->var['forum_id'], 'post'));
$trackPref = varset($this->prefs['track']);
if(!empty($trackPref) && $forum->checkPerm($this->var['forum_id'], 'post'))
{
$uInfo[2] = "<a href='".e107::url('forum','track')."'>".LAN_FORUM_0030."</a>";
@ -139,6 +164,7 @@ class forum_shortcodes extends e_shortcode
function sc_userlist()
{
$text = '';
if(!defined('e_TRACKING_DISABLED'))
{
// String candidate for USERLIST wrapper
@ -202,24 +228,27 @@ class forum_shortcodes extends e_shortcode
function sc_info()
{
//$fVars->INFO = "";
// global $forum;
//$sql = e107::getDb();
//$gen = new convert;
if (ANON == TRUE)
$allread = false;
$total_new_threads = 0;
$total_read_threads = 0;
$text = '';
if(ANON == true)
{
$text = LAN_FORUM_0049.'<br />'.LAN_FORUM_0050." <a href='".e_SIGNUP."'>".LAN_FORUM_0051."</a> ".LAN_FORUM_0052;
$text = LAN_FORUM_0049 . '<br />' . LAN_FORUM_0050 . " <a href='" . e_SIGNUP . "'>" . LAN_FORUM_0051 . "</a> " . LAN_FORUM_0052;
}
elseif(USER == FALSE)
elseif(USER == false)
{
$text = LAN_FORUM_0049.'<br />'.LAN_FORUM_0053." <a href='".e_SIGNUP."'>".LAN_FORUM_0054."</a> ".LAN_FORUM_0055;
$text = LAN_FORUM_0049 . '<br />' . LAN_FORUM_0053 . " <a href='" . e_SIGNUP . "'>" . LAN_FORUM_0054 . "</a> " . LAN_FORUM_0055;
}
if (USER == TRUE)
if(USER == true)
{
$total_new_threads = e107::getDb()->count('forum_thread', '(*)', "WHERE thread_datestamp>'".USERLV."' ");
$total_new_threads = defined('USERLV') ? e107::getDb()->count('forum_thread', '(*)', "WHERE thread_datestamp>'" . USERLV . "' ") : 0;
$total_read_threads = 0;
if (defset('USERVIEWED') != "")
if(defset('USERVIEWED') != "")
{
$tmp = explode(".", USERVIEWED); // List of numbers, separated by single period
$total_read_threads = count($tmp);
@ -232,8 +261,8 @@ class forum_shortcodes extends e_shortcode
*/
// $gen = new convert;
$text = LAN_FORUM_0018." ".USERNAME."<br />";
$lastvisit_datestamp = $this->gen->convert_date(USERLV, 'long'); //FIXME Use e107::getParser()->toDate();
$text = LAN_FORUM_0018 . " " . USERNAME . "<br />";
$lastvisit_datestamp = defined('USERLV') ? $this->gen->convert_date(USERLV, 'long') : '';
$datestamp = $this->gen->convert_date(time(), "long");
/*
@ -250,22 +279,22 @@ class forum_shortcodes extends e_shortcode
$text .= LAN_FORUM_0021." ".$total_new_threads." ".LAN_FORUM_0022." ";
}
*/
$text .= (!$total_new_threads?LAN_FORUM_0019." ":($total_new_threads == 1?LAN_FORUM_0020:LAN_FORUM_0021." ".$total_new_threads." ".LAN_FORUM_0022." ")).LAN_FORUM_0023;
$text .= (!$total_new_threads ? LAN_FORUM_0019 . " " : ($total_new_threads == 1 ? LAN_FORUM_0020 : LAN_FORUM_0021 . " " . $total_new_threads . " " . LAN_FORUM_0022 . " ")) . LAN_FORUM_0023;
// $text .= LAN_FORUM_0023;
// if ($total_new_threads == $total_read_threads && $total_new_threads != 0 && $total_read_threads >= $total_new_threads)
if ($total_new_threads != 0 && $total_read_threads >= $total_new_threads)
if($total_new_threads != 0 && $total_read_threads >= $total_new_threads)
{
$text .= LAN_FORUM_0029;
$allread = TRUE;
$allread = true;
}
elseif($total_read_threads != 0)
{
$text .= " (".LAN_FORUM_0027." ".$total_read_threads." ".LAN_FORUM_0028.")";
$text .= " (" . LAN_FORUM_0027 . " " . $total_read_threads . " " . LAN_FORUM_0028 . ")";
}
$text .= "<br />
".LAN_FORUM_0024." ".$lastvisit_datestamp."<br />
".LAN_FORUM_0025." ".$datestamp;
" . LAN_FORUM_0024 . " " . $lastvisit_datestamp . "<br />
" . LAN_FORUM_0025 . " " . $datestamp;
}
/*
else
@ -288,10 +317,7 @@ class forum_shortcodes extends e_shortcode
$text .= "<br /><a href='".e_SELF."?mark.all.as.read'>".LAN_FORUM_0057.'</a>'.(e_QUERY != 'new' ? ", <a href='".e_SELF."?new'>".LAN_FORUM_0058."</a>" : '');
}
$forum = new e107forum;
//$trackPref = $forum->prefs->get('track');
//if (USER && vartrue($trackPref) && e_QUERY != 'track')
if (USER && !empty($forum->prefs->get('track')) && e_QUERY != 'track')
if (USER && !empty($this->prefs['track']) && e_QUERY != 'track')
{
$text .= "<br /><a href='".e107::url('forum','track')."'>".LAN_FORUM_0030.'</a>';
}
@ -304,6 +330,10 @@ class forum_shortcodes extends e_shortcode
{
$sql = e107::getDb();
$users = 0;
$member_users = 0;
$guest_users = 0;
$total_topics = $sql->count("forum_thread", "(*)");
$total_replies = $sql->count("forum_post", "(*)");
$total_members = $sql->count("user");
@ -367,14 +397,14 @@ class forum_shortcodes extends e_shortcode
{
$url = $this->sc_lastpost(array('type'=>'url'));
return "<a href='".$url."'>".IMAGE_new.'</a>';
return "<a href='".$url."'>".defset('IMAGE_new').'</a>';
}
elseif(empty($this->var['forum_replies']) && defined('IMAGE_noreplies'))
{
return IMAGE_noreplies;
return defset('IMAGE_noreplies');
}
return IMAGE_nonew;
return defset('IMAGE_nonew');
}
@ -541,32 +571,25 @@ class forum_shortcodes extends e_shortcode
function sc_startertitle()
{
$author_name = ($this->var['user_name'] ? $this->var['user_name'] : $this->var['lastuser_anon']);
$author_name = (!empty($this->var['user_name']) ? $this->var['user_name'] : varset($this->var['lastuser_anon']));
//-- $datestamp = $gen->convert_date($thread['thread_lastpost'], 'forum');
$datestamp = $this->gen->convert_date($this->var['thread_lastpost'], 'forum');
$datestamp = !empty($this->var['thread_lastpost']) ? $this->gen->convert_date($this->var['thread_lastpost'], 'forum') : '';
if(!$this->var['user_name'])
if(!empty($this->var['user_name']))
{
return $author_name.'<br />'.$datestamp;
}
// return "<a href='".$e107->url->create('user/profile/view', array('id' => $thread['thread_lastuser'], 'name' => $sc->author_name))."'>{$sc->author_name}</a><br />".$sc->datestamp;
return "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['thread_lastuser'], 'name' => $author_name))."'>{$author_name}</a><br />".$datestamp;
return isset($this->var['thread_lastuser']) ? "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['thread_lastuser'], 'name' => $author_name))."'>{$author_name}</a><br />".$datestamp : '';
//---- }
}
function sc_newspostname()
{
// global $thread;
// $e107 = e107::getInstance();
// $tp = e107::getParser();
// return empty($thread)?LAN_FORUM_0029:"<a href='".$e107->url->create('forum/thread/last', $thread)."'>".$tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
// Only $this->var???'
return empty($this->var) ? LAN_FORUM_0029:"<a href='".e107::getUrl()->create('forum/thread/last', $this->var)."'>".e107::getParser()->toHTML($this->var['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
return empty($this->var) || empty($this->var['thread_name']) ? LAN_FORUM_0029 : "<a href='".e107::getUrl()->create('forum/thread/last', $this->var)."'>".e107::getParser()->toHTML($this->var['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
}
@ -578,7 +601,7 @@ class forum_shortcodes extends e_shortcode
return $frm->breadcrumb($breadarray);
}
function sc_avatar($opts)
function sc_avatar($opts=null)
{
return e107::getParser()->toAvatar(e107::user($this->var['forum_lastpost_user']),$opts);
}

View File

@ -8,9 +8,13 @@
if (!defined('e107_INIT')) { exit; }
e107::plugLan('forum', 'front', true);
class plugin_forum_post_shortcodes extends e_shortcode
{
protected $e107;
public $threadInfo = array();
//public $forum;
function __construct()
{
@ -18,15 +22,22 @@ class plugin_forum_post_shortcodes extends e_shortcode
$this->e107 = e107::getInstance();
}
function sc_latestposts($parm) //TODO move elsewhere?
function sc_latestposts($parm=null) //TODO move elsewhere?
{
$parm = ($parm ? $parm : 10);
$parm = !empty($parm) ? (int) $parm : 10;
global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST;
if(empty($LATESTPOSTS_POST))
{
return null;
}
$tp = e107::getParser();
$txt = $tp->parseTemplate($LATESTPOSTS_START, true);
$start = max($this->threadInfo['thread_total_replies'] - $parm, 0);
$num = min($this->threadInfo['thread_total_replies'], $parm);
$start = isset($this->threadInfo['thread_total_replies']) ? max($this->threadInfo['thread_total_replies'] - $parm, 0) : 0;
$num = isset($this->threadInfo['thread_total_replies']) ? min($this->threadInfo['thread_total_replies'], $parm) : 0;
$tmp = $this->forum->postGet($this->threadInfo['thread_id'], $start, $num);
@ -43,6 +54,12 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_threadtopic()
{
global $THREADTOPIC_REPLY;
if(empty($THREADTOPIC_REPLY))
{
return null;
}
$tmp = $this->forum->postGet($this->threadInfo['thread_id'], 0, 1);
e107::getScBatch('view', 'forum')->setScVar('postInfo', $tmp[0]);
return e107::getParser()->parseTemplate($THREADTOPIC_REPLY, true);
@ -56,11 +73,16 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_forum_post_form_end()
{
$frm = e107::getForm();
return $frm->hidden('action',$this->var['action']).$frm->close();
return $frm->hidden('action', varset($this->var['action'])).$frm->close();
}
function sc_forumjump()
{
if(!is_object($this->forum))
{
return null;
}
$jumpList = $this->forum->forumGetAllowed('view');
$text = "<form class='form-inline' method='post' action='".e_REQUEST_URI."'><div class='btn-group'><p>".LAN_FORUM_1017.": <select name='forumjump' class='tbox form-control'>";
foreach($jumpList as $key => $val)
@ -135,9 +157,9 @@ class plugin_forum_post_shortcodes extends e_shortcode
// {
// $_POST['subject'] = $this->varp;
// }
$value = varset($_POST['subject']);
$tp = e107::getParser();
return e107::getForm()->text('subject',$tp->post_toForm($_POST['subject']), 100, $opts);
return e107::getForm()->text('subject',$tp->post_toForm($value), 100, $opts);
// <input class='tbox form-control' type='text' name='subject' size='71' value='".vartrue($subject)."' maxlength='100' style='width:95%' />
@ -183,7 +205,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
$text = '';
}
$editor = $this->forum->prefs->get('editor');
$editor = is_object($this->forum) ? $this->forum->prefs->get('editor') : null;
//$wysiwyg = ($editor === 'bbcode') ? false : null;
$wysiwyg = is_null($editor) ? 'default' : $editor;
@ -230,7 +252,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
$uploadClass = e107::pref('core','upload_class');
if ($this->forum->prefs->get('attach') && (check_class($uploadClass) || getperms('0')))
if (is_object($this->forum) && $this->forum->prefs->get('attach') && (check_class($uploadClass) || getperms('0')))
{
if (is_writable(e_PLUGIN.'forum/attachments'))
{
@ -276,7 +298,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
";
//<input class='btn btn-default button' type='button' name='addoption' value=".LAN_FORUM_3020." />
if( $this->forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
if(is_object($this->forum) && $this->forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
{
return $fileattach;
}
@ -416,7 +438,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_postthreadas()
{
// Show when creating new topic or when editing the original starting post (make sure post is not a reply)
if (MODERATOR && $this->var['action'] == "nt" || $this->var['thread_datestamp'] == $this->var['post_datestamp'])
if (deftrue('MODERATOR') && $this->var['action'] == "nt" || varset($this->var['thread_datestamp']) == $this->var['post_datestamp'])
{
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : vartrue($this->var['thread_sticky'], 0)); // no reference of 'head' $threadInfo['head']['thread_sticky']
@ -441,6 +463,11 @@ class plugin_forum_post_shortcodes extends e_shortcode
$_tmp = array();
// no reference of 'head' $threadInfo['head']['thread_name']
$eaction = ($this->var['action'] == 'edit');
if(!is_object($this->forum))
{
return null;
}
$this->forum->set_crumb(true, ($this->var['action'] == 'nt' ? ($eaction ? LAN_FORUM_3023 : LAN_FORUM_1018) : ($eaction ? LAN_FORUM_3024 : $this->var['thread_name'])), $_tmp);
//---- return $_tmp->BREADCRUMB;
return $_tmp['breadcrumb'];
@ -451,6 +478,10 @@ class plugin_forum_post_shortcodes extends e_shortcode
$tp = e107::getParser();
$url = '';
$name = '';
$pre = '';
$post = '';
if($this->var['action'] == "rp")
{

View File

@ -601,9 +601,360 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
}
// -------------- Plugins ------------------------
public function testChatboxMenuShortcodes()
{
require_once(e_PLUGIN."chatbox_menu/chatbox_menu_shortcodes.php");
try
{
/** @var chatbox_menu_shortcodes $sc */
$sc = $this->make('chatbox_menu_shortcodes');
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
$vars = array(
'cb_id' => '11',
'cb_nick' => '1.admin',
'cb_message' => 'A new chatbox comment',
'cb_datestamp' => '1609613065',
'cb_blocked' => '0',
'cb_ip' => '0000:0000:0000:0000:0000:ffff:7f00:0001'
);
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
}
public function testCommentMenuShortcodes()
{
require_once(e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
try
{
/** @var comment_menu_shortcodes $sc */
$sc = $this->make('comment_menu_shortcodes');
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
$values = array(
'comment_id' => '84',
'comment_pid' => '82',
'comment_item_id' => '53',
'comment_subject' => 'Re: New Item',
'comment_author_id' => '1',
'comment_author_name' => 'admin',
'comment_author_email' => 'someone@gmail.com',
'comment_datestamp' => '1609767045',
'comment_comment' => 'Nested Comment here',
'comment_blocked' => '0',
'comment_ip' => '0000:0000:0000:0000:0000:ffff:7f00:0001',
'comment_type' => '0',
'comment_lock' => '0',
'comment_share' => '0',
'table' => 'news',
'action' => '',
'subject' => 'subject name',
'comval' => 'a comment',
'itemid' => 5,
'pid' => 3,
'eaction' => '',
'rate' => 2,
'user_id' => 1,
'user_join' => 1518441749,
'comment_type' => 'Type',
'comment_title' => "Title",
'comment_url' => e_HTTP."page.php?3",
'comment_author' => 'admin',
'comment_author_image' => '',
);
$sc->setVars($values);
$this->processShortcodeMethods($sc);
}
public function testDownloadShortcodes()
{
require_once(e_PLUGIN."download/download_shortcodes.php");
try
{
/** @var download_shortcodes $sc */
$sc = $this->make('download_shortcodes');
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
$vars = array(
'download_id' => '1',
'download_name' => 'MyFile v1',
'download_url' => '{e_MEDIA_FILE}2016-03/myfile.zip',
'download_sef' => 'italk-v1',
'download_author' => 'admin',
'download_author_email' => 'email@gmail.com',
'download_author_website' => 'https://somewhere.com',
'download_description' => 'description of my file',
'download_keywords' => 'keyword1,keyword2',
'download_filesize' => '654432',
'download_requested' => '4',
'download_category' => '2',
'download_active' => '1',
'download_datestamp' => '1560544675',
'download_thumb' => '',
'download_image' => '',
'download_comment' => '1',
'download_class' => '0',
'download_mirror' => '',
'download_mirror_type' => '0',
'download_visible' => '0',
'download_category_id' => '2',
'download_category_name' => 'My Category',
'download_category_description' => 'My Category Description',
'download_category_icon' => '',
'download_category_parent' => '0',
'download_category_class' => '0',
'download_category_order' => '1',
'download_category_sef' => 'my-category'
);
$sc->__construct();
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
}
public function testFaqsShortcodes()
{
require_once(e_PLUGIN."faqs/faqs_shortcodes.php");
try
{
/** @var faqs_shortcodes $sc */
$sc = $this->make('faqs_shortcodes');
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
$vars = array(
'faq_id' => '4',
'faq_parent' => '1',
'faq_question' => 'My Second Question which is quite long and might wrap to another line after that',
'faq_answer' => '[html]<p>My Second Answer</p>[/html]',
'faq_comment' => '0',
'faq_datestamp' => '1461263100',
'faq_author' => '1',
'faq_author_ip' => '',
'faq_tags' => '',
'faq_order' => '2',
'faq_info_id' => '2',
'faq_info_title' => 'Misc',
'faq_info_about' => 'Other FAQs',
'faq_info_parent' => '0',
'faq_info_class' => '0',
'faq_info_order' => '1',
'faq_info_icon' => '',
'faq_info_metad' => 'description',
'faq_info_metak' => 'keyword1,keyword2',
'faq_info_sef' => 'misc'
);
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
}
public function testForumShortcodes()
{
require_once(e_PLUGIN."forum/shortcodes/batch/forum_shortcodes.php");
try
{
/** @var forum_shortcodes $sc */
$sc = $this->make('forum_shortcodes');
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
$vars = array(
'forum_id' => '2',
'forum_name' => 'Parent Number Two',
'forum_description' => 'Forum Description',
'forum_parent' => '0',
'forum_sub' => '0',
'forum_datestamp' => '1367304545',
'forum_moderators' => '248',
'forum_threads' => '0',
'forum_replies' => '0',
'forum_lastpost_user' => '0',
'forum_lastpost_user_anon' => NULL,
'forum_lastpost_info' => '',
'forum_class' => '253',
'forum_order' => '300',
'forum_postclass' => '253',
'forum_threadclass' => '0',
'forum_options' => '',
'forum_sef' => 'parent-number-two',
'forum_image' => NULL,
'forum_icon' => NULL
);
$sc->__construct();
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
}
public function testForumPostShortcodes()
{
require_once(e_PLUGIN."forum/shortcodes/batch/post_shortcodes.php");
try
{
/** @var plugin_forum_post_shortcodes $sc */
$sc = $this->make('plugin_forum_post_shortcodes');
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
$vars = array(
'forum_id' => '2',
'forum_name' => 'Parent Number Two',
'forum_description' => 'Forum Description',
'forum_parent' => '0',
'forum_sub' => '0',
'forum_datestamp' => '1367304545',
'forum_moderators' => '248',
'forum_threads' => '0',
'forum_replies' => '0',
'forum_lastpost_user' => '0',
'forum_lastpost_user_anon' => NULL,
'forum_lastpost_info' => '',
'forum_class' => '253',
'forum_order' => '300',
'forum_postclass' => '253',
'forum_threadclass' => '0',
'forum_options' => '',
'forum_sef' => 'parent-number-two',
'forum_image' => NULL,
'forum_icon' => NULL,
'thread_id' => '1',
'thread_name' => '3 Duis tempus enim vitae magna placerat vel dapibus tellus feugiat.',
'thread_forum_id' => '4',
'thread_views' => '53',
'thread_active' => '1',
'thread_lastpost' => '1434584999',
'thread_sticky' => '0',
'thread_datestamp' => '1367307189',
'thread_user' => '2',
'thread_user_anon' => NULL,
'thread_lastuser' => '1',
'thread_lastuser_anon' => NULL,
'thread_total_replies' => '7',
'thread_options' => NULL,
'post_id' => '1',
'post_entry' => '4 Morbi eleifend auctor quam, ac consequat ipsum dictum vitae. Curabitur egestas lacinia mi, in venenatis mi euismod eu.',
'post_thread' => '1',
'post_forum' => '4',
'post_status' => '0',
'post_datestamp' => '1367307189',
'post_user' => '2',
'post_edit_datestamp' => NULL,
'post_edit_user' => NULL,
'post_ip' => NULL,
'post_user_anon' => NULL,
'post_attachments' => NULL,
'post_options' => NULL
);
$sc->__construct();
$sc->setVars($vars);
$this->processShortcodeMethods($sc);
}
/*
e107_plugins\faqs/
faqs_shortcodes.php (1 usage found)
1 <?php
e107_plugins\forum\shortcodes\batch (4 usages found)
forum_shortcodes.php (1 usage found)
1 <?php
post_shortcodes.php (1 usage found)
1 <?php
view_shortcodes.php (1 usage found)
1 <?php
viewforum_shortcodes.php (1 usage found)
1 <?php
e107_plugins\forum\todelete (2 usages found)
forum_post_shortcodes.php (1 usage found)
1 <?php
forum_shortcodes.php (1 usage found)
1 <?php
e107_plugins\gallery\shortcodes\batch (1 usage found)
gallery_shortcodes.php (1 usage found)
1 <?php
e107_plugins\hero (1 usage found)
hero_shortcodes.php (1 usage found)
1 <?php
e107_plugins\links_page (1 usage found)
links_page_shortcodes.php (1 usage found)
1 <?php
e107_plugins\list_new (1 usage found)
list_shortcodes.php (1 usage found)
1 <?php
e107_plugins\login_menu (1 usage found)
login_menu_shortcodes.php (1 usage found)
1 <?php
e107_plugins\online (1 usage found)
online_shortcodes.php (1 usage found)
1 <?php
e107_plugins\pm (1 usage found)
pm_shortcodes.php (1 usage found)
1 <?php
e107_plugins\rss_menu (1 usage found)
rss_shortcodes.php (1 usage found)
1 <?php
e107_plugins\signin (1 usage found)
signin_shortcodes.php (1 usage found)
1 <?php
*/
// ------------------------------------------------