mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Shortcode tests for list_new, pm, rss_menu, signin and simpleParse()
This commit is contained in:
@@ -159,10 +159,9 @@ class rss_ui extends e_admin_ui
|
||||
global $i,$rss_shortcodes, $feed, $pref;
|
||||
|
||||
require_once(e_PLUGIN.'rss_menu/rss_shortcodes.php');
|
||||
$rss_shortcodes = e107::getScBatch('rss_menu', true);
|
||||
|
||||
if(!isset($RSS_ADMIN_IMPORT_HEADER))
|
||||
{
|
||||
$RSS_ADMIN_IMPORT_HEADER = "
|
||||
$RSS_ADMIN_IMPORT_HEADER = "
|
||||
<form action='".e_SELF."' id='imlistform' method='post' >
|
||||
<table class='table table-striped adminlist'>
|
||||
<thead>
|
||||
@@ -175,10 +174,8 @@ class rss_ui extends e_admin_ui
|
||||
<th>".RSS_LAN_ADMIN_12."</td>
|
||||
</tr>
|
||||
</thead><tbody>";
|
||||
}
|
||||
if(!isset($RSS_ADMIN_IMPORT_TABLE))
|
||||
{
|
||||
$RSS_ADMIN_IMPORT_TABLE = "
|
||||
|
||||
$RSS_ADMIN_IMPORT_TABLE = "
|
||||
<tr>
|
||||
<td class='first center'>{RSS_ADMIN_IMPORT_CHECK}</td>
|
||||
<td>{RSS_ADMIN_IMPORT_NAME} - {RSS_ADMIN_IMPORT_TEXT}</td>
|
||||
@@ -187,85 +184,22 @@ class rss_ui extends e_admin_ui
|
||||
<td>{RSS_ADMIN_IMPORT_URL}</td>
|
||||
<td>{RSS_ADMIN_IMPORT_TOPICID}</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
if(!isset($RSS_ADMIN_IMPORT_FOOTER))
|
||||
{
|
||||
$RSS_ADMIN_IMPORT_FOOTER = "</tbody>
|
||||
|
||||
$RSS_ADMIN_IMPORT_FOOTER = "</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
".$frm->admin_button('import_rss',LAN_ADD,'submit')."
|
||||
</div>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// global $RSS_ADMIN_IMPORT_HEADER, $RSS_ADMIN_IMPORT_TABLE, $RSS_ADMIN_IMPORT_FOOTER;
|
||||
|
||||
$sqli = new db;
|
||||
$feedlist = array();
|
||||
|
||||
// @see e107_plugins/news/e_rss.php
|
||||
/*
|
||||
// News
|
||||
$feed['name'] = ADLAN_0;
|
||||
$feed['url'] = 'news'; // The identifier for the rss feed url
|
||||
$feed['topic_id'] = ''; // The topic_id, empty on default (to select a certain category)
|
||||
$feed['path'] = 'news'; // This is the plugin path location
|
||||
$feed['text'] = RSS_PLUGIN_LAN_7;
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
|
||||
// News categories
|
||||
if($sqli ->select("news_category", "*","category_id!='' ORDER BY category_name "))
|
||||
{
|
||||
while($rowi = $sqli ->fetch())
|
||||
{
|
||||
$feed['name'] = ADLAN_0.' > '.$rowi['category_name'];
|
||||
$feed['url'] = 'news';
|
||||
$feed['topic_id'] = $rowi['category_id'];
|
||||
$feed['path'] = 'news';
|
||||
$feed['text'] = RSS_PLUGIN_LAN_10.' '.$rowi['category_name'];
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
// $feed['exclude_class'] = '';
|
||||
$feedlist[] = $feed;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* // Download
|
||||
$feed['name'] = ADLAN_24;
|
||||
$feed['url'] = 'download';
|
||||
$feed['topic_id'] = '';
|
||||
$feed['path'] = 'download';
|
||||
$feed['text'] = RSS_PLUGIN_LAN_8;
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
|
||||
// Download categories
|
||||
if($sqli ->select("download_category", "*","download_category_id!='' ORDER BY download_category_order "))
|
||||
{
|
||||
while($rowi = $sqli ->fetch())
|
||||
{
|
||||
$feed['name'] = ADLAN_24.' > '.$rowi['download_category_name'];
|
||||
$feed['url'] = 'download';
|
||||
$feed['topic_id'] = $rowi['download_category_id'];
|
||||
$feed['path'] = 'download';
|
||||
$feed['text'] = RSS_PLUGIN_LAN_11.' '.$rowi['download_category_name'];
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// Comments
|
||||
$feed['name'] = LAN_COMMENTS;
|
||||
$feed['url'] = 'comments';
|
||||
@@ -318,10 +252,12 @@ class rss_ui extends e_admin_ui
|
||||
if(!$sql->select("rss", "*", "rss_path='".$feed['path']."' AND rss_url='".$feed['url']."' AND rss_topicid='".$feed['topic_id']."' "))
|
||||
{
|
||||
$render = TRUE;
|
||||
$rss_shortcodes->setVars($feed);
|
||||
$text .= $tp -> parseTemplate($RSS_ADMIN_IMPORT_TABLE, FALSE, $rss_shortcodes);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$text .= $tp -> parseTemplate($RSS_ADMIN_IMPORT_FOOTER, FALSE, $rss_shortcodes);
|
||||
|
||||
if(!$render)
|
||||
@@ -330,7 +266,6 @@ class rss_ui extends e_admin_ui
|
||||
}
|
||||
else
|
||||
{
|
||||
// $ns->tablerender(RSS_LAN_ADMIN_11, $mes->render(). $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
@@ -112,14 +112,15 @@ if (empty($rss_type))
|
||||
}
|
||||
}
|
||||
|
||||
$text = $tp->parseTemplate($RSS_LIST_HEADER);
|
||||
$text = $tp->parseTemplate($RSS_LIST_HEADER, true);
|
||||
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$sc->setVars($row);
|
||||
$text .= $tp->parseTemplate($RSS_LIST_TABLE, false, $sc);
|
||||
}
|
||||
|
||||
$text .= $tp->parseTemplate($RSS_LIST_FOOTER);
|
||||
$text .= $tp->parseTemplate($RSS_LIST_FOOTER, true);
|
||||
|
||||
$ns->tablerender(RSS_MENU_L2, $text);
|
||||
}
|
||||
|
@@ -11,279 +11,108 @@
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
include_once(e_HANDLER.'shortcode_handler.php');
|
||||
// $rss_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
|
||||
|
||||
|
||||
|
||||
class rss_menu_shortcodes extends e_shortcode
|
||||
{
|
||||
private $tp;
|
||||
|
||||
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->tp = e107::getParser();
|
||||
}
|
||||
|
||||
function sc_rss_feed()
|
||||
{
|
||||
global $row, $tp;
|
||||
// $url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
$url2 = e107::url('rss_menu','rss', $row);
|
||||
return "<a href='".$url2."'>".$tp->toHTML($row['rss_name'], TRUE)."</a>";
|
||||
$url2 = e107::url('rss_menu','rss', $this->var);
|
||||
return "<a href='".$url2."'>".$this->tp->toHTML($this->var['rss_name'], TRUE)."</a>";
|
||||
}
|
||||
|
||||
function sc_rss_icon()
|
||||
{
|
||||
global $row, $tp;
|
||||
// $url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
$url2 = e107::url('rss_menu','rss', $row);
|
||||
return "<a href='".$url2."'>".RSS_ICON."</a>";
|
||||
$url2 = e107::url('rss_menu','rss', $this->var);
|
||||
return "<a href='".$url2."'>".defset('RSS_ICON')."</a>";
|
||||
}
|
||||
|
||||
function sc_rss_text()
|
||||
{
|
||||
global $row, $tp;
|
||||
return $tp->toHTML($row['rss_text'], TRUE, "defs");
|
||||
return $this->tp->toHTML($this->var['rss_text'], TRUE, "defs");
|
||||
}
|
||||
|
||||
function sc_rss_types()
|
||||
{
|
||||
global $row, $tp;
|
||||
// $url1 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
// $url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
// $url3 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
// $url4 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
|
||||
$url2 = e107::url('rss_menu','rss', $row);
|
||||
$url4 = e107::url('rss_menu','atom', $row);
|
||||
|
||||
$url2 = e107::url('rss_menu','rss', $this->var);
|
||||
$url4 = e107::url('rss_menu','atom', $this->var);
|
||||
|
||||
if(deftrue('BOOTSTRAP')) // v2.x
|
||||
{
|
||||
$text = "
|
||||
<div>
|
||||
<a class='btn btn-sm btn-default' href='".e107::url('rss_menu', 'rss', $row)."' title='RSS 2.0'>".$tp->toGlyph('fa-rss')." RSS</a>
|
||||
<a class='btn btn-sm btn-default' href='".e107::url('rss_menu', 'atom', $row)."' title='ATOM'>".$tp->toGlyph('fa-rss')." Atom</a>
|
||||
<a class='btn btn-sm btn-default' href='".$url2."' title='RSS 2.0'>".$this->tp->toGlyph('fa-rss')." RSS</a>
|
||||
<a class='btn btn-sm btn-default' href='".$url4."' title='ATOM'>".$this->tp->toGlyph('fa-rss')." Atom</a>
|
||||
</div>";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$text = "";
|
||||
// $text .= "<a href='".$url1."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss1.png' class='icon' alt='RSS 0.92' /></a>";
|
||||
$text .= "<a href='".$url2."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss2.png' class='icon' alt='RSS 2.0' /></a>";
|
||||
// $text .= "<a href='".$url3."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss3.png' class='icon' alt='RDF' /></a>";
|
||||
$text .= "<a href='".$url4."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss4.png' class='icon' alt='ATOM' /></a>";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//##### ADMIN --------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function sc_rss_admin_caption($parm='')
|
||||
{
|
||||
global $sort;
|
||||
list($field,$txt) = explode(",",$parm);
|
||||
$txt = constant($txt);
|
||||
return "<a href='".e_SELF."?list.{$field}.".($sort == "desc" ? "asc" : "desc")."'>".$txt."</a>\n";
|
||||
}
|
||||
|
||||
function sc_rss_admin_id()
|
||||
{
|
||||
global $row;
|
||||
return $row['rss_id'];
|
||||
}
|
||||
|
||||
function sc_rss_admin_name()
|
||||
{
|
||||
global $row;
|
||||
return $row['rss_name'];
|
||||
}
|
||||
|
||||
function sc_rss_admin_path()
|
||||
{
|
||||
global $row;
|
||||
return $row['rss_path'];
|
||||
}
|
||||
|
||||
function sc_rss_admin_url()
|
||||
{
|
||||
global $row;
|
||||
return "<a href='".e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$row['rss_url']."'>".$row['rss_url']."</a>";
|
||||
}
|
||||
|
||||
function sc_rss_admin_topicid()
|
||||
{
|
||||
global $row;
|
||||
return $row['rss_topicid'];
|
||||
}
|
||||
|
||||
function sc_rss_admin_limit()
|
||||
{
|
||||
global $row, $rs;
|
||||
$id = $row['rss_id'];
|
||||
$frm = e107::getForm();
|
||||
return $frm->number("limit[$id]",$row['rss_limit']);
|
||||
return "<input class='tbox' type='text' name=\"limit[$id]\" title=\"".RSS_LAN05."\" value='".intval($row['rss_limit'])."' size='3' maxlength='3' />";
|
||||
}
|
||||
|
||||
function sc_rss_admin_limitbutton()
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
return $frm->admin_button('update_limit',LAN_UPDATE,'update');
|
||||
}
|
||||
|
||||
function sc_rss_admin_options()
|
||||
{
|
||||
global $row, $tp;
|
||||
$delname = $row['rss_name'];
|
||||
$delid = $row['rss_id'];
|
||||
$options = "
|
||||
<a href='".e_SELF."?create.edit.".$row['rss_id']."' >".ADMIN_EDIT_ICON."</a>
|
||||
<input type='image' title=\"".LAN_DELETE."\" name='delete[{$delid}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL ." [".LAN_ID.": ".$delid." : ".$delname."]\\n\\n")."')\"/>";
|
||||
return $options;
|
||||
}
|
||||
|
||||
function sc_rss_admin_form_name()
|
||||
{
|
||||
global $row;
|
||||
return "<input class='tbox' type='text' name='rss_name' size='74' value=\"".$row['rss_name']."\" />\n";
|
||||
}
|
||||
|
||||
function sc_rss_admin_form_url()
|
||||
{
|
||||
global $row,$PLUGINS_DIRECTORY;
|
||||
return SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".e_LANQRY." <input class='tbox' type='text' name='rss_url' size='10' value=\"".$row['rss_url']."\" maxlength='50' /> .{".LAN_TYPE."}.{".RSS_LAN_ADMIN_12."}";
|
||||
}
|
||||
|
||||
function sc_rss_admin_form_topicid()
|
||||
{
|
||||
global $row;
|
||||
return "<input class='tbox' type='text' name='rss_topicid' size='74' value=\"".$row['rss_topicid']."\" maxlength='250' />";
|
||||
}
|
||||
|
||||
function sc_rss_admin_form_path()
|
||||
{
|
||||
global $row;
|
||||
return "<input class='tbox' type='text' name='rss_path' size='74' value=\"".$row['rss_path']."\" maxlength='250' />";
|
||||
}
|
||||
|
||||
function sc_rss_admin_form_text()
|
||||
{
|
||||
global $row;
|
||||
return "<textarea class='tbox' name='rss_text' cols='74' rows='5' >".$row['rss_text']."</textarea>\n";
|
||||
}
|
||||
|
||||
function sc_rss_admin_form_class()
|
||||
{
|
||||
global $row;
|
||||
$vals = array(RSS_LAN_ADMIN_21,RSS_LAN_ADMIN_22,RSS_LAN_ADMIN_23);
|
||||
$text = "<select class='tbox' name='rss_class'>";
|
||||
foreach($vals as $key=>$val)
|
||||
{
|
||||
$sel = ($row['rss_class'] == $key) ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$key}'{$sel}>$val</option>\n";
|
||||
}
|
||||
$text .= "</select>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_rss_admin_form_limit()
|
||||
{
|
||||
global $row;
|
||||
$frm = e107::getForm();
|
||||
|
||||
return $frm->number('rss_limit',$row['rss_limit'],3);
|
||||
return "<input class='tbox' name='rss_limit' size='3' title=\"".RSS_LAN05."\" value='".intval($row['rss_limit'])."' maxlength='3' />";
|
||||
}
|
||||
|
||||
|
||||
function sc_rss_admin_form_createbutton()
|
||||
{
|
||||
global $row;
|
||||
$qs = explode(".", e_QUERY);
|
||||
$frm = e107::getForm();
|
||||
|
||||
if(isset($qs[1]) && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) )
|
||||
{
|
||||
$text = "<input type='hidden' name='rss_datestamp' value='".$row['rss_datestamp']."' />
|
||||
<input type='hidden' name='rss_id' value='".$row['rss_id']."' />";
|
||||
|
||||
$text .= $frm->admin_button('update_rss',LAN_UPDATE,'update');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $frm->admin_button('create_rss',LAN_CREATE,'submit');
|
||||
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_rss_admin_import_check()
|
||||
{
|
||||
global $feed, $rs, $tp, $i;
|
||||
if($feed['description'])
|
||||
global $rs, $i;
|
||||
if(!empty($this->var['description']))
|
||||
{
|
||||
$feed['text'] = $feed['description'];
|
||||
$this->var['text'] = $this->var['description'];
|
||||
}
|
||||
|
||||
$text = "<input id='import-".$i."' type='checkbox' name='importid[$i]' value='1' />";
|
||||
$text .= "<input type='hidden' name='name[$i]' value='".$tp->toForm($feed['name'])."' />";
|
||||
$text .= "<input type='hidden' name='url[$i]' value='".$tp->toForm($feed['url'])."' />";
|
||||
$text .= "<input type='hidden' name='topic_id[$i]' value='".$tp->toForm($feed['topic_id'])."' />";
|
||||
$text .= "<input type='hidden' name='path[$i]' value='".$tp->toForm($feed['path'])."' />";
|
||||
$text .= "<input type='hidden' name='text[$i]' value='".$tp->toForm($feed['text'])."' />";
|
||||
$text .= "<input type='hidden' name='class[$i]' value='".$tp->toForm($feed['class'])."' />";
|
||||
$text .= "<input type='hidden' name='limit[$i]' value='".intval($feed['limit'])."' />";
|
||||
$text .= "<input type='hidden' name='name[$i]' value='".$this->tp->toForm($this->var['name'])."' />";
|
||||
$text .= "<input type='hidden' name='url[$i]' value='".$this->tp->toForm($this->var['url'])."' />";
|
||||
$text .= "<input type='hidden' name='topic_id[$i]' value='".$this->tp->toForm($this->var['topic_id'])."' />";
|
||||
$text .= "<input type='hidden' name='path[$i]' value='".$this->tp->toForm($this->var['path'])."' />";
|
||||
$text .= "<input type='hidden' name='text[$i]' value='".$this->tp->toForm($this->var['text'])."' />";
|
||||
$text .= "<input type='hidden' name='class[$i]' value='".$this->tp->toForm($this->var['class'])."' />";
|
||||
$text .= "<input type='hidden' name='limit[$i]' value='".intval($this->var['limit'])."' />";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_rss_admin_import_path()
|
||||
{
|
||||
global $feed, $i;
|
||||
return "<label for='import-".$i."'>".$feed['path']."</label>";
|
||||
global $i;
|
||||
return "<label for='import-".$i."'>".$this->var['path']."</label>";
|
||||
}
|
||||
|
||||
function sc_rss_admin_import_name()
|
||||
{
|
||||
global $feed, $i;
|
||||
return "<label for='import-".$i."'>".$feed['name']."</label>";
|
||||
global $i;
|
||||
return "<label for='import-".$i."'>".$this->var['name']."</label>";
|
||||
}
|
||||
|
||||
function sc_rss_admin_import_text()
|
||||
{
|
||||
global $feed;
|
||||
return ($feed['description']) ? $feed['description'] : $feed['text'];
|
||||
return !empty($this->var['description']) ? $this->var['description'] : $this->var['text'];
|
||||
}
|
||||
|
||||
function sc_rss_admin_import_url()
|
||||
{
|
||||
global $feed;
|
||||
return $feed['url'];
|
||||
return $this->var['url'];
|
||||
}
|
||||
|
||||
function sc_rss_admin_import_topicid()
|
||||
{
|
||||
global $feed;
|
||||
return $feed['topic_id'];
|
||||
return $this->var['topic_id'];
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user