From c35959a7ea2fb94de13c93782f471800a349a804 Mon Sep 17 00:00:00 2001 From: mcfly Date: Wed, 7 Jan 2009 20:04:25 +0000 Subject: [PATCH] Forgot this file with last commit --- .../shortcode/batch/bbcode_shortcodes.php | 260 +++++++++--------- 1 file changed, 127 insertions(+), 133 deletions(-) diff --git a/e107_files/shortcode/batch/bbcode_shortcodes.php b/e107_files/shortcode/batch/bbcode_shortcodes.php index 8275eebc1..608134dd7 100644 --- a/e107_files/shortcode/batch/bbcode_shortcodes.php +++ b/e107_files/shortcode/batch/bbcode_shortcodes.php @@ -11,148 +11,142 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/bbcode_shortcodes.php,v $ -| $Revision: 1.9 $ -| $Date: 2009-01-07 15:40:06 $ -| $Author: secretr $ +| $Revision: 1.10 $ +| $Date: 2009-01-07 20:04:25 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ if (!defined('e107_INIT')) { exit; } include_once(e_HANDLER.'shortcode_handler.php'); -include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_ren_help.php"); -global $register_bb; -$bbcode_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__); +include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_ren_help.php'); -/* -SC_BEGIN BB -//FIXME - cachevars/getcachedvars! -global $pref, $eplug_bb, $bbcode_func, $bbcode_help, $bbcode_filedir, $bbcode_imagedir, $bbcode_helpactive, $bbcode_helptag, $register_bb, $imode; +$codes = array('bb', 'bb_help', 'bb_preimagedir'); +register_shortcode('bbcode_shortcodes', $codes); -if(defsettrue('e_WYSIWYG')){ return; } - -$bbcode_func = ($bbcode_func) ? $bbcode_func : "addtext"; -$bbcode_help = ($bbcode_help) ? $bbcode_help : "help"; -$bbcode_tag = ($bbcode_helptag != 'helpb') ? ",'$bbcode_helptag'" : ""; - -$rand = rand(1000,9999); -$imagedir_display = str_replace("../","",$bbcode_imagedir); - -if($parm == "emotes") +class bbcode_shortcodes { - if ($pref['comments_emoticons'] && $pref['smiley_activate'] && !defsettrue('e_WYSIWYG')) - { - $bbcode['emotes'] = array("expandit","emoticon_selector_".$rand, LANHELP_44, "emotes.png", "Emoticon_Select", "emoticon_selector_".$rand); - } - else - { // If emotes disabled, don't return anything (without this we return an empty image reference) - return ''; - } -} - -// Format: $bbcode['UNIQUE_NAME'] = array(ONCLICK_FUNC, ONCLICK_VAR, HELPTEXT, ICON, INCLUDE_FUNC, INCLUDE_FUNCTION_VAR); - -$bbcode['newpage'] = array($bbcode_func,"[newpage]", LANHELP_34, "newpage.png"); -$bbcode['link'] = array($bbcode_func,"[link=".LANHELP_35."][/link]", LANHELP_23,"link.png"); -$bbcode['b'] = array($bbcode_func,"[b][/b]", LANHELP_24,"bold.png"); -$bbcode['i'] = array($bbcode_func,"[i][/i]", LANHELP_25,"italic.png"); -$bbcode['u'] = array($bbcode_func,"[u][/u]", LANHELP_26,"underline.png"); -$bbcode['center'] = array($bbcode_func,"[center][/center]", LANHELP_28,"center.png"); -$bbcode['left'] = array($bbcode_func,"[left][/left]", LANHELP_29,"left.png"); -$bbcode['right'] = array($bbcode_func,"[right][/right]", LANHELP_30,"right.png"); -$bbcode['bq'] = array($bbcode_func,"[blockquote][/blockquote]", LANHELP_31,"blockquote.png"); -$bbcode['code'] = array($bbcode_func,"[code][/code]", LANHELP_32,"code.png"); -$bbcode['list'] = array($bbcode_func,"[list][/list]", LANHELP_36,"list.png"); -$bbcode['img'] = array($bbcode_func,"[img][/img]", LANHELP_27,"image.png"); -$bbcode['flash'] = array($bbcode_func,"[flash=width,height][/flash]", LANHELP_47,"flash.png"); - -$bbcode['fontsize'] = array("expandit","size_selector_".$rand, LANHELP_22,"fontsize.png","Size_Select",'size_selector_'.$rand); -$bbcode['fontcol'] = array("expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand); -$bbcode['preimage'] = array("expandit","preimage_selector_".$rand, LANHELP_45.$imagedir_display,"preimage.png","PreImage_Select","preimage_selector_".$rand); -$bbcode['prefile'] = array("expandit","prefile_selector_".$rand, LANHELP_39,"prefile.png","PreFile_Select",'prefile_selector_'.$rand); - -if(!isset($iconpath[$parm])) -{ - $iconpath[$parm] = (file_exists(THEME."bbcode/bold.png") ? THEME_ABS."bbcode/" : e_IMAGE_ABS."bbcode/"); - $iconpath[$parm] .= $bbcode[$parm][3]; -} - - - -if (!empty($register_bb)) -{ - foreach($register_bb as $key=>$val) // allow themes to plug in to it. - { - if($val[0]=="") + function get_bb($parm) { - $val[0] = $bbcode_func; + //FIXME - cachevars/getcachedvars! + global $pref, $eplug_bb, $bbcode_func, $bbcode_help, $bbcode_filedir, $bbcode_imagedir, $bbcode_helpactive, $bbcode_helptag, $register_bb, $imode; + + if(defsettrue('e_WYSIWYG')){ return; } + + $bbcode_func = ($bbcode_func) ? $bbcode_func : "addtext"; + $bbcode_help = ($bbcode_help) ? $bbcode_help : "help"; + $bbcode_tag = ($bbcode_helptag != 'helpb') ? ",'$bbcode_helptag'" : ""; + + $rand = rand(1000,9999); + $imagedir_display = str_replace('../','',$bbcode_imagedir); + + if($parm == 'emotes') + { + if ($pref['comments_emoticons'] && $pref['smiley_activate'] && !defsettrue('e_WYSIWYG')) + { + $bbcode['emotes'] = array("expandit","emoticon_selector_".$rand, LANHELP_44, "emotes.png", "Emoticon_Select", "emoticon_selector_".$rand); + } + else + { // If emotes disabled, don't return anything (without this we return an empty image reference) + return ''; + } + } + + // Format: $bbcode['UNIQUE_NAME'] = array(ONCLICK_FUNC, ONCLICK_VAR, HELPTEXT, ICON, INCLUDE_FUNC, INCLUDE_FUNCTION_VAR); + + $bbcode['newpage'] = array($bbcode_func,"[newpage]", LANHELP_34, "newpage.png"); + $bbcode['link'] = array($bbcode_func,"[link=".LANHELP_35."][/link]", LANHELP_23,"link.png"); + $bbcode['b'] = array($bbcode_func,"[b][/b]", LANHELP_24,"bold.png"); + $bbcode['i'] = array($bbcode_func,"[i][/i]", LANHELP_25,"italic.png"); + $bbcode['u'] = array($bbcode_func,"[u][/u]", LANHELP_26,"underline.png"); + $bbcode['center'] = array($bbcode_func,"[center][/center]", LANHELP_28,"center.png"); + $bbcode['left'] = array($bbcode_func,"[left][/left]", LANHELP_29,"left.png"); + $bbcode['right'] = array($bbcode_func,"[right][/right]", LANHELP_30,"right.png"); + $bbcode['bq'] = array($bbcode_func,"[blockquote][/blockquote]", LANHELP_31,"blockquote.png"); + $bbcode['code'] = array($bbcode_func,"[code][/code]", LANHELP_32,"code.png"); + $bbcode['list'] = array($bbcode_func,"[list][/list]", LANHELP_36,"list.png"); + $bbcode['img'] = array($bbcode_func,"[img][/img]", LANHELP_27,"image.png"); + $bbcode['flash'] = array($bbcode_func,"[flash=width,height][/flash]", LANHELP_47,"flash.png"); + + $bbcode['fontsize'] = array("expandit","size_selector_".$rand, LANHELP_22,"fontsize.png","Size_Select",'size_selector_'.$rand); + $bbcode['fontcol'] = array("expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand); + $bbcode['preimage'] = array("expandit","preimage_selector_".$rand, LANHELP_45.$imagedir_display,"preimage.png","PreImage_Select","preimage_selector_".$rand); + $bbcode['prefile'] = array("expandit","prefile_selector_".$rand, LANHELP_39,"prefile.png","PreFile_Select",'prefile_selector_'.$rand); + + if(!isset($iconpath[$parm])) + { + $iconpath[$parm] = (file_exists(THEME."bbcode/bold.png") ? THEME_ABS."bbcode/" : e_IMAGE_ABS."bbcode/"); + $iconpath[$parm] .= $bbcode[$parm][3]; + } + + + + if (!empty($register_bb)) + { + foreach($register_bb as $key=>$val) // allow themes to plug in to it. + { + if($val[0]=="") + { + $val[0] = $bbcode_func; + } + $bbcode[$key] = $val; + $iconpath[$key] = $val[3]; + } + } + + + if (!empty($eplug_bb)) + { + foreach($eplug_bb as $key=>$val) // allow plugins to plug into it. + { + extract($val); + // echo "$onclick $onclick_var $helptext $icon
"; + $bbcode[$name] = array($onclick,$onclick_var,$helptext,$icon,$function,$function_var); + $iconpath[$name] = $icon; + } + } + + + $_onclick_func = (isset($bbcode[$parm][0])) ? $bbcode[$parm][0] : $bbcode_func; + $_onclick_var = (isset($bbcode[$parm][1])) ? $bbcode[$parm][1] : ''; + $_helptxt = (isset($bbcode[$parm][2])) ? $bbcode[$parm][2] : ''; + $_function = (isset($bbcode[$parm][4])) ? $bbcode[$parm][4] : ''; + $_function_var = (isset($bbcode[$parm][5])) ? $bbcode[$parm][5] : ''; + + + if($bbcode[$parm]) // default - insert text. + { + $text = "\n\n"; + } + + if($_function) + { + + $text .= ($bbcode_helpactive && $_helptxt && !$iconpath[$parm]) ? "" : ""; + $text .= $_function($_function_var); + $text .= ($bbcode_helpactive && $_helptxt && !$iconpath[$parm]) ? "" : ""; + } + + return $text; + } + + function get_bb_help($parm) + { + if(defsettrue('e_WYSIWYG')) { return; } + global $bbcode_helpactive,$bbcode_helptag; + if($parm) $bbcode_helptag = $parm; + elseif(!varset($bbcode_helptag)) $bbcode_helptag = 'helpb'; + $bbcode_helpactive = TRUE; + //FIXME - better bb help + return ""; + } + + function get_bb_preimagedir($parm) + { + if(defsettrue('e_WYSIWYG')) { return; } + global $bbcode_imagedir; + $bbcode_imagedir = $parm; + return; } - $bbcode[$key] = $val; - $iconpath[$key] = $val[3]; - } } - - -if (!empty($eplug_bb)) -{ - foreach($eplug_bb as $key=>$val) // allow plugins to plug into it. - { - extract($val); - // echo "$onclick $onclick_var $helptext $icon
"; - $bbcode[$name] = array($onclick,$onclick_var,$helptext,$icon,$function,$function_var); - $iconpath[$name] = $icon; - } -} - - -$_onclick_func = (isset($bbcode[$parm][0])) ? $bbcode[$parm][0] : $bbcode_func; -$_onclick_var = (isset($bbcode[$parm][1])) ? $bbcode[$parm][1] : ''; -$_helptxt = (isset($bbcode[$parm][2])) ? $bbcode[$parm][2] : ''; -$_function = (isset($bbcode[$parm][4])) ? $bbcode[$parm][4] : ''; -$_function_var = (isset($bbcode[$parm][5])) ? $bbcode[$parm][5] : ''; - - -if($bbcode[$parm]) // default - insert text. -{ - $text = "\n\n"; -} - -if($_function) -{ - - $text .= ($bbcode_helpactive && $_helptxt && !$iconpath[$parm]) ? "" : ""; - $text .= $_function($_function_var); - $text .= ($bbcode_helpactive && $_helptxt && !$iconpath[$parm]) ? "" : ""; -} - -return $text; - - - - -SC_END - - - - -SC_BEGIN BB_HELP - if(defsettrue('e_WYSIWYG')) { return; } - global $bbcode_helpactive,$bbcode_helptag; - if($parm) $bbcode_helptag = $parm; - elseif(!varset($bbcode_helptag)) $bbcode_helptag = 'helpb'; - $bbcode_helpactive = TRUE; - //FIXME - better bb help - return ""; -SC_END - - - -SC_BEGIN BB_PREIMAGEDIR - if(defsettrue('e_WYSIWYG')) { return; } - global $bbcode_imagedir; - $bbcode_imagedir = $parm; - return; -SC_END - - -*/ ?> \ No newline at end of file