From 586af71243752095913c2ba407382b1b51f7fd62 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Fri, 2 Nov 2012 01:50:28 +0000 Subject: [PATCH] More shortcode cleanup. --- e107_handlers/bbcode_handler.php | 10 ++++++++-- e107_plugins/faqs/faqs.php | 8 +++----- e107_plugins/faqs/faqs_shortcodes.php | 3 --- e107_plugins/forum/forum_viewtopic.php | 8 +++----- .../forum/shortcodes/batch/post_shortcodes.php | 1 - e107_plugins/tagwords/tagwords_class.php | 5 +++-- e107_plugins/tagwords/tagwords_shortcodes.php | 6 +++--- 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index 38ac18c04..13ed2916b 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -533,7 +533,7 @@ class e_bbcode 'size' => $helpsize ); - $bbcode_shortcodes->setParserVars($data); + $bbcode_shortcodes->setVars($data); return "
".$tp->parseTemplate($BBCODE_TEMPLATE,TRUE)."
"; } @@ -545,6 +545,8 @@ class e_bbcode { $text = str_replace("","[html]",$text); $text = str_replace("","[/html]",$text); + // $text = str_replace('',"[newpage=]",$text); + if(substr($text,0,6)=='[html]') { @@ -552,8 +554,11 @@ class e_bbcode } // Youtube conversion (TinyMce) + + // return $text; + $text = preg_replace('/([^/i',"[youtube=$1]$4[/youtube]",$text); - $text = preg_replace('/.*/i','[youtube=$1]$2[/youtube]',$text); + $text = preg_replace('/([^!]*)/i','[youtube=$1]$2[/youtube]',$text); $text = preg_replace("/(.*?)<\/a>/i","[file=$2]$3[/file]",$text); @@ -587,6 +592,7 @@ class e_bbcode // Mostly closing tags. $convert = array( array( "\n", '
'), + // array( "\n", '

'), array( "\n[/list]", ''), array( "[h=2]", '

'), // e107 bbcode markup array( "[h=2]", '

'), diff --git a/e107_plugins/faqs/faqs.php b/e107_plugins/faqs/faqs.php index 18c7eb092..dfe809d96 100644 --- a/e107_plugins/faqs/faqs.php +++ b/e107_plugins/faqs/faqs.php @@ -167,8 +167,10 @@ class faq function __construct() { + $sc = e107::getScBatch('faqs',TRUE); $this->pref = e107::getPlugConfig('faqs')->getPref(); - setScVar('faqs_shortcodes', 'pref', $this->pref); + $sc->pref = $this->pref; + // setScVar('faqs_shortcodes', 'pref', $this->pref); } function view_all() // new funtion to render all FAQs @@ -191,7 +193,6 @@ class faq while ($rw = $sql->db_Fetch()) { - // setScVar('faqs_shortcodes', 'row', $rw); $sc->setVars($rw); if($rw['faq_info_order'] != $prevcat) @@ -239,11 +240,9 @@ class faq while ($rw = $sql->db_Fetch()) { - // setScVar('faqs_shortcodes', 'var', $rw); $sc->setVars($rw); $text .= $tp->parseTemplate($FAQ_LIST_LOOP, true); $caption = " Category: ".$rw['faq_info_title'].""; - } $text .= $tp->parseTemplate($FAQ_LIST_END, true); @@ -285,7 +284,6 @@ class faq while ($row = $sql->db_Fetch()) { $sc->setVars($row); - // setScVar('faqs_shortcodes', 'row', $row); if ($row['faq_info_parent'] == '0') // { diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php index a8fdfeda0..9538c182c 100644 --- a/e107_plugins/faqs/faqs_shortcodes.php +++ b/e107_plugins/faqs/faqs_shortcodes.php @@ -17,9 +17,6 @@ */ if (!defined('e107_INIT')) { exit; } -// register_shortcode('faqs_shortcodes', true); -// initShortcodeClass('faqs_shortcodes'); - class faqs_shortcodes extends e_shortcode { // var $var; diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index ea07468c5..57af9c1f7 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -76,9 +76,7 @@ if(isset($_GET['f'])) if($_GET['f'] != 'last') { $thread->init(); } } -//e107::getScParser(); -//require_once (e_PLUGIN . 'forum/forum_shortcodes.php'); -//setScVar('forum_shortcodes', 'thread', $thread); + e107::getScBatch('view', 'forum')->setScVar('thread', $thread); $pm_installed = plugInstalled('pm'); @@ -96,7 +94,7 @@ define('MODERATOR', (USER && $forum->isModerator(USERID))); e107::getScBatch('view', 'forum')->setScVar('forum', $forum); //var_dump(e107::getScBatch('forum', 'forum')); -//setScVar('forum_shortcodes', 'forum', $forum); + if (MODERATOR && isset($_POST['mod'])) { @@ -259,7 +257,7 @@ foreach ($postList as $postInfo) { $_style = (isset($FORUMREPLYSTYLE_ALT) && $alt ? $FORUMREPLYSTYLE_ALT : $FORUMREPLYSTYLE); } -// setScVar('forum_shortcodes', 'postInfo', $postInfo); + e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo); $forrep .= $e107->tp->parseTemplate($_style, true, $forum_shortcodes) . "\n"; } diff --git a/e107_plugins/forum/shortcodes/batch/post_shortcodes.php b/e107_plugins/forum/shortcodes/batch/post_shortcodes.php index a6dccda14..a940372ca 100644 --- a/e107_plugins/forum/shortcodes/batch/post_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/post_shortcodes.php @@ -26,7 +26,6 @@ class plugin_forum_post_shortcodes extends e_shortcode for($i = count($tmp); $i > 0; $i--) { $bach->setScVar('postInfo', $tmp[$i-1]); - //setScVar('forum_shortcodes', 'postInfo', $tmp[$i]); $txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_POST, true); } $txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_END, true); diff --git a/e107_plugins/tagwords/tagwords_class.php b/e107_plugins/tagwords/tagwords_class.php index 467b18a16..df278e45d 100644 --- a/e107_plugins/tagwords/tagwords_class.php +++ b/e107_plugins/tagwords/tagwords_class.php @@ -45,8 +45,9 @@ class tagwords e107::includeLan(e_PLUGIN."tagwords/languages/".e_LANGUAGE.".php"); //shortcodes - require_once(e_PLUGIN.'tagwords/tagwords_shortcodes.php'); - $this->shortcodes = $tagwords_shortcodes; + //require_once(e_PLUGIN.'tagwords/tagwords_shortcodes.php'); + $this->shortcodes = e107::getScBatch('tagwords',TRUE); + //$this->shortcodes = $tagwords_shortcodes; //template if (is_readable(THEME."tagwords_template.php")) diff --git a/e107_plugins/tagwords/tagwords_shortcodes.php b/e107_plugins/tagwords/tagwords_shortcodes.php index d9caa266f..e391c6ada 100644 --- a/e107_plugins/tagwords/tagwords_shortcodes.php +++ b/e107_plugins/tagwords/tagwords_shortcodes.php @@ -31,11 +31,11 @@ foreach($tmp as $c) } } */ -register_shortcode('tagwords_shortcodes', TRUE); +// register_shortcode('tagwords_shortcodes', TRUE); -initShortcodeClass('tagwords_shortcodes'); +// initShortcodeClass('tagwords_shortcodes'); -class tagwords_shortcodes +class tagwords_shortcodes extends e_shortcode { var $e107;