/** * Process the [rawr] shortcode in priority 8. * * Since the [rawr] shortcode needs to be run earlier than other shortcodes, * this function removes all existing shortcodes, uses the shortcode parser to grab all [raw blocks], * calls {@link do_shortcode()}, and then re-registers the old shortcodes. * * @uses $shortcode_tags * @uses remove_all_shortcodes() * @uses add_shortcode() * @uses do_shortcode() * * @param string $content Content to parse * @return string Content with shortcode parsed */ function get_unformatted_shortcode_blocks($content) { global $shortcode_tags; // Back up current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); // my_shortcode_handler1(), below, saves the raw blocks into $this->unformatted_shortcode_blocks[] add_shortcode('rawr', array(&$this, 'my_shortcode_handler1')); // Put all our shortcodes back and run them, all except 'mysitePortfolio' & 'mysiteImages' foreach (mysite_shortcodes() as $shortcodes) { $class = 'mysite' . ucfirst(preg_replace('/[0-9-_]/', '', str_replace('.php', '', $shortcodes))); $button = new mysiteButtons(); $class_methods = get_class_methods($class); if ($class == 'mysitePortfolio' || $class == 'mysiteImages') { continue; } foreach ($class_methods as $shortcode) { if ($shortcode[0] != '_' && $class != 'mysiteLayouts') { add_shortcode($shortcode, array($class, $shortcode)); } } } // Do the shortcode (only the [rawr] shortcode and our core shortcodes are now registered) $content = do_shortcode($content); // Put the original shortcodes back for normal processing at priority 11 $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * */ function mysite_shortcodes_init() { foreach (mysite_shortcodes() as $shortcodes) { require_once THEME_SHORTCODES . '/' . $shortcodes; } if (is_admin()) { return; } # Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553 @ini_set('pcre.backtrack_limit', 9000000); foreach (mysite_shortcodes() as $shortcodes) { $class = 'mysite' . ucfirst(preg_replace('/[0-9-_]/', '', str_replace('.php', '', $shortcodes))); $class_methods = get_class_methods($class); foreach ($class_methods as $shortcode) { if ($shortcode[0] != '_' && $class != 'mysiteLayouts') { add_shortcode($shortcode, array($class, $shortcode)); } } } }