Example #1
0
 public function remove()
 {
     if (!empty($this->p->options['plugin_shortcodes'])) {
         remove_shortcode($this->shortcode_tag);
         $this->p->debug->log('[' . $this->shortcode_tag . '] sharing shortcode removed');
     }
 }
Example #2
0
 /**
  * Replace the default caption shortcode handler.
  *
  * @return void
  */
 static function wpse_74735_replace_wp_caption_shortcode()
 {
     remove_shortcode('caption', 'img_caption_shortcode');
     remove_shortcode('wp_caption', 'img_caption_shortcode');
     add_shortcode('caption', array('Bw_setup', 'wpse_74735_caption_shortcode'));
     add_shortcode('wp_caption', array('Bw_setup', 'wpse_74735_caption_shortcode'));
 }
Example #3
0
function icp_post_page_hook($content)
{
    global $post;
    if (trim(icp_get_option('icp_global_carousel_active')) != 'active') {
        if (trim(get_post_meta($post->ID, 'icp_meta_options', true)) != 'no') {
            if (has_filter('icp_frontend_filter')) {
                apply_filters('icp_frontend_filter', '');
            }
            //deactivate WordPress function
            remove_shortcode('gallery', 'gallery_shortcode');
            //activate own function
            add_shortcode('gallery', 'icp_gallery_shortcode');
            //add_action( 'print_footer_scripts', 'icp_frontend_wp_footer' );
            wp_enqueue_script('icp-carousel');
            wp_enqueue_script('icp-easing');
            //wp_enqueue_script( 'icp-lazyload' ); BETA
            wp_enqueue_style('icp-carousel-style');
            wp_enqueue_style('icp-carousel-theme');
            //add_filter( 'wp_get_attachment_image_attributes', 'icp_bfi_thumb_lazyload'); // Lazyload only ( BETA )
            add_filter('wp_get_attachment_image_attributes', 'icp_bfi_thumb');
            // bfi_thumb
            if (trim(icp_get_option('icp_carousel_adapt_height')) == 'false') {
                add_filter('wp_calculate_image_srcset_meta', '__return_null');
            }
        }
    }
    return $content;
}
 public static function affiliates_landing($attr = array(), $content = null)
 {
     global $wpdb;
     remove_shortcode('affiliates_landing');
     $content = do_shortcode($content);
     add_shortcode('affiliates_landing', array(__CLASS__, 'affiliates_landing'));
     $output = "";
     if (strlen($content) > 0) {
         $base_url = trim($content);
         $base_url = str_replace('&', '&', $base_url);
         $base_url = strip_tags($base_url);
         $base_url = preg_replace('/\\r|\\n/', '', $base_url);
         $base_url = trim($base_url);
     }
     if (!class_exists("Affiliates_Service")) {
         require_once AFFILIATES_CORE_LIB . '/class-affiliates-service.php';
     }
     if (isset($_GET[get_option('aff_pname', AFFILIATES_PNAME)])) {
         $affiliate_id = $_GET[get_option('aff_pname', AFFILIATES_PNAME)];
     } else {
         if (isset($_POST[get_option('aff_pname', AFFILIATES_PNAME)])) {
             $affiliate_id = $_POST[get_option('aff_pname', AFFILIATES_PNAME)];
         } else {
             $affiliate_id = Affiliates_Service::get_referrer_id();
         }
     }
     $output .= affiliates_get_affiliate_url($base_url, $affiliate_id);
     return $output;
 }
Example #5
0
 /**
  * Create a gallery shortcode.
  *
  * @since 1.0
  */
 public function setup_gallery_shortcode()
 {
     remove_shortcode('gallery', array($this, 'gallery_shortcode'));
     // First remove the standard wordpress gallery shortcode action.
     add_shortcode('gallery', array($this, 'foundation_gallery_shortcode'));
     // Add our foundation clearing gallery shortcode action here.
 }
 public function attach_to_hooks()
 {
     if (isset($GLOBALS['VipersVideoQuicktags'])) {
         remove_shortcode('youtube');
         add_shortcode('youtube', array($this, 'shortcode_youtube'));
         remove_shortcode('vimeo');
         add_shortcode('vimeo', array($this, 'shortcode_vimeo'));
         remove_shortcode('quicktime');
         remove_shortcode('flash');
         remove_shortcode('videofile');
         remove_shortcode('video');
         remove_shortcode('avi');
         remove_shortcode('mpeg');
         remove_shortcode('wmv');
         add_shortcode('quicktime', array($this, 'shortcode_viper_generic'));
         add_shortcode('flash', array($this, 'shortcode_viper_generic'));
         add_shortcode('videofile', array($this, 'shortcode_viper_generic'));
         add_shortcode('video', array($this, 'shortcode_viper_generic'));
         add_shortcode('avi', array($this, 'shortcode_viper_generic'));
         add_shortcode('mpeg', array($this, 'shortcode_viper_generic'));
         add_shortcode('wmv', array($this, 'shortcode_viper_generic'));
     }
     remove_action('shoutem_get_post_start', array($this, 'on_shoutem_post_start'));
     add_action('shoutem_get_post_start', array($this, 'on_shoutem_post_start'));
 }
