Plugin Directory

Changeset 2037928


Ignore:
Timestamp:
02/23/2019 09:46:19 PM (7 years ago)
Author:
DevynCJohnson
Message:

tagging version 2019.02.23

Location:
bbcode-deluxe
Files:
5 edited
7 copied

Legend:

Unmodified
Added
Removed
  • bbcode-deluxe/tags/2019.02.23/bbcode-admin.php

    r1256906 r2037928  
    1 <?php function bbcode_deluxe_plugin_menu(){add_options_page('BBCode Deluxe','BBCode Deluxe','manage_options','bbcode-deluxe','bbcode_deluxe_plugin_options');}
    2 add_action('admin_menu','bbcode_deluxe_plugin_menu');
    3 function bbcode_deluxe_plugin_options(){
    4 global $bbp_sc_whitelist;
    5 if(!current_user_can('manage_options')){
    6     echo '<div><p>No options currently available.</p></div>';
    7 } else {
    8     $bbcodes_active=true;
    9     $whitelist_enabled=is_plugin_active('bbpress2-shortcode-whitelist/bbpress2-shortcode-whitelist.php');
    10     if($whitelist_enabled){
    11         $enabled_plugins=get_option('bbpscwl_enabled_plugins');
    12         if($enabled_plugins==='') $enabled_plugins=array();
    13         else $enabled_plugins=unserialize($enabled_plugins);
    14         $bbcodes_active=false;
    15         foreach($enabled_plugins as $plugin_tag){
    16             if($plugin_tag==='bbpress-bbcode') $bbcodes_active=true;
     1<?php
     2
     3function bbcode_deluxe_plugin_menu() { add_options_page('BBCode Deluxe', 'BBCode Deluxe', 'manage_options', 'bbcode-deluxe', 'bbcode_deluxe_plugin_options'); }
     4
     5add_action('admin_menu', 'bbcode_deluxe_plugin_menu');
     6
     7function bbcode_deluxe_plugin_options() {
     8    global $bbp_sc_whitelist;
     9    if (is_admin() && current_user_can('manage_options')) {
     10        $bbcodes_active = true;
     11        $whitelist_enabled = is_plugin_active('bbpress2-shortcode-whitelist/bbpress2-shortcode-whitelist.php');
     12        if ($whitelist_enabled) {
     13            $enabled_plugins = get_option('bbpscwl_enabled_plugins');
     14            if ($enabled_plugins === '') { $enabled_plugins = array(); }
     15            else { $enabled_plugins = unserialize($enabled_plugins); }
     16            $bbcodes_active = false;
     17            foreach ($enabled_plugins as $plugin_tag) {
     18                if ($plugin_tag === 'bbpress-bbcode') { $bbcodes_active = true; }
     19            }
    1720        }
    18     }
    19     require(dirname(__FILE__).'/options-form-template.php');
     21        require(dirname(__FILE__).'/options-form-template.php');
     22    } else { echo '<div><p>No options currently available.</p></div>'; }
    2023}
    21 }?>
     24
     25?>
  • bbcode-deluxe/tags/2019.02.23/bbcode-deluxe.php

    r1724542 r2037928  
    22Plugin Name: BBCode Deluxe
    33Plugin URI: http://dcjtech.info/
    4 Description: Adds support for BBCode to Wordpress and BBPress.
    5 Version: 2017.09.04
     4Description: Adds support for BBCode to Wordpress and BBPress
     5Version: 2019.02.23
    66Author: Devyn Collier Johnson (DevynCJohnson)
    77Author URI: http://dcjtech.info/
     
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1010This plugin includes code from the below listed developers and their plugins.
    11 Copyright (C) 2013 Anton Channing (Video and Audio BBCodes and bbPress2 BBCode)
     11Copyright (C) 2013 Anton Channing ("Video and Audio BBCodes" and "bbPress2 BBCode")
    1212Copyright (C) 2010 b0ingBall (b0ingBall BBCode plugin)
    1313Copyright (C) 2008 Viper007Bond (the original BBCode plugin)
     
    1515"BBCode Deluxe" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
    1616"BBCode Deluxe" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    17 You should have received a copy of the GNU General Public License along with "BBCode Deluxe". If not, see <http://www.gnu.org/licenses/>.*/
    18 defined('ABSPATH') or die('Invalid Entrance!');
     17You should have received a copy of the GNU General Public License along with "BBCode Deluxe". If not, see <http://www.gnu.org/licenses/>.
     18*/
     19
     20
     21function quote_exempt_from_wptexturize($shortcodes) {
     22    $shortcodes = ['quote', 'q', 'QUOTE', 'Q'];
     23    return $shortcodes;
     24}
     25
     26
     27function code_exempt_from_wptexturize($shortcodes) {
     28    $shortcodes = ['no-highlight', 'pre', 'raw'];
     29    return $shortcodes;
     30}
     31
     32
     33function nested_quotes($content, $not_used = false) {
     34    $counter = 0;
     35    $tag_counter_string = '';
     36    $content = preg_replace('/[\n\r]/', '', $content);
     37    $content = str_replace('', '', $content);
     38    $content = str_replace('[quote', '[', $content);
     39    $content = str_replace('[/quote]', '[/]', $content);
     40    $pos = strpos($content, '[/]');
     41    while ($pos !== false) {
     42        $content = preg_replace('/(?<=\[)([^]*?)(?=\[\/\])/u', '[]$0[/]', $content, 1);
     43        $tag_counter_string = 'quote-'.strval($counter);
     44        $content = str_replace('[]', $tag_counter_string, $content);
     45        $content = str_replace('][/', $tag_counter_string, $content);
     46        ++$counter;
     47        $pos = strpos($content, '[/]');
     48    }
     49    $content = str_replace('', "\n", $content);
     50    return $content;
     51}
     52
     53
     54defined('ABSPATH') or die('Invalid entrance into the plugin BBCode Deluxe!');
     55add_filter('no_texturize_shortcodes', 'code_exempt_from_wptexturize');
     56add_filter('no_texturize_shortcodes', 'quote_exempt_from_wptexturize');
     57add_filter('the_content', 'nested_quotes', 9);
     58add_filter('the_content', 'do_shortcode', 11);
     59add_filter('widget_text', 'do_shortcode', 11);
     60if (function_exists('get_comment_text')) { add_filter('get_comment_text', 'do_shortcode', 11); }
     61if (function_exists('bbp_get_topic_content')) { add_filter('bbp_get_topic_content', 'do_shortcode', 11); }
     62if (function_exists('bbp_get_reply_content')) { add_filter('bbp_get_reply_content', 'do_shortcode', 11); }
     63if (function_exists('bp_get_activity_content_body')) { add_filter('bp_get_activity_content_body', 'do_shortcode', 11); }
     64if (function_exists('bp_get_the_topic_post_content')) { add_filter('bp_get_the_topic_post_content', 'do_shortcode', 11); }
     65if (function_exists('bp_get_the_thread_message_content')) { add_filter('bp_get_the_thread_message_content', 'do_shortcode', 11); }
    1966require_once(dirname(__FILE__).'/bbcode-admin.php');
    2067require_once(dirname(__FILE__).'/class-bbcode.php');
    21 add_action('plugins_loaded',function(){global $BBCode; $BBCode = new BBCode();},14);
     68add_action('plugins_loaded', function() { global $BBCode; $BBCode = new BBCode(); }, 14);
     69
    2270?>
  • bbcode-deluxe/tags/2019.02.23/class-bbcode.php

    r1314018 r2037928  
    1 <?php class BBCode{
    2 public $use_whitelist=false;
    3 function __construct(){
    4     if(!function_exists('add_shortcode')) return;
    5     //Formatting+Style
    6     add_shortcode('b',array(&$this,'shortcode_bold'));
    7     add_shortcode('B',array(&$this,'shortcode_bold'));
    8     add_shortcode('bold',array(&$this,'shortcode_bold'));
    9     add_shortcode('BOLD',array(&$this,'shortcode_bold'));
    10     add_shortcode('strong',array(&$this,'shortcode_bold'));
    11     add_shortcode('STRONG',array(&$this,'shortcode_bold'));
    12     add_shortcode('center',array(&$this,'shortcode_center'));
    13     add_shortcode('CENTER',array(&$this,'shortcode_center'));
    14     add_shortcode('color',array(&$this,'shortcode_color'));
    15     add_shortcode('COLOR',array(&$this,'shortcode_color'));
    16     add_shortcode('del',array(&$this,'shortcode_del'));
    17     add_shortcode('DEL',array(&$this,'shortcode_del'));
    18     add_shortcode('i',array(&$this,'shortcode_italics'));
    19     add_shortcode('I',array(&$this,'shortcode_italics'));
    20     add_shortcode('italic',array(&$this,'shortcode_italics'));
    21     add_shortcode('ITALIC',array(&$this,'shortcode_italics'));
    22     add_shortcode('em',array(&$this,'shortcode_italics'));
    23     add_shortcode('EM',array(&$this,'shortcode_italics'));
    24     add_shortcode('justify',array(&$this,'shortcode_justify'));
    25     add_shortcode('JUSTIFY',array(&$this,'shortcode_justify'));
    26     add_shortcode('left',array(&$this,'shortcode_left'));
    27     add_shortcode('LEFT',array(&$this,'shortcode_left'));
    28     add_shortcode('bdo',array(&$this,'shortcode_reverse'));
    29     add_shortcode('BDO',array(&$this,'shortcode_reverse'));
    30     add_shortcode('reverse',array(&$this,'shortcode_reverse'));
    31     add_shortcode('REVERSE',array(&$this,'shortcode_reverse'));
    32     add_shortcode('right',array(&$this,'shortcode_right'));
    33     add_shortcode('RIGHT',array(&$this,'shortcode_right'));
    34     add_shortcode('size',array(&$this,'shortcode_size'));
    35     add_shortcode('SIZE',array(&$this,'shortcode_size'));
    36     add_shortcode('s',array(&$this,'shortcode_strikethrough'));
    37     add_shortcode('S',array(&$this,'shortcode_strikethrough'));
    38     add_shortcode('strike',array(&$this,'shortcode_strikethrough'));
    39     add_shortcode('STRIKE',array(&$this,'shortcode_strikethrough'));
    40     add_shortcode('sub',array(&$this,'shortcode_subscript'));
    41     add_shortcode('SUB',array(&$this,'shortcode_subscript'));
    42     add_shortcode('sup',array(&$this,'shortcode_superscript'));
    43     add_shortcode('SUP',array(&$this,'shortcode_superscript'));
    44     add_shortcode('u',array(&$this,'shortcode_underline'));
    45     add_shortcode('U',array(&$this,'shortcode_underline'));
    46     add_shortcode('underline',array(&$this,'shortcode_underline'));
    47     add_shortcode('UNDERLINE',array(&$this,'shortcode_underline'));
    48     //Code and Quotes
    49     add_shortcode('q',array(&$this,'shortcode_quote'));
    50     add_shortcode('Q',array(&$this,'shortcode_quote'));
    51     add_shortcode('quote',array(&$this,'shortcode_quote'));
    52     add_shortcode('QUOTE',array(&$this,'shortcode_quote'));
    53     add_shortcode('cite',array(&$this,'shortcode_cite'));
    54     add_shortcode('CITE',array(&$this,'shortcode_cite'));
    55     add_shortcode('abbr',array(&$this,'shortcode_abbr'));
    56     add_shortcode('ABBR',array(&$this,'shortcode_abbr'));
    57     add_shortcode('acronym',array(&$this,'shortcode_abbr'));
    58     add_shortcode('ACRONYM',array(&$this,'shortcode_abbr'));
    59     add_shortcode('code',array(&$this,'shortcode_code'));
    60     add_shortcode('CODE',array(&$this,'shortcode_code'));
    61     add_shortcode('kbd',array(&$this,'shortcode_kbd'));
    62     add_shortcode('KBD',array(&$this,'shortcode_kbd'));
    63     add_shortcode('key',array(&$this,'shortcode_kbd'));
    64     add_shortcode('KEY',array(&$this,'shortcode_kbd'));
    65     add_shortcode('keyboard',array(&$this,'shortcode_kbd'));
    66     add_shortcode('KEYBOARD',array(&$this,'shortcode_kbd'));
    67     //Lists and Tables
    68     add_shortcode('ol',array(&$this,'shortcode_orderedlist'));
    69     add_shortcode('OL',array(&$this,'shortcode_orderedlist'));
    70     add_shortcode('ul',array(&$this,'shortcode_unorderedlist'));
    71     add_shortcode('UL',array(&$this,'shortcode_unorderedlist'));
    72     add_shortcode('list',array(&$this,'shortcode_unorderedlist'));
    73     add_shortcode('LIST',array(&$this,'shortcode_unorderedlist'));
    74     add_shortcode('li',array(&$this,'shortcode_listitem'));
    75     add_shortcode('LI',array(&$this,'shortcode_listitem'));
    76     add_shortcode('table',array(&$this,'shortcode_table'));
    77     add_shortcode('TABLE',array(&$this,'shortcode_table'));
    78     add_shortcode('thead',array(&$this,'shortcode_thead'));
    79     add_shortcode('THEAD',array(&$this,'shortcode_thead'));
    80     add_shortcode('tbody',array(&$this,'shortcode_tbody'));
    81     add_shortcode('TBODY',array(&$this,'shortcode_tbody'));
    82     add_shortcode('tfoot',array(&$this,'shortcode_tfoot'));
    83     add_shortcode('TFOOT',array(&$this,'shortcode_tfoot'));
    84     add_shortcode('th',array(&$this,'shortcode_th'));
    85     add_shortcode('TH',array(&$this,'shortcode_th'));
    86     add_shortcode('tr',array(&$this,'shortcode_tr'));
    87     add_shortcode('TR',array(&$this,'shortcode_tr'));
    88     add_shortcode('td',array(&$this,'shortcode_td'));
    89     add_shortcode('TD',array(&$this,'shortcode_td'));
    90     //Links and Images
    91     add_shortcode('email',array(&$this,'shortcode_email'));
    92     add_shortcode('EMAIL',array(&$this,'shortcode_email'));
    93     add_shortcode('img',array(&$this,'shortcode_image'));
    94     add_shortcode('IMG',array(&$this,'shortcode_image'));
    95     add_shortcode('url',array(&$this,'shortcode_url'));
    96     add_shortcode('URL',array(&$this,'shortcode_url'));
    97     add_shortcode('link',array(&$this,'shortcode_url'));
    98     add_shortcode('LINK',array(&$this,'shortcode_url'));
    99     //Videos and Audio
    100     add_shortcode('freesound',array(&$this,'shortcode_freesound'));
    101     add_shortcode('FREESOUND',array(&$this,'shortcode_freesound'));
    102     add_shortcode('gvideo',array(&$this,'shortcode_gvideo'));
    103     add_shortcode('GVIDEO',array(&$this,'shortcode_gvideo'));
    104     add_shortcode('vimeo',array(&$this,'shortcode_vimeo'));
    105     add_shortcode('VIMEO',array(&$this,'shortcode_vimeo'));
    106     add_shortcode('youtube',array(&$this,'shortcode_youtube'));
    107     add_shortcode('YOUTUBE',array(&$this,'shortcode_youtube'));
    108     //Misc
    109     add_shortcode('ip',array(&$this,'shortcode_clientip'));
    110     add_shortcode('IP',array(&$this,'shortcode_clientip'));
    111     add_shortcode('hr',array(&$this,'shortcode_hr'));
    112     add_shortcode('HR',array(&$this,'shortcode_hr'));
    113     add_shortcode('note',array(&$this,'shortcode_note'));
    114     add_shortcode('NOTE',array(&$this,'shortcode_note'));
    115     add_shortcode('useragent',array(&$this,'shortcode_useragent'));
    116     add_shortcode('USERAGENT',array(&$this,'shortcode_useragent'));
    117     //Hide and Display Content
    118     add_shortcode('spoiler',array(&$this,'shortcode_spoiler'));
    119     add_shortcode('SPOILER',array(&$this,'shortcode_spoiler'));
    120     add_shortcode('user',array(&$this,'shortcode_user'));
    121     add_shortcode('USER',array(&$this,'shortcode_user'));
    122     add_shortcode('guest',array(&$this,'shortcode_guest'));
    123     add_shortcode('GUEST',array(&$this,'shortcode_guest'));
    124     if(function_exists('bbp_whitelist_do_shortcode')){
    125         $this->use_whitelist=true;
    126     } else {
    127         $this->use_whitelist=false;
    128         //Add all shortcodes to -
    129         add_filter('get_comment_text','do_shortcode',14);//forum topics
    130         add_filter('bbp_get_reply_content','do_shortcode',14);//forum replies
    131         //add_filter('bp_get_activity_content_body','do_shortcode', 1);//activity stream
    132         //add_filter('bp_get_the_topic_post_content','do_shortcode');//group forum posts
    133         //add_filter('bp_get_the_thread_message_content','do_shortcode');//private messages
    134     }
    135 }
    136 function do_shortcode($content){
    137     if(function_exists('bbp_whitelist_do_shortcode')){return bbp_whitelist_do_shortcode($content);}
    138     else {return do_shortcode($content);}
    139 }
    140 function attributefix($atts=array()){
    141     if(empty($atts[0])) return $atts;
    142     if(0!==preg_match('#=("|\')(.*?)("|\')#',$atts[0],$match))
    143         $atts[0]=$match[2];
    144     return $atts;
    145 }
    146 
    147 //SHORTCODES//
    148 //Formatting+Style
    149 function shortcode_bold($atts=array(),$content=NULL){
    150     if(NULL===$content) return '';
    151     return '<strong>'.$this->do_shortcode($content).'</strong>';
    152 }
    153 function shortcode_center($atts=array(),$content=NULL){
    154     if(NULL===$content) return '';
    155     return '<span style="text-align:center">'.$this->do_shortcode($content).'</span>';
    156 }
    157 function shortcode_color($atts=array(),$content=NULL){
    158     if(NULL===$content||''===$atts) return '';
    159     $attribs=implode('',$atts);
    160     $color=substr ($attribs, 1);
    161     if(ctype_xdigit($color))
    162         $color = '#'.$color;
    163     return '<span style="color:'.$color.'">'.$this->do_shortcode($content).'</span>';
    164 }
    165 function shortcode_del($atts=array(),$content=NULL){
    166     if(NULL===$content) return '';
    167     return '<del>'.$this->do_shortcode($content).'</del>';
    168 }
    169 function shortcode_italics($atts=array(),$content=NULL){
    170     if(NULL===$content) return '';
    171     return '<em>'.$this->do_shortcode($content).'</em>';
    172 }
    173 function shortcode_justify($atts=array(),$content=NULL){
    174     if(NULL===$content) return '';
    175     return '<span style="text-align:justify">'.$this->do_shortcode($content).'</span>';
    176 }
    177 function shortcode_left($atts=array(),$content=NULL){
    178     if(NULL===$content) return '';
    179     return '<span style="text-align:left">'.$this->do_shortcode($content).'</span>';
    180 }
    181 function shortcode_reverse($atts=array(),$content=NULL){
    182     if(NULL===$content) return '';
    183     return '<bdo dir="rtl">'.$this->do_shortcode($content).'</bdo>';
    184 }
    185 function shortcode_right($atts=array(),$content=NULL){
    186     if(NULL===$content) return '';
    187     return '<span style="text-align:right">'.$this->do_shortcode($content).'</span>';
    188 }
    189 function shortcode_size($atts=array(),$content=NULL){
    190     if(NULL===$content||''===$atts) return '';
    191     $attribs = implode('',$atts);
    192     $subattribs = substr ($attribs, 1);
    193     return '<span style="font-size:'.$subattribs.'px">'.$this->do_shortcode($content).'</span>';
    194 }
    195 function shortcode_strikethrough($atts=array(),$content=NULL){
    196     if(NULL===$content) return '';
    197     return '<s>'.$this->do_shortcode($content).'</s>';
    198 }
    199 function shortcode_subscript($atts=array(),$content=NULL){
    200     if(NULL===$content) return '';
    201     return '<sub>'.$this->do_shortcode($content).'</sub>';
    202 }
    203 function shortcode_superscript($atts=array(),$content=NULL){
    204     if(NULL===$content) return '';
    205     return '<sup>'.$this->do_shortcode($content).'</sup>';
    206 }
    207 function shortcode_underline($atts=array(),$content=NULL){
    208     if(NULL===$content) return '';
    209     return '<span style="text-decoration:underline">'.$this->do_shortcode($content).'</span>';
    210 }
    211 
    212 //Code and Quotes
    213 function shortcode_quote($atts=array(),$content=NULL){
    214     global $bp;global $bbp;
    215     $css_classes=array('bbcode-quote');
    216     if(NULL===$content) return '';
    217     if(empty($atts)){
    218         return '<div class="'.implode(' ',$css_classes).'"><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
    219     } else {
    220         $name=trim(array_shift($atts),'="');
    221         $css_classes[]='bbcode-quote-'.$name;
    222         $user=get_user_by('login',$name);
    223         if(false!==$user){
    224             $css_classes[]='bbcode-quote-user';
    225             if(function_exists('bp_is_active')) $name = '<a href="'.site_url().'/members/'.$user->user_login.'">'.$user->display_name.'</a>';
    226             elseif ('bbPress'===get_class($bbp)) $name='<a href="'.site_url().'?bbp_user='.$user->ID.'">'.$user->display_name.'</a>';
    227             else $name=$user->display_name;
    228         }
    229         If(''!==$subattribs) return '<div class="'.implode(' ',$css_classes).'"><strong>'.$name.' wrote: </strong><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
    230     }
    231 }
    232 function shortcode_cite($atts=array(),$content=NULL){
    233     if(NULL===$content) return '';
    234     return '<cite>'.$this->do_shortcode($content).'</cite>';
    235 }
    236 function shortcode_abbr($atts=array(),$content=NULL){
    237     if(NULL===$content) return '';
    238     if(!isset($atts['title'])) return '';
    239     $atts=$this->attributefix($atts);
    240     return '<abbr title="'.$atts['title'].'">'.$this->do_shortcode($content).'</abbr>';
    241 }
    242 function shortcode_code($atts=array(),$content=NULL){
    243     if(NULL===$content) return '';
    244     return '<code>'.$this->do_shortcode($content).'</code>';
    245 }
    246 function shortcode_kbd($atts=array(),$content=NULL){
    247     if(NULL===$content) return '';
    248     return '<kbd>'.$this->do_shortcode($content).'</kbd>';
    249 }
    250 
    251 //Lists and Tables
    252 function shortcode_orderedlist($atts=array(),$content=NULL){
    253     if(NULL===$content) return '';
    254     return '<ol>'.$this->do_shortcode($content).'</ol>';
    255 }
    256 function shortcode_unorderedlist($atts=array(),$content=NULL){
    257     if(NULL===$content) return '';
    258     return '<ul>'.$this->do_shortcode($content).'</ul>';
    259 }
    260 function shortcode_listitem($atts=array(),$content=NULL){
    261     if(NULL===$content) return '';
    262     return '<li>'.$this->do_shortcode($content).'</li>';
    263 }
    264 function shortcode_table($atts=array(),$content=NULL){
    265     if(NULL===$content) return '';
    266     return '<table>'.$this->do_shortcode($content).'</table>';
    267 }
    268 function shortcode_thead($atts=array(),$content=NULL){
    269     if(NULL===$content) return '';
    270     return '<thead>'.$this->do_shortcode($content).'</thead>';
    271 }
    272 function shortcode_tbody($atts=array(),$content=NULL){
    273     if(NULL===$content) return '';
    274     return '<tbody>'.$this->do_shortcode($content).'</tbody>';
    275 }
    276 function shortcode_tfoot($atts=array(),$content=NULL){
    277     if(NULL===$content) return '';
    278     return '<tfoot>'.$this->do_shortcode($content).'</tfoot>';
    279 }
    280 function shortcode_th($atts=array(),$content=NULL){
    281     if(NULL===$content) return '';
    282     return '<th>'.$this->do_shortcode($content).'</th>';
    283 }
    284 function shortcode_tr($atts=array(),$content=NULL){
    285     if(NULL===$content) return '';
    286     return '<tr>'.$this->do_shortcode($content).'</tr>';
    287 }
    288 function shortcode_td($atts=array(),$content=NULL){
    289     if(NULL===$content) return '';
    290     return '<td>'.$this->do_shortcode($content).'</td>';
    291 }
    292 
    293 //Links and Images
    294 function shortcode_email($atts=array(),$content=NULL){
    295     if(empty($atts)){
    296         //[email][email protected][/email]
    297         $url=$content;$text=$content;
    298     } else {
    299         //[[email protected]]text[/email]
    300         //[email="[email protected]"]text[/email]
    301         $atts=$this->attributefix($atts);
    302         $url=trim(array_shift($atts),'="');
    303     }
    304     if(empty($url)) return '';
    305     if(empty($text)) $text=$url;
    306     return '<a href="mailto:'.$url.'">'.$this->do_shortcode($content).'</a>';
    307 }
    308 function shortcode_image($atts=array(),$content=NULL){
    309     if(NULL===$content) return '';
    310     $alt='';
    311     if(!empty($atts))
    312         $alt=trim(implode(' ',$atts ),'="');
    313     //[img=alttext]imageurl[/img]
    314     return '<img src="'.$content.'" alt="'.$alt.'" title="'.$alt.' />';
    315 }
    316 function shortcode_url($atts=array(),$content=NULL){
    317     if(empty($atts)){
    318         //[url]http://www.example.com/[/url]
    319         $url=$content;$text=$content;
    320     } else {
    321         //[url=http://www.example.com/]text[/url]
    322         //[url="http://www.example.com/"]text[/url]
    323         $atts=$this->attributefix($atts);
    324         $url=trim(array_shift($atts),'="');
    325     }
    326     if(empty($url)) return '';
    327     if(empty($text)) $text=$url;
    328     return '<a href="'.$url.'">'.$this->do_shortcode($content).'</a>';
    329 }
    330 
    331 //Videos and Audio
    332 function shortcode_freesound($atts=array(),$content=NULL){
    333     if(''===$content) return 'No Freesound Audio ID Set';
    334     if(empty($atts)){
    335         //[freesound]164929[/freesound]
    336         $size = 'medium';
    337     } else {
    338         //[freesound=large]164929[/freesound]
    339         //[freesound=small]164929[/freesound]
    340         $size=$this->attributefix($atts);
    341         $size=trim(array_shift($size),'="');
    342     }
    343     $id=$text=$content;
    344     switch($size){
    345         case 'big':
    346         case 'large':
    347         case 'l':
    348             return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$id.'/simple/large/" width="920" height="245"></iframe>';
    349             break;
    350         case 'little':
    351         case 'short':
    352         case 'small':
    353         case 's':
    354             return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$id.'/simple/small/" width="375" height="30"></iframe>';
    355             break;
    356         case 'mid':
    357         case 'medium':
    358         case 'm':
    359         default:
    360             return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$id.'/simple/medium/" width="481" height="86"></iframe>';
    361             break;
    362     }
    363 }
    364 function shortcode_gvideo($atts=array(),$content=NULL){
    365     if(''===$content) return 'No Google Video ID Set';
    366     $id=$text=$content;
    367     return '<embed style="width:400px;height:325px" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId='.$id.'&hl=en"></embed>';
    368 }
    369 function shortcode_vimeo($atts=array(),$content=NULL){
    370     if(''===$content) return 'No Vimeo Video ID Set';
    371     $id=$content;
    372     if(!empty($atts)){
    373         $atts=$this->attributefix($atts);
    374         $autoplay=($atts['autoplay']==='yes') ? '&amp;autoplay=1' : '';
    375         $id=(preg_match('~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix',$atts['url'],$match)) ? $match[1] : false;
    376         $height=(isset($atts['height'])&&is_numeric($atts['height'])) ? $atts['height'] : '325';
    377         $width=(isset($atts['width'])&&is_numeric($atts['width'])) ? $atts['width'] : '400';
    378     }
    379     return '<iframe width="'.$atts['width'].'" height="'.$atts['height'].'" src="//player.vimeo.com/video/'.$id.'?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
    380 }
    381 function shortcode_youtube($atts=array(),$content=NULL){
    382     if(''===$content) return 'No YouTube Video ID Set';
    383     $id=$content;
    384     if(!empty($atts)){
    385         $atts=$this->attributefix($atts);
    386         $autoplay=($atts['autoplay']==='yes') ? '?autoplay=1' : '';
    387         $id=(preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i',$atts['url'],$match)) ? $match[1] : false;
    388         $height=(isset($atts['height'])&&is_numeric($atts['height'])) ? $atts['height'] : '325';
    389         $width=(isset($atts['width'])&&is_numeric($atts['width'])) ? $atts['width'] : '400';
    390     }
    391     return '<iframe width="'.$atts['width'].'" height="'.$atts['height'].'" src="http://www.youtube.com/embed/'.$id.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
    392 }
    393 
    394 //Misc
    395 function shortcode_clientip($atts=array(),$content=NULL){
    396     return $_SERVER['REMOTE_ADDR'];
    397 }
    398 function shortcode_hr($atts=array(),$content=NULL){
    399     return '<hr />';
    400 }
    401 function shortcode_note($atts=array(),$content=NULL){
    402     if(NULL===$content) return '';
    403     return '<!--'.$content.'-->';
    404 }
    405 function shortcode_useragent($atts=array(),$content=NULL){
    406     return $_SERVER['HTTP_USER_AGENT'];
    407 }
    408 
    409 //Hide and Display Content
    410 function shortcode_spoiler($atts=array(),$content=NULL){
    411     if(NULL===$content) return '';
    412     if(''===$atts) return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler: </strong><input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>';
    413     $attribs=implode(" ",$atts);
    414     $subattribs=substr($attribs, 1);
    415     return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler</strong> for <em>'. $subattribs .'</em> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>';
    416 }
    417 function shortcode_guest($atts=array(),$content=NULL){
    418     if(NULL===$content || is_user_logged_in()) return '';
    419     return '<div>'.$this->do_shortcode($content).'</div>';
    420 }
    421 function shortcode_user($atts=array(),$content=NULL){
    422     if(NULL===$content || !is_user_logged_in()) return '';
    423     return '<div>'.$this->do_shortcode($content).'</div>';
    424 }
    425 }
    426 ?>
     1<?php class BBCode {
     2
     3    public $use_whitelist = false;
     4    function __construct() {
     5        if (!function_exists('add_shortcode')) { return; }
     6        // Shortcode Protection
     7        add_shortcode('c', 'skip_enclosed_shortcodes');
     8        add_shortcode('codegroup', 'skip_enclosed_shortcodes');
     9        add_shortcode('css', 'skip_enclosed_shortcodes');
     10        add_shortcode('html', 'skip_enclosed_shortcodes');
     11        add_shortcode('ignore', 'skip_enclosed_shortcodes');
     12        add_shortcode('ignore-code', 'skip_enclosed_shortcodes');
     13        add_shortcode('ignore_code', 'skip_enclosed_shortcodes');
     14        add_shortcode('json', 'skip_enclosed_shortcodes');
     15        add_shortcode('lua', 'skip_enclosed_shortcodes');
     16        add_shortcode('matlab', 'skip_enclosed_shortcodes');
     17        add_shortcode('md', 'skip_enclosed_shortcodes');
     18        add_shortcode('no-highlight', 'skip_enclosed_shortcodes');
     19        add_shortcode('raw', 'skip_enclosed_shortcodes');
     20        add_shortcode('shell', 'skip_enclosed_shortcodes');
     21        add_shortcode('sql', 'skip_enclosed_shortcodes');
     22        add_shortcode('xml', 'skip_enclosed_shortcodes');
     23        if (function_exists('tiny_mce_before_init')) { add_action('tiny_mce_before_init', 'tinymce_skip_enclosed_shortcodes'); }
     24        // Formatting + Style
     25        add_shortcode('b', array(&$this, 'shortcode_bold'));
     26        add_shortcode('B', array(&$this, 'shortcode_bold'));
     27        add_shortcode('bold', array(&$this, 'shortcode_bold'));
     28        add_shortcode('BOLD', array(&$this, 'shortcode_bold'));
     29        add_shortcode('strong', array(&$this, 'shortcode_bold'));
     30        add_shortcode('STRONG', array(&$this, 'shortcode_bold'));
     31        add_shortcode('center', array(&$this, 'shortcode_center'));
     32        add_shortcode('CENTER', array(&$this, 'shortcode_center'));
     33        add_shortcode('color', array(&$this, 'shortcode_color'));
     34        add_shortcode('COLOR', array(&$this, 'shortcode_color'));
     35        add_shortcode('del', array(&$this, 'shortcode_del'));
     36        add_shortcode('DEL', array(&$this, 'shortcode_del'));
     37        add_shortcode('i', array(&$this, 'shortcode_italics'));
     38        add_shortcode('I', array(&$this, 'shortcode_italics'));
     39        add_shortcode('italic', array(&$this, 'shortcode_italics'));
     40        add_shortcode('ITALIC', array(&$this, 'shortcode_italics'));
     41        add_shortcode('em', array(&$this, 'shortcode_italics'));
     42        add_shortcode('EM', array(&$this, 'shortcode_italics'));
     43        add_shortcode('justify', array(&$this, 'shortcode_justify'));
     44        add_shortcode('JUSTIFY', array(&$this, 'shortcode_justify'));
     45        add_shortcode('left', array(&$this, 'shortcode_left'));
     46        add_shortcode('LEFT', array(&$this, 'shortcode_left'));
     47        add_shortcode('bdo', array(&$this, 'shortcode_reverse'));
     48        add_shortcode('BDO', array(&$this, 'shortcode_reverse'));
     49        add_shortcode('reverse', array(&$this, 'shortcode_reverse'));
     50        add_shortcode('REVERSE', array(&$this, 'shortcode_reverse'));
     51        add_shortcode('right', array(&$this, 'shortcode_right'));
     52        add_shortcode('RIGHT', array(&$this, 'shortcode_right'));
     53        add_shortcode('size', array(&$this, 'shortcode_size'));
     54        add_shortcode('SIZE', array(&$this, 'shortcode_size'));
     55        add_shortcode('s', array(&$this, 'shortcode_strikethrough'));
     56        add_shortcode('S', array(&$this, 'shortcode_strikethrough'));
     57        add_shortcode('strike', array(&$this, 'shortcode_strikethrough'));
     58        add_shortcode('STRIKE', array(&$this, 'shortcode_strikethrough'));
     59        add_shortcode('sub', array(&$this, 'shortcode_subscript'));
     60        add_shortcode('SUB', array(&$this, 'shortcode_subscript'));
     61        add_shortcode('sup', array(&$this, 'shortcode_superscript'));
     62        add_shortcode('SUP', array(&$this, 'shortcode_superscript'));
     63        add_shortcode('u', array(&$this, 'shortcode_underline'));
     64        add_shortcode('U', array(&$this, 'shortcode_underline'));
     65        add_shortcode('underline', array(&$this, 'shortcode_underline'));
     66        add_shortcode('UNDERLINE', array(&$this, 'shortcode_underline'));
     67        // Quotes
     68        add_shortcode('q', array(&$this, 'shortcode_quote'));
     69        add_shortcode('q-0', array(&$this, 'shortcode_quote'));
     70        add_shortcode('q-1', array(&$this, 'shortcode_quote'));
     71        add_shortcode('q-2', array(&$this, 'shortcode_quote'));
     72        add_shortcode('q-3', array(&$this, 'shortcode_quote'));
     73        add_shortcode('q-4', array(&$this, 'shortcode_quote'));
     74        add_shortcode('q-5', array(&$this, 'shortcode_quote'));
     75        add_shortcode('q-6', array(&$this, 'shortcode_quote'));
     76        add_shortcode('q-7', array(&$this, 'shortcode_quote'));
     77        add_shortcode('q-8', array(&$this, 'shortcode_quote'));
     78        add_shortcode('q-9', array(&$this, 'shortcode_quote'));
     79        add_shortcode('q-10', array(&$this, 'shortcode_quote'));
     80        add_shortcode('Q', array(&$this, 'shortcode_quote'));
     81        add_shortcode('Q-0', array(&$this, 'shortcode_quote'));
     82        add_shortcode('Q-1', array(&$this, 'shortcode_quote'));
     83        add_shortcode('Q-2', array(&$this, 'shortcode_quote'));
     84        add_shortcode('Q-3', array(&$this, 'shortcode_quote'));
     85        add_shortcode('Q-4', array(&$this, 'shortcode_quote'));
     86        add_shortcode('Q-5', array(&$this, 'shortcode_quote'));
     87        add_shortcode('Q-6', array(&$this, 'shortcode_quote'));
     88        add_shortcode('Q-7', array(&$this, 'shortcode_quote'));
     89        add_shortcode('Q-8', array(&$this, 'shortcode_quote'));
     90        add_shortcode('Q-9', array(&$this, 'shortcode_quote'));
     91        add_shortcode('Q-10', array(&$this, 'shortcode_quote'));
     92        add_shortcode('quote', array(&$this, 'shortcode_quote'));
     93        add_shortcode('quote-0', array(&$this, 'shortcode_quote'));
     94        add_shortcode('quote-1', array(&$this, 'shortcode_quote'));
     95        add_shortcode('quote-2', array(&$this, 'shortcode_quote'));
     96        add_shortcode('quote-3', array(&$this, 'shortcode_quote'));
     97        add_shortcode('quote-4', array(&$this, 'shortcode_quote'));
     98        add_shortcode('quote-5', array(&$this, 'shortcode_quote'));
     99        add_shortcode('quote-6', array(&$this, 'shortcode_quote'));
     100        add_shortcode('quote-7', array(&$this, 'shortcode_quote'));
     101        add_shortcode('quote-8', array(&$this, 'shortcode_quote'));
     102        add_shortcode('quote-9', array(&$this, 'shortcode_quote'));
     103        add_shortcode('quote-10', array(&$this, 'shortcode_quote'));
     104        add_shortcode('quote-11', array(&$this, 'shortcode_quote'));
     105        add_shortcode('quote-12', array(&$this, 'shortcode_quote'));
     106        add_shortcode('quote-13', array(&$this, 'shortcode_quote'));
     107        add_shortcode('quote-14', array(&$this, 'shortcode_quote'));
     108        add_shortcode('quote-15', array(&$this, 'shortcode_quote'));
     109        add_shortcode('quote-16', array(&$this, 'shortcode_quote'));
     110        add_shortcode('quote-17', array(&$this, 'shortcode_quote'));
     111        add_shortcode('quote-18', array(&$this, 'shortcode_quote'));
     112        add_shortcode('quote-19', array(&$this, 'shortcode_quote'));
     113        add_shortcode('quote-20', array(&$this, 'shortcode_quote'));
     114        add_shortcode('quote-21', array(&$this, 'shortcode_quote'));
     115        add_shortcode('quote-22', array(&$this, 'shortcode_quote'));
     116        add_shortcode('quote-23', array(&$this, 'shortcode_quote'));
     117        add_shortcode('quote-24', array(&$this, 'shortcode_quote'));
     118        add_shortcode('quote-25', array(&$this, 'shortcode_quote'));
     119        add_shortcode('quote-26', array(&$this, 'shortcode_quote'));
     120        add_shortcode('quote-27', array(&$this, 'shortcode_quote'));
     121        add_shortcode('quote-28', array(&$this, 'shortcode_quote'));
     122        add_shortcode('quote-29', array(&$this, 'shortcode_quote'));
     123        add_shortcode('quote-30', array(&$this, 'shortcode_quote'));
     124        add_shortcode('quote-31', array(&$this, 'shortcode_quote'));
     125        add_shortcode('quote-32', array(&$this, 'shortcode_quote'));
     126        add_shortcode('quote-33', array(&$this, 'shortcode_quote'));
     127        add_shortcode('quote-34', array(&$this, 'shortcode_quote'));
     128        add_shortcode('quote-35', array(&$this, 'shortcode_quote'));
     129        add_shortcode('quote-36', array(&$this, 'shortcode_quote'));
     130        add_shortcode('quote-37', array(&$this, 'shortcode_quote'));
     131        add_shortcode('quote-38', array(&$this, 'shortcode_quote'));
     132        add_shortcode('quote-39', array(&$this, 'shortcode_quote'));
     133        add_shortcode('quote-40', array(&$this, 'shortcode_quote'));
     134        add_shortcode('quote-41', array(&$this, 'shortcode_quote'));
     135        add_shortcode('quote-42', array(&$this, 'shortcode_quote'));
     136        add_shortcode('quote-43', array(&$this, 'shortcode_quote'));
     137        add_shortcode('quote-44', array(&$this, 'shortcode_quote'));
     138        add_shortcode('quote-45', array(&$this, 'shortcode_quote'));
     139        add_shortcode('quote-46', array(&$this, 'shortcode_quote'));
     140        add_shortcode('quote-47', array(&$this, 'shortcode_quote'));
     141        add_shortcode('quote-48', array(&$this, 'shortcode_quote'));
     142        add_shortcode('quote-49', array(&$this, 'shortcode_quote'));
     143        add_shortcode('QUOTE', array(&$this, 'shortcode_quote'));
     144        add_shortcode('QUOTE-0', array(&$this, 'shortcode_quote'));
     145        add_shortcode('QUOTE-1', array(&$this, 'shortcode_quote'));
     146        add_shortcode('QUOTE-2', array(&$this, 'shortcode_quote'));
     147        add_shortcode('QUOTE-3', array(&$this, 'shortcode_quote'));
     148        add_shortcode('QUOTE-4', array(&$this, 'shortcode_quote'));
     149        add_shortcode('QUOTE-5', array(&$this, 'shortcode_quote'));
     150        add_shortcode('QUOTE-6', array(&$this, 'shortcode_quote'));
     151        add_shortcode('QUOTE-7', array(&$this, 'shortcode_quote'));
     152        add_shortcode('QUOTE-8', array(&$this, 'shortcode_quote'));
     153        add_shortcode('QUOTE-9', array(&$this, 'shortcode_quote'));
     154        add_shortcode('QUOTE-10', array(&$this, 'shortcode_quote'));
     155        add_shortcode('cite', array(&$this, 'shortcode_cite'));
     156        add_shortcode('CITE', array(&$this, 'shortcode_cite'));
     157        // Code
     158        add_shortcode('code', array(&$this, 'shortcode_code'));
     159        add_shortcode('CODE', array(&$this, 'shortcode_code'));
     160        add_shortcode('kbd', array(&$this, 'shortcode_kbd'));
     161        add_shortcode('KBD', array(&$this, 'shortcode_kbd'));
     162        add_shortcode('key', array(&$this, 'shortcode_kbd'));
     163        add_shortcode('KEY', array(&$this, 'shortcode_kbd'));
     164        add_shortcode('keyboard', array(&$this, 'shortcode_kbd'));
     165        add_shortcode('KEYBOARD', array(&$this, 'shortcode_kbd'));
     166        // Lists
     167        add_shortcode('ol', array(&$this, 'shortcode_orderedlist'));
     168        add_shortcode('OL', array(&$this, 'shortcode_orderedlist'));
     169        add_shortcode('ul', array(&$this, 'shortcode_unorderedlist'));
     170        add_shortcode('UL', array(&$this, 'shortcode_unorderedlist'));
     171        add_shortcode('list', array(&$this, 'shortcode_unorderedlist'));
     172        add_shortcode('LIST', array(&$this, 'shortcode_unorderedlist'));
     173        add_shortcode('li', array(&$this, 'shortcode_listitem'));
     174        add_shortcode('LI', array(&$this, 'shortcode_listitem'));
     175        // Tables
     176        add_shortcode('table', array(&$this, 'shortcode_table'));
     177        add_shortcode('TABLE', array(&$this, 'shortcode_table'));
     178        add_shortcode('thead', array(&$this, 'shortcode_thead'));
     179        add_shortcode('THEAD', array(&$this, 'shortcode_thead'));
     180        add_shortcode('tbody', array(&$this, 'shortcode_tbody'));
     181        add_shortcode('TBODY', array(&$this, 'shortcode_tbody'));
     182        add_shortcode('tfoot', array(&$this, 'shortcode_tfoot'));
     183        add_shortcode('TFOOT', array(&$this, 'shortcode_tfoot'));
     184        add_shortcode('th', array(&$this, 'shortcode_th'));
     185        add_shortcode('TH', array(&$this, 'shortcode_th'));
     186        add_shortcode('tr', array(&$this, 'shortcode_tr'));
     187        add_shortcode('TR', array(&$this, 'shortcode_tr'));
     188        add_shortcode('td', array(&$this, 'shortcode_td'));
     189        add_shortcode('TD', array(&$this, 'shortcode_td'));
     190        // Links and Images
     191        add_shortcode('email', array(&$this, 'shortcode_email'));
     192        add_shortcode('EMAIL', array(&$this, 'shortcode_email'));
     193        add_shortcode('tel', array(&$this, 'shortcode_telephone'));
     194        add_shortcode('TEL', array(&$this, 'shortcode_telephone'));
     195        add_shortcode('img', array(&$this, 'shortcode_image'));
     196        add_shortcode('IMG', array(&$this, 'shortcode_image'));
     197        add_shortcode('url', array(&$this, 'shortcode_url'));
     198        add_shortcode('URL', array(&$this, 'shortcode_url'));
     199        add_shortcode('link', array(&$this, 'shortcode_url'));
     200        add_shortcode('LINK', array(&$this, 'shortcode_url'));
     201        // Videos and Audio
     202        add_shortcode('freesound', array(&$this, 'shortcode_freesound'));
     203        add_shortcode('FREESOUND', array(&$this, 'shortcode_freesound'));
     204        add_shortcode('gvideo', array(&$this, 'shortcode_gvideo'));
     205        add_shortcode('GVIDEO', array(&$this, 'shortcode_gvideo'));
     206        add_shortcode('vimeo', array(&$this, 'shortcode_vimeo'));
     207        add_shortcode('VIMEO', array(&$this, 'shortcode_vimeo'));
     208        add_shortcode('youtube', array(&$this, 'shortcode_youtube'));
     209        add_shortcode('YOUTUBE', array(&$this, 'shortcode_youtube'));
     210        // Special/Miscellaneous Content
     211        add_shortcode('abbr', array(&$this, 'shortcode_abbr'));
     212        add_shortcode('ABBR', array(&$this, 'shortcode_abbr'));
     213        add_shortcode('acronym', array(&$this, 'shortcode_abbr'));
     214        add_shortcode('ACRONYM', array(&$this, 'shortcode_abbr'));
     215        add_shortcode('ip', array(&$this, 'shortcode_clientip'));
     216        add_shortcode('IP', array(&$this, 'shortcode_clientip'));
     217        add_shortcode('hr', array(&$this, 'shortcode_hr'));
     218        add_shortcode('HR', array(&$this, 'shortcode_hr'));
     219        add_shortcode('note', array(&$this, 'shortcode_note'));
     220        add_shortcode('NOTE', array(&$this, 'shortcode_note'));
     221        add_shortcode('useragent', array(&$this, 'shortcode_useragent'));
     222        add_shortcode('USERAGENT', array(&$this, 'shortcode_useragent'));
     223        // Hide and Display Content
     224        add_shortcode('spoiler', array(&$this, 'shortcode_spoiler'));
     225        add_shortcode('SPOILER', array(&$this, 'shortcode_spoiler'));
     226        add_shortcode('user', array(&$this, 'shortcode_user'));
     227        add_shortcode('USER', array(&$this, 'shortcode_user'));
     228        add_shortcode('guest', array(&$this, 'shortcode_guest'));
     229        add_shortcode('GUEST', array(&$this, 'shortcode_guest'));
     230        $this->use_whitelist = false;
     231        if (function_exists('bbp_whitelist_do_shortcode')) { $this->use_whitelist = true; }
     232    }
     233
     234    function do_shortcode($content) {
     235        if (function_exists('bbp_whitelist_do_shortcode')) { return bbp_whitelist_do_shortcode($content); }
     236        else { return do_shortcode($content); }
     237    }
     238
     239    function attributefix($atts = array()) {
     240        if (empty($atts[0])) { return $atts; }
     241        if (0 !== preg_match('#=("|\')(.*?)("|\')#', $atts[0], $match)) { $atts[0] = $match[2]; }
     242        return $atts;
     243    }
     244
     245
     246    // SHORTCODES //
     247
     248
     249    // Shortcode Protection
     250
     251    function skip_enclosed_shortcodes($atts, $content = null) {
     252        return $content;
     253    }
     254
     255    function tinymce_skip_enclosed_shortcodes($datainput) {
     256        $datainput['protect'] = "[/\<\?php[\s\S]*?\?\>/g, /\[insert_php\][\s\S]*?\[\/insert_php\]/g, /\[ignore_code\][\s\S]*?\[\/ignore_code\]/g]";
     257        return $datainput;
     258    }
     259
     260    // Formatting + Style
     261
     262    function shortcode_bold($atts = array(), $content = null) {
     263        if (null === $content) { return ''; }
     264        return '<strong>'.$this->do_shortcode($content).'</strong>';
     265    }
     266
     267    function shortcode_center($atts = array(), $content = null) {
     268        if (null === $content) { return ''; }
     269        return '<span style="text-align:center">'.$this->do_shortcode($content).'</span>';
     270    }
     271
     272    function shortcode_color($atts = array(), $content = null) {
     273        if (null === $content || '' === $atts) { return ''; }
     274        $color = substr(implode('', $atts), 1);
     275        if (ctype_xdigit($color)) { $color = '#'.$color; }
     276        return '<span style="color:'.$color.'">'.$this->do_shortcode($content).'</span>';
     277    }
     278
     279    function shortcode_del($atts = array(), $content = null) {
     280        if (null === $content) { return ''; }
     281        return '<del>'.$this->do_shortcode($content).'</del>';
     282    }
     283
     284    function shortcode_italics($atts = array(), $content = null) {
     285        if (null === $content) { return ''; }
     286        return '<em>'.$this->do_shortcode($content).'</em>';
     287    }
     288
     289    function shortcode_justify($atts = array(), $content = null) {
     290        if (null === $content) { return ''; }
     291        return '<span style="text-align:justify">'.$this->do_shortcode($content).'</span>';
     292    }
     293
     294    function shortcode_left($atts = array(), $content = null) {
     295        if (null === $content) { return ''; }
     296        return '<span style="text-align:left">'.$this->do_shortcode($content).'</span>';
     297    }
     298
     299    function shortcode_reverse($atts = array(), $content = null) {
     300        if (null === $content) { return ''; }
     301        return '<bdo dir="rtl">'.$this->do_shortcode($content).'</bdo>';
     302    }
     303
     304    function shortcode_right($atts = array(), $content = null) {
     305        if (null === $content) { return ''; }
     306        return '<span style="text-align:right">'.$this->do_shortcode($content).'</span>';
     307    }
     308
     309    function shortcode_size($atts = array(), $content = null) {
     310        if (null === $content || '' === $atts) { return ''; }
     311        $subattribs = substr(implode('', $atts), 1);
     312        return '<span style="font-size:'.$subattribs.'px">'.$this->do_shortcode($content).'</span>';
     313    }
     314
     315    function shortcode_strikethrough($atts = array(), $content = null) {
     316        if (null === $content) { return ''; }
     317        return '<s>'.$this->do_shortcode($content).'</s>';
     318    }
     319
     320    function shortcode_subscript($atts = array(), $content = null) {
     321        if (null === $content) { return ''; }
     322        return '<sub>'.$this->do_shortcode($content).'</sub>';
     323    }
     324
     325    function shortcode_superscript($atts = array(), $content = null) {
     326        if (null === $content) { return ''; }
     327        return '<sup>'.$this->do_shortcode($content).'</sup>';
     328    }
     329
     330    function shortcode_underline($atts = array(), $content = null) {
     331        if (null === $content) { return ''; }
     332        return '<span style="text-decoration:underline">'.$this->do_shortcode($content).'</span>';
     333    }
     334
     335
     336    // Quotes
     337
     338    function shortcode_quote($atts = array(), $content = null) {
     339        global $bp;
     340        global $bbp;
     341        $css_classes = array('bbcode-quote');
     342        if ($content === null) { return ''; }
     343        elseif (empty($atts)){
     344            return '<div class="'.implode(' ',$css_classes).'"><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
     345        } else {
     346            $name = trim(array_shift($atts), '="');
     347            $css_classes[] = 'bbcode-quote-'.$name;
     348            $user = get_user_by('login',$name);
     349            if (false !== $user){
     350                $css_classes[] = 'bbcode-quote-user';
     351                if (function_exists('bp_is_active')) { $name = '<a href="'.site_url().'/members/'.$user->user_login.'">'.$user->display_name.'</a>'; }
     352                elseif ('bbPress' === get_class($bbp)) { $name = '<a href="'.site_url().'?bbp_user='.$user->ID.'">'.$user->display_name.'</a>'; }
     353                else { $name = $user->display_name; }
     354            }
     355            return '<div class="'.implode(' ', $css_classes).'"><strong>'.$name.' wrote: </strong><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
     356        }
     357    }
     358
     359    function shortcode_cite($atts = array(), $content = null) {
     360        if (null === $content) { return ''; }
     361        return '<cite>'.$this->do_shortcode($content).'</cite>';
     362    }
     363
     364    // Code
     365
     366    function shortcode_code($atts = array(), $content = null) {
     367        if (null === $content) { return ''; }
     368        return '<code>'.$this->do_shortcode($content).'</code>';
     369    }
     370
     371    function shortcode_kbd($atts = array(), $content = null) {
     372        if (null === $content) { return ''; }
     373        return '<kbd>'.$this->do_shortcode($content).'</kbd>';
     374    }
     375
     376    // Lists
     377
     378    function shortcode_orderedlist($atts = array(), $content = null) {
     379        if (null === $content) { return ''; }
     380        return '<ol>'.$this->do_shortcode($content).'</ol>';
     381    }
     382
     383    function shortcode_unorderedlist($atts = array(), $content = null) {
     384        if (null === $content) { return ''; }
     385        return '<ul>'.$this->do_shortcode($content).'</ul>';
     386    }
     387
     388    function shortcode_listitem($atts = array(), $content = null) {
     389        if (null === $content) { return ''; }
     390        return '<li>'.$this->do_shortcode($content).'</li>';
     391    }
     392
     393    // Tables
     394
     395    function shortcode_table($atts = array(), $content = null) {
     396        if (null === $content) { return ''; }
     397        return '<table>'.$this->do_shortcode($content).'</table>';
     398    }
     399
     400    function shortcode_thead($atts = array(), $content = null) {
     401        if (null === $content) { return ''; }
     402        return '<thead>'.$this->do_shortcode($content).'</thead>';
     403    }
     404
     405    function shortcode_tbody($atts = array(), $content = null) {
     406        if (null === $content) { return ''; }
     407        return '<tbody>'.$this->do_shortcode($content).'</tbody>';
     408    }
     409
     410    function shortcode_tfoot($atts = array(), $content = null) {
     411        if (null === $content) { return ''; }
     412        return '<tfoot>'.$this->do_shortcode($content).'</tfoot>';
     413    }
     414
     415    function shortcode_th($atts = array(), $content = null) {
     416        if (null === $content) { return ''; }
     417        return '<th>'.$this->do_shortcode($content).'</th>';
     418    }
     419
     420    function shortcode_tr($atts = array(), $content = null) {
     421        if (null === $content) { return ''; }
     422        return '<tr>'.$this->do_shortcode($content).'</tr>';
     423    }
     424
     425    function shortcode_td($atts = array(), $content = null) {
     426        if (null === $content) { return ''; }
     427        return '<td>'.$this->do_shortcode($content).'</td>';
     428    }
     429
     430    // Links and Images
     431
     432    function shortcode_email($atts = array(), $content = null) {
     433        if (empty($atts)) {  // [email][email protected][/email]
     434            $url = $content;
     435        } else {  // [[email protected]]text[/email] or [email="[email protected]"]text[/email]
     436            $atts = $this->attributefix($atts);
     437            $url = trim(array_shift($atts), '="');
     438        }
     439        if (empty($url)) { return ''; }
     440        $url = str_replace(' at ', '@', str_replace('  ', ' ', $url));
     441        return '<a href="mailto:'.$url.'">'.$this->do_shortcode($content).'</a>';
     442    }
     443
     444    function shortcode_telephone($atts = array(), $content = null) {
     445        if (empty($atts)) {  // [tel]123-456-7890[/tel]
     446            $phone = $content;
     447        } else {  // [tel=123-456-7890]text[/tel] or [tel="123-456-7890"]text[/tel]
     448            $atts = $this->attributefix($atts);
     449            $phone = trim(array_shift($atts), '="');
     450        }
     451        if (empty($phone)) { return ''; }
     452        $phone = $phone.replace('-', '').replace('.', '').replace('+', '');
     453        return '<a href="tel:'.$phone.'">'.$this->do_shortcode($content).'</a>';
     454    }
     455
     456    function shortcode_image($atts = array(), $content = null) {
     457        if (null === $content) { return ''; }
     458        $alt = '';
     459        if (!empty($atts)) { $alt = trim(implode(' ', $atts ), '="'); }  //  [img=alttext]imageurl[/img]
     460        return '<img src="'.$content.'" alt="'.$alt.'" title="'.$alt.' />';
     461    }
     462
     463    function shortcode_url($atts = array(), $content = null) {
     464        if (empty($atts)) {  //  [url]http://www.example.com/[/url]
     465            $url = $text = $content;
     466        } else {  // [url=http://www.example.com/]text[/url] or [url="http://www.example.com/"]text[/url]
     467            $atts = $this->attributefix($atts);
     468            $url = trim(array_shift($atts), '="');
     469        }
     470        if (empty($url)) { return ''; }
     471        if (empty($text)) { $text=$url; }
     472        return '<a href="'.$url.'">'.$this->do_shortcode($content).'</a>';
     473    }
     474
     475    // Videos and Audio
     476
     477    function shortcode_freesound($atts = array(), $content = null) {
     478        if ('' === $content) { return 'No Freesound Audio ID Set'; }
     479        if (empty($atts)) {  // [freesound]164929[/freesound]
     480            $size = 'medium';
     481        } else {  // [freesound=large]164929[/freesound] or [freesound=small]164929[/freesound]
     482            $size = $this->attributefix($atts);
     483            $size = trim(array_shift($size), '="');
     484        }
     485        $vidID = $content;
     486        switch ($size) {
     487            case 'big':
     488            case 'large':
     489            case 'l':
     490                return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$vidID.'/simple/large/" width="920" height="245"></iframe>';
     491            case 'little':
     492            case 'short':
     493            case 'small':
     494            case 's':
     495                return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$vidID.'/simple/small/" width="375" height="30"></iframe>';
     496            case 'mid':
     497            case 'medium':
     498            case 'm':
     499            default:
     500                return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$vidID.'/simple/medium/" width="481" height="86"></iframe>';
     501        }
     502    }
     503
     504    function shortcode_gvideo($atts = array(), $content = null) {
     505        if ('' === $content) { return 'No Google Video ID Set'; }
     506        $vidID = $content;
     507        return '<embed style="width:400px;height:325px" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId='.$vidID.'&hl=en"></embed>';
     508    }
     509
     510    function shortcode_vimeo($atts = array(), $content = null) {
     511        if ('' === $content) { return 'No Vimeo Video ID Set'; }
     512        $vidID = $content;
     513        $height = '325';
     514        $width = '400';
     515        if (!empty($atts)){
     516            $atts = $this->attributefix($atts);
     517            $autoplay = $atts['autoplay'] === 'yes' ? '&amp;autoplay=1' : '';
     518            $vidID = (preg_match('~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match)) ? $match[1] : false;
     519            $height = (isset($atts['height']) && is_numeric($atts['height'])) ? $atts['height'] : '325';
     520            $width = (isset($atts['width']) && is_numeric($atts['width'])) ? $atts['width'] : '400';
     521        }
     522        return '<iframe width="'.$width.'" height="'.$height.'" src="//player.vimeo.com/video/'.$vidID.'?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
     523    }
     524
     525    function shortcode_youtube($atts = array(), $content = null) {
     526        if ('' === $content) { return 'No YouTube Video ID Set'; }
     527        $vidID = $content;
     528        $height = '325';
     529        $width = '400';
     530        if (!empty($atts)){
     531            $atts = $this->attributefix($atts);
     532            $autoplay = $atts['autoplay'] === 'yes' ? '?autoplay=1' : '';
     533            $vidID = (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $atts['url'], $match)) ? $match[1] : false;
     534            $height = (isset($atts['height']) && is_numeric($atts['height'])) ? $atts['height'] : '325';
     535            $width = (isset($atts['width']) && is_numeric($atts['width'])) ? $atts['width'] : '400';
     536        }
     537        return '<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$vidID.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
     538    }
     539
     540    // Special/Miscellaneous Content
     541
     542    function shortcode_abbr($atts = array(), $content = null) {
     543        if (null === $content || !isset($atts['title'])) { return ''; }
     544        $atts = $this->attributefix($atts);
     545        return '<abbr title="'.$atts['title'].'">'.$this->do_shortcode($content).'</abbr>';
     546    }
     547
     548    function shortcode_clientip($atts = array(), $content = null) {
     549        return $_SERVER['REMOTE_ADDR'];
     550    }
     551
     552    function shortcode_hr($atts = array(), $content = null) {
     553        return '<hr/>';
     554    }
     555
     556    function shortcode_note($atts = array(), $content = null) {
     557        if (null === $content) { return ''; }
     558        return '<!--'.$content.'-->';
     559    }
     560
     561    function shortcode_useragent($atts = array(), $content = null) {
     562        return $_SERVER['HTTP_USER_AGENT'];
     563    }
     564
     565    // Hide and Display Content
     566
     567    function shortcode_spoiler($atts = array(), $content = null) {
     568        if ($content === null) { return ''; }
     569        if ($atts === '') { return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler: </strong><input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>'; }
     570        $subattribs = substr(implode(' ', $atts), 1);
     571        return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler</strong> for <em>'. $subattribs .'</em> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>';
     572    }
     573
     574    function shortcode_guest($atts = array(), $content = null) {
     575        if ($content === null || is_user_logged_in()) { return ''; }
     576        return '<div>'.$this->do_shortcode($content).'</div>';
     577    }
     578
     579    function shortcode_user($atts = array(), $content = null) {
     580        if ($content === null || !is_user_logged_in()) { return ''; }
     581        return '<div>'.$this->do_shortcode($content).'</div>';
     582    }
     583
     584}?>
  • bbcode-deluxe/tags/2019.02.23/options-form-template.php

    r1256906 r2037928  
    1 <div class="wrap"><h2>BBCode Deluxe</h2>
    2 <p>BBCode (Bulletin Board Code) is a lightweight markup language used as an alternative to HTML for formatting. <a href="http://www.bbcode.org/reference.php">http://www.bbcode.org/reference.php</a></p>
    3 <?php if($whitelist_enabled) {
    4     if($bbcodes_active){ ?>
    5 <p>BBCodes are enabled and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated. Users should be able to use BBCodes in blogs, comments, and forums.</p>
     1<div class="wrap">
     2    <h1>BBCode Deluxe</h1>
     3    <p>BBCode (Bulletin Board Code) is a lightweight markup language used as an alternative to HTML for formatting. <a href="http://www.bbcode.org/reference.php">http://www.bbcode.org/reference.php</a></p>
     4    <?php if ($whitelist_enabled) {
     5        if ($bbcodes_active) { ?>
     6            <p>BBCodes are enabled and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated. Users should be able to use BBCodes in blogs, comments, and forums.</p>
     7        <?php } else { ?>
     8            <p>BBCodes are installed and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated. However, it seems that BBCode Deluxe needs to be added to the whitelist settings. However, if some BBcodes are included in the manual whitelist, then those BBCodes should work.</p>
     9        <?php } ?>
    610    <?php } else { ?>
    7 <p>BBCodes are installed and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated.  However, it seems that BBCode Deluxe needs to be added to the whitelist settings. However, if some BBcodes are included in the manual whitelist, then those BBCodes should work.</p>
     11        <p>BBCodes are enabled and working in the forums. However, to be safe, install the <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> to stop unsafe shortcodes like <code>[bbp-register]</code> from being used.</p>
    812    <?php } ?>
    9 <?php } else { ?>
    10 <p>BBCodes are enabled and working in the forums. However, to be safe, install the <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> to stop unsafe shortcodes like <code>[bbp-register]</code> from being used.</p>
    11 <?php } ?>
    12 <div><h3 id="extras">Extras</h3>
    13 <h4>Your Info</h4><ul>
    14 <li>HTTP_USER_AGENT - <?php echo $_SERVER['HTTP_USER_AGENT'];?></li>
    15 <li>REMOTE_ADDR - <?php echo $_SERVER['REMOTE_ADDR'];?></li>
    16 <li>REMOTE_HOST - <?php echo ((!empty($_SERVER['REMOTE_HOST'])) ? $_SERVER['REMOTE_HOST'] : 'Your web server must be configured to create this variable. For instance, Apache needs <code>HostnameLookups On</code> in <em>httpd.conf</em>.');?></li>
    17 <li>REMOTE_PORT - <?php echo $_SERVER['REMOTE_PORT'];?></li>
    18 <li>REQUEST_METHOD - <?php echo $_SERVER['REQUEST_METHOD'];?></li>
    19 <li>HTTP_REFERER - <?php echo ((!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'No referer found.');?></li>
    20 </ul>
    21 <h4>Server's Info</h4><ul>
    22 <li>SERVER_NAME - <?php echo $_SERVER['SERVER_NAME'];?></li>
    23 <li>SERVER_ADDR - <?php echo $_SERVER['SERVER_ADDR'];?></li>
    24 <li>SERVER_PORT - <?php echo $_SERVER['SERVER_PORT'];?></li>
    25 <li>SERVER_SOFTWARE - <?php echo $_SERVER['SERVER_SOFTWARE'];?></li>
    26 <li>SERVER_PROTOCOL - <?php echo $_SERVER['SERVER_PROTOCOL'];?></li>
    27 </ul>
     13    <br/>
     14    <h2 id="extras">Information</h2>
     15    <div>
     16        <h3>Your Info</h3>
     17        <table>
     18            <tbody>
     19                <tr><td>User Agent</td><td><?php echo $_SERVER['HTTP_USER_AGENT']; ?></td></tr>
     20                <tr><td>Referrer</td><td><?php echo ((!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'No referer found.'); ?></td></tr>
     21                <tr><td>Request Method</td><td><?php echo $_SERVER['REQUEST_METHOD']; ?></td></tr>
     22                <tr><td>Remote Address</td><td><?php echo $_SERVER['REMOTE_ADDR']; ?></td></tr>
     23                <tr><td>Remote Host</td><td><?php echo ((!empty($_SERVER['REMOTE_HOST'])) ? $_SERVER['REMOTE_HOST'] : 'Your web server must be configured to create this variable. For instance, Apache needs <code>HostnameLookups On</code> in <em>httpd.conf</em>.'); ?></td></tr>
     24                <tr><td>Remote Port</td><td><?php echo $_SERVER['REMOTE_PORT']; ?></td></tr>
     25            </tbody>
     26        </table>
     27    </div>
     28    <br/>
     29    <div>
     30        <h3>Server's Info</h3>
     31        <table>
     32            <tbody>
     33                <tr><td>Server Name</td><td><?php echo $_SERVER['SERVER_NAME']; ?></td></tr>
     34                <tr><td>Server Address</td><td><?php echo $_SERVER['SERVER_ADDR']; ?></td></tr>
     35                <tr><td>Server Port</td><td><?php echo $_SERVER['SERVER_PORT']; ?></td></tr>
     36                <tr><td>Server Software</td><td><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td></tr>
     37                <tr><td>Server Protocol</td><td><?php echo $_SERVER['SERVER_PROTOCOL']; ?></td></tr>
     38                <tr><td>OS Family</td><td><?php echo PHP_OS_FAMILY; ?></td></tr>
     39                <tr><td>OS</td><td><?php echo PHP_OS; ?></td></tr>
     40                <tr><td>Uname</td><td><?php echo php_uname('a'); ?></td></tr>
     41                <tr><td>Default Charset</td><td><?php echo ini_get('default_charset'); ?></td></tr>
     42                <tr><td>PHP Version</td><td><?php echo PHP_VERSION; ?></td></tr>
     43                <tr><td>PHP Version ID</td><td><?php echo PHP_VERSION_ID; ?></td></tr>
     44                <tr><td>PHP Release Version</td><td><?php echo PHP_RELEASE_VERSION; ?></td></tr>
     45                <tr><td>PHP SAPI Name</td><td><?php echo php_sapi_name(); ?></td></tr>
     46                <tr><td>Memory Usage</td><td><?php echo memory_get_usage(true); ?></td></tr>
     47                <tr><td>Peak Memory Usage</td><td><?php echo memory_get_peak_usage(true); ?></td></tr>
     48                <tr><td>Debug</td><td><?php echo PHP_DEBUG; ?></td></tr>
     49                <tr><td>File Descriptor Size</td><td><?php echo PHP_FD_SETSIZE; ?></td></tr>
     50                <tr><td>Register Globals</td><td><?php echo ini_get('register_globals'); ?></td></tr>
     51                <tr><td>EOL</td><td><?php echo PHP_EOL; ?></td></tr>
     52                <tr><td>Directory Separator</td><td><?php echo DIRECTORY_SEPARATOR; ?></td></tr>
     53                <tr><td>Path Separator</td><td><?php echo PATH_SEPARATOR; ?></td></tr>
     54                <tr><td>Shared Library Suffix</td><td><?php echo PHP_SHLIB_SUFFIX; ?></td></tr>
     55                <tr><td>INT Max</td><td><?php echo PHP_INT_MAX; ?></td></tr>
     56                <tr><td>PHP Binary Directory</td><td><?php echo PHP_BINDIR ; ?></td></tr>
     57                <tr><td>Current Directory Name</td><td><?php echo dirname(__FILE__); ?></td></tr>
     58            </tbody>
     59        </table>
     60    </div>
     61    <div>
     62        <h3>Loaded Extensions</h3>
     63        <ul><?php
     64            $conf_array = get_loaded_extensions();
     65            foreach ($conf_array as $val_pair) {
     66                echo '<li>'.strval($val_pair).'</li>';
     67            }
     68        ?></ul>
     69    </div>
    2870</div>
    29 </div>
  • bbcode-deluxe/tags/2019.02.23/readme.txt

    r1724540 r2037928  
    22Contributors: DevynCJohnson
    33Donate link: http://dcjtech.info/donations/
    4 Tags: bbpress, bbpress2, bbpress-plugin, bbcode, shortcode, forum, html5, markup
     4Tags: bbcode, bbpress, buddypress, bbpress-plugin, bbpress2, forum, html5, information, markup, nested-quotes, php-version, server-info, shortcode
    55Requires at least: 3.9
    6 Tested up to: 4.9.1
     6Tested up to: 5.1
    77Stable tag: trunk
    88License: GPLv3
     
    1313== Description ==
    1414
    15 BBCode Deluxe adds BBCode markup (and other shortcodes) to Wordpress and BBPress. These BBCodes create HTML5 tags, so be sure that your site supports HTML5.
     15BBCode Deluxe adds BBCode markup (and other shortcodes) to Wordpress and BBPress. These BBCodes create HTML5 tags, so be sure that your site supports HTML5. The plugin also creates a backend page that provides the administrator with information about the server including the version of PHP being used. Go to http://dcjtech.info/html-and-shortcodes-formatting/ to see a live demonstration of this plugin in use.
     16
     17This plugin also supports nested `[quote]` shortcodes such as `[quote]Outer Quote[quote]Inner Quote[quote]Deep Quote[/quote][/quote][/quote]`.
     18
     19BBCode Deluxe works perfectly fine with Enlighter (by Andi Dittrich) as long as you set Enlighter's priority to "12".
    1620
    1721* Plugin Name: BBCode Deluxe
    1822* Plugin URI: https://wordpress.org/plugins/bbcode-deluxe/
    1923* Description: Adds support for BBCode to Wordpress and BBPress
    20 * Version: 2017.09.04
     24* Version: 2019.02.23
    2125* Author: Devyn Collier Johnson (DevynCJohnson)
    2226* Author URI: http://dcjtech.info/
     
    2529* License URI: http://www.gnu.org/licenses/gpl-3.0.html
    2630
    27 This plugin includes code from the below listed developers and their plugins.
     31This plugin includes code that derives from the below listed developers and their plugins.
    2832
    2933* Copyright (C) 2013 Anton Channing ("Video and Audio BBCodes" and "bbPress2 BBCode")
     
    3337Feel free to submit suggestions, bug reports, concerns, etc. to me. If a user donates more than twenty USD to my PayPal account, then I will give that user my phone-number to allow the user to call me for bug reports, suggestions, help, concerns, etc.
    3438
    35 The BBCodes can be typed in all lowercase or all uppercase, but the opening and closing BBCodes must match. For instance, `[b]bold[/b] = [B]bold[/B]`.
     39The BBCodes can be typed in all lowercase or all uppercase, but the opening and closing BBCodes must match. For instance, `[b]bold[/b] == [B]bold[/B]`.
     40
     41As for attributes, BBCodes that only except one attribute at most can be written in one of two formats - `[abbr="HyperText Markup Language"]HTML[/abbr]` or `[abbr title="HyperText Markup Language"]HTML[/abbr]`.
    3642
    3743`*Inline Styling*
     
    5763Gvideo: [gvideo]ID[/gvideo]
    5864Image: [img]http://dcjtech.info/DCJTech_128.jpg[/img] [img img=DCJTech Logo]http://dcjtech.info/DCJTech_128.jpg[/img]
    59 URL: [url]http://dcjtech.info/[/url] [url url=http://dcjtech.info/]DCJTech[/url]
     65Telephone: [tel [email protected]]text[/tel] [tel][email protected][/tel]
     66URL: [url]http://dcjtech.info/[/url] [url=http://dcjtech.info/]DCJTech[/url]
    6067Vimeo: [vimeo]ID[/vimeo]
    6168Youtube: [youtube]ID[/youtube]
    6269
    63 *Quotes and Code*
    64 Abbreviation: [abbr title="HyperText Markup Language"]HTML[/abbr]
     70*Quotes*
    6571Cite: [cite]Relevant source[/cite]
     72Quote: [quote]KISS - Keep It Simple, Stupid[/quote]
     73Quote (NAME): [quote quote=NAME]Life is what you make of it[/quote] [quote="NAME"]Persistance is the main ingredient for success[/quote]
     74Quote (author=NAME): [quote author=NAME]Quitters never succeed, and successors never quit[/quote] [quote author="Martin Jones"]Kissing arses is pointless. However, knowing whose arse to kiss and whose to kick and when is priceless.[/quote]
     75
     76*Code*
    6677Computer Code: [code]function HelloWorld($greet = 'World') { return 'Hello '.$greet } [/code]
    6778Keyboard Keys: [kbd]Ctrl[/kbd]+[kbd]S[/kbd] [keyboard]Ctrl[/keyboard]+[keyboard]S[/keyboard]
    68 Quote: [quote]KISS - Keep It Simple, Stupid[/quote]
    69 Quote (NAME): [quote quote=NAME]Life is what you make of it[/quote] [quote quote="NAME"]Persistance is the main ingredient for success[/quote]
    70 Quote (author=NAME): [quote author=NAME]Quitters never succeed, and successors never quit[/quote] [quote author="Martin Jones"]Kissing arses is pointless. However, knowing whose arse to kiss and whose to kick and when is priceless.[/quote]
    7179
    72 *Lists and Tables*
     80*Lists*
    7381Ordered Lists: [ol][li]Ordered-list[/li][/ol]
    7482Unordered Lists: [ul][li]Unordered-list[/li][/ul]
     83
     84*Tables*
    7585Table: [table]
    7686Thead: [thead]
     
    8191td: [td]
    8292
    83 *Special Content*
     93*Special/Miscellaneous Content*
     94Abbreviation: [abbr title="HyperText Markup Language"]HTML[/abbr]
    8495Client IP: [ip/]
     96Horizontal Ruler (Line): [hr/]
     97
     98*Hide and Display Content*
    8599Contents appear to registered users: [user]This is a secret message[/user]
    86100Contents appear to non-registered users: [guest]Login to see less ads and content hidden from guests. (CODE TO DISPLAY AD)[/guest]
    87 Horizontal Ruler (Line): [hr/]
    88101Spoiler: [spoiler]Surprise![/spoiler]
    89102Spoiler (Named): [spoiler spoiler=one plus one]is 10 (in binary)[/spoiler]
     
    1151282. Activate the plugin through the "Plugins" menu in WordPress
    116129
     130== Conflicting Plugins ==
     131
     132* bbPress2 BBCode
     133* Enlighter - BBCode Deluxe works perfectly fine with Enlighter as long as you set Enlighter's priority to "12"
     134* Ignore Code
     135* Outerbridge Nested Shortcodes
     136* Video and Audio BBCodes
     137
    117138== Screenshots ==
    118139
     
    129150
    130151== Changelog ==
     152= 2019.02.23 =
     153* Optimizations
     154* Bug fixes
     155* Added `[tel]` shortcode for creating telephone links
     156* Added `[ignore]`, `[ignore-code]`, and `[ignore_code]` shortcodes for ignoring/protecting enclosed code and shortcodes
     157* Added support for BuddyPress
     158* Added additional information to the admin control/settings page for this plugin (including the PHP version)
     159* Fixed nesting issue (thanks to Robert Chipperfield and his website http://www.sqlservercentral.com/ for reporting the bug)
    131160= 2016.09.04 =
    132161* Minor Changes
  • bbcode-deluxe/trunk/bbcode-admin.php

    r1256906 r2037928  
    1 <?php function bbcode_deluxe_plugin_menu(){add_options_page('BBCode Deluxe','BBCode Deluxe','manage_options','bbcode-deluxe','bbcode_deluxe_plugin_options');}
    2 add_action('admin_menu','bbcode_deluxe_plugin_menu');
    3 function bbcode_deluxe_plugin_options(){
    4 global $bbp_sc_whitelist;
    5 if(!current_user_can('manage_options')){
    6     echo '<div><p>No options currently available.</p></div>';
    7 } else {
    8     $bbcodes_active=true;
    9     $whitelist_enabled=is_plugin_active('bbpress2-shortcode-whitelist/bbpress2-shortcode-whitelist.php');
    10     if($whitelist_enabled){
    11         $enabled_plugins=get_option('bbpscwl_enabled_plugins');
    12         if($enabled_plugins==='') $enabled_plugins=array();
    13         else $enabled_plugins=unserialize($enabled_plugins);
    14         $bbcodes_active=false;
    15         foreach($enabled_plugins as $plugin_tag){
    16             if($plugin_tag==='bbpress-bbcode') $bbcodes_active=true;
     1<?php
     2
     3function bbcode_deluxe_plugin_menu() { add_options_page('BBCode Deluxe', 'BBCode Deluxe', 'manage_options', 'bbcode-deluxe', 'bbcode_deluxe_plugin_options'); }
     4
     5add_action('admin_menu', 'bbcode_deluxe_plugin_menu');
     6
     7function bbcode_deluxe_plugin_options() {
     8    global $bbp_sc_whitelist;
     9    if (is_admin() && current_user_can('manage_options')) {
     10        $bbcodes_active = true;
     11        $whitelist_enabled = is_plugin_active('bbpress2-shortcode-whitelist/bbpress2-shortcode-whitelist.php');
     12        if ($whitelist_enabled) {
     13            $enabled_plugins = get_option('bbpscwl_enabled_plugins');
     14            if ($enabled_plugins === '') { $enabled_plugins = array(); }
     15            else { $enabled_plugins = unserialize($enabled_plugins); }
     16            $bbcodes_active = false;
     17            foreach ($enabled_plugins as $plugin_tag) {
     18                if ($plugin_tag === 'bbpress-bbcode') { $bbcodes_active = true; }
     19            }
    1720        }
    18     }
    19     require(dirname(__FILE__).'/options-form-template.php');
     21        require(dirname(__FILE__).'/options-form-template.php');
     22    } else { echo '<div><p>No options currently available.</p></div>'; }
    2023}
    21 }?>
     24
     25?>
  • bbcode-deluxe/trunk/bbcode-deluxe.php

    r1724542 r2037928  
    22Plugin Name: BBCode Deluxe
    33Plugin URI: http://dcjtech.info/
    4 Description: Adds support for BBCode to Wordpress and BBPress.
    5 Version: 2017.09.04
     4Description: Adds support for BBCode to Wordpress and BBPress
     5Version: 2019.02.23
    66Author: Devyn Collier Johnson (DevynCJohnson)
    77Author URI: http://dcjtech.info/
     
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1010This plugin includes code from the below listed developers and their plugins.
    11 Copyright (C) 2013 Anton Channing (Video and Audio BBCodes and bbPress2 BBCode)
     11Copyright (C) 2013 Anton Channing ("Video and Audio BBCodes" and "bbPress2 BBCode")
    1212Copyright (C) 2010 b0ingBall (b0ingBall BBCode plugin)
    1313Copyright (C) 2008 Viper007Bond (the original BBCode plugin)
     
    1515"BBCode Deluxe" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
    1616"BBCode Deluxe" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    17 You should have received a copy of the GNU General Public License along with "BBCode Deluxe". If not, see <http://www.gnu.org/licenses/>.*/
    18 defined('ABSPATH') or die('Invalid Entrance!');
     17You should have received a copy of the GNU General Public License along with "BBCode Deluxe". If not, see <http://www.gnu.org/licenses/>.
     18*/
     19
     20
     21function quote_exempt_from_wptexturize($shortcodes) {
     22    $shortcodes = ['quote', 'q', 'QUOTE', 'Q'];
     23    return $shortcodes;
     24}
     25
     26
     27function code_exempt_from_wptexturize($shortcodes) {
     28    $shortcodes = ['no-highlight', 'pre', 'raw'];
     29    return $shortcodes;
     30}
     31
     32
     33function nested_quotes($content, $not_used = false) {
     34    $counter = 0;
     35    $tag_counter_string = '';
     36    $content = preg_replace('/[\n\r]/', '', $content);
     37    $content = str_replace('', '', $content);
     38    $content = str_replace('[quote', '[', $content);
     39    $content = str_replace('[/quote]', '[/]', $content);
     40    $pos = strpos($content, '[/]');
     41    while ($pos !== false) {
     42        $content = preg_replace('/(?<=\[)([^]*?)(?=\[\/\])/u', '[]$0[/]', $content, 1);
     43        $tag_counter_string = 'quote-'.strval($counter);
     44        $content = str_replace('[]', $tag_counter_string, $content);
     45        $content = str_replace('][/', $tag_counter_string, $content);
     46        ++$counter;
     47        $pos = strpos($content, '[/]');
     48    }
     49    $content = str_replace('', "\n", $content);
     50    return $content;
     51}
     52
     53
     54defined('ABSPATH') or die('Invalid entrance into the plugin BBCode Deluxe!');
     55add_filter('no_texturize_shortcodes', 'code_exempt_from_wptexturize');
     56add_filter('no_texturize_shortcodes', 'quote_exempt_from_wptexturize');
     57add_filter('the_content', 'nested_quotes', 9);
     58add_filter('the_content', 'do_shortcode', 11);
     59add_filter('widget_text', 'do_shortcode', 11);
     60if (function_exists('get_comment_text')) { add_filter('get_comment_text', 'do_shortcode', 11); }
     61if (function_exists('bbp_get_topic_content')) { add_filter('bbp_get_topic_content', 'do_shortcode', 11); }
     62if (function_exists('bbp_get_reply_content')) { add_filter('bbp_get_reply_content', 'do_shortcode', 11); }
     63if (function_exists('bp_get_activity_content_body')) { add_filter('bp_get_activity_content_body', 'do_shortcode', 11); }
     64if (function_exists('bp_get_the_topic_post_content')) { add_filter('bp_get_the_topic_post_content', 'do_shortcode', 11); }
     65if (function_exists('bp_get_the_thread_message_content')) { add_filter('bp_get_the_thread_message_content', 'do_shortcode', 11); }
    1966require_once(dirname(__FILE__).'/bbcode-admin.php');
    2067require_once(dirname(__FILE__).'/class-bbcode.php');
    21 add_action('plugins_loaded',function(){global $BBCode; $BBCode = new BBCode();},14);
     68add_action('plugins_loaded', function() { global $BBCode; $BBCode = new BBCode(); }, 14);
     69
    2270?>
  • bbcode-deluxe/trunk/class-bbcode.php

    r1314018 r2037928  
    1 <?php class BBCode{
    2 public $use_whitelist=false;
    3 function __construct(){
    4     if(!function_exists('add_shortcode')) return;
    5     //Formatting+Style
    6     add_shortcode('b',array(&$this,'shortcode_bold'));
    7     add_shortcode('B',array(&$this,'shortcode_bold'));
    8     add_shortcode('bold',array(&$this,'shortcode_bold'));
    9     add_shortcode('BOLD',array(&$this,'shortcode_bold'));
    10     add_shortcode('strong',array(&$this,'shortcode_bold'));
    11     add_shortcode('STRONG',array(&$this,'shortcode_bold'));
    12     add_shortcode('center',array(&$this,'shortcode_center'));
    13     add_shortcode('CENTER',array(&$this,'shortcode_center'));
    14     add_shortcode('color',array(&$this,'shortcode_color'));
    15     add_shortcode('COLOR',array(&$this,'shortcode_color'));
    16     add_shortcode('del',array(&$this,'shortcode_del'));
    17     add_shortcode('DEL',array(&$this,'shortcode_del'));
    18     add_shortcode('i',array(&$this,'shortcode_italics'));
    19     add_shortcode('I',array(&$this,'shortcode_italics'));
    20     add_shortcode('italic',array(&$this,'shortcode_italics'));
    21     add_shortcode('ITALIC',array(&$this,'shortcode_italics'));
    22     add_shortcode('em',array(&$this,'shortcode_italics'));
    23     add_shortcode('EM',array(&$this,'shortcode_italics'));
    24     add_shortcode('justify',array(&$this,'shortcode_justify'));
    25     add_shortcode('JUSTIFY',array(&$this,'shortcode_justify'));
    26     add_shortcode('left',array(&$this,'shortcode_left'));
    27     add_shortcode('LEFT',array(&$this,'shortcode_left'));
    28     add_shortcode('bdo',array(&$this,'shortcode_reverse'));
    29     add_shortcode('BDO',array(&$this,'shortcode_reverse'));
    30     add_shortcode('reverse',array(&$this,'shortcode_reverse'));
    31     add_shortcode('REVERSE',array(&$this,'shortcode_reverse'));
    32     add_shortcode('right',array(&$this,'shortcode_right'));
    33     add_shortcode('RIGHT',array(&$this,'shortcode_right'));
    34     add_shortcode('size',array(&$this,'shortcode_size'));
    35     add_shortcode('SIZE',array(&$this,'shortcode_size'));
    36     add_shortcode('s',array(&$this,'shortcode_strikethrough'));
    37     add_shortcode('S',array(&$this,'shortcode_strikethrough'));
    38     add_shortcode('strike',array(&$this,'shortcode_strikethrough'));
    39     add_shortcode('STRIKE',array(&$this,'shortcode_strikethrough'));
    40     add_shortcode('sub',array(&$this,'shortcode_subscript'));
    41     add_shortcode('SUB',array(&$this,'shortcode_subscript'));
    42     add_shortcode('sup',array(&$this,'shortcode_superscript'));
    43     add_shortcode('SUP',array(&$this,'shortcode_superscript'));
    44     add_shortcode('u',array(&$this,'shortcode_underline'));
    45     add_shortcode('U',array(&$this,'shortcode_underline'));
    46     add_shortcode('underline',array(&$this,'shortcode_underline'));
    47     add_shortcode('UNDERLINE',array(&$this,'shortcode_underline'));
    48     //Code and Quotes
    49     add_shortcode('q',array(&$this,'shortcode_quote'));
    50     add_shortcode('Q',array(&$this,'shortcode_quote'));
    51     add_shortcode('quote',array(&$this,'shortcode_quote'));
    52     add_shortcode('QUOTE',array(&$this,'shortcode_quote'));
    53     add_shortcode('cite',array(&$this,'shortcode_cite'));
    54     add_shortcode('CITE',array(&$this,'shortcode_cite'));
    55     add_shortcode('abbr',array(&$this,'shortcode_abbr'));
    56     add_shortcode('ABBR',array(&$this,'shortcode_abbr'));
    57     add_shortcode('acronym',array(&$this,'shortcode_abbr'));
    58     add_shortcode('ACRONYM',array(&$this,'shortcode_abbr'));
    59     add_shortcode('code',array(&$this,'shortcode_code'));
    60     add_shortcode('CODE',array(&$this,'shortcode_code'));
    61     add_shortcode('kbd',array(&$this,'shortcode_kbd'));
    62     add_shortcode('KBD',array(&$this,'shortcode_kbd'));
    63     add_shortcode('key',array(&$this,'shortcode_kbd'));
    64     add_shortcode('KEY',array(&$this,'shortcode_kbd'));
    65     add_shortcode('keyboard',array(&$this,'shortcode_kbd'));
    66     add_shortcode('KEYBOARD',array(&$this,'shortcode_kbd'));
    67     //Lists and Tables
    68     add_shortcode('ol',array(&$this,'shortcode_orderedlist'));
    69     add_shortcode('OL',array(&$this,'shortcode_orderedlist'));
    70     add_shortcode('ul',array(&$this,'shortcode_unorderedlist'));
    71     add_shortcode('UL',array(&$this,'shortcode_unorderedlist'));
    72     add_shortcode('list',array(&$this,'shortcode_unorderedlist'));
    73     add_shortcode('LIST',array(&$this,'shortcode_unorderedlist'));
    74     add_shortcode('li',array(&$this,'shortcode_listitem'));
    75     add_shortcode('LI',array(&$this,'shortcode_listitem'));
    76     add_shortcode('table',array(&$this,'shortcode_table'));
    77     add_shortcode('TABLE',array(&$this,'shortcode_table'));
    78     add_shortcode('thead',array(&$this,'shortcode_thead'));
    79     add_shortcode('THEAD',array(&$this,'shortcode_thead'));
    80     add_shortcode('tbody',array(&$this,'shortcode_tbody'));
    81     add_shortcode('TBODY',array(&$this,'shortcode_tbody'));
    82     add_shortcode('tfoot',array(&$this,'shortcode_tfoot'));
    83     add_shortcode('TFOOT',array(&$this,'shortcode_tfoot'));
    84     add_shortcode('th',array(&$this,'shortcode_th'));
    85     add_shortcode('TH',array(&$this,'shortcode_th'));
    86     add_shortcode('tr',array(&$this,'shortcode_tr'));
    87     add_shortcode('TR',array(&$this,'shortcode_tr'));
    88     add_shortcode('td',array(&$this,'shortcode_td'));
    89     add_shortcode('TD',array(&$this,'shortcode_td'));
    90     //Links and Images
    91     add_shortcode('email',array(&$this,'shortcode_email'));
    92     add_shortcode('EMAIL',array(&$this,'shortcode_email'));
    93     add_shortcode('img',array(&$this,'shortcode_image'));
    94     add_shortcode('IMG',array(&$this,'shortcode_image'));
    95     add_shortcode('url',array(&$this,'shortcode_url'));
    96     add_shortcode('URL',array(&$this,'shortcode_url'));
    97     add_shortcode('link',array(&$this,'shortcode_url'));
    98     add_shortcode('LINK',array(&$this,'shortcode_url'));
    99     //Videos and Audio
    100     add_shortcode('freesound',array(&$this,'shortcode_freesound'));
    101     add_shortcode('FREESOUND',array(&$this,'shortcode_freesound'));
    102     add_shortcode('gvideo',array(&$this,'shortcode_gvideo'));
    103     add_shortcode('GVIDEO',array(&$this,'shortcode_gvideo'));
    104     add_shortcode('vimeo',array(&$this,'shortcode_vimeo'));
    105     add_shortcode('VIMEO',array(&$this,'shortcode_vimeo'));
    106     add_shortcode('youtube',array(&$this,'shortcode_youtube'));
    107     add_shortcode('YOUTUBE',array(&$this,'shortcode_youtube'));
    108     //Misc
    109     add_shortcode('ip',array(&$this,'shortcode_clientip'));
    110     add_shortcode('IP',array(&$this,'shortcode_clientip'));
    111     add_shortcode('hr',array(&$this,'shortcode_hr'));
    112     add_shortcode('HR',array(&$this,'shortcode_hr'));
    113     add_shortcode('note',array(&$this,'shortcode_note'));
    114     add_shortcode('NOTE',array(&$this,'shortcode_note'));
    115     add_shortcode('useragent',array(&$this,'shortcode_useragent'));
    116     add_shortcode('USERAGENT',array(&$this,'shortcode_useragent'));
    117     //Hide and Display Content
    118     add_shortcode('spoiler',array(&$this,'shortcode_spoiler'));
    119     add_shortcode('SPOILER',array(&$this,'shortcode_spoiler'));
    120     add_shortcode('user',array(&$this,'shortcode_user'));
    121     add_shortcode('USER',array(&$this,'shortcode_user'));
    122     add_shortcode('guest',array(&$this,'shortcode_guest'));
    123     add_shortcode('GUEST',array(&$this,'shortcode_guest'));
    124     if(function_exists('bbp_whitelist_do_shortcode')){
    125         $this->use_whitelist=true;
    126     } else {
    127         $this->use_whitelist=false;
    128         //Add all shortcodes to -
    129         add_filter('get_comment_text','do_shortcode',14);//forum topics
    130         add_filter('bbp_get_reply_content','do_shortcode',14);//forum replies
    131         //add_filter('bp_get_activity_content_body','do_shortcode', 1);//activity stream
    132         //add_filter('bp_get_the_topic_post_content','do_shortcode');//group forum posts
    133         //add_filter('bp_get_the_thread_message_content','do_shortcode');//private messages
    134     }
    135 }
    136 function do_shortcode($content){
    137     if(function_exists('bbp_whitelist_do_shortcode')){return bbp_whitelist_do_shortcode($content);}
    138     else {return do_shortcode($content);}
    139 }
    140 function attributefix($atts=array()){
    141     if(empty($atts[0])) return $atts;
    142     if(0!==preg_match('#=("|\')(.*?)("|\')#',$atts[0],$match))
    143         $atts[0]=$match[2];
    144     return $atts;
    145 }
    146 
    147 //SHORTCODES//
    148 //Formatting+Style
    149 function shortcode_bold($atts=array(),$content=NULL){
    150     if(NULL===$content) return '';
    151     return '<strong>'.$this->do_shortcode($content).'</strong>';
    152 }
    153 function shortcode_center($atts=array(),$content=NULL){
    154     if(NULL===$content) return '';
    155     return '<span style="text-align:center">'.$this->do_shortcode($content).'</span>';
    156 }
    157 function shortcode_color($atts=array(),$content=NULL){
    158     if(NULL===$content||''===$atts) return '';
    159     $attribs=implode('',$atts);
    160     $color=substr ($attribs, 1);
    161     if(ctype_xdigit($color))
    162         $color = '#'.$color;
    163     return '<span style="color:'.$color.'">'.$this->do_shortcode($content).'</span>';
    164 }
    165 function shortcode_del($atts=array(),$content=NULL){
    166     if(NULL===$content) return '';
    167     return '<del>'.$this->do_shortcode($content).'</del>';
    168 }
    169 function shortcode_italics($atts=array(),$content=NULL){
    170     if(NULL===$content) return '';
    171     return '<em>'.$this->do_shortcode($content).'</em>';
    172 }
    173 function shortcode_justify($atts=array(),$content=NULL){
    174     if(NULL===$content) return '';
    175     return '<span style="text-align:justify">'.$this->do_shortcode($content).'</span>';
    176 }
    177 function shortcode_left($atts=array(),$content=NULL){
    178     if(NULL===$content) return '';
    179     return '<span style="text-align:left">'.$this->do_shortcode($content).'</span>';
    180 }
    181 function shortcode_reverse($atts=array(),$content=NULL){
    182     if(NULL===$content) return '';
    183     return '<bdo dir="rtl">'.$this->do_shortcode($content).'</bdo>';
    184 }
    185 function shortcode_right($atts=array(),$content=NULL){
    186     if(NULL===$content) return '';
    187     return '<span style="text-align:right">'.$this->do_shortcode($content).'</span>';
    188 }
    189 function shortcode_size($atts=array(),$content=NULL){
    190     if(NULL===$content||''===$atts) return '';
    191     $attribs = implode('',$atts);
    192     $subattribs = substr ($attribs, 1);
    193     return '<span style="font-size:'.$subattribs.'px">'.$this->do_shortcode($content).'</span>';
    194 }
    195 function shortcode_strikethrough($atts=array(),$content=NULL){
    196     if(NULL===$content) return '';
    197     return '<s>'.$this->do_shortcode($content).'</s>';
    198 }
    199 function shortcode_subscript($atts=array(),$content=NULL){
    200     if(NULL===$content) return '';
    201     return '<sub>'.$this->do_shortcode($content).'</sub>';
    202 }
    203 function shortcode_superscript($atts=array(),$content=NULL){
    204     if(NULL===$content) return '';
    205     return '<sup>'.$this->do_shortcode($content).'</sup>';
    206 }
    207 function shortcode_underline($atts=array(),$content=NULL){
    208     if(NULL===$content) return '';
    209     return '<span style="text-decoration:underline">'.$this->do_shortcode($content).'</span>';
    210 }
    211 
    212 //Code and Quotes
    213 function shortcode_quote($atts=array(),$content=NULL){
    214     global $bp;global $bbp;
    215     $css_classes=array('bbcode-quote');
    216     if(NULL===$content) return '';
    217     if(empty($atts)){
    218         return '<div class="'.implode(' ',$css_classes).'"><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
    219     } else {
    220         $name=trim(array_shift($atts),'="');
    221         $css_classes[]='bbcode-quote-'.$name;
    222         $user=get_user_by('login',$name);
    223         if(false!==$user){
    224             $css_classes[]='bbcode-quote-user';
    225             if(function_exists('bp_is_active')) $name = '<a href="'.site_url().'/members/'.$user->user_login.'">'.$user->display_name.'</a>';
    226             elseif ('bbPress'===get_class($bbp)) $name='<a href="'.site_url().'?bbp_user='.$user->ID.'">'.$user->display_name.'</a>';
    227             else $name=$user->display_name;
    228         }
    229         If(''!==$subattribs) return '<div class="'.implode(' ',$css_classes).'"><strong>'.$name.' wrote: </strong><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
    230     }
    231 }
    232 function shortcode_cite($atts=array(),$content=NULL){
    233     if(NULL===$content) return '';
    234     return '<cite>'.$this->do_shortcode($content).'</cite>';
    235 }
    236 function shortcode_abbr($atts=array(),$content=NULL){
    237     if(NULL===$content) return '';
    238     if(!isset($atts['title'])) return '';
    239     $atts=$this->attributefix($atts);
    240     return '<abbr title="'.$atts['title'].'">'.$this->do_shortcode($content).'</abbr>';
    241 }
    242 function shortcode_code($atts=array(),$content=NULL){
    243     if(NULL===$content) return '';
    244     return '<code>'.$this->do_shortcode($content).'</code>';
    245 }
    246 function shortcode_kbd($atts=array(),$content=NULL){
    247     if(NULL===$content) return '';
    248     return '<kbd>'.$this->do_shortcode($content).'</kbd>';
    249 }
    250 
    251 //Lists and Tables
    252 function shortcode_orderedlist($atts=array(),$content=NULL){
    253     if(NULL===$content) return '';
    254     return '<ol>'.$this->do_shortcode($content).'</ol>';
    255 }
    256 function shortcode_unorderedlist($atts=array(),$content=NULL){
    257     if(NULL===$content) return '';
    258     return '<ul>'.$this->do_shortcode($content).'</ul>';
    259 }
    260 function shortcode_listitem($atts=array(),$content=NULL){
    261     if(NULL===$content) return '';
    262     return '<li>'.$this->do_shortcode($content).'</li>';
    263 }
    264 function shortcode_table($atts=array(),$content=NULL){
    265     if(NULL===$content) return '';
    266     return '<table>'.$this->do_shortcode($content).'</table>';
    267 }
    268 function shortcode_thead($atts=array(),$content=NULL){
    269     if(NULL===$content) return '';
    270     return '<thead>'.$this->do_shortcode($content).'</thead>';
    271 }
    272 function shortcode_tbody($atts=array(),$content=NULL){
    273     if(NULL===$content) return '';
    274     return '<tbody>'.$this->do_shortcode($content).'</tbody>';
    275 }
    276 function shortcode_tfoot($atts=array(),$content=NULL){
    277     if(NULL===$content) return '';
    278     return '<tfoot>'.$this->do_shortcode($content).'</tfoot>';
    279 }
    280 function shortcode_th($atts=array(),$content=NULL){
    281     if(NULL===$content) return '';
    282     return '<th>'.$this->do_shortcode($content).'</th>';
    283 }
    284 function shortcode_tr($atts=array(),$content=NULL){
    285     if(NULL===$content) return '';
    286     return '<tr>'.$this->do_shortcode($content).'</tr>';
    287 }
    288 function shortcode_td($atts=array(),$content=NULL){
    289     if(NULL===$content) return '';
    290     return '<td>'.$this->do_shortcode($content).'</td>';
    291 }
    292 
    293 //Links and Images
    294 function shortcode_email($atts=array(),$content=NULL){
    295     if(empty($atts)){
    296         //[email][email protected][/email]
    297         $url=$content;$text=$content;
    298     } else {
    299         //[[email protected]]text[/email]
    300         //[email="[email protected]"]text[/email]
    301         $atts=$this->attributefix($atts);
    302         $url=trim(array_shift($atts),'="');
    303     }
    304     if(empty($url)) return '';
    305     if(empty($text)) $text=$url;
    306     return '<a href="mailto:'.$url.'">'.$this->do_shortcode($content).'</a>';
    307 }
    308 function shortcode_image($atts=array(),$content=NULL){
    309     if(NULL===$content) return '';
    310     $alt='';
    311     if(!empty($atts))
    312         $alt=trim(implode(' ',$atts ),'="');
    313     //[img=alttext]imageurl[/img]
    314     return '<img src="'.$content.'" alt="'.$alt.'" title="'.$alt.' />';
    315 }
    316 function shortcode_url($atts=array(),$content=NULL){
    317     if(empty($atts)){
    318         //[url]http://www.example.com/[/url]
    319         $url=$content;$text=$content;
    320     } else {
    321         //[url=http://www.example.com/]text[/url]
    322         //[url="http://www.example.com/"]text[/url]
    323         $atts=$this->attributefix($atts);
    324         $url=trim(array_shift($atts),'="');
    325     }
    326     if(empty($url)) return '';
    327     if(empty($text)) $text=$url;
    328     return '<a href="'.$url.'">'.$this->do_shortcode($content).'</a>';
    329 }
    330 
    331 //Videos and Audio
    332 function shortcode_freesound($atts=array(),$content=NULL){
    333     if(''===$content) return 'No Freesound Audio ID Set';
    334     if(empty($atts)){
    335         //[freesound]164929[/freesound]
    336         $size = 'medium';
    337     } else {
    338         //[freesound=large]164929[/freesound]
    339         //[freesound=small]164929[/freesound]
    340         $size=$this->attributefix($atts);
    341         $size=trim(array_shift($size),'="');
    342     }
    343     $id=$text=$content;
    344     switch($size){
    345         case 'big':
    346         case 'large':
    347         case 'l':
    348             return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$id.'/simple/large/" width="920" height="245"></iframe>';
    349             break;
    350         case 'little':
    351         case 'short':
    352         case 'small':
    353         case 's':
    354             return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$id.'/simple/small/" width="375" height="30"></iframe>';
    355             break;
    356         case 'mid':
    357         case 'medium':
    358         case 'm':
    359         default:
    360             return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$id.'/simple/medium/" width="481" height="86"></iframe>';
    361             break;
    362     }
    363 }
    364 function shortcode_gvideo($atts=array(),$content=NULL){
    365     if(''===$content) return 'No Google Video ID Set';
    366     $id=$text=$content;
    367     return '<embed style="width:400px;height:325px" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId='.$id.'&hl=en"></embed>';
    368 }
    369 function shortcode_vimeo($atts=array(),$content=NULL){
    370     if(''===$content) return 'No Vimeo Video ID Set';
    371     $id=$content;
    372     if(!empty($atts)){
    373         $atts=$this->attributefix($atts);
    374         $autoplay=($atts['autoplay']==='yes') ? '&amp;autoplay=1' : '';
    375         $id=(preg_match('~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix',$atts['url'],$match)) ? $match[1] : false;
    376         $height=(isset($atts['height'])&&is_numeric($atts['height'])) ? $atts['height'] : '325';
    377         $width=(isset($atts['width'])&&is_numeric($atts['width'])) ? $atts['width'] : '400';
    378     }
    379     return '<iframe width="'.$atts['width'].'" height="'.$atts['height'].'" src="//player.vimeo.com/video/'.$id.'?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
    380 }
    381 function shortcode_youtube($atts=array(),$content=NULL){
    382     if(''===$content) return 'No YouTube Video ID Set';
    383     $id=$content;
    384     if(!empty($atts)){
    385         $atts=$this->attributefix($atts);
    386         $autoplay=($atts['autoplay']==='yes') ? '?autoplay=1' : '';
    387         $id=(preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i',$atts['url'],$match)) ? $match[1] : false;
    388         $height=(isset($atts['height'])&&is_numeric($atts['height'])) ? $atts['height'] : '325';
    389         $width=(isset($atts['width'])&&is_numeric($atts['width'])) ? $atts['width'] : '400';
    390     }
    391     return '<iframe width="'.$atts['width'].'" height="'.$atts['height'].'" src="http://www.youtube.com/embed/'.$id.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
    392 }
    393 
    394 //Misc
    395 function shortcode_clientip($atts=array(),$content=NULL){
    396     return $_SERVER['REMOTE_ADDR'];
    397 }
    398 function shortcode_hr($atts=array(),$content=NULL){
    399     return '<hr />';
    400 }
    401 function shortcode_note($atts=array(),$content=NULL){
    402     if(NULL===$content) return '';
    403     return '<!--'.$content.'-->';
    404 }
    405 function shortcode_useragent($atts=array(),$content=NULL){
    406     return $_SERVER['HTTP_USER_AGENT'];
    407 }
    408 
    409 //Hide and Display Content
    410 function shortcode_spoiler($atts=array(),$content=NULL){
    411     if(NULL===$content) return '';
    412     if(''===$atts) return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler: </strong><input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>';
    413     $attribs=implode(" ",$atts);
    414     $subattribs=substr($attribs, 1);
    415     return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler</strong> for <em>'. $subattribs .'</em> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>';
    416 }
    417 function shortcode_guest($atts=array(),$content=NULL){
    418     if(NULL===$content || is_user_logged_in()) return '';
    419     return '<div>'.$this->do_shortcode($content).'</div>';
    420 }
    421 function shortcode_user($atts=array(),$content=NULL){
    422     if(NULL===$content || !is_user_logged_in()) return '';
    423     return '<div>'.$this->do_shortcode($content).'</div>';
    424 }
    425 }
    426 ?>
     1<?php class BBCode {
     2
     3    public $use_whitelist = false;
     4    function __construct() {
     5        if (!function_exists('add_shortcode')) { return; }
     6        // Shortcode Protection
     7        add_shortcode('c', 'skip_enclosed_shortcodes');
     8        add_shortcode('codegroup', 'skip_enclosed_shortcodes');
     9        add_shortcode('css', 'skip_enclosed_shortcodes');
     10        add_shortcode('html', 'skip_enclosed_shortcodes');
     11        add_shortcode('ignore', 'skip_enclosed_shortcodes');
     12        add_shortcode('ignore-code', 'skip_enclosed_shortcodes');
     13        add_shortcode('ignore_code', 'skip_enclosed_shortcodes');
     14        add_shortcode('json', 'skip_enclosed_shortcodes');
     15        add_shortcode('lua', 'skip_enclosed_shortcodes');
     16        add_shortcode('matlab', 'skip_enclosed_shortcodes');
     17        add_shortcode('md', 'skip_enclosed_shortcodes');
     18        add_shortcode('no-highlight', 'skip_enclosed_shortcodes');
     19        add_shortcode('raw', 'skip_enclosed_shortcodes');
     20        add_shortcode('shell', 'skip_enclosed_shortcodes');
     21        add_shortcode('sql', 'skip_enclosed_shortcodes');
     22        add_shortcode('xml', 'skip_enclosed_shortcodes');
     23        if (function_exists('tiny_mce_before_init')) { add_action('tiny_mce_before_init', 'tinymce_skip_enclosed_shortcodes'); }
     24        // Formatting + Style
     25        add_shortcode('b', array(&$this, 'shortcode_bold'));
     26        add_shortcode('B', array(&$this, 'shortcode_bold'));
     27        add_shortcode('bold', array(&$this, 'shortcode_bold'));
     28        add_shortcode('BOLD', array(&$this, 'shortcode_bold'));
     29        add_shortcode('strong', array(&$this, 'shortcode_bold'));
     30        add_shortcode('STRONG', array(&$this, 'shortcode_bold'));
     31        add_shortcode('center', array(&$this, 'shortcode_center'));
     32        add_shortcode('CENTER', array(&$this, 'shortcode_center'));
     33        add_shortcode('color', array(&$this, 'shortcode_color'));
     34        add_shortcode('COLOR', array(&$this, 'shortcode_color'));
     35        add_shortcode('del', array(&$this, 'shortcode_del'));
     36        add_shortcode('DEL', array(&$this, 'shortcode_del'));
     37        add_shortcode('i', array(&$this, 'shortcode_italics'));
     38        add_shortcode('I', array(&$this, 'shortcode_italics'));
     39        add_shortcode('italic', array(&$this, 'shortcode_italics'));
     40        add_shortcode('ITALIC', array(&$this, 'shortcode_italics'));
     41        add_shortcode('em', array(&$this, 'shortcode_italics'));
     42        add_shortcode('EM', array(&$this, 'shortcode_italics'));
     43        add_shortcode('justify', array(&$this, 'shortcode_justify'));
     44        add_shortcode('JUSTIFY', array(&$this, 'shortcode_justify'));
     45        add_shortcode('left', array(&$this, 'shortcode_left'));
     46        add_shortcode('LEFT', array(&$this, 'shortcode_left'));
     47        add_shortcode('bdo', array(&$this, 'shortcode_reverse'));
     48        add_shortcode('BDO', array(&$this, 'shortcode_reverse'));
     49        add_shortcode('reverse', array(&$this, 'shortcode_reverse'));
     50        add_shortcode('REVERSE', array(&$this, 'shortcode_reverse'));
     51        add_shortcode('right', array(&$this, 'shortcode_right'));
     52        add_shortcode('RIGHT', array(&$this, 'shortcode_right'));
     53        add_shortcode('size', array(&$this, 'shortcode_size'));
     54        add_shortcode('SIZE', array(&$this, 'shortcode_size'));
     55        add_shortcode('s', array(&$this, 'shortcode_strikethrough'));
     56        add_shortcode('S', array(&$this, 'shortcode_strikethrough'));
     57        add_shortcode('strike', array(&$this, 'shortcode_strikethrough'));
     58        add_shortcode('STRIKE', array(&$this, 'shortcode_strikethrough'));
     59        add_shortcode('sub', array(&$this, 'shortcode_subscript'));
     60        add_shortcode('SUB', array(&$this, 'shortcode_subscript'));
     61        add_shortcode('sup', array(&$this, 'shortcode_superscript'));
     62        add_shortcode('SUP', array(&$this, 'shortcode_superscript'));
     63        add_shortcode('u', array(&$this, 'shortcode_underline'));
     64        add_shortcode('U', array(&$this, 'shortcode_underline'));
     65        add_shortcode('underline', array(&$this, 'shortcode_underline'));
     66        add_shortcode('UNDERLINE', array(&$this, 'shortcode_underline'));
     67        // Quotes
     68        add_shortcode('q', array(&$this, 'shortcode_quote'));
     69        add_shortcode('q-0', array(&$this, 'shortcode_quote'));
     70        add_shortcode('q-1', array(&$this, 'shortcode_quote'));
     71        add_shortcode('q-2', array(&$this, 'shortcode_quote'));
     72        add_shortcode('q-3', array(&$this, 'shortcode_quote'));
     73        add_shortcode('q-4', array(&$this, 'shortcode_quote'));
     74        add_shortcode('q-5', array(&$this, 'shortcode_quote'));
     75        add_shortcode('q-6', array(&$this, 'shortcode_quote'));
     76        add_shortcode('q-7', array(&$this, 'shortcode_quote'));
     77        add_shortcode('q-8', array(&$this, 'shortcode_quote'));
     78        add_shortcode('q-9', array(&$this, 'shortcode_quote'));
     79        add_shortcode('q-10', array(&$this, 'shortcode_quote'));
     80        add_shortcode('Q', array(&$this, 'shortcode_quote'));
     81        add_shortcode('Q-0', array(&$this, 'shortcode_quote'));
     82        add_shortcode('Q-1', array(&$this, 'shortcode_quote'));
     83        add_shortcode('Q-2', array(&$this, 'shortcode_quote'));
     84        add_shortcode('Q-3', array(&$this, 'shortcode_quote'));
     85        add_shortcode('Q-4', array(&$this, 'shortcode_quote'));
     86        add_shortcode('Q-5', array(&$this, 'shortcode_quote'));
     87        add_shortcode('Q-6', array(&$this, 'shortcode_quote'));
     88        add_shortcode('Q-7', array(&$this, 'shortcode_quote'));
     89        add_shortcode('Q-8', array(&$this, 'shortcode_quote'));
     90        add_shortcode('Q-9', array(&$this, 'shortcode_quote'));
     91        add_shortcode('Q-10', array(&$this, 'shortcode_quote'));
     92        add_shortcode('quote', array(&$this, 'shortcode_quote'));
     93        add_shortcode('quote-0', array(&$this, 'shortcode_quote'));
     94        add_shortcode('quote-1', array(&$this, 'shortcode_quote'));
     95        add_shortcode('quote-2', array(&$this, 'shortcode_quote'));
     96        add_shortcode('quote-3', array(&$this, 'shortcode_quote'));
     97        add_shortcode('quote-4', array(&$this, 'shortcode_quote'));
     98        add_shortcode('quote-5', array(&$this, 'shortcode_quote'));
     99        add_shortcode('quote-6', array(&$this, 'shortcode_quote'));
     100        add_shortcode('quote-7', array(&$this, 'shortcode_quote'));
     101        add_shortcode('quote-8', array(&$this, 'shortcode_quote'));
     102        add_shortcode('quote-9', array(&$this, 'shortcode_quote'));
     103        add_shortcode('quote-10', array(&$this, 'shortcode_quote'));
     104        add_shortcode('quote-11', array(&$this, 'shortcode_quote'));
     105        add_shortcode('quote-12', array(&$this, 'shortcode_quote'));
     106        add_shortcode('quote-13', array(&$this, 'shortcode_quote'));
     107        add_shortcode('quote-14', array(&$this, 'shortcode_quote'));
     108        add_shortcode('quote-15', array(&$this, 'shortcode_quote'));
     109        add_shortcode('quote-16', array(&$this, 'shortcode_quote'));
     110        add_shortcode('quote-17', array(&$this, 'shortcode_quote'));
     111        add_shortcode('quote-18', array(&$this, 'shortcode_quote'));
     112        add_shortcode('quote-19', array(&$this, 'shortcode_quote'));
     113        add_shortcode('quote-20', array(&$this, 'shortcode_quote'));
     114        add_shortcode('quote-21', array(&$this, 'shortcode_quote'));
     115        add_shortcode('quote-22', array(&$this, 'shortcode_quote'));
     116        add_shortcode('quote-23', array(&$this, 'shortcode_quote'));
     117        add_shortcode('quote-24', array(&$this, 'shortcode_quote'));
     118        add_shortcode('quote-25', array(&$this, 'shortcode_quote'));
     119        add_shortcode('quote-26', array(&$this, 'shortcode_quote'));
     120        add_shortcode('quote-27', array(&$this, 'shortcode_quote'));
     121        add_shortcode('quote-28', array(&$this, 'shortcode_quote'));
     122        add_shortcode('quote-29', array(&$this, 'shortcode_quote'));
     123        add_shortcode('quote-30', array(&$this, 'shortcode_quote'));
     124        add_shortcode('quote-31', array(&$this, 'shortcode_quote'));
     125        add_shortcode('quote-32', array(&$this, 'shortcode_quote'));
     126        add_shortcode('quote-33', array(&$this, 'shortcode_quote'));
     127        add_shortcode('quote-34', array(&$this, 'shortcode_quote'));
     128        add_shortcode('quote-35', array(&$this, 'shortcode_quote'));
     129        add_shortcode('quote-36', array(&$this, 'shortcode_quote'));
     130        add_shortcode('quote-37', array(&$this, 'shortcode_quote'));
     131        add_shortcode('quote-38', array(&$this, 'shortcode_quote'));
     132        add_shortcode('quote-39', array(&$this, 'shortcode_quote'));
     133        add_shortcode('quote-40', array(&$this, 'shortcode_quote'));
     134        add_shortcode('quote-41', array(&$this, 'shortcode_quote'));
     135        add_shortcode('quote-42', array(&$this, 'shortcode_quote'));
     136        add_shortcode('quote-43', array(&$this, 'shortcode_quote'));
     137        add_shortcode('quote-44', array(&$this, 'shortcode_quote'));
     138        add_shortcode('quote-45', array(&$this, 'shortcode_quote'));
     139        add_shortcode('quote-46', array(&$this, 'shortcode_quote'));
     140        add_shortcode('quote-47', array(&$this, 'shortcode_quote'));
     141        add_shortcode('quote-48', array(&$this, 'shortcode_quote'));
     142        add_shortcode('quote-49', array(&$this, 'shortcode_quote'));
     143        add_shortcode('QUOTE', array(&$this, 'shortcode_quote'));
     144        add_shortcode('QUOTE-0', array(&$this, 'shortcode_quote'));
     145        add_shortcode('QUOTE-1', array(&$this, 'shortcode_quote'));
     146        add_shortcode('QUOTE-2', array(&$this, 'shortcode_quote'));
     147        add_shortcode('QUOTE-3', array(&$this, 'shortcode_quote'));
     148        add_shortcode('QUOTE-4', array(&$this, 'shortcode_quote'));
     149        add_shortcode('QUOTE-5', array(&$this, 'shortcode_quote'));
     150        add_shortcode('QUOTE-6', array(&$this, 'shortcode_quote'));
     151        add_shortcode('QUOTE-7', array(&$this, 'shortcode_quote'));
     152        add_shortcode('QUOTE-8', array(&$this, 'shortcode_quote'));
     153        add_shortcode('QUOTE-9', array(&$this, 'shortcode_quote'));
     154        add_shortcode('QUOTE-10', array(&$this, 'shortcode_quote'));
     155        add_shortcode('cite', array(&$this, 'shortcode_cite'));
     156        add_shortcode('CITE', array(&$this, 'shortcode_cite'));
     157        // Code
     158        add_shortcode('code', array(&$this, 'shortcode_code'));
     159        add_shortcode('CODE', array(&$this, 'shortcode_code'));
     160        add_shortcode('kbd', array(&$this, 'shortcode_kbd'));
     161        add_shortcode('KBD', array(&$this, 'shortcode_kbd'));
     162        add_shortcode('key', array(&$this, 'shortcode_kbd'));
     163        add_shortcode('KEY', array(&$this, 'shortcode_kbd'));
     164        add_shortcode('keyboard', array(&$this, 'shortcode_kbd'));
     165        add_shortcode('KEYBOARD', array(&$this, 'shortcode_kbd'));
     166        // Lists
     167        add_shortcode('ol', array(&$this, 'shortcode_orderedlist'));
     168        add_shortcode('OL', array(&$this, 'shortcode_orderedlist'));
     169        add_shortcode('ul', array(&$this, 'shortcode_unorderedlist'));
     170        add_shortcode('UL', array(&$this, 'shortcode_unorderedlist'));
     171        add_shortcode('list', array(&$this, 'shortcode_unorderedlist'));
     172        add_shortcode('LIST', array(&$this, 'shortcode_unorderedlist'));
     173        add_shortcode('li', array(&$this, 'shortcode_listitem'));
     174        add_shortcode('LI', array(&$this, 'shortcode_listitem'));
     175        // Tables
     176        add_shortcode('table', array(&$this, 'shortcode_table'));
     177        add_shortcode('TABLE', array(&$this, 'shortcode_table'));
     178        add_shortcode('thead', array(&$this, 'shortcode_thead'));
     179        add_shortcode('THEAD', array(&$this, 'shortcode_thead'));
     180        add_shortcode('tbody', array(&$this, 'shortcode_tbody'));
     181        add_shortcode('TBODY', array(&$this, 'shortcode_tbody'));
     182        add_shortcode('tfoot', array(&$this, 'shortcode_tfoot'));
     183        add_shortcode('TFOOT', array(&$this, 'shortcode_tfoot'));
     184        add_shortcode('th', array(&$this, 'shortcode_th'));
     185        add_shortcode('TH', array(&$this, 'shortcode_th'));
     186        add_shortcode('tr', array(&$this, 'shortcode_tr'));
     187        add_shortcode('TR', array(&$this, 'shortcode_tr'));
     188        add_shortcode('td', array(&$this, 'shortcode_td'));
     189        add_shortcode('TD', array(&$this, 'shortcode_td'));
     190        // Links and Images
     191        add_shortcode('email', array(&$this, 'shortcode_email'));
     192        add_shortcode('EMAIL', array(&$this, 'shortcode_email'));
     193        add_shortcode('tel', array(&$this, 'shortcode_telephone'));
     194        add_shortcode('TEL', array(&$this, 'shortcode_telephone'));
     195        add_shortcode('img', array(&$this, 'shortcode_image'));
     196        add_shortcode('IMG', array(&$this, 'shortcode_image'));
     197        add_shortcode('url', array(&$this, 'shortcode_url'));
     198        add_shortcode('URL', array(&$this, 'shortcode_url'));
     199        add_shortcode('link', array(&$this, 'shortcode_url'));
     200        add_shortcode('LINK', array(&$this, 'shortcode_url'));
     201        // Videos and Audio
     202        add_shortcode('freesound', array(&$this, 'shortcode_freesound'));
     203        add_shortcode('FREESOUND', array(&$this, 'shortcode_freesound'));
     204        add_shortcode('gvideo', array(&$this, 'shortcode_gvideo'));
     205        add_shortcode('GVIDEO', array(&$this, 'shortcode_gvideo'));
     206        add_shortcode('vimeo', array(&$this, 'shortcode_vimeo'));
     207        add_shortcode('VIMEO', array(&$this, 'shortcode_vimeo'));
     208        add_shortcode('youtube', array(&$this, 'shortcode_youtube'));
     209        add_shortcode('YOUTUBE', array(&$this, 'shortcode_youtube'));
     210        // Special/Miscellaneous Content
     211        add_shortcode('abbr', array(&$this, 'shortcode_abbr'));
     212        add_shortcode('ABBR', array(&$this, 'shortcode_abbr'));
     213        add_shortcode('acronym', array(&$this, 'shortcode_abbr'));
     214        add_shortcode('ACRONYM', array(&$this, 'shortcode_abbr'));
     215        add_shortcode('ip', array(&$this, 'shortcode_clientip'));
     216        add_shortcode('IP', array(&$this, 'shortcode_clientip'));
     217        add_shortcode('hr', array(&$this, 'shortcode_hr'));
     218        add_shortcode('HR', array(&$this, 'shortcode_hr'));
     219        add_shortcode('note', array(&$this, 'shortcode_note'));
     220        add_shortcode('NOTE', array(&$this, 'shortcode_note'));
     221        add_shortcode('useragent', array(&$this, 'shortcode_useragent'));
     222        add_shortcode('USERAGENT', array(&$this, 'shortcode_useragent'));
     223        // Hide and Display Content
     224        add_shortcode('spoiler', array(&$this, 'shortcode_spoiler'));
     225        add_shortcode('SPOILER', array(&$this, 'shortcode_spoiler'));
     226        add_shortcode('user', array(&$this, 'shortcode_user'));
     227        add_shortcode('USER', array(&$this, 'shortcode_user'));
     228        add_shortcode('guest', array(&$this, 'shortcode_guest'));
     229        add_shortcode('GUEST', array(&$this, 'shortcode_guest'));
     230        $this->use_whitelist = false;
     231        if (function_exists('bbp_whitelist_do_shortcode')) { $this->use_whitelist = true; }
     232    }
     233
     234    function do_shortcode($content) {
     235        if (function_exists('bbp_whitelist_do_shortcode')) { return bbp_whitelist_do_shortcode($content); }
     236        else { return do_shortcode($content); }
     237    }
     238
     239    function attributefix($atts = array()) {
     240        if (empty($atts[0])) { return $atts; }
     241        if (0 !== preg_match('#=("|\')(.*?)("|\')#', $atts[0], $match)) { $atts[0] = $match[2]; }
     242        return $atts;
     243    }
     244
     245
     246    // SHORTCODES //
     247
     248
     249    // Shortcode Protection
     250
     251    function skip_enclosed_shortcodes($atts, $content = null) {
     252        return $content;
     253    }
     254
     255    function tinymce_skip_enclosed_shortcodes($datainput) {
     256        $datainput['protect'] = "[/\<\?php[\s\S]*?\?\>/g, /\[insert_php\][\s\S]*?\[\/insert_php\]/g, /\[ignore_code\][\s\S]*?\[\/ignore_code\]/g]";
     257        return $datainput;
     258    }
     259
     260    // Formatting + Style
     261
     262    function shortcode_bold($atts = array(), $content = null) {
     263        if (null === $content) { return ''; }
     264        return '<strong>'.$this->do_shortcode($content).'</strong>';
     265    }
     266
     267    function shortcode_center($atts = array(), $content = null) {
     268        if (null === $content) { return ''; }
     269        return '<span style="text-align:center">'.$this->do_shortcode($content).'</span>';
     270    }
     271
     272    function shortcode_color($atts = array(), $content = null) {
     273        if (null === $content || '' === $atts) { return ''; }
     274        $color = substr(implode('', $atts), 1);
     275        if (ctype_xdigit($color)) { $color = '#'.$color; }
     276        return '<span style="color:'.$color.'">'.$this->do_shortcode($content).'</span>';
     277    }
     278
     279    function shortcode_del($atts = array(), $content = null) {
     280        if (null === $content) { return ''; }
     281        return '<del>'.$this->do_shortcode($content).'</del>';
     282    }
     283
     284    function shortcode_italics($atts = array(), $content = null) {
     285        if (null === $content) { return ''; }
     286        return '<em>'.$this->do_shortcode($content).'</em>';
     287    }
     288
     289    function shortcode_justify($atts = array(), $content = null) {
     290        if (null === $content) { return ''; }
     291        return '<span style="text-align:justify">'.$this->do_shortcode($content).'</span>';
     292    }
     293
     294    function shortcode_left($atts = array(), $content = null) {
     295        if (null === $content) { return ''; }
     296        return '<span style="text-align:left">'.$this->do_shortcode($content).'</span>';
     297    }
     298
     299    function shortcode_reverse($atts = array(), $content = null) {
     300        if (null === $content) { return ''; }
     301        return '<bdo dir="rtl">'.$this->do_shortcode($content).'</bdo>';
     302    }
     303
     304    function shortcode_right($atts = array(), $content = null) {
     305        if (null === $content) { return ''; }
     306        return '<span style="text-align:right">'.$this->do_shortcode($content).'</span>';
     307    }
     308
     309    function shortcode_size($atts = array(), $content = null) {
     310        if (null === $content || '' === $atts) { return ''; }
     311        $subattribs = substr(implode('', $atts), 1);
     312        return '<span style="font-size:'.$subattribs.'px">'.$this->do_shortcode($content).'</span>';
     313    }
     314
     315    function shortcode_strikethrough($atts = array(), $content = null) {
     316        if (null === $content) { return ''; }
     317        return '<s>'.$this->do_shortcode($content).'</s>';
     318    }
     319
     320    function shortcode_subscript($atts = array(), $content = null) {
     321        if (null === $content) { return ''; }
     322        return '<sub>'.$this->do_shortcode($content).'</sub>';
     323    }
     324
     325    function shortcode_superscript($atts = array(), $content = null) {
     326        if (null === $content) { return ''; }
     327        return '<sup>'.$this->do_shortcode($content).'</sup>';
     328    }
     329
     330    function shortcode_underline($atts = array(), $content = null) {
     331        if (null === $content) { return ''; }
     332        return '<span style="text-decoration:underline">'.$this->do_shortcode($content).'</span>';
     333    }
     334
     335
     336    // Quotes
     337
     338    function shortcode_quote($atts = array(), $content = null) {
     339        global $bp;
     340        global $bbp;
     341        $css_classes = array('bbcode-quote');
     342        if ($content === null) { return ''; }
     343        elseif (empty($atts)){
     344            return '<div class="'.implode(' ',$css_classes).'"><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
     345        } else {
     346            $name = trim(array_shift($atts), '="');
     347            $css_classes[] = 'bbcode-quote-'.$name;
     348            $user = get_user_by('login',$name);
     349            if (false !== $user){
     350                $css_classes[] = 'bbcode-quote-user';
     351                if (function_exists('bp_is_active')) { $name = '<a href="'.site_url().'/members/'.$user->user_login.'">'.$user->display_name.'</a>'; }
     352                elseif ('bbPress' === get_class($bbp)) { $name = '<a href="'.site_url().'?bbp_user='.$user->ID.'">'.$user->display_name.'</a>'; }
     353                else { $name = $user->display_name; }
     354            }
     355            return '<div class="'.implode(' ', $css_classes).'"><strong>'.$name.' wrote: </strong><blockquote>'.$this->do_shortcode($content).'</blockquote></div>';
     356        }
     357    }
     358
     359    function shortcode_cite($atts = array(), $content = null) {
     360        if (null === $content) { return ''; }
     361        return '<cite>'.$this->do_shortcode($content).'</cite>';
     362    }
     363
     364    // Code
     365
     366    function shortcode_code($atts = array(), $content = null) {
     367        if (null === $content) { return ''; }
     368        return '<code>'.$this->do_shortcode($content).'</code>';
     369    }
     370
     371    function shortcode_kbd($atts = array(), $content = null) {
     372        if (null === $content) { return ''; }
     373        return '<kbd>'.$this->do_shortcode($content).'</kbd>';
     374    }
     375
     376    // Lists
     377
     378    function shortcode_orderedlist($atts = array(), $content = null) {
     379        if (null === $content) { return ''; }
     380        return '<ol>'.$this->do_shortcode($content).'</ol>';
     381    }
     382
     383    function shortcode_unorderedlist($atts = array(), $content = null) {
     384        if (null === $content) { return ''; }
     385        return '<ul>'.$this->do_shortcode($content).'</ul>';
     386    }
     387
     388    function shortcode_listitem($atts = array(), $content = null) {
     389        if (null === $content) { return ''; }
     390        return '<li>'.$this->do_shortcode($content).'</li>';
     391    }
     392
     393    // Tables
     394
     395    function shortcode_table($atts = array(), $content = null) {
     396        if (null === $content) { return ''; }
     397        return '<table>'.$this->do_shortcode($content).'</table>';
     398    }
     399
     400    function shortcode_thead($atts = array(), $content = null) {
     401        if (null === $content) { return ''; }
     402        return '<thead>'.$this->do_shortcode($content).'</thead>';
     403    }
     404
     405    function shortcode_tbody($atts = array(), $content = null) {
     406        if (null === $content) { return ''; }
     407        return '<tbody>'.$this->do_shortcode($content).'</tbody>';
     408    }
     409
     410    function shortcode_tfoot($atts = array(), $content = null) {
     411        if (null === $content) { return ''; }
     412        return '<tfoot>'.$this->do_shortcode($content).'</tfoot>';
     413    }
     414
     415    function shortcode_th($atts = array(), $content = null) {
     416        if (null === $content) { return ''; }
     417        return '<th>'.$this->do_shortcode($content).'</th>';
     418    }
     419
     420    function shortcode_tr($atts = array(), $content = null) {
     421        if (null === $content) { return ''; }
     422        return '<tr>'.$this->do_shortcode($content).'</tr>';
     423    }
     424
     425    function shortcode_td($atts = array(), $content = null) {
     426        if (null === $content) { return ''; }
     427        return '<td>'.$this->do_shortcode($content).'</td>';
     428    }
     429
     430    // Links and Images
     431
     432    function shortcode_email($atts = array(), $content = null) {
     433        if (empty($atts)) {  // [email][email protected][/email]
     434            $url = $content;
     435        } else {  // [[email protected]]text[/email] or [email="[email protected]"]text[/email]
     436            $atts = $this->attributefix($atts);
     437            $url = trim(array_shift($atts), '="');
     438        }
     439        if (empty($url)) { return ''; }
     440        $url = str_replace(' at ', '@', str_replace('  ', ' ', $url));
     441        return '<a href="mailto:'.$url.'">'.$this->do_shortcode($content).'</a>';
     442    }
     443
     444    function shortcode_telephone($atts = array(), $content = null) {
     445        if (empty($atts)) {  // [tel]123-456-7890[/tel]
     446            $phone = $content;
     447        } else {  // [tel=123-456-7890]text[/tel] or [tel="123-456-7890"]text[/tel]
     448            $atts = $this->attributefix($atts);
     449            $phone = trim(array_shift($atts), '="');
     450        }
     451        if (empty($phone)) { return ''; }
     452        $phone = $phone.replace('-', '').replace('.', '').replace('+', '');
     453        return '<a href="tel:'.$phone.'">'.$this->do_shortcode($content).'</a>';
     454    }
     455
     456    function shortcode_image($atts = array(), $content = null) {
     457        if (null === $content) { return ''; }
     458        $alt = '';
     459        if (!empty($atts)) { $alt = trim(implode(' ', $atts ), '="'); }  //  [img=alttext]imageurl[/img]
     460        return '<img src="'.$content.'" alt="'.$alt.'" title="'.$alt.' />';
     461    }
     462
     463    function shortcode_url($atts = array(), $content = null) {
     464        if (empty($atts)) {  //  [url]http://www.example.com/[/url]
     465            $url = $text = $content;
     466        } else {  // [url=http://www.example.com/]text[/url] or [url="http://www.example.com/"]text[/url]
     467            $atts = $this->attributefix($atts);
     468            $url = trim(array_shift($atts), '="');
     469        }
     470        if (empty($url)) { return ''; }
     471        if (empty($text)) { $text=$url; }
     472        return '<a href="'.$url.'">'.$this->do_shortcode($content).'</a>';
     473    }
     474
     475    // Videos and Audio
     476
     477    function shortcode_freesound($atts = array(), $content = null) {
     478        if ('' === $content) { return 'No Freesound Audio ID Set'; }
     479        if (empty($atts)) {  // [freesound]164929[/freesound]
     480            $size = 'medium';
     481        } else {  // [freesound=large]164929[/freesound] or [freesound=small]164929[/freesound]
     482            $size = $this->attributefix($atts);
     483            $size = trim(array_shift($size), '="');
     484        }
     485        $vidID = $content;
     486        switch ($size) {
     487            case 'big':
     488            case 'large':
     489            case 'l':
     490                return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$vidID.'/simple/large/" width="920" height="245"></iframe>';
     491            case 'little':
     492            case 'short':
     493            case 'small':
     494            case 's':
     495                return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$vidID.'/simple/small/" width="375" height="30"></iframe>';
     496            case 'mid':
     497            case 'medium':
     498            case 'm':
     499            default:
     500                return '<iframe frameborder="0" scrolling="no" src="http://www.freesound.org/embed/sound/iframe/'.$vidID.'/simple/medium/" width="481" height="86"></iframe>';
     501        }
     502    }
     503
     504    function shortcode_gvideo($atts = array(), $content = null) {
     505        if ('' === $content) { return 'No Google Video ID Set'; }
     506        $vidID = $content;
     507        return '<embed style="width:400px;height:325px" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId='.$vidID.'&hl=en"></embed>';
     508    }
     509
     510    function shortcode_vimeo($atts = array(), $content = null) {
     511        if ('' === $content) { return 'No Vimeo Video ID Set'; }
     512        $vidID = $content;
     513        $height = '325';
     514        $width = '400';
     515        if (!empty($atts)){
     516            $atts = $this->attributefix($atts);
     517            $autoplay = $atts['autoplay'] === 'yes' ? '&amp;autoplay=1' : '';
     518            $vidID = (preg_match('~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match)) ? $match[1] : false;
     519            $height = (isset($atts['height']) && is_numeric($atts['height'])) ? $atts['height'] : '325';
     520            $width = (isset($atts['width']) && is_numeric($atts['width'])) ? $atts['width'] : '400';
     521        }
     522        return '<iframe width="'.$width.'" height="'.$height.'" src="//player.vimeo.com/video/'.$vidID.'?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
     523    }
     524
     525    function shortcode_youtube($atts = array(), $content = null) {
     526        if ('' === $content) { return 'No YouTube Video ID Set'; }
     527        $vidID = $content;
     528        $height = '325';
     529        $width = '400';
     530        if (!empty($atts)){
     531            $atts = $this->attributefix($atts);
     532            $autoplay = $atts['autoplay'] === 'yes' ? '?autoplay=1' : '';
     533            $vidID = (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $atts['url'], $match)) ? $match[1] : false;
     534            $height = (isset($atts['height']) && is_numeric($atts['height'])) ? $atts['height'] : '325';
     535            $width = (isset($atts['width']) && is_numeric($atts['width'])) ? $atts['width'] : '400';
     536        }
     537        return '<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$vidID.$autoplay.'" frameborder="0" allowfullscreen="true"></iframe>';
     538    }
     539
     540    // Special/Miscellaneous Content
     541
     542    function shortcode_abbr($atts = array(), $content = null) {
     543        if (null === $content || !isset($atts['title'])) { return ''; }
     544        $atts = $this->attributefix($atts);
     545        return '<abbr title="'.$atts['title'].'">'.$this->do_shortcode($content).'</abbr>';
     546    }
     547
     548    function shortcode_clientip($atts = array(), $content = null) {
     549        return $_SERVER['REMOTE_ADDR'];
     550    }
     551
     552    function shortcode_hr($atts = array(), $content = null) {
     553        return '<hr/>';
     554    }
     555
     556    function shortcode_note($atts = array(), $content = null) {
     557        if (null === $content) { return ''; }
     558        return '<!--'.$content.'-->';
     559    }
     560
     561    function shortcode_useragent($atts = array(), $content = null) {
     562        return $_SERVER['HTTP_USER_AGENT'];
     563    }
     564
     565    // Hide and Display Content
     566
     567    function shortcode_spoiler($atts = array(), $content = null) {
     568        if ($content === null) { return ''; }
     569        if ($atts === '') { return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler: </strong><input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>'; }
     570        $subattribs = substr(implode(' ', $atts), 1);
     571        return '<div style="margin:20px;margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><strong>Spoiler</strong> for <em>'. $subattribs .'</em> <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px" onClick="if (this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display != \'\') { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\'; } else { this.parentNode.parentNode.getElementsByTagName(\'div\')[1].getElementsByTagName(\'div\')[0].style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display:none">'. $this->do_shortcode($content) .'</div></div></div>';
     572    }
     573
     574    function shortcode_guest($atts = array(), $content = null) {
     575        if ($content === null || is_user_logged_in()) { return ''; }
     576        return '<div>'.$this->do_shortcode($content).'</div>';
     577    }
     578
     579    function shortcode_user($atts = array(), $content = null) {
     580        if ($content === null || !is_user_logged_in()) { return ''; }
     581        return '<div>'.$this->do_shortcode($content).'</div>';
     582    }
     583
     584}?>
  • bbcode-deluxe/trunk/options-form-template.php

    r1256906 r2037928  
    1 <div class="wrap"><h2>BBCode Deluxe</h2>
    2 <p>BBCode (Bulletin Board Code) is a lightweight markup language used as an alternative to HTML for formatting. <a href="http://www.bbcode.org/reference.php">http://www.bbcode.org/reference.php</a></p>
    3 <?php if($whitelist_enabled) {
    4     if($bbcodes_active){ ?>
    5 <p>BBCodes are enabled and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated. Users should be able to use BBCodes in blogs, comments, and forums.</p>
     1<div class="wrap">
     2    <h1>BBCode Deluxe</h1>
     3    <p>BBCode (Bulletin Board Code) is a lightweight markup language used as an alternative to HTML for formatting. <a href="http://www.bbcode.org/reference.php">http://www.bbcode.org/reference.php</a></p>
     4    <?php if ($whitelist_enabled) {
     5        if ($bbcodes_active) { ?>
     6            <p>BBCodes are enabled and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated. Users should be able to use BBCodes in blogs, comments, and forums.</p>
     7        <?php } else { ?>
     8            <p>BBCodes are installed and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated. However, it seems that BBCode Deluxe needs to be added to the whitelist settings. However, if some BBcodes are included in the manual whitelist, then those BBCodes should work.</p>
     9        <?php } ?>
    610    <?php } else { ?>
    7 <p>BBCodes are installed and <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> has been detected as activated.  However, it seems that BBCode Deluxe needs to be added to the whitelist settings. However, if some BBcodes are included in the manual whitelist, then those BBCodes should work.</p>
     11        <p>BBCodes are enabled and working in the forums. However, to be safe, install the <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> to stop unsafe shortcodes like <code>[bbp-register]</code> from being used.</p>
    812    <?php } ?>
    9 <?php } else { ?>
    10 <p>BBCodes are enabled and working in the forums. However, to be safe, install the <a href="http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/">bbPress shortcode whitelist</a> to stop unsafe shortcodes like <code>[bbp-register]</code> from being used.</p>
    11 <?php } ?>
    12 <div><h3 id="extras">Extras</h3>
    13 <h4>Your Info</h4><ul>
    14 <li>HTTP_USER_AGENT - <?php echo $_SERVER['HTTP_USER_AGENT'];?></li>
    15 <li>REMOTE_ADDR - <?php echo $_SERVER['REMOTE_ADDR'];?></li>
    16 <li>REMOTE_HOST - <?php echo ((!empty($_SERVER['REMOTE_HOST'])) ? $_SERVER['REMOTE_HOST'] : 'Your web server must be configured to create this variable. For instance, Apache needs <code>HostnameLookups On</code> in <em>httpd.conf</em>.');?></li>
    17 <li>REMOTE_PORT - <?php echo $_SERVER['REMOTE_PORT'];?></li>
    18 <li>REQUEST_METHOD - <?php echo $_SERVER['REQUEST_METHOD'];?></li>
    19 <li>HTTP_REFERER - <?php echo ((!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'No referer found.');?></li>
    20 </ul>
    21 <h4>Server's Info</h4><ul>
    22 <li>SERVER_NAME - <?php echo $_SERVER['SERVER_NAME'];?></li>
    23 <li>SERVER_ADDR - <?php echo $_SERVER['SERVER_ADDR'];?></li>
    24 <li>SERVER_PORT - <?php echo $_SERVER['SERVER_PORT'];?></li>
    25 <li>SERVER_SOFTWARE - <?php echo $_SERVER['SERVER_SOFTWARE'];?></li>
    26 <li>SERVER_PROTOCOL - <?php echo $_SERVER['SERVER_PROTOCOL'];?></li>
    27 </ul>
     13    <br/>
     14    <h2 id="extras">Information</h2>
     15    <div>
     16        <h3>Your Info</h3>
     17        <table>
     18            <tbody>
     19                <tr><td>User Agent</td><td><?php echo $_SERVER['HTTP_USER_AGENT']; ?></td></tr>
     20                <tr><td>Referrer</td><td><?php echo ((!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'No referer found.'); ?></td></tr>
     21                <tr><td>Request Method</td><td><?php echo $_SERVER['REQUEST_METHOD']; ?></td></tr>
     22                <tr><td>Remote Address</td><td><?php echo $_SERVER['REMOTE_ADDR']; ?></td></tr>
     23                <tr><td>Remote Host</td><td><?php echo ((!empty($_SERVER['REMOTE_HOST'])) ? $_SERVER['REMOTE_HOST'] : 'Your web server must be configured to create this variable. For instance, Apache needs <code>HostnameLookups On</code> in <em>httpd.conf</em>.'); ?></td></tr>
     24                <tr><td>Remote Port</td><td><?php echo $_SERVER['REMOTE_PORT']; ?></td></tr>
     25            </tbody>
     26        </table>
     27    </div>
     28    <br/>
     29    <div>
     30        <h3>Server's Info</h3>
     31        <table>
     32            <tbody>
     33                <tr><td>Server Name</td><td><?php echo $_SERVER['SERVER_NAME']; ?></td></tr>
     34                <tr><td>Server Address</td><td><?php echo $_SERVER['SERVER_ADDR']; ?></td></tr>
     35                <tr><td>Server Port</td><td><?php echo $_SERVER['SERVER_PORT']; ?></td></tr>
     36                <tr><td>Server Software</td><td><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td></tr>
     37                <tr><td>Server Protocol</td><td><?php echo $_SERVER['SERVER_PROTOCOL']; ?></td></tr>
     38                <tr><td>OS Family</td><td><?php echo PHP_OS_FAMILY; ?></td></tr>
     39                <tr><td>OS</td><td><?php echo PHP_OS; ?></td></tr>
     40                <tr><td>Uname</td><td><?php echo php_uname('a'); ?></td></tr>
     41                <tr><td>Default Charset</td><td><?php echo ini_get('default_charset'); ?></td></tr>
     42                <tr><td>PHP Version</td><td><?php echo PHP_VERSION; ?></td></tr>
     43                <tr><td>PHP Version ID</td><td><?php echo PHP_VERSION_ID; ?></td></tr>
     44                <tr><td>PHP Release Version</td><td><?php echo PHP_RELEASE_VERSION; ?></td></tr>
     45                <tr><td>PHP SAPI Name</td><td><?php echo php_sapi_name(); ?></td></tr>
     46                <tr><td>Memory Usage</td><td><?php echo memory_get_usage(true); ?></td></tr>
     47                <tr><td>Peak Memory Usage</td><td><?php echo memory_get_peak_usage(true); ?></td></tr>
     48                <tr><td>Debug</td><td><?php echo PHP_DEBUG; ?></td></tr>
     49                <tr><td>File Descriptor Size</td><td><?php echo PHP_FD_SETSIZE; ?></td></tr>
     50                <tr><td>Register Globals</td><td><?php echo ini_get('register_globals'); ?></td></tr>
     51                <tr><td>EOL</td><td><?php echo PHP_EOL; ?></td></tr>
     52                <tr><td>Directory Separator</td><td><?php echo DIRECTORY_SEPARATOR; ?></td></tr>
     53                <tr><td>Path Separator</td><td><?php echo PATH_SEPARATOR; ?></td></tr>
     54                <tr><td>Shared Library Suffix</td><td><?php echo PHP_SHLIB_SUFFIX; ?></td></tr>
     55                <tr><td>INT Max</td><td><?php echo PHP_INT_MAX; ?></td></tr>
     56                <tr><td>PHP Binary Directory</td><td><?php echo PHP_BINDIR ; ?></td></tr>
     57                <tr><td>Current Directory Name</td><td><?php echo dirname(__FILE__); ?></td></tr>
     58            </tbody>
     59        </table>
     60    </div>
     61    <div>
     62        <h3>Loaded Extensions</h3>
     63        <ul><?php
     64            $conf_array = get_loaded_extensions();
     65            foreach ($conf_array as $val_pair) {
     66                echo '<li>'.strval($val_pair).'</li>';
     67            }
     68        ?></ul>
     69    </div>
    2870</div>
    29 </div>
  • bbcode-deluxe/trunk/readme.txt

    r1724540 r2037928  
    22Contributors: DevynCJohnson
    33Donate link: http://dcjtech.info/donations/
    4 Tags: bbpress, bbpress2, bbpress-plugin, bbcode, shortcode, forum, html5, markup
     4Tags: bbcode, bbpress, buddypress, bbpress-plugin, bbpress2, forum, html5, information, markup, nested-quotes, php-version, server-info, shortcode
    55Requires at least: 3.9
    6 Tested up to: 4.9.1
     6Tested up to: 5.1
    77Stable tag: trunk
    88License: GPLv3
     
    1313== Description ==
    1414
    15 BBCode Deluxe adds BBCode markup (and other shortcodes) to Wordpress and BBPress. These BBCodes create HTML5 tags, so be sure that your site supports HTML5.
     15BBCode Deluxe adds BBCode markup (and other shortcodes) to Wordpress and BBPress. These BBCodes create HTML5 tags, so be sure that your site supports HTML5. The plugin also creates a backend page that provides the administrator with information about the server including the version of PHP being used. Go to http://dcjtech.info/html-and-shortcodes-formatting/ to see a live demonstration of this plugin in use.
     16
     17This plugin also supports nested `[quote]` shortcodes such as `[quote]Outer Quote[quote]Inner Quote[quote]Deep Quote[/quote][/quote][/quote]`.
     18
     19BBCode Deluxe works perfectly fine with Enlighter (by Andi Dittrich) as long as you set Enlighter's priority to "12".
    1620
    1721* Plugin Name: BBCode Deluxe
    1822* Plugin URI: https://wordpress.org/plugins/bbcode-deluxe/
    1923* Description: Adds support for BBCode to Wordpress and BBPress
    20 * Version: 2017.09.04
     24* Version: 2019.02.23
    2125* Author: Devyn Collier Johnson (DevynCJohnson)
    2226* Author URI: http://dcjtech.info/
     
    2529* License URI: http://www.gnu.org/licenses/gpl-3.0.html
    2630
    27 This plugin includes code from the below listed developers and their plugins.
     31This plugin includes code that derives from the below listed developers and their plugins.
    2832
    2933* Copyright (C) 2013 Anton Channing ("Video and Audio BBCodes" and "bbPress2 BBCode")
     
    3337Feel free to submit suggestions, bug reports, concerns, etc. to me. If a user donates more than twenty USD to my PayPal account, then I will give that user my phone-number to allow the user to call me for bug reports, suggestions, help, concerns, etc.
    3438
    35 The BBCodes can be typed in all lowercase or all uppercase, but the opening and closing BBCodes must match. For instance, `[b]bold[/b] = [B]bold[/B]`.
     39The BBCodes can be typed in all lowercase or all uppercase, but the opening and closing BBCodes must match. For instance, `[b]bold[/b] == [B]bold[/B]`.
     40
     41As for attributes, BBCodes that only except one attribute at most can be written in one of two formats - `[abbr="HyperText Markup Language"]HTML[/abbr]` or `[abbr title="HyperText Markup Language"]HTML[/abbr]`.
    3642
    3743`*Inline Styling*
     
    5763Gvideo: [gvideo]ID[/gvideo]
    5864Image: [img]http://dcjtech.info/DCJTech_128.jpg[/img] [img img=DCJTech Logo]http://dcjtech.info/DCJTech_128.jpg[/img]
    59 URL: [url]http://dcjtech.info/[/url] [url url=http://dcjtech.info/]DCJTech[/url]
     65Telephone: [tel [email protected]]text[/tel] [tel][email protected][/tel]
     66URL: [url]http://dcjtech.info/[/url] [url=http://dcjtech.info/]DCJTech[/url]
    6067Vimeo: [vimeo]ID[/vimeo]
    6168Youtube: [youtube]ID[/youtube]
    6269
    63 *Quotes and Code*
    64 Abbreviation: [abbr title="HyperText Markup Language"]HTML[/abbr]
     70*Quotes*
    6571Cite: [cite]Relevant source[/cite]
     72Quote: [quote]KISS - Keep It Simple, Stupid[/quote]
     73Quote (NAME): [quote quote=NAME]Life is what you make of it[/quote] [quote="NAME"]Persistance is the main ingredient for success[/quote]
     74Quote (author=NAME): [quote author=NAME]Quitters never succeed, and successors never quit[/quote] [quote author="Martin Jones"]Kissing arses is pointless. However, knowing whose arse to kiss and whose to kick and when is priceless.[/quote]
     75
     76*Code*
    6677Computer Code: [code]function HelloWorld($greet = 'World') { return 'Hello '.$greet } [/code]
    6778Keyboard Keys: [kbd]Ctrl[/kbd]+[kbd]S[/kbd] [keyboard]Ctrl[/keyboard]+[keyboard]S[/keyboard]
    68 Quote: [quote]KISS - Keep It Simple, Stupid[/quote]
    69 Quote (NAME): [quote quote=NAME]Life is what you make of it[/quote] [quote quote="NAME"]Persistance is the main ingredient for success[/quote]
    70 Quote (author=NAME): [quote author=NAME]Quitters never succeed, and successors never quit[/quote] [quote author="Martin Jones"]Kissing arses is pointless. However, knowing whose arse to kiss and whose to kick and when is priceless.[/quote]
    7179
    72 *Lists and Tables*
     80*Lists*
    7381Ordered Lists: [ol][li]Ordered-list[/li][/ol]
    7482Unordered Lists: [ul][li]Unordered-list[/li][/ul]
     83
     84*Tables*
    7585Table: [table]
    7686Thead: [thead]
     
    8191td: [td]
    8292
    83 *Special Content*
     93*Special/Miscellaneous Content*
     94Abbreviation: [abbr title="HyperText Markup Language"]HTML[/abbr]
    8495Client IP: [ip/]
     96Horizontal Ruler (Line): [hr/]
     97
     98*Hide and Display Content*
    8599Contents appear to registered users: [user]This is a secret message[/user]
    86100Contents appear to non-registered users: [guest]Login to see less ads and content hidden from guests. (CODE TO DISPLAY AD)[/guest]
    87 Horizontal Ruler (Line): [hr/]
    88101Spoiler: [spoiler]Surprise![/spoiler]
    89102Spoiler (Named): [spoiler spoiler=one plus one]is 10 (in binary)[/spoiler]
     
    1151282. Activate the plugin through the "Plugins" menu in WordPress
    116129
     130== Conflicting Plugins ==
     131
     132* bbPress2 BBCode
     133* Enlighter - BBCode Deluxe works perfectly fine with Enlighter as long as you set Enlighter's priority to "12"
     134* Ignore Code
     135* Outerbridge Nested Shortcodes
     136* Video and Audio BBCodes
     137
    117138== Screenshots ==
    118139
     
    129150
    130151== Changelog ==
     152= 2019.02.23 =
     153* Optimizations
     154* Bug fixes
     155* Added `[tel]` shortcode for creating telephone links
     156* Added `[ignore]`, `[ignore-code]`, and `[ignore_code]` shortcodes for ignoring/protecting enclosed code and shortcodes
     157* Added support for BuddyPress
     158* Added additional information to the admin control/settings page for this plugin (including the PHP version)
     159* Fixed nesting issue (thanks to Robert Chipperfield and his website http://www.sqlservercentral.com/ for reporting the bug)
    131160= 2016.09.04 =
    132161* Minor Changes
Note: See TracChangeset for help on using the changeset viewer.