1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 23:26:41 +02:00

Bugtracker #5230 - add profanity filter to list_new

This commit is contained in:
e107steved
2011-05-28 11:17:03 +00:00
parent 868696d0e9
commit e8de8930be
2 changed files with 37 additions and 8 deletions

View File

@@ -36,6 +36,7 @@ class listclass
var $content_name; var $content_name;
var $list_pref; var $list_pref;
var $mode; var $mode;
var $shortcodes = FALSE;
/** /**
* constructor * constructor
@@ -67,7 +68,9 @@ class listclass
//shortcodes //shortcodes
require_once($this->plugin_dir."list_shortcodes.php"); require_once($this->plugin_dir."list_shortcodes.php");
$this->shortcodes = $list_shortcodes; // $this->shortcodes = $list_shortcodes;
$this->shortcodes = new list_shortcodes();
$this->shortcodes->rc = $this;
if($mode=='admin') if($mode=='admin')
{ {
@@ -89,7 +92,7 @@ class listclass
function parseTemplate($template) function parseTemplate($template)
{ {
//for each call to the template, provide the correct data set through load_globals //for each call to the template, provide the correct data set through load_globals
list_shortcodes::load_globals(); //list_shortcodes::load_globals();
return $this->e107->tp->parseTemplate($this->template[$template], true, $this->shortcodes); return $this->e107->tp->parseTemplate($this->template[$template], true, $this->shortcodes);
} }
@@ -416,6 +419,8 @@ class listclass
//load e_list file //load e_list file
$this->data = $this->load_elist(); $this->data = $this->load_elist();
//$this->shortcodes->rc->data = $this->data;
//set record variables //set record variables
$this->row = array(); $this->row = array();
$this->row['caption'] = ''; $this->row['caption'] = '';
@@ -467,6 +472,7 @@ class listclass
{ {
foreach($this->data['records'] as $this->row) foreach($this->data['records'] as $this->row)
{ {
$this->shortcodes->row = $this->row;
//echo "parse: ".$area."<br />"; //echo "parse: ".$area."<br />";
$text .= $this->parseTemplate($area); $text .= $this->parseTemplate($area);
} }
@@ -475,7 +481,8 @@ class listclass
{ {
if($this->list_pref[$this->mode."_showempty"]) if($this->list_pref[$this->mode."_showempty"])
{ {
$this->row['heading'] = $this->data['records']; // $this->row['heading'] = $this->data['records'];
$this->shortcodes->row['heading'] = $this->data['records'];
//echo "parse: ".$area."<br />"; //echo "parse: ".$area."<br />";
$text .= $this->parseTemplate($area); $text .= $this->parseTemplate($area);
} }
@@ -561,6 +568,22 @@ class listclass
else else
{ {
$listArray = $class->getListData(); $listArray = $class->getListData();
if (e107::getPref('profanity_filter'))
{
$parser = e107::getParser();
if (!is_object($parser->e_pf))
{
require_once(e_HANDLER.'profanity_filter.php');
$parser->e_pf = new e_profanityFilter;
}
foreach ($listArray as $k => $v)
{
if (isset($v['heading']))
{
$listArray[$k]['heading'] = $parser->e_pf->filterProfanities($v['heading']);
}
}
}
} }
} }
return $listArray; return $listArray;
@@ -749,6 +772,7 @@ class listclass
if(!isset($this->list_pref)) if(!isset($this->list_pref))
{ {
$this->list_pref = $this->getListPrefs(); $this->list_pref = $this->getListPrefs();
$this->shortcodes->list_pref = $this->list_pref;
} }
//get sections //get sections
@@ -806,12 +830,14 @@ class listclass
if(!isset($this->list_pref)) if(!isset($this->list_pref))
{ {
$this->list_pref = $this->getListPrefs(); $this->list_pref = $this->getListPrefs();
$this->shortcodes->list_pref = $this->list_pref;
} }
//get sections //get sections
$this->sections = $this->prepareSection($this->mode); $this->sections = $this->prepareSection($this->mode);
$arr = $this->prepareSectionArray($this->mode); $arr = $this->prepareSectionArray($this->mode);
//display the sections //display the sections
$text = ''; $text = '';
foreach($arr as $sect) foreach($arr as $sect)

View File

@@ -24,8 +24,8 @@
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
register_shortcode('list_shortcodes', true); //register_shortcode('list_shortcodes', true);
initShortcodeClass('list_shortcodes'); //initShortcodeClass('list_shortcodes');
class list_shortcodes class list_shortcodes
{ {
@@ -37,16 +37,19 @@ class list_shortcodes
function list_shortcodes() function list_shortcodes()
{ {
$this->e107 = e107::getInstance(); $this->e107 = e107::getInstance();
$this->rc = '';
} }
/*
function load_globals() function load_globals()
{ {
global $rc; global $rc;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
$e107->tp->e_sc->scClasses['list_shortcodes']->rc = $rc; // $e107->tp->e_sc->scClasses['list_shortcodes']->rc = $rc;
$e107->tp->e_sc->scClasses['list_shortcodes']->row = $rc->row; // $e107->tp->e_sc->scClasses['list_shortcodes']->row = $rc->row;
$e107->tp->e_sc->scClasses['list_shortcodes']->list_pref = $rc->list_pref; // $e107->tp->e_sc->scClasses['list_shortcodes']->list_pref = $rc->list_pref;
} }
*/
function sc_list_date() function sc_list_date()
{ {