Example #7
0
 public function remove()
 {
     if (!empty($this->p->options['plugin_shortcodes'])) {
         remove_shortcode(NGFB_SHARING_SHORTCODE);
         $this->p->debug->log('[' . NGFB_SHARING_SHORTCODE . '] sharing shortcode removed');
     }
 }
 function filter_select()
 {
     $simplemasonry_apply = get_post_meta(get_the_ID(), 'simplemasonry_apply');
     if (!empty($simplemasonry_apply) && $simplemasonry_apply[0] === 'true') {
         $pattern_gallerylink = '/\\[' . preg_quote('gallerylink') . '[^\\]]*\\]/im';
         $pattern_medialink = '/\\[' . preg_quote('medialink') . '[^\\]]*\\]/im';
         $post_text = get_post(get_the_ID());
         if (!empty($post_text->post_content)) {
             $contents = $post_text->post_content;
         }
         if (!empty($contents) && preg_match($pattern_gallerylink, $contents)) {
             // for GalleryLink http://wordpress.org/plugins/gallerylink/
             add_filter('album_gallerylink', array($this, 'add_img_tag'), 17);
             add_filter('album_gallerylink', array($this, 'add_div_tag'), 18);
         } else {
             if (!empty($contents) && preg_match($pattern_medialink, $contents)) {
                 // for MediaLink http://wordpress.org/plugins/medialink/
                 add_filter('album_medialink', array($this, 'add_img_tag'), 17);
                 add_filter('album_medialink', array($this, 'add_div_tag'), 18);
             } else {
                 // for post or page
                 add_filter('the_content', array($this, 'add_img_tag'), 9);
                 remove_shortcode('gallery', 'gallery_shortcode');
                 add_shortcode('gallery', array($this, 'simplemasonry_gallery_shortcode'));
                 add_filter('the_content', array($this, 'add_div_tag'), 16);
             }
         }
     }
 }
 public function initialise_shortcode_listener()
 {
     //remove shortcode listener
     remove_shortcode($this->shortcode);
     //add shortcode listener
     add_shortcode($this->shortcode, array(&$this, 'use_shortcode'));
 }
 /**
  * Get a post by a specified field and value
  *
  * @param string $field
  * @param string $field_value
  * @param string $context Post use context (e.g. 'display')
  * @return array Post
  **/
 function get_post_by($field, $field_value, $context = 'display')
 {
     // validate input
     if (!in_array($field, array('ID', 'name'))) {
         return new WP_Error('invalid_field', 'Invalid API FIELD', 400);
     }
     if (!in_array($context, array('display', 'edit'))) {
         return new WP_Error('invalid_context', 'Invalid API CONTEXT', 400);
     }
     if ('display' === $context) {
         $args = $this->query_args();
         if (isset($args['content_width']) && $args['content_width']) {
             $GLOBALS['content_width'] = (int) $args['content_width'];
         }
     }
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'wp-windows8')) {
         remove_shortcode('gallery', 'gallery_shortcode');
         add_shortcode('gallery', array(&$this, 'win8_gallery_shortcode'));
     }
     // fetch SAL post
     $post = $this->get_sal_post_by($field, $field_value, $context);
     if (is_wp_error($post)) {
         return $post;
     }
     $GLOBALS['post'] = $post;
     // TODO: not sure where this one should go
     if ('display' === $context) {
         setup_postdata($post);
     }
     $response = $this->render_response_keys($post, $context, array_keys($this->post_object_format));
     unset($GLOBALS['post']);
     return $response;
 }
