function gdlr_fix_shortcodes($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); add_shortcode('gdlr_text_align', 'gdlr_text_align_shortcode'); add_shortcode('gdlr_button', 'gdlr_button_shortcode'); add_shortcode('gdlr_heading', 'gdlr_heading_shortcode'); add_shortcode('gdlr_divider', 'gdlr_divider_shortcode'); add_shortcode('gdlr_circle_progress', 'gdlr_circle_progress_shortcode'); add_shortcode('gdlr_stunning_text', 'gdlr_stunning_text_shortcode'); add_shortcode('gdlr_skill_bar', 'gdlr_skill_bar_shortcode'); add_shortcode('gdlr_row', 'gdlr_row_shortcode'); add_shortcode('gdlr_column', 'gdlr_column_shortcode'); add_shortcode('gdlr_frame', 'gdlr_frame_shortcode'); add_shortcode('gdlr_image_link', 'gdlr_image_link_shortcode'); add_shortcode('gdlr_space', 'gdlr_space_shortcode'); add_shortcode('gdlr_quote', 'gdlr_quote_shortcode'); add_shortcode('gdlr_dropcap', 'gdlr_dropcap_shortcode'); add_shortcode('gdlr_icon', 'gdlr_icon_shortcode'); add_shortcode('gdlr_notification', 'gdlr_notification_shortcode'); add_shortcode('gdlr_box_icon', 'gdlr_box_icon_shortcode'); add_shortcode('gdlr_styled_box', 'gdlr_styled_box_shortcode'); add_shortcode('gdlr_blog', 'gdlr_blog_shortcode'); add_shortcode('gdlr_portfolio', 'gdlr_portfolio_shortcode'); add_shortcode('gdlr_code', 'gdlr_code_shortcode'); // Do the shortcode (only the one above is registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ ) * * @param array $images * @param int $post_id * * @return array $image list of all founded images */ function add_wpseo_xml_sitemap_images($images, $post_id) { global $gmGallery, $gmCore; $this->images = $images; // first get the content of the post/page $p = get_post($post_id); $content = $p->post_content; // Don't process the images in the normal way remove_all_shortcodes(); add_shortcode('gmedia', 'gmedia_shortcode'); add_shortcode('gm', 'gmedia_term_shortcode'); // Search now for shortcodes do_shortcode($content); if (isset($gmGallery->shortcode['gmedia'])) { foreach ($gmGallery->shortcode['gmedia'] as $termitems) { foreach ($termitems as $item) { $newimage = array(); $newimage['src'] = $gmCore->gm_get_media_image($item, 'web'); if (!empty($item->title)) { $newimage['title'] = strip_tags($item->title); } if (!empty($item->description)) { $newimage['alt'] = strip_tags($item->description); } $this->images[] = $newimage; } } } return $this->images; }
/** * 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; }
/** * Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ ) * * @param array $images * @param int $post_id * * @return array $image list of all founded images */ function add_wpseo_xml_sitemap_images($images, $post_id) { global $gmGallery, $gmCore, $gmDB; $this->images = $images; // first get the content of the post/page $p = get_post($post_id); $content = $p->post_content; // Don't process the images in the normal way remove_all_shortcodes(); add_shortcode('gmedia', 'gmedia_shortcode'); add_shortcode('gm', 'gmedia_term_shortcode'); // Search now for shortcodes do_shortcode($content); if (count($gmGallery->shortcode)) { foreach ($gmGallery->shortcode as $gmedia_shortcode) { $query = array_merge($gmedia_shortcode['query'], array('status' => 'publish', 'mime_type' => 'image')); $gmedias = $gmDB->get_gmedias($query); foreach ($gmedias as $item) { $newimage = array(); $newimage['src'] = $gmCore->gm_get_media_image($item, 'web'); if (!empty($item->title)) { $newimage['title'] = strip_tags($item->title); } if (!empty($item->description)) { $newimage['alt'] = strip_tags($item->description); } $this->images[] = $newimage; } } } return $this->images; }
function gg_run_shortcode($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); add_shortcode('one_half', 'one_half'); add_shortcode('one_half_last', 'one_half_last'); add_shortcode('one_third', 'one_third'); add_shortcode('one_third_last', 'one_third_last'); add_shortcode('two_third', 'two_third'); add_shortcode('two_third_last', 'two_third_last'); add_shortcode('one_fourth', 'one_fourth'); add_shortcode('one_fourth_last', 'one_fourth_last'); add_shortcode('three_fourth', 'three_fourth'); add_shortcode('three_fourth_last', 'three_fourth_last'); add_shortcode('one_fifth', 'one_fifth'); add_shortcode('one_fifth_last', 'one_fifth_last'); add_shortcode('two_fifth', 'two_fifth'); add_shortcode('two_fifth_last', 'two_fifth_last'); add_shortcode('three_fifth', 'three_fifth'); add_shortcode('three_fifth_last', 'three_fifth_last'); add_shortcode('four_fifth', 'four_fifth'); add_shortcode('four_fifth_last', 'four_fifth_last'); add_shortcode('one_sixth', 'one_sixth'); add_shortcode('one_sixth_last', 'one_sixth_last'); add_shortcode('five_sixth', 'five_sixth'); add_shortcode('five_sixth_last', 'five_sixth_last'); // Do the shortcode $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
public function createShortCodes() { remove_all_shortcodes(); foreach (SPBMap::getShortCodes() as $sc_base => $el) { $name = 'SwiftPageBuilderShortcode_' . $el['base']; if (class_exists($name) && is_subclass_of($name, 'SwiftPageBuilderShortcode')) { $this->shortcodes[$sc_base] = new $name($el); } } }
public function createShortCodes() { remove_all_shortcodes(); foreach (WPBMap::getShortCodes() as $sc_base => $el) { $name = 'WPBakeryShortCode_' . $el['base']; if (class_exists($name) && is_subclass_of($name, 'WPBakeryShortCode')) { $this->shortcodes[$sc_base] = new $name($el); } } $this->createColumnShortCode(); }
function idz_run_shortcode($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); add_shortcode('idz_row', 'indonez_func_row'); add_shortcode('idz_col_full', 'indonez_func_col_full'); add_shortcode('idz_col_12', 'indonez_func_col_12'); add_shortcode('idz_col_13', 'indonez_func_col_13'); add_shortcode('idz_col_14', 'indonez_func_col_14'); add_shortcode('idz_col_16', 'indonez_func_col_16'); add_shortcode('idz_col_23', 'indonez_func_col_23'); add_shortcode('idz_col_34', 'indonez_func_col_34'); add_shortcode('idz_col_125_3', 'indonez_func_col_125_3'); add_shortcode('idz_col_275_3', 'indonez_func_col_275_3'); add_shortcode('idz_spacer', 'indonez_func_spacer'); add_shortcode('idz_button', 'indonez_func_button'); add_shortcode('idz_alert', 'indonez_func_alert'); add_shortcode('idz_toggle', 'indonez_func_toggle'); add_shortcode('idz_accordion', 'indonez_func_accordion'); add_shortcode('idz_tab', 'indonez_func_tab'); add_shortcode('idz_div', 'indonez_func_div_html'); add_shortcode('idz_end_div', 'indonez_func_div_closed_html'); add_shortcode('idz_dropcap', 'indonez_func_drop_cap'); add_shortcode('idz_pullquote', 'indonez_func_pullquote'); add_shortcode('idz_table', 'indonez_func_table'); add_shortcode('idz_paragraph', 'indonez_func_paragraph_text'); add_shortcode('idz_highlight', 'indonez_func_highlight_text'); add_shortcode('idz_pricing', 'indonez_func_pricing_table_shortcode'); add_shortcode('idz_pricing_item', 'indonez_func_pricing_shortcode'); add_shortcode('idz_custom_heading', 'indonez_func_custom_heading'); add_shortcode('idz_list', 'indonez_func_list_style'); add_shortcode('idz_progress_bar', 'indonez_func_progress_bar'); add_shortcode('idz_note', 'indonez_func_note'); add_shortcode('idz_icon', 'indonez_func_icons'); add_shortcode("idz_video", "indonez_func_video"); add_shortcode('idz_promobox', 'indonez_func_promobox'); add_shortcode('idz_testimonial_carousel', 'indonez_func_carousel_testimonial'); add_shortcode('idz_team_list', 'indonez_func_team_list_shortcode'); add_shortcode('idz_client_list', 'indonez_func_client_list_shortcode'); add_shortcode('idz_portfolio', 'indonez_func_recent_portfolio_shortcode'); add_shortcode('idz_portfolio_carousel', 'indonez_func_recent_portfolio_carousel_shortcode'); add_shortcode('idz_twitter', 'indonez_func_twitter'); add_shortcode('idz_wrapbox', 'indonez_func_wrapbox'); add_shortcode('idz_blogpost', 'indonez_func_blogposts'); add_shortcode('idz_gmap', 'indonez_func_shortcode_googlemap'); // Do the shortcode (only the one above is registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Run a shortcode in a clean way * * @param unknown $content Wordpress Post Content * @return $content The Processed Content */ public function run_shortcodes($content) { global $shortcode_tags; $original_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); foreach ($this->protected_shortcodes as $shortcode) { add_shortcode($this->prefix . $shortcode, array('Pure_ML', $shortcode)); } // Do only Pure_Shortcodes! $content = do_shortcode($content); $shortcode_tags = $original_shortcode_tags; return $content; }
/** * Process the [embed] shortcode. * * Since the [embed] shortcode needs to be run earlier than other shortcodes, * this function removes all existing shortcodes, registers the [embed] shortcode, * calls {@link do_shortcode()}, and then re-registers the old shortcodes. * * @global array $shortcode_tags * * @param string $content Content to parse * @return string Content with shortcode parsed */ public function run_shortcode($content) { global $shortcode_tags; // Back up current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); add_shortcode('embed', array($this, 'shortcode')); // Do the shortcode (only the [embed] one is registered) $content = do_shortcode($content, true); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
function vw_do_shortcode($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); vw_register_shortcodes(); // Do the shortcode (only the one above is registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
function process_shortcodes($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; $shortcode_tags = array(); remove_all_shortcodes(); $this->add_shortcodes(); // Do the shortcode (only the one above is registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Process all grid shortcodes * 'the_content' filter callback * Only renders grid markup. */ static function do_grid_shortcodes($content) { global $shortcode_tags; // backup $_shortcode_tags = $shortcode_tags; // clear remove_all_shortcodes(); // add self::add_shortcodes(); // do $content = do_shortcode($content); // restore $shortcode_tags = $_shortcode_tags; return $content; }
function kimili_shortcode_hack($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); // Register all of this plugin's shortcodes add_shortcode('kml_flashembed', 'kml_flash_shortcode'); add_shortcode('kml_swfembed', 'kml_flash_shortcode'); // Do the shortcodes (only this plugins's are registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Actual processing of the shortcode happens here. */ function dt_run_puny_shortcode($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); foreach (dt_get_puny_shortcodes() as $shortcode => $callback) { add_shortcode($shortcode, $callback); } // Do the shortcode (only the one above is registered) $content = do_shortcode(shortcode_unautop($content)); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * @param string $content * @return string */ public function runShortcodesBeforeAutop($content) { global $shortcode_tags; // Back up current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); $shortcode = $this->shortcodeFunctions; foreach ($shortcode as $sortcode_name => $function_name) { add_shortcode(self::PREFIX . $sortcode_name, array($this, $function_name)); } // Do the shortcode (only the [motopress shortcodes] are registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Pre-filter the_content and replace our shortcodes with placeholders using * a regex filter similar to the original WordPress shortcode replacements. * @param string $content Original content, before WordPress filters applied. * @return string Content with placeholders */ public function preserve_shortcodes($content) { $this->shortcodes = apply_filters('cs_preserve_shortcodes', $this->shortcodes); if (empty($this->shortcodes)) { return $content; } global $shortcode_tags; $original = $shortcode_tags; remove_all_shortcodes(); foreach ($this->shortcodes as $shortcode) { add_shortcode($shortcode, '__return_empty_string'); } $pattern = get_shortcode_regex(); $content = preg_replace_callback("/{$pattern}/s", array($this, 'preserve_shortcode'), $content); $shortcode_tags = $original; return $content; }
/** * Actual processing of the shortcode happens here. */ function presscore_run_puny_shortcodes($content) { global $shortcode_tags; $puny_shortcodes = presscore_get_puny_shortcodes(); if (is_array($puny_shortcodes) && count($puny_shortcodes) > 0) { // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); foreach ($puny_shortcodes as $shortcode => $callback) { add_shortcode($shortcode, $callback); } // Do the shortcode (only the one above is registered) $content = do_shortcode(shortcode_unautop($content)); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; } return $content; }
/** * parse_wpv_noautop_shortcodes * * Parse and resolve wpv-noautop shortcodes * * @param $content string * * @return string * * @since 1.9 */ static function parse_wpv_noautop_shortcodes( $content ) { global $shortcode_tags; // Back up current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); add_shortcode( 'wpv-noautop', array( 'WPV_Formatting_Embedded', 'wpv_shortcode_wpv_noautop' ) ); $expression = '/\\[wpv-noautop((?!\\[wpv-noautop).)*\\[\\/wpv-noautop\\]/isU'; $counts = preg_match_all( $expression, $content, $matches ); while ( $counts ) { foreach( $matches[0] as $match ) { $shortcode = do_shortcode( $match ); $content = str_replace( $match, $shortcode, $content ); } $counts = preg_match_all( $expression, $content, $matches ); } $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ ) * * @param array $images * @param int $post_id * * @return array $image list of all founded images */ function add_wpseo_xml_sitemap_images($images, $post_id) { $this->images = $images; // first get the content of the post/page $p = get_post($post_id); if ('flagallery' == get_post_type($post_id)) { $flag_custom = get_post_custom($post_id); $content = $flag_custom["mb_scode"][0]; } else { $content = $p->post_content; } // Don't process the images in the normal way remove_all_shortcodes(); add_shortcode('flagallery', array(&$this, 'show_flashalbum')); // Search now for shortcodes do_shortcode($content); return $this->images; }
/** * Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ ) * * @since Version 1.8.0 * @param array $images * @param int $post ID * @return array $image list of all founded images */ function add_wpseo_xml_sitemap_images($images, $post_id) { $this->images = $images; // first get the content of the post/page $p = get_post($post_id); // Backward check for older images $p->post_content = NextGEN_Shortcodes::convert_shortcode($p->post_content); // Don't process the images in the normal way remove_all_shortcodes(); // We cannot parse at this point a album, just galleries & single images add_shortcode('singlepic', array(&$this, 'add_images')); add_shortcode('thumb', array(&$this, 'add_images')); add_shortcode('nggallery', array(&$this, 'add_gallery')); add_shortcode('imagebrowser', array(&$this, 'add_gallery')); add_shortcode('slideshow', array(&$this, 'add_gallery')); // Search now for shortcodes do_shortcode($p->post_content); return $this->images; }
private function _run_raw_shortcode($content, $token = false) { global $shortcode_tags; $backup = $shortcode_tags; remove_all_shortcodes(); add_shortcode('raw', array($this, 'raw_shortcode')); // only [raw] shortcode is registered $content = do_shortcode($content); // remove all shortcodes again and process the output of raw_shortcode if ($token) { remove_all_shortcodes(); add_shortcode('awpcp-raw-token', array($this, 'raw_token_shortcode')); // only [raw-token] shortcode is registered $content = do_shortcode($content); } // restore original shortcodes $shortcode_tags = $backup; return $content; }
/** * For sites where text widgets are not processed for shortcodes, we add this hack to process just our shortcode * Attached to `widget_text` * * @param string $text The widget text * @return string The contact-form filtered widget text */ function widget_shortcode_hack($text) { if (!preg_match('/\\[contact-form([^a-zA-Z_-])/', $text)) { return $text; } $old = $GLOBALS['shortcode_tags']; remove_all_shortcodes(); Grunion_Contact_Form_Plugin::$using_contact_form_field = true; $this->add_shortcode(); $text = do_shortcode($text); Grunion_Contact_Form_Plugin::$using_contact_form_field = false; $GLOBALS['shortcode_tags'] = $old; return $text; }
/** * For sites where text widgets are not processed for shortcodes, we add this hack to process just our shortcode * Attached to `widget_text` * * @param string $text The widget text * @return string The contact-form filtered widget text */ function widget_shortcode_hack($text) { if (!preg_match('/\\[contact-form([^a-zA-Z_-])/', $text)) { return $text; } $old = $GLOBALS['shortcode_tags']; remove_all_shortcodes(); $this->add_shortcode(); $text = do_shortcode($text); $GLOBALS['shortcode_tags'] = $old; return $text; }
function fix_shortcodes($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); add_shortcode('last_minute_deal', 'gdl_last_minute_deal_shortcode'); add_shortcode('accordion', 'gdl_accordion_shortcode'); add_shortcode('acc_item', 'gdl_acc_item_shortcode'); add_shortcode('quote', 'gdl_quote_shortcode'); add_shortcode('button', 'gdl_button_shortcode'); add_shortcode('column', 'gdl_column_shortcode'); add_shortcode('code', 'gdl_hilighter_shortcode'); add_shortcode('divider', 'gdl_divider_shortcode'); add_shortcode('dropcap', 'gdl_dropcap_shortcode'); add_shortcode('gdl_gallery', 'gdl_gallery_shortcode'); add_shortcode('list', 'gdl_list_shortcode'); add_shortcode('li', 'gdl_li_shortcode'); add_shortcode('message_box', 'gdl_message_box_shortcode'); add_shortcode('personnel', 'gdl_personnal_shortcode'); add_shortcode('price-item', 'gdl_price_item_shortcode'); add_shortcode('price_list', 'gdl_price_list_shortcode'); add_shortcode('price_content', 'gdl_price_content_shortcode'); add_shortcode('progress_bar', 'gdl_progress_bar'); add_shortcode('social', 'gdl_social_shortcode'); add_shortcode('space', 'gdl_space_shortcode'); add_shortcode('tab', 'gdl_tab_shortcode'); add_shortcode('tab_item', 'gdl_tab_item_shortcode'); add_shortcode('testimonial', 'gdl_testimonial_shortcode'); add_shortcode('toggle_box', 'gdl_toggle_box_shortcode'); add_shortcode('toggle_item', 'gdl_toggle_item_shortcode'); add_shortcode('vimeo', 'gdl_vimeo_shortcode'); add_shortcode('youtube', 'gdl_youtube_shortcode'); add_shortcode('jwplayer', 'gdl_jw_player_shortcode'); // Do the shortcode (only the one above is registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Preprocess shortcodes to prevent HTML mismatch * * Preprocessing shortcodes that use inline HTML tags prevent mess * with <p> tags openings and closings. * These shortcodes will be processed also normally (outside preprocessing) * to retain compatibility with do_shortcode() (in sliders for example). * Surely, if the shortcode was applied in preprocess, it shouldn't appear * again in the content when processing shortcodes normally. * * @since 1.0 * @version 1.0.9.6 * @access public * * @param string $content Post/page content. */ public function preprocess_shortcodes($content = '') { //Helper variables $codes = (array) apply_filters('wmhook_shortcode_' . 'preprocess_shortcodes_array', self::$codes['preprocess']); //If there is no shortcode to preprocess, do nothing if (empty($codes)) { return $content; } //Variables global $shortcode_tags; //Backup current registered shortcodes and clear them all out $shortcodesBackup = $shortcode_tags; remove_all_shortcodes(); //Register shortcodes in preprocessing call_user_func_array(array($this, 'add_shortcodes'), array($codes)); do_action('wmhook_shortcode_' . 'preprocess_shortcodes', $codes, $content); //Do the preprocess shortcodes prematurely (in WordPress standards) $content = do_shortcode($content); //Put the original shortcodes back $shortcode_tags = $shortcodesBackup; //Output return apply_filters('wmhook_shortcode_' . 'preprocess_shortcodes' . '_output', $content); }
/** * Send the application email if posted */ public function application_form_handler() { if (!empty($_POST['wp_job_manager_send_application'])) { try { $fields = $this->get_fields(); $values = array(); $job_id = absint($_POST['job_id']); $job = get_post($job_id); $meta = array(); if (empty($job_id) || !$job || 'job_listing' !== $job->post_type) { throw new Exception(__('Invalid job', 'wp-job-manager-applications')); } if (get_option('job_application_prevent_multiple_applications') && user_has_applied_for_job(get_current_user_id(), $job_id)) { throw new Exception(__('You have already applied for this job', 'wp-job-manager-applications')); } // Validate posted fields foreach ($fields as $key => $field) { $field['rules'] = array_filter(isset($field['rules']) ? (array) $field['rules'] : array()); switch ($field['type']) { case "file": $values[$key] = $this->upload_file($key, $field); if (is_wp_error($values[$key])) { throw new Exception($field['label'] . ': ' . $values[$key]->get_error_message()); } break; default: $values[$key] = isset($_POST[$key]) ? $this->sanitize_text_field_with_linebreaks($_POST[$key]) : ''; break; } // Validate required if ($field['required'] && empty($values[$key])) { throw new Exception(sprintf(__('"%s" is a required field', 'wp-job-manager-applications'), $field['label'])); } // Extra validation rules if (!empty($field['rules']) && !empty($values[$key])) { foreach ($field['rules'] as $rule) { switch ($rule) { case 'email': case 'from_email': if (!is_email($values[$key])) { throw new Exception($field['label'] . ': ' . __('Please provide a valid email address', 'wp-job-manager-applications')); } break; case 'numeric': if (!is_numeric($values[$key])) { throw new Exception($field['label'] . ': ' . __('Please enter a number', 'wp-job-manager-applications')); } break; } } } } // Validation hook $valid = apply_filters('application_form_validate_fields', true, $fields, $values); if (is_wp_error($valid)) { throw new Exception($valid->get_error_message()); } // Prepare meta data to save $from_name = array(); $from_email = ''; $application_message = array(); $meta['_secret_dir'] = self::$secret_dir; $meta['_attachment'] = array(); $meta['_attachment_file'] = array(); foreach ($fields as $key => $field) { if (empty($values[$key])) { continue; } $field['rules'] = array_filter(isset($field['rules']) ? (array) $field['rules'] : array()); if (in_array('from_name', $field['rules'])) { $from_name[] = $values[$key]; } if (in_array('from_email', $field['rules'])) { $from_email = $values[$key]; } if (in_array('message', $field['rules'])) { $application_message[] = $values[$key]; } if (in_array('resume_id', $field['rules'])) { $meta['_resume_id'] = absint($values[$key]); continue; } if ('file' === $field['type']) { if (!empty($values[$key])) { $index = 1; foreach ($values[$key] as $attachment) { if (!is_wp_error($attachment)) { if (in_array('attachment', $field['rules'])) { $meta['_attachment'][] = $attachment->url; $meta['_attachment_file'][] = $attachment->file; } else { $meta[$field['label'] . ' ' . $index] = $attachment->url; } } $index++; } } } elseif ('checkbox' === $field['type']) { $meta[$field['label']] = $values[$key] ? __('Yes', 'wp-job-manager-applications') : __('No', 'wp-job-manager-applications'); } elseif (is_array($values[$key])) { $meta[$field['label']] = implode(', ', $values[$key]); } else { $meta[$field['label']] = $values[$key]; } } $from_name = implode(' ', $from_name); $application_message = implode("\n\n", $application_message); $meta = apply_filters('job_application_form_posted_meta', $meta, $values); // Create application if (!($application_id = create_job_application($job_id, $from_name, $from_email, $application_message, $meta))) { throw new Exception(__('Could not create job application', 'wp-job-manager-applications')); } // Candidate email $candidate_email_content = get_job_application_candidate_email_content(); if ($candidate_email_content) { $existing_shortcode_tags = $GLOBALS['shortcode_tags']; remove_all_shortcodes(); job_application_email_add_shortcodes(array('application_id' => $application_id, 'job_id' => $job_id, 'user_id' => get_current_user_id(), 'candidate_name' => $from_name, 'candidate_email' => $from_email, 'application_message' => $application_message, 'meta' => $meta)); $subject = do_shortcode(get_job_application_candidate_email_subject()); $message = do_shortcode($candidate_email_content); $message = str_replace("\n\n\n\n", "\n\n", implode("\n", array_map('trim', explode("\n", $message)))); $is_html = $message != strip_tags($message); // Does this message contain formatting already? if ($is_html && !strstr($message, '<p') && !strstr($message, '<br')) { $message = nl2br($message); } $GLOBALS['shortcode_tags'] = $existing_shortcode_tags; $headers = array(); $headers[] = 'From: ' . get_bloginfo('name') . ' <noreply@' . str_replace(array('http://', 'https://', 'www.'), '', site_url('')) . '>'; $headers[] = $is_html ? 'Content-Type: text/html' : 'Content-Type: text/plain'; $headers[] = 'charset=utf-8'; wp_mail(apply_filters('create_job_application_candidate_notification_recipient', $from_email, $job_id, $application_id), apply_filters('create_job_application_candidate_notification_subject', $subject, $job_id, $application_id), apply_filters('create_job_application_candidate_notification_message', $message), apply_filters('create_job_application_candidate_notification_headers', $headers, $job_id, $application_id), apply_filters('create_job_application_candidate_notification_attachments', array(), $job_id, $application_id)); } // Message to display add_action('job_content_start', array($this, 'application_form_success')); // Trigger action do_action('new_job_application', $application_id, $job_id); } catch (Exception $e) { $this->error = $e->getMessage(); add_action('job_content_start', array($this, 'application_form_errors')); } } }
private function remove_existing_shortcodes() { global $shortcode_tags; $this->original_shortcodes = $shortcode_tags; remove_all_shortcodes(); }
/** * Rewrite code or name * @since 4.2 */ public function createShortCodes() { remove_all_shortcodes(); foreach (WPBMap::getShortCodes() as $sc_base => $el) { $this->shortcodes[$sc_base] = new WPBakeryShortCodeFishBones($el); } }
function pp_last_run_shortcode($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); add_shortcode('one_half', 'one_half_func'); add_shortcode('one_half_last', 'one_half_last_func'); add_shortcode('one_half_bg', 'one_half_bg_func'); add_shortcode('one_third', 'one_third_func'); add_shortcode('one_third_last', 'one_third_last_func'); add_shortcode('one_third_bg', 'one_third_bg_func'); add_shortcode('two_third', 'two_third_func'); add_shortcode('two_third_bg', 'two_third_bg_func'); add_shortcode('two_third_last', 'two_third_last_func'); add_shortcode('one_fourth', 'one_fourth_func'); add_shortcode('one_fourth_bg', 'one_fourth_bg_func'); add_shortcode('one_fourth_last', 'one_fourth_last_func'); add_shortcode('one_fifth', 'one_fifth_func'); add_shortcode('one_fifth_last', 'one_fifth_last_func'); add_shortcode('tg_gallery', 'tg_gallery_func'); add_shortcode('tg_image', 'tg_image_func'); add_shortcode('tg_tab', 'tg_tab_func'); add_shortcode('tg_ver_tab', 'tg_ver_tab_func'); add_shortcode('tab', 'tab_func'); add_shortcode('tg_accordion', 'tg_accordion_func'); add_shortcode('pp_pre', 'pp_pre_func'); // Do the shortcode (only the one above is registered) $content = do_shortcode($content); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }