Ticket #12368: shortcode-limit.patch
| File shortcode-limit.patch, 978 bytes (added by , 16 years ago) |
|---|
-
wp-includes/shortcodes.php
function remove_all_shortcodes() { 139 139 * @uses get_shortcode_regex() Gets the search pattern for searching shortcodes. 140 140 * 141 141 * @param string $content Content to search for shortcodes 142 * @param int $limit Maximum number of shortcode replacements, default is no limit 142 143 * @return string Content with shortcodes filtered out. 143 144 */ 144 function do_shortcode($content ) {145 function do_shortcode($content, $limit = -1) { 145 146 global $shortcode_tags; 146 147 147 148 if (empty($shortcode_tags) || !is_array($shortcode_tags)) 148 149 return $content; 149 150 150 151 $pattern = get_shortcode_regex(); 151 return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content); 152 $limit = (int)$limit; 153 return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content, $limit); 152 154 } 153 155 154 156 /**