function xtreme_init_gallery()
{
    $start_xtreme_gallery = apply_filters('use_xtreme_gallery', FALSE);
    if ($start_xtreme_gallery) {
        remove_shortcode('gallery', 'gallery_shortcode');
        add_shortcode('gallery', 'xtreme_gallery_shortcode');
    }
}
Example #12
0
function override_download_shortcode()
{
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (is_plugin_active('download-manager/download-manager.php')) {
        remove_shortcode('wpdm_file');
        add_shortcode('wpdm_file', 'new_wpdm_downloadable_nsc');
    }
}
 /**
  * Unregisters the list of shortcodes in Wordpress.
  * @return null
  */
 public function unregister()
 {
     if ($this->hasShortcodes()) {
         foreach ($this->shortcodes as $shortcode => $methodName) {
             remove_shortcode($this->formatCode($shortcode));
         }
     }
 }
function jobman_remove_shortcodes($array)
{
    foreach ((array) $array as $shortcode) {
        $conditional = 'if_' . $shortcode;
        remove_shortcode($shortcode);
        remove_shortcode($conditional);
    }
}
 function remove_embed()
 {
     global $wp_embed;
     remove_filter('the_content', array($wp_embed, 'run_shortcode'), 8);
     // remove the embed shortcode since we would do the part later.
     remove_shortcode('embed');
     // Attempts to embed all URLs in a post
     remove_filter('the_content', array($wp_embed, 'autoembed'), 8);
 }
function bp_media_activity_parent_content_filter($content)
{
    add_shortcode('bp_media_action', 'bp_media_shortcode_action');
    add_shortcode('bp_media_content', 'bp_media_shortcode_content');
    $content = do_shortcode($content);
    remove_shortcode('bp_media_action');
    remove_shortcode('bp_media_content');
    return $content;
}
Example #17
0
 /**
  * Constructor
  */
 public function __construct()
 {
     // GalleryTools Instance
     $this->tools = new GalleryTools();
     // Remove existing WordPress [gallery] shortcode
     remove_shortcode('gallery');
     // Add shortcode
     add_shortcode('gallery', array($this, 'galleryShortcode'));
 }
 /**
  * Evaluate a cost from a sum/string
  * @param  string $sum
  * @param  array  $args
  * @return string
  */
 protected function evaluate_cost($sum, $args = array())
 {
     include_once 'includes/class-wc-eval-math.php';
     add_shortcode('fee', array($this, 'fee'));
     $this->fee_cost = $args['cost'];
     $sum = do_shortcode(str_replace(array('[qty]', '[cost]'), array($args['qty'], $args['cost']), $sum));
     remove_shortcode('fee', array($this, 'fee'));
     return $sum ? WC_Eval_Math::evaluate($sum) : 0;
 }
function mq_delete_setting()
{
    delete_option('mq_register_form_setting');
    delete_option('mq_register_form_title');
    delete_option('mq_register_form_css');
    delete_option('mq_register_facelink');
    delete_option('mq_register_form_intro');
    remove_shortcode('mq_register');
}
function divi_child_theme_setup()
{
    if (class_exists('ET_Builder_Module')) {
        get_template_part('custom-modules/cfpm');
        $cfpm = new FDL_ET_Builder_Module_Fullwidth_Portfolio();
        remove_shortcode('et_pb_fullwidth_portfolio');
        add_shortcode('et_pb_fullwidth_portfolio', array($cfpm, '_shortcode_callback'));
    }
}
Example #21
0
 public function processFormForStrings($content, $prefix = '')
 {
     $this->_prefix = $prefix;
     $shorts = cred_disable_shortcodes();
     add_shortcode('cred-field', array(&$this, 'check_strings_in_shortcodes'));
     do_shortcode($content);
     remove_shortcode('cred-field', array(&$this, 'check_strings_in_shortcodes'));
     cred_re_enable_shortcodes($shorts);
 }
/**
 * Registers "Ads By Author" filter and actions.
 *
 * It does two things:
 * - replaces "by John Doe" on Ad details with link to all user Ads
 * - if current page is default Ads list and GET param "posted_by" is provided
 *   then this function will modify [adverts_list] shortcode to include user
 *   info above Ads list.
 * 
 * @since 1.0
 */
