### Eclipse Workspace Patch 1.0
#P Shortcode Patch Development
|
|
|
|
| 40 | 40 | * @var array |
| 41 | 41 | * @global array $shortcode_tags |
| 42 | 42 | */ |
| 43 | | $shortcode_tags = array(); |
| 44 | 43 | |
| | 44 | $shortcode_tags = get_option('wp_shortcodes', array()); |
| | 45 | |
| | 46 | $default_shortcode = "unregistered_shortcode"; |
| | 47 | |
| | 48 | function unregistered_shortcode($atts = null, $content = null) { return $content; } |
| | 49 | |
| | 50 | function register_shortcodes() { |
| | 51 | global $default_shortcode; |
| | 52 | global $shortcode_tags; |
| | 53 | foreach($shortcode_tags as $k => $v) { |
| | 54 | $shortcode_tags[$k] = $default_shortcode; |
| | 55 | } |
| | 56 | update_option('wp_shortcodes', $shortcode_tags); |
| | 57 | } |
| | 58 | |
| | 59 | add_action( 'shutdown', 'register_shortcodes'); |
| | 60 | |
| | 61 | function register_default_shortcode($func) { |
| | 62 | global $default_shortcode; |
| | 63 | $default_shortcode = $func; |
| | 64 | } |
| | 65 | |
| 45 | 66 | /** |
| 46 | 67 | * Add hook for shortcode tag. |
| 47 | 68 | * |
| … |
… |
|
| 95 | 116 | |
| 96 | 117 | if ( is_callable($func) ) |
| 97 | 118 | $shortcode_tags[$tag] = $func; |
| | 119 | |
| 98 | 120 | } |
| 99 | 121 | |
| 100 | 122 | /** |
| … |
… |
|
| 157 | 179 | * The regular expression combines the shortcode tags in the regular expression |
| 158 | 180 | * in a regex class. |
| 159 | 181 | * |
| 160 | | * The regular expression contains 6 different sub matches to help with parsing. |
| | 182 | * The regular expresion contains 6 different sub matches to help with parsing. |
| 161 | 183 | * |
| 162 | 184 | * 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]] |
| 163 | 185 | * 2 - The shortcode name |