0 ) return $results; // No differences so return false else return false; } /** * wpsc_list_product_templates( $path = '' ) * * Lists the files within the WPSC_CORE_THEME_PATH directory * * @access public * @since 3.8 * @param $path - you can provide a path to find the files within it * @return $templates (Array) List of files */ function wpsc_list_product_templates( $path = '' ) { $selected_theme = get_option( 'wpsc_selected_theme' ); // If no path, then try to make some assuptions if ( empty( $path ) ) { if ( file_exists( WPSC_OLD_THEMES_PATH . $selected_theme . '/' . $selected_theme . '.css' ) ) { $path = WPSC_OLD_THEMES_PATH . $selected_theme . '/'; } else { $path = WPSC_CORE_THEME_PATH; } } // Open the path and get the file names $dh = opendir( $path ); while ( ( $file = readdir( $dh ) ) !== false ) { if ( $file != "." && $file != ".." && !strstr( $file, ".svn" ) && !strstr( $file, "images" ) && is_file( $path . $file ) ) { $templates[] = $file; } } // Return template names return $templates; } /** * Displays the theme upgrade notice * @access public * * @since 3.8 * @param null * @return null */ function wpsc_theme_upgrade_notice() { ?>
WP eCommerce is ready. If you plan on editing the look of your site, you should update your active theme to include the additional WP eCommerce files. Click here to ignore and remove this box.', 'wpsc' ), admin_url( 'admin.php?page=wpsc-settings&tab=presentation' ), admin_url( 'admin.php?page=wpsc-settings&tab=presentation&wpsc_notices=theme_ignore' ) ) ?>
Your WP eCommerce data needs to be updated. You\'ve upgraded from a previous version of the WP eCommerce plugin, and your store needs updating.
You should update your database for your store to continue working.', 'wpsc' ), admin_url( 'index.php?page=wpsc-update' ) ) ?>
Store Settings: You have set \'users must register before checkout\', for this to work you need to check \'Anyone can register\' in your WordPress General Settings.', 'wpsc' ), admin_url( 'options-general.php' ) ) ?>
)*\[productspage\](<\/p>)*/", $output, $content ); } elseif(is_archive() && wpsc_is_viewable_taxonomy()){ remove_filter( 'the_content', 'wpautop' ); return wpsc_products_page('[productspage]'); } else { return $content; } } /** * wpsc_the_category_template swaps the template used for product categories with pageif archive template is being used use * @access public * * @since 3.8 * @param $template (string) template path * @return $template (string) */ function wpsc_the_category_template($template){ global $wp_query; //this bit of code makes sure we use a nice standard page template for our products if(wpsc_is_viewable_taxonomy() && false !== strpos($template,'archive')) return str_ireplace('archive', 'page',$template); else return $template; } /** * Returns current product category ID or default category ID if one is set. If one is not set and there is no current category, returns empty string * @return mixed */ function wpsc_get_current_category_id() { global $wp_query; $category_id = ''; if ( isset( $wp_query ) && isset( $wp_query->query_vars['taxonomy'] ) && ('wpsc_product_category' == $wp_query->query_vars['taxonomy'] ) || is_numeric( get_option( 'wpsc_default_category' ) ) ) $category_id = isset( $wp_query->query_vars['term'] ) && is_string( $wp_query->query_vars['term'] ) ? wpsc_get_category_id( $wp_query->query_vars['term'], 'slug' ) : get_option( 'wpsc_default_category' ); return $category_id; } /** * Returns Dynamic User CSS URL * * This produces the cached CSS file if it exists and the uploads folder is writeable. * If the folder is not writeable, we return the dynamic URL * If the folder is writeable, but for some reason a cached copy of the CSS doesn't exist, we attempt to create it and return that URL. * * @since 3.8.9 * @return string */ function wpsc_get_dynamic_user_css_url() { $uploads_dir = wp_upload_dir(); $upload_folder = $uploads_dir['path']; if ( is_writable( $upload_folder ) && file_exists( $upload_folder . '/wpsc_cached_styles.css' ) ) return esc_url( add_query_arg( 'timestamp', get_option( 'wpsc_dynamic_css_hash', time() ), $uploads_dir['url'] . '/wpsc_cached_styles.css' ) ); if ( ! is_writable( $upload_folder ) ) return esc_url( add_query_arg( 'wpsc_user_dynamic_css', 'true', home_url( 'index.php' ) ) ); if ( is_writable( $upload_folder ) && ! file_exists( $upload_folder . '/wpsc_cached_styles.css' ) ) return wpsc_cache_to_upload(); } /** * Moves dynamically generated input into a file in the uploads folder. * Also updates CSS hash timestamp. Timestamp is appended to URL * * @since 3.8.9 * @return mixed File URL on successful move, false on failure */ function wpsc_cache_to_upload() { $uploads_dir = wp_upload_dir(); $upload_folder = $uploads_dir['path']; $path = $upload_folder . '/wpsc_cached_styles.css'; if ( ! is_writable( $upload_folder ) ) return false; if ( false === file_put_contents( $path, wpsc_get_user_dynamic_css() ) ) return false; $timestamp = time(); update_option( 'wpsc_dynamic_css_hash', $timestamp ); return esc_url( add_query_arg( 'timestamp', $timestamp, $uploads_dir['url'] . '/wpsc_cached_styles.css' ) ); } /** * Prints dynamic CSS. This function is run either when the dynamic URL is hit, or when we need to grab new CSS to cache. * * @since 3.8.9 * @return CSS */ function wpsc_user_dynamic_css() { header( 'Content-Type: text/css' ); header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) ); header( 'Cache-Control: public, must-revalidate, max-age=86400' ); header( 'Pragma: public' ); echo wpsc_get_user_dynamic_css(); exit; } /** * Returns dynamic CSS as string. This function is run either when the dynamic URL is hit, or when we need to grab new CSS to cache. * * @since 3.8.9 * @return string */ function wpsc_get_user_dynamic_css() { global $wpdb; ob_start(); if ( ! defined( 'WPSC_DISABLE_IMAGE_SIZE_FIXES' ) || (constant( 'WPSC_DISABLE_IMAGE_SIZE_FIXES' ) != true ) ) { $thumbnail_width = get_option( 'product_image_width' ); if ( $thumbnail_width <= 0 ) $thumbnail_width = 96; $thumbnail_height = get_option( 'product_image_height' ); if ( $thumbnail_height <= 0 ) $thumbnail_height = 96; $single_thumbnail_width = get_option( 'single_view_image_width' ); $single_thumbnail_height = get_option( 'single_view_image_height' ); if ( $single_thumbnail_width <= 0 ) $single_thumbnail_width = 128; $category_height = get_option( 'category_image_height' ); $category_width = get_option( 'category_image_width' ); ?> /* * Default View Styling */ div.default_product_display div.textcol{ margin-left: px !important; min-height: px; _height: px; } div.default_product_display div.textcol div.imagecol{ position:absolute; top:0px; left: 0px; margin-left: -px !important; } div.default_product_display div.textcol div.imagecol a img { width: px; height: px; } .wpsc_category_grid_item { display:block; float:left; width: px; height: px; } .wpsc_category_grid_item span{ position:relative; top:px; } div.default_product_display div.item_no_image a { width: px; } div.default_product_display .imagecol img.no-image, #content div.default_product_display .imagecol img.no-image { width: px; height: px; } /* * Single View Styling */ div.single_product_display div.item_no_image { width: px; height: px; } div.single_product_display div.item_no_image a { width: px; } div.single_product_display div.textcol{ margin-left: px !important; min-height: px; _height: px; } div.single_product_display div.textcol div.imagecol{ position:absolute; margin-left: -px !important; } div.single_product_display div.textcol div.imagecol a img { width: px; height: px; } div#categorydisplay{ display: ; } div#branddisplay{ display: ; } get_var($wpdb->prepare( "SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = %s AND `meta_value` = %d LIMIT 1", '_wpsc_original_id', $prod_id )); return $post_id; } /** * This switched between the 3 view types on category and products pages and includes the necessary template part * @access public * * @since 3.8 * @param $display_type * @return NULL */ function wpsc_include_products_page_template( $display_type = 'default' ) { if ( isset( $_GET['view_type'] ) ) { switch ( $_GET['view_type'] ) { case 'grid': $display_type = 'grid'; wpsc_update_customer_meta( 'display_type', $display_type ); break; case 'list': $display_type = 'list'; wpsc_update_customer_meta( 'display_type', $display_type ); break; case 'default': $display_type = 'default'; wpsc_update_customer_meta( 'display_type', $display_type ); break; default: break; } } // switch the display type, based on the display type variable... switch ( $display_type ) { case "grid": include( wpsc_get_template_file_path( 'wpsc-grid_view.php' ) ); break; // only break if we have the function; case "list": include( wpsc_get_template_file_path( 'wpsc-list_view.php' ) ); break; // only break if we have the file; default: include( wpsc_get_template_file_path( 'wpsc-products_page.php' ) ); break; } } function wpsc_thesis_compat( $loop ) { $loop[1] = 'page'; return $loop; } // Template tags function wpsc_all_products_on_page(){ if ( is_404() ) { return; } global $wp_query,$wpsc_query; do_action('wpsc_swap_the_template'); $products_page_id = wpsc_get_the_post_id_by_shortcode('[productspage]'); $term = get_query_var( 'wpsc_product_category' ); $tax_term = get_query_var ('product_tag' ); $obj = $wp_query->get_queried_object(); $id = isset( $obj->ID ) ? $obj->ID : null; if( get_query_var( 'post_type' ) == 'wpsc-product' || $term || $tax_term || ( $id == $products_page_id )){ $templates = array(); if ( $term && ! is_single() ) { array_push( $templates, "taxonomy-wpsc_product_category-{$term}.php", 'taxonomy-wpsc_product_category.php' ); } if ( $tax_term && ! is_single() ) { array_push( $templates, "taxonomy-product_tag-{$tax_term}.php", 'taxonomy-product_tag.php' ); } // Attempt to use the [productspage]'s custom page template as a higher priority than the normal page.php template if ( false !== $productspage_page_template = get_post_meta($products_page_id, '_wp_page_template', true) ) array_push( $templates, $productspage_page_template ); array_push( $templates, 'page.php', 'single.php' ); if ( is_single() ) array_unshift( $templates, 'single-wpsc-product.php' ); // have to pass 'page' as the template type. This is lame, btw, and needs a rewrite in 4.0 if ( ! $template = get_query_template( 'page', $templates ) ) $template = get_index_template(); add_filter( 'thesis_custom_loop', 'wpsc_thesis_compat' ); include( $template ); exit; } } /** * wpsc_count_themes_in_uploads_directory, does exactly what the name says */ function wpsc_count_themes_in_uploads_directory() { $uploads_dir = false; if ( is_dir( WPSC_OLD_THEMES_PATH.get_option('wpsc_selected_theme').'/' ) ) $uploads_dir = @opendir( WPSC_OLD_THEMES_PATH.get_option('wpsc_selected_theme').'/' ); // might cause problems if dir doesnt exist if ( !$uploads_dir ) return false; $file_names = array( ); while ( ($file = @readdir( $uploads_dir )) !== false ) { if ( is_dir( WPSC_OLD_THEMES_PATH . get_option('wpsc_selected_theme') . '/' . $file ) && ($file != "..") && ($file != ".") && ($file != ".svn") ) $file_names[] = $file; } @closedir( $uploads_dir ); return count( $file_names ); } function wpsc_place_shopping_cart( $content = '' ) { if ( ! in_the_loop() ) return $content; if ( preg_match( "/\[shoppingcart\]/", $content ) ) { // BEGIN: compatibility fix for outdated theme files still relying on sessions $_SESSION['coupon_numbers' ] = wpsc_get_customer_meta( 'coupon' ); $_SESSION['wpsc_checkout_misc_error_messages' ] = wpsc_get_customer_meta( 'checkout_misc_error_messages' ); $_SESSION['categoryAndShippingCountryConflict'] = wpsc_get_customer_meta( 'category_shipping_conflict' ); $_SESSION['shippingSameBilling' ] = wpsc_get_customer_meta( 'shippingSameBilling' ); $_SESSION['wpsc_checkout_user_error_messages' ] = wpsc_get_customer_meta( 'registration_error_messages' ); // END: compatibility fix $GLOBALS['nzshpcrt_activateshpcrt'] = true; if ( ! defined( 'DONOTCACHEPAGE' ) ) define( 'DONOTCACHEPAGE', true ); // call this function to detect conflicts when the cart page is first loaded, otherwise // any conflict messages will only be displayed on the next page load wpsc_get_acceptable_countries(); ob_start(); do_action( 'wpsc_before_shopping_cart_page' ); include( wpsc_get_template_file_path( 'wpsc-shopping_cart_page.php' ) ); do_action( 'wpsc_after_shopping_cart_page' ); $output = ob_get_contents(); ob_end_clean(); $output = str_replace( '$', '\$', $output ); wpsc_delete_customer_meta( 'checkout_misc_error_messages' ); wpsc_delete_customer_meta( 'category_shipping_conflict' ); wpsc_delete_customer_meta( 'registration_error_messages' ); wpsc_delete_customer_meta( 'checkout_error_messages' ); wpsc_delete_customer_meta( 'gateway_error_messages' ); return preg_replace( "/(
)*\[shoppingcart\](<\/p>)*/", $output, $content ); } else { return $content; } } function wpsc_transaction_results( $content = '' ) { if ( ! in_the_loop() ) return $content; if ( preg_match( "/\[transactionresults\]/", $content ) ) { if ( ! defined( 'DONOTCACHEPAGE' ) || ( defined( 'DONOTCACHEPAGE' ) && ! DONOTCACHEPAGE ) ) { define( 'DONOTCACHEPAGE', true ); } ob_start(); include( wpsc_get_template_file_path( 'wpsc-transaction_results.php' ) ); $output = ob_get_contents(); ob_end_clean(); $output = preg_replace( '#(?)*\[transactionresults\](<\/p>)*/", $output, $content ); } else { return $content; } } function wpsc_user_log( $content = '' ) { if ( ! in_the_loop() ) return $content; if ( preg_match( "/\[userlog\]/", $content ) ) { if ( ! defined( 'DONOTCACHEPAGE' ) ) { define( 'DONOTCACHEPAGE', true ); } ob_start(); include( wpsc_get_template_file_path('wpsc-user-log.php') ); $output = ob_get_clean(); $content = preg_replace( "/(
)*\[userlog\](<\/p>)*/", '[userlog]', $content ); return str_replace( '[userlog]', $output, $content ); } else { return $content; } } function wpsc_get_the_post_id_by_shortcode( $shortcode ) { $shortcode_options = array( '[productspage]' => 'product_list_url', '[shoppingcart]' => 'shopping_cart_url', '[checkout]' => 'shopping_cart_url', '[transactionresults]' => 'transact_url', '[userlog]' => 'user_account_url' ); if ( ! isset( $shortcode_options[$shortcode] ) ) return 0; $page_ids = get_option( 'wpsc_shortcode_page_ids', false ); if ( $page_ids === false ) { wpsc_update_permalink_slugs(); $page_ids = get_option( 'wpsc_shortcode_page_ids', false ); } $post_id = isset( $page_ids[$shortcode] ) ? $page_ids[$shortcode] : null; // For back compat $post_id = apply_filters( 'wpec_get_the_post_id_by_shortcode', $post_id ); return apply_filters( 'wpsc_get_the_post_id_by_shortcode', $post_id, $shortcode ); } function wpec_remap_shop_subpages( $vars ) { if( empty( $vars ) ) return $vars; $reserved_names = array('[shoppingcart]','[userlog]','[transactionresults]'); foreach($reserved_names as $reserved_name){ if ( isset( $vars['taxonomy'] ) && $vars['taxonomy'] == 'wpsc_product_category' && isset( $vars['term'] ) && $vars['term'] == $page->post_name ) { $page_id = wpsc_get_the_post_id_by_shortcode( $reserved_name ); $page = get_post( $page_id ); return array( 'page_id' => $page->ID ); } } return $vars; } function wpsc_remove_page_from_query_string( $query_string ) { if ( false === strpos( implode( ' ', $query_string ), 'wpsc' ) ) { return $query_string; } if ( isset( $query_string['name'] ) && $query_string['name'] == 'page' && isset( $query_string['page'] ) ) { unset( $query_string['name'] ); list( $delim, $page_index ) = explode( '/', $query_string['page'] ); $query_string['paged'] = $page_index; } if ( isset( $query_string['wpsc-product'] ) && 'page' == $query_string['wpsc-product'] ) { $query_string['wpsc-product'] = ''; } if ( isset( $query_string['name'] ) && is_numeric( $query_string['name'] ) ) { $query_string['paged'] = $query_string['name']; $query_string['page'] = '/'.$query_string['name']; $query_string['posts_per_page'] = get_option('wpsc_products_per_page'); } if ( isset( $query_string['wpsc-product'] ) && is_numeric( $query_string['wpsc-product'] ) ) { unset( $query_string['wpsc-product'] ); } if ( isset( $query_string['wpsc_product_category'] ) && 'page' == $query_string['wpsc_product_category'] ) { unset( $query_string['wpsc_product_category'] ); } if ( isset( $query_string['name'] ) && is_numeric( $query_string['name'] ) ) { unset( $query_string['name'] ); } if ( isset($query_string['term']) && 'page' == $query_string['term'] ) { unset( $query_string['term'] ); unset( $query_string['taxonomy'] ); } return $query_string; } function is_products_page(){ global $post; if ( empty( $post ) || ! is_object( $post ) || empty( $post->ID ) ) return false; $product_page_id = wpsc_get_the_post_id_by_shortcode( '[productspage]' ); return $post->ID == $product_page_id; } /** * wpsc_display_products_page function. * * @access public * @param mixed $query * @return void */ function wpsc_display_featured_products_page() { global $wp_query; $output = ''; $sticky_array = get_option( 'sticky_products' ); if ( (is_front_page() || is_home() || is_products_page() ) && !empty( $sticky_array ) && $wp_query->post_count > 1) { $query = get_posts( array( 'post__in' => $sticky_array, 'post_type' => 'wpsc-product', 'orderby' => 'rand', 'numberposts' => 1, 'posts_per_page' => 1 ) ); if ( count( $query ) > 0 ) { $GLOBALS['nzshpcrt_activateshpcrt'] = true; $image_width = get_option( 'product_image_width' ); $image_height = get_option( 'product_image_height' ); $featured_product_theme_path = wpsc_get_template_file_path( 'wpsc-featured_product.php' ); ob_start(); include_once($featured_product_theme_path); $is_single = false; $output .= ob_get_contents(); ob_end_clean(); //Begin outputting featured product. We can worry about templating later, or folks can just CSS it up. echo $output; //End output } } } function wpsc_hidesubcatprods_init() { $hide_subcatsprods = new WPSC_Hide_subcatsprods_in_cat; add_action( 'pre_get_posts', array( &$hide_subcatsprods, 'get_posts' ) ); } // check for all in one SEO pack and the is_static_front_page function if ( is_callable( array( "All_in_One_SEO_Pack", 'is_static_front_page' ) ) ) { function wpsc_change_aioseop_home_title( $title ) { global $aiosp, $aioseop_options; if ( (get_class( $aiosp ) == 'All_in_One_SEO_Pack') && $aiosp->is_static_front_page() ) { $aiosp_home_title = $aiosp->internationalize( $aioseop_options['aiosp_home_title'] ); $new_title = wpsc_obtain_the_title(); if ( $new_title != '' ) { $title = str_replace( $aiosp_home_title, $new_title, $title ); } } return $title; } add_filter( 'aioseop_home_page_title', 'wpsc_change_aioseop_home_title' ); } /** * wpsc_obtain_the_title function, for replaacing the page title with the category or product * @return string - the new page title */ function wpsc_obtain_the_title() { global $wpdb, $wp_query, $wpsc_title_data; $output = null; $category_id = null; if( !isset( $wp_query->query_vars['wpsc_product_category']) && !isset( $wp_query->query_vars['wpsc-product'])) return; if ( !isset( $wp_query->query_vars['wpsc_product_category'] ) && isset($wp_query->query_vars['wpsc-product']) ) $wp_query->query_vars['wpsc_product_category'] = 0; if ( isset( $wp_query->query_vars['taxonomy'] ) && 'wpsc_product_category' == $wp_query->query_vars['taxonomy'] || isset($wp_query->query_vars['wpsc_product_category'])) $category_id = wpsc_get_the_category_id($wp_query->query_vars['wpsc_product_category'],'slug'); if ( $category_id > 0 ) { if ( isset( $wpsc_title_data['category'][$category_id] ) ) { $output = $wpsc_title_data['category'][$category_id]; } else { $term = get_term($category_id, 'wpsc_product_category'); $output = $term->name; $wpsc_title_data['category'][$category_id] = $output; } } if ( !isset( $_GET['wpsc-product'] ) ) $_GET['wpsc-product'] = 0; if ( !isset( $wp_query->query_vars['wpsc-product'] ) ) $wp_query->query_vars['wpsc-product'] = ''; if ( isset( $wp_query->query_vars['wpsc-product'] ) || is_string( $_GET['wpsc-product'] ) ) { $product_name = $wp_query->query_vars['wpsc-product']; if ( isset( $wpsc_title_data['product'][$product_name] ) ) { $product_list = array( ); $full_product_name = $wpsc_title_data['product'][$product_name]; } else if ( $product_name != '' ) { $product_id = $wp_query->post->ID; $full_product_name = $wpdb->get_var( $wpdb->prepare( "SELECT `post_title` FROM `$wpdb->posts` WHERE `ID`= %d LIMIT 1", $product_id ) ); $wpsc_title_data['product'][$product_name] = $full_product_name; } else { if(isset($_REQUEST['product_id'])){ $product_id = absint( $_REQUEST['product_id'] ); $product_name = $wpdb->get_var( $wpdb->prepare( "SELECT `post_title` FROM `$wpdb->posts` WHERE `ID`= %d LIMIT 1", $product_id ) ); $full_product_name = $wpdb->get_var( $wpdb->prepare( "SELECT `post_title` FROM `$wpdb->posts` WHERE `ID`= %d LIMIT 1", $product_id ) ); $wpsc_title_data['product'][$product_name] = $full_product_name; }else{ //This has to exist, otherwise we would have bailed earlier. $category = $wp_query->query_vars['wpsc_product_category']; $cat_term = get_term_by('slug',$wp_query->query_vars['wpsc_product_category'], 'wpsc_product_category'); $full_product_name = $cat_term->name; } } $output = $full_product_name; } if ( isset( $full_product_name ) && ($full_product_name != null) ) $output = esc_html( $full_product_name ); $seperator = ' | '; $seperator = apply_filters('wpsc_the_wp_title_seperator' , $seperator); return $output.$seperator; } /** * Return category or product description depending on queried item */ function wpsc_obtain_the_description() { $output = null; // Return Category Description if ( is_numeric( get_query_var('category_id') ) ) { $output = wpsc_get_categorymeta( get_query_var('category_id'), 'description' ); } else if ( ! empty($_GET['category']) ) { $output = wpsc_get_categorymeta( absint( $_GET['category'] ), 'description' ); } // Return product content as description if product page if ( !empty($_GET['product_id'] ) && is_numeric( $_GET['product_id'] ) ) { $product = get_post(absint( $_GET['product_id'] )); $output = $product->post_content; } return $output; } function wpsc_set_aioseop_description( $data ) { $replacement_data = wpsc_obtain_the_description(); if ( $replacement_data != '' ) { $data = $replacement_data; } return $data; } /** * this page url function, returns the URL of this page * @return string - the URL of the current page */ function wpsc_this_page_url() { global $wpsc_query, $wp_query; if ( $wpsc_query->is_single === true ) { $output = get_permalink( $wp_query->post->ID ); } else if ( isset( $wpsc_query->category ) && $wpsc_query->category != null ) { $output = wpsc_category_url( $wpsc_query->category ); if ( $wpsc_query->query_vars['page'] > 1 ) { if ( get_option( 'permalink_structure' ) ) { $output .= "page/{$wpsc_query->query_vars['page']}/"; } else { $output = add_query_arg( 'page_number', $wpsc_query->query_vars['page'], $output ); } } } elseif ( isset( $id ) ) { $output = get_permalink( $id ); } else { $output = get_permalink( get_the_ID() ); } return esc_url( $output ); } /** * Strips shortcode placeholders from excerpts returned in search results (and excerpts returned anywhere). * * @param string $text Trimmed excerpt * @return string $text Trimmed excerpt, sans placeholders * * @since 3.9.0 */ function wpsc_strip_shortcode_placeholders( $text ) { $is_wpsc_placeholder = false; $wpsc_shortcodes = array( '[productspage]' , '[shoppingcart]' , '[checkout]' , '[transactionresults]', '[userlog]' , ); foreach ( $wpsc_shortcodes as $shortcode ) { if ( false !== strpos( $text, $shortcode ) ) { $is_wpsc_placeholder = $shortcode; break; } } if ( $is_wpsc_placeholder ) { $text = str_replace( $is_wpsc_placeholder, '', $text ); } return $text; } add_filter( 'wp_trim_excerpt', 'wpsc_strip_shortcode_placeholders' );