function ads_by_author_init()
{
    add_filter("adverts_tpl_single_posted_by", "ads_by_author_tpl_single_posted_by", 10, 2);
    if (is_page(adverts_config('ads_list_id')) && is_numeric(adverts_request("posted_by"))) {
        remove_shortcode("adverts_list");
        add_shortcode("adverts_list", "ads_by_author_list");
        add_filter("adverts_list_pagination_base", "ads_by_author_pagination_base");
        add_filter("adverts_list_query", "ads_by_author_query");
    }
}
function overwrite_shortcode_woocommerce_cart()
{
    remove_shortcode('woocommerce_cart');
    function submit_form_func($atts)
    {
        include plugin_dir_path(__FILE__) . 'includes/mail.php';
        include plugin_dir_path(__FILE__) . 'includes/submit-form.php';
    }
    add_shortcode('woocommerce_cart', 'submit_form_func');
}
Example #24
0
 public static function mapTemplate($content)
 {
     // Define shortcodes
     $shortcodes = array('product' => 'JV_WCShortcodes::product', 'product_page' => 'JV_WCShortcodes::product_page', 'product_category' => 'JV_WCShortcodes::product_category', 'product_categories' => 'JV_WCShortcodes::product_categories', 'products' => 'JV_WCShortcodes::products', 'recent_products' => 'JV_WCShortcodes::recent_products', 'sale_products' => 'JV_WCShortcodes::sale_products', 'best_selling_products' => 'JV_WCShortcodes::best_selling_products', 'top_rated_products' => 'JV_WCShortcodes::top_rated_products', 'featured_products' => 'JV_WCShortcodes::featured_products', 'product_attribute' => 'JV_WCShortcodes::product_attribute', 'related_products' => 'JV_WCShortcodes::related_products');
     foreach ($shortcodes as $shortcode => $function) {
         remove_shortcode($shortcode);
         add_shortcode(apply_filters("{$shortcode}_shortcode_tag", $shortcode), $function);
     }
     return $content;
 }
 /**
  * Add the shortcodes via the appropriate WP actions, apply the shortcodes to the content and
  * remove the shortcodes after the content has been filtered.
  *
  * @param  string $message_name
  * @param  string $content
  * @return string
  */
 public static function do_shortcodes($message_name, $content)
 {
     foreach (self::$messages[$message_name]['shortcodes'] as $shortcode) {
         add_shortcode($shortcode, array(__CLASS__, 'message_shortcode'));
     }
     $content = do_shortcode($content);
     foreach (self::$messages[$message_name]['shortcodes'] as $shortcode) {
         remove_shortcode($shortcode);
     }
     return $content;
 }
