mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 04:38:27 +01:00
Updated FAQs plugin to use the right shortcode methods.
This commit is contained in:
parent
01dcf2a822
commit
f2c7bad663
@ -275,7 +275,7 @@ class comment
|
||||
'rate' => $rating
|
||||
);
|
||||
|
||||
e107::getScBatch('comment')->setParserVars($data);
|
||||
e107::getScBatch('comment')->setVars($data);
|
||||
|
||||
e107::getScBatch('comment')->setMode('edit');
|
||||
|
||||
@ -395,7 +395,7 @@ class comment
|
||||
|
||||
$row['rating_enabled'] = true; // Toggles rating shortcode. //TODO add pref
|
||||
|
||||
e107::getScBatch('comment')->setParserVars($row);
|
||||
e107::getScBatch('comment')->setVars($row);
|
||||
|
||||
$COMMENT_TEMPLATE = $this->template;
|
||||
|
||||
|
@ -114,7 +114,7 @@ function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $help
|
||||
'size' => $helpsize
|
||||
);
|
||||
|
||||
$sc->setParserVars($data);
|
||||
$sc->setVars($data);
|
||||
|
||||
return "<div id='bbcode-panel-".$tagid."' class='mceToolbar bbcode-panel' {$visible}>".$tp->parseTemplate($BBCODE_TEMPLATE)."</div>";
|
||||
}
|
||||
|
@ -292,6 +292,12 @@ class e_parse_shortcode
|
||||
|
||||
$path = ($pluginName ? e_PLUGIN.$pluginName.'/shortcodes/batch/' : e_CORE.'shortcodes/batch/').$_class_fname.'.php';
|
||||
|
||||
$pathBC = e_PLUGIN.$pluginName.'/'.$_class_fname.'.php';
|
||||
|
||||
if(is_readable($pathBC)) // BC - required.
|
||||
{
|
||||
$path = $pathBC;
|
||||
}
|
||||
|
||||
if (is_readable($path))
|
||||
{
|
||||
@ -914,16 +920,20 @@ class e_shortcode
|
||||
|
||||
/**
|
||||
* Set external array data to be used in the batch
|
||||
* Use setVars() - preferred.
|
||||
*
|
||||
* @param array $eVars
|
||||
* @return e_shortcode
|
||||
*/
|
||||
public function setParserVars($eVars)
|
||||
public function setParserVars($eVars) //XXX will soon become private. Use setVars() instead.
|
||||
{
|
||||
$this->var = $eVars;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of setParserVars - Preferred use by Plugins.
|
||||
*/
|
||||
public function setVars($eVars) // Alias of setParserVars();
|
||||
{
|
||||
return $this->setParserVars($eVars);
|
||||
|
@ -179,15 +179,20 @@ class faq
|
||||
|
||||
global $FAQ_START, $FAQ_END, $FAQ_LISTALL_START,$FAQ_LISTALL_LOOP,$FAQ_LISTALL_END;
|
||||
|
||||
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
|
||||
//require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
|
||||
|
||||
$query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE cat.faq_info_class IN (".USERCLASS_LIST.") ORDER BY cat.faq_info_order,f.faq_order ";
|
||||
$sql->db_Select_gen($query);
|
||||
$text = $tp->parseTemplate($FAQ_START, true);
|
||||
$prevcat = "";
|
||||
$sc = e107::getScBatch('faqs',TRUE);
|
||||
|
||||
// var_dump($sc);
|
||||
|
||||
while ($rw = $sql->db_Fetch())
|
||||
{
|
||||
setScVar('faqs_shortcodes', 'row', $rw);
|
||||
// setScVar('faqs_shortcodes', 'row', $rw);
|
||||
$sc->setVars($rw);
|
||||
|
||||
if($rw['faq_info_order'] != $prevcat)
|
||||
{
|
||||
@ -222,20 +227,20 @@ class faq
|
||||
{
|
||||
global $ns,$row,$FAQ_LIST_START,$FAQ_LIST_LOOP,$FAQ_LIST_END;
|
||||
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
$sc = e107::getScBatch('faqs',TRUE);
|
||||
|
||||
$query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE f.faq_parent = '$id' ";
|
||||
$sql->db_Select_gen($query);
|
||||
|
||||
setScVar('faqs_shortcodes', 'row', $row);
|
||||
$sc->setVars($row);
|
||||
|
||||
$text = $tp->parseTemplate($FAQ_LIST_START, true);
|
||||
|
||||
while ($rw = $sql->db_Fetch())
|
||||
{
|
||||
setScVar('faqs_shortcodes', 'row', $rw);
|
||||
// setScVar('faqs_shortcodes', 'var', $rw);
|
||||
$sc->setVars($rw);
|
||||
$text .= $tp->parseTemplate($FAQ_LIST_LOOP, true);
|
||||
$caption = " Category: <b>".$rw['faq_info_title']."</b>";
|
||||
|
||||
@ -258,7 +263,8 @@ class faq
|
||||
// ##### Display scrolling list of existing FAQ items ---------------------------------------------------------------------------------------------------------
|
||||
global $FAQ_CAT_START,$FAQ_CAT_PARENT,$FAQ_CAT_CHILD,$FAQ_CAT_END;
|
||||
|
||||
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
|
||||
// require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
|
||||
$sc = e107::getScBatch('faqs',TRUE);
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<div style='text-align:center'>";
|
||||
@ -278,8 +284,8 @@ class faq
|
||||
$sql->db_Select_gen($qry);
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
|
||||
setScVar('faqs_shortcodes', 'row', $row);
|
||||
$sc->setVars($row);
|
||||
// setScVar('faqs_shortcodes', 'row', $row);
|
||||
|
||||
if ($row['faq_info_parent'] == '0') //
|
||||
{
|
||||
@ -313,11 +319,14 @@ class faq
|
||||
{
|
||||
global $ns,$row,$sql,$aj,$pref,$cobj,$id,$tp,$FAQ_VIEW_TEMPLATE;
|
||||
|
||||
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
|
||||
//require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
|
||||
|
||||
$sc = e107::getScBatch('faqs',TRUE);
|
||||
|
||||
$sql->db_Select("faqs", "*", "faq_id='$idx' LIMIT 1");
|
||||
$row = $sql->db_Fetch();
|
||||
setScVar('faqs_shortcodes', 'row', $row);
|
||||
|
||||
$sc->setVars($row);
|
||||
|
||||
$caption = " FAQ #".$row['faq_id'];
|
||||
$text = $tp->parseTemplate($FAQ_VIEW_TEMPLATE, true);
|
||||
|
@ -17,12 +17,12 @@
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
register_shortcode('faqs_shortcodes', true);
|
||||
initShortcodeClass('faqs_shortcodes');
|
||||
// register_shortcode('faqs_shortcodes', true);
|
||||
// initShortcodeClass('faqs_shortcodes');
|
||||
|
||||
class faqs_shortcodes
|
||||
class faqs_shortcodes extends e_shortcode
|
||||
{
|
||||
var $row;
|
||||
// var $var;
|
||||
|
||||
function sc_faq_question($parm='')
|
||||
{
|
||||
@ -30,13 +30,13 @@ class faqs_shortcodes
|
||||
|
||||
if($parm == 'expand')
|
||||
{
|
||||
$id = "faq_".$this->row['faq_id'];
|
||||
$text = "<a class='e-expandit faq-question' href='#{$id}'>".$tp->toHtml($this->row['faq_question'])."</a>
|
||||
<div id='{$id}' class='e-hideme faq-answer faq_answer'>".$tp->toHTML($this->row['faq_answer'],TRUE)."</div>";
|
||||
$id = "faq_".$this->var['faq_id'];
|
||||
$text = "<a class='e-expandit faq-question' href='#{$id}'>".$tp->toHtml($this->var['faq_question'])."</a>
|
||||
<div id='{$id}' class='e-hideme faq-answer faq_answer'>".$tp->toHTML($this->var['faq_answer'],TRUE)."</div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $tp->toHtml($this->row['faq_question']);
|
||||
$text = $tp->toHtml($this->var['faq_question']);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
@ -44,47 +44,47 @@ class faqs_shortcodes
|
||||
function sc_faq_question_link($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return "<a class='faq-question' href='faqs.php?cat.".$this->row['faq_info_id'].".".$this->row['faq_id']."' >".$tp -> toHtml($this->row['faq_question'])."</a>";
|
||||
return "<a class='faq-question' href='faqs.php?cat.".$this->var['faq_info_id'].".".$this->var['faq_id']."' >".$tp -> toHtml($this->var['faq_question'])."</a>";
|
||||
}
|
||||
|
||||
function sc_faq_answer()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return "<div class='faq-answer'>".$tp -> toHtml($this->row['faq_answer'])."</div>";
|
||||
return "<div class='faq-answer'>".$tp -> toHtml($this->var['faq_answer'])."</div>";
|
||||
}
|
||||
|
||||
function sc_faq_edit()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$faqpref = e107::getPlugConfig('faqs')->getPref();
|
||||
if(($faqpref['add_faq'] && $this->row['faq_author'] == USERID) || ADMIN )
|
||||
if(($faqpref['add_faq'] && $this->var['faq_author'] == USERID) || ADMIN )
|
||||
{
|
||||
return "[ <a href='faqs.php?edit.".$this->row['faq_parent'].".".$this->row['faq_id']."'>Edit</a> ]";
|
||||
return "[ <a href='faqs.php?edit.".$this->var['faq_parent'].".".$this->var['faq_id']."'>Edit</a> ]";
|
||||
}
|
||||
}
|
||||
|
||||
function sc_faq_category()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return "<a href='".e_SELF."?cat.".$this->row['faq_info_id']."'>".$tp->toHtml($this->row['faq_info_title'])."</a>";
|
||||
return "<a href='".e_SELF."?cat.".$this->var['faq_info_id']."'>".$tp->toHtml($this->var['faq_info_title'])."</a>";
|
||||
}
|
||||
|
||||
function sc_faq_catlink()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return "<a href='".e_SELF."?cat.".$this->row['faq_info_id']."'>".($this->row['faq_info_title'] ? $tp -> toHtml($this->row['faq_info_title']) : "[".NWSLAN_42."]")."</a>";
|
||||
return "<a href='".e_SELF."?cat.".$this->var['faq_info_id']."'>".($this->var['faq_info_title'] ? $tp -> toHtml($this->var['faq_info_title']) : "[".NWSLAN_42."]")."</a>";
|
||||
}
|
||||
|
||||
function sc_faq_count()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return $this->row['f_count'];
|
||||
return $this->var['f_count'];
|
||||
}
|
||||
|
||||
function sc_faq_cat_diz()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return $tp->toHtml($this->row['faq_info_about'])." ";
|
||||
return $tp->toHtml($this->var['faq_info_about'])." ";
|
||||
}
|
||||
|
||||
function sc_faq_icon()
|
||||
|
@ -85,7 +85,7 @@ if(!defined("USER_WIDTH"))
|
||||
<table class='fborder' style='margin-left:auto;margin-right:auto;padding:0px;".USER_WIDTH.";' >
|
||||
<tr>
|
||||
<td class='forumheader3' style='vertical-align:top;width:30px'>
|
||||
<img src='".e_PLUGIN."faq/images/q.png' alt='' />
|
||||
<img src='".e_PLUGIN_ABS."faqs/images/q.png' alt='' />
|
||||
</td>
|
||||
<td class='forumheader3' style='vertical-align:top'>
|
||||
{FAQ_QUESTION}
|
||||
@ -94,7 +94,7 @@ if(!defined("USER_WIDTH"))
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:30px;vertical-align:top'>
|
||||
<img src='".e_PLUGIN."faq/images/a.png' alt='' />
|
||||
<img src='".e_PLUGIN_ABS."faqs/images/a.png' alt='' />
|
||||
</td>
|
||||
<td class='forumheader3'>
|
||||
<div class='faq_answer'>{FAQ_ANSWER}</div>
|
||||
|
@ -86,7 +86,7 @@ class plugin_gallery_index_controller extends eControllerFront
|
||||
$text = "";
|
||||
foreach($this->catList as $val)
|
||||
{
|
||||
$sc->setParserVars($val);
|
||||
$sc->setVars($val);
|
||||
$text .= e107::getParser()->parseTemplate($template['CAT_ITEM'],TRUE);
|
||||
}
|
||||
$text = $template['CAT_START'].$text.$template['CAT_END'];
|
||||
|
8
page.php
8
page.php
@ -207,7 +207,7 @@ class pageClass
|
||||
$ret['cachecontrol'] = false;
|
||||
$this->authorized = 'nf';
|
||||
$this->template = e107::getCoreTemplate('page', 'default');
|
||||
$this->batch = e107::getScBatch('page')->setParserVars(new e_vars($ret))->setScVar('page', array());
|
||||
$this->batch = e107::getScBatch('page')->setVars(new e_vars($ret))->setScVar('page', array());
|
||||
|
||||
define("e_PAGETITLE", $ret['title']);
|
||||
return;
|
||||
@ -248,7 +248,7 @@ class pageClass
|
||||
$ret['err'] = FALSE;
|
||||
$ret['cachecontrol'] = (isset($this->page['page_password']) && !$this->page['page_password'] && $this->authorized === true); // Don't cache password protected pages
|
||||
|
||||
$this->batch->setParserVars(new e_vars($ret))->setScVar('page', $this->page);
|
||||
$this->batch->setVars(new e_vars($ret))->setScVar('page', $this->page);
|
||||
|
||||
define('e_PAGETITLE', eHelper::formatMetaTitle($ret['title']));
|
||||
define('META_DESCRIPTION', $this->page['page_metadscr']);
|
||||
@ -286,7 +286,7 @@ class pageClass
|
||||
if($this->cacheData['COMMENT_FLAG'])
|
||||
{
|
||||
$vars = new e_vars(array('comments' => $this->pageComment(true)));
|
||||
$comments = e107::getScBatch('page')->setParserVars($vars)->cpagecomments();
|
||||
$comments = e107::getScBatch('page')->setVars($vars)->cpagecomments();
|
||||
}
|
||||
define('e_PAGETITLE', eHelper::formatMetaTitle($this->cacheData['TITLE']));
|
||||
define('META_DESCRIPTION', $this->cacheData['META_DSCR']);
|
||||
@ -326,7 +326,7 @@ class pageClass
|
||||
$vars = $this->batch->getParserVars();
|
||||
|
||||
// reset batch data
|
||||
$this->batch->setParserVars(null)->setScVar('page', array());
|
||||
$this->batch->setVars(null)->setScVar('page', array());
|
||||
|
||||
// copy some data
|
||||
$extend->title = $vars->title;
|
||||
|
@ -697,7 +697,7 @@ if (e_QUERY == "update")
|
||||
$text .= "<div class='fborder' style='text-align:center'><br />".str_replace("*", "<span class='required'>*</span>", LAN_USET_9)."<br />".LAN_USET_10."<br /><br /></div>";
|
||||
}
|
||||
|
||||
// $sc->setParserVars($val);
|
||||
|
||||
e107::getScBatch('usersettings')->setVars($curVal);
|
||||
$text .= $tp->parseTemplate($USERSETTINGS_EDIT, TRUE, $usersettings_shortcodes);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user