function hb_shortcodes_wpautop_fix($content) { $all_shortcodes = hb_recognized_shortcodes(); $fix_shortcodes = (array) apply_filters('hb_shortcodes_wpautop_fix', $all_shortcodes); $block = join("|", $fix_shortcodes); $rep = preg_replace("/(<p>)?\\[({$block})(\\s[^\\]]+)?\\](<\\/p>|<br \\/>)?/", "[\$2\$3]", $content); $rep = preg_replace("/(<p>)?\\[\\/({$block})](<\\/p>|<br \\/>)?/", "[/\$2]", $rep); return $rep; }
function hb_gshortcodes_init() { $gshortcodes = (array) hb_recognized_shortcodes(); foreach ($gshortcodes as $shortcode) { // SHORTCODENAME_shortcode $function_name = $shortcode . '_shortcode'; // SHORTCODENAME_shortcode_custom $function_name_custom = $function_name . '_custom'; if (function_exists($function_name_custom)) { add_shortcode($shortcode, $function_name_custom); } elseif (function_exists($function_name)) { add_shortcode($shortcode, $function_name); } } }
function hb_gshortcodes_remove($shortcodes) { $gshortcodes = hb_recognized_shortcodes(); foreach ($shortcodes as $index => $shortcode) { if (0 === strpos($index, 'headline_')) { continue; } if (!in_array($index, $gshortcodes)) { unset($shortcodes[$index]); continue; } // SHORTCODENAME_shortcode $function_name = $index . '_shortcode'; // SHORTCODENAME_shortcode_custom $function_name_custom = $function_name . '_custom'; if (!function_exists($function_name) && !function_exists($function_name_custom)) { unset($shortcodes[$index]); } } return $shortcodes; }