Example #26
0
 function __construct()
 {
     add_action('init', array(&$this, 'add_slideshow_header'));
     add_filter('post_gallery', array(&$this, 'handle_slideshow'), 10, 2);
     if (!is_admin()) {
         return;
     }
     add_action('save_post', array(&$this, 'tag_post_as_slideshow'), 10, 2);
     remove_shortcode('gallery');
     add_shortcode('gallery', array(&$this, 'handle_slideshow'), 10, 2);
 }
 /**
  * Register TablePress Shortcodes, after removing WP-Table Reloaded Shortcodes
  *
  * @since 1.0.0
  */
 public function init_shortcodes()
 {
     // Remove previously registered [table /] Shortcodes (e.g. from WP-Table Reloaded), as these would otherwise be used instead of TablePress's Shortcodes
     remove_shortcode(TablePress::$shortcode);
     remove_shortcode(TablePress::$shortcode_info);
     // Dequeue WP-Table Relaoded Default CSS, as it can influence TablePress table styling
     if (isset($GLOBALS['WP_Table_Reloaded_Frontend'])) {
         remove_action('wp_head', array($GLOBALS['WP_Table_Reloaded_Frontend'], 'add_frontend_css'));
     }
     add_shortcode(TablePress::$shortcode, array($this, 'shortcode_table'));
     add_shortcode(TablePress::$shortcode_info, array($this, 'shortcode_table_info'));
 }
 function init()
 {
     if (shortcode_exists('featured_products')) {
         remove_shortcode('featured_products');
     }
     if (shortcode_exists('recent_products')) {
         remove_shortcode('recent_products');
     }
     add_shortcode('featured_products', 'bs_featured_products');
     add_shortcode('recent_products', 'bs_recent_products');
     add_action('wp_enqueue_scripts', array(&$this, 'woocommerce_twitterbootstrap_setstylesheets'), 99);
     add_action('shop_loop', array($this, 'bs_shop_loop'), 99);
     add_action('woocommerce_before_single_product_summary', array(&$this, 'woocommerce_before_single_product_summary_bs'), 1);
     add_action('woocommerce_before_single_product_summary', array(&$this, 'woocommerce_before_single_product_summary_bs_end'), 100);
     add_action('woocommerce_after_single_product_summary', array(&$this, 'woocommerce_after_single_product_summary_bs'), 1);
     /* thumbnails */
     add_action('bs_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
     add_action('bs_before_shop_loop_item_title', array(&$this, 'bs_get_product_thumbnail'), 10, 3);
     add_action('woocommerce_after_shop_loop', array(&$this, 'endsetupgrid'), 1);
     add_action('woocommerce_before_shop_loop', array(&$this, 'setupgrid'), 999);
     /* the grid display */
     /*
     |  	columns		| mobile 	| tablet 	| desktop	|per page 	|
     ----------------------------------------------------|-----------|
     |		1		|	1		|	1		|	1		| 	10		|
     |---------------------------------------------------|-----------|
     |		2		|	1		|	2		|	2		|	10		|
     |---------------------------------------------------|-----------|
     |		3		|	1		|	1		|	3		|	 9		|
     |---------------------------------------------------|-----------|
     |		3(1)	|	1		|	2		|	3		|	12		|
     |---------------------------------------------------|-----------|
     |		4		|	1		|	2		|	4		|	12		|
     |---------------------------------------------------|-----------|
     |		5		|	n/a		|	n/a		|	n/a		|	n/a	    |
     |---------------------------------------------------|-----------|
     |		6		|	2		|	4		|	6		|	12		|
     |---------------------------------------------------|-----------|
     |		>=6		|	n/a		|	n/a		|	n/a		|	n/a		|
     |---------------------------------------------------------------|
     */
     // Store column count for displaying the grid
     global $woocommerce_loop;
     if (empty($woocommerce_loop['columns'])) {
         $woocommerce_loop['columns'] = get_option('number_of_columns', 4);
     }
     if ($woocommerce_loop['columns'] == 3) {
         add_filter('loop_shop_per_page', create_function('$cols', 'return 9;'), 10);
     } elseif ($woocommerce_loop['columns'] > 2) {
         add_filter('loop_shop_per_page', create_function('$cols', 'return 12;'), 10);
     }
     define('WooCommerce_Twitter_Bootstrap_grid_classes', $this->get_grid_classes($woocommerce_loop));
 }
Example #29
0
/**
* displays pdf button
*/
function dkpdf_display_pdf_button($content)
{
    // if is generated pdf don't show pdf button
    $pdf = get_query_var('pdf');
    if (isset($_POST['dkpdfg_action_create'])) {
        if ($pdf || $_POST['dkpdfg_action_create'] == 'dkpdfg_action_create') {
            remove_shortcode('dkpdf-button');
            $content = str_replace("[dkpdf-button]", "", $content);
            return $content;
        }
    } else {
        if ($pdf) {
            remove_shortcode('dkpdf-button');
            $content = str_replace("[dkpdf-button]", "", $content);
            return $content;
        }
    }
    global $post;
    $post_type = get_post_type($post->ID);
    $option_post_types = sanitize_option('dkpdf_pdfbutton_post_types', get_option('dkpdf_pdfbutton_post_types', array()));
    // TODO button checkboxes?
    if (is_archive() || is_front_page() || is_home()) {
        return $content;
    }
    // return content if not checked
    if ($option_post_types) {
        if (!in_array(get_post_type($post), $option_post_types)) {
            return $content;
        }
    }
    if ($option_post_types) {
        if (in_array(get_post_type($post), $option_post_types)) {
            $c = $content;
            $pdfbutton_position = sanitize_option('dkpdf_pdfbutton_position', get_option('dkpdf_pdfbutton_position', 'before'));
            $template = new DKPDF_Template_Loader();
            if ($pdfbutton_position) {
                if ($pdfbutton_position == 'before') {
                    ob_start();
                    $content = $template->get_template_part('dkpdf-button');
                    return ob_get_clean() . $c;
                } else {
                    if ($pdfbutton_position == 'after') {
                        ob_start();
                        $content = $template->get_template_part('dkpdf-button');
                        return $c . ob_get_clean();
                    }
                }
            }
        }
    } else {
        return $content;
    }
}
 public function attach_to_shortcodes()
 {
     if (isset($GLOBALS['nggdb'])) {
         remove_shortcode('album');
         add_shortcode('album', array($this, 'shortcode_album'));
         remove_shortcode('imagebrowser');
         remove_shortcode('slideshow');
         remove_shortcode('nggallery');
         add_shortcode('nggallery', array($this, 'shortcode_gallery'));
         add_shortcode('slideshow', array($this, 'shortcode_gallery'));
         add_shortcode('imagebrowser', array($this, 'shortcode_gallery'));
     }
 }