Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/module
File: Shop.php
[500] Fix | Delete
if ( is_product_category() ) {
[501] Fix | Delete
$this->props['include_categories'] = (string) get_queried_object_id();
[502] Fix | Delete
} else if ( is_product_tag() ) {
[503] Fix | Delete
$product_tags = array( get_queried_object()->slug );
[504] Fix | Delete
} else if ( is_product_taxonomy() ) {
[505] Fix | Delete
$term = get_queried_object();
[506] Fix | Delete
[507] Fix | Delete
// Product attribute taxonomy slugs start with pa_
[508] Fix | Delete
if ( et_()->starts_with( $term->taxonomy, 'pa_' ) ) {
[509] Fix | Delete
$product_attribute = $term->taxonomy;
[510] Fix | Delete
$product_terms[] = $term->slug;
[511] Fix | Delete
}
[512] Fix | Delete
}
[513] Fix | Delete
}
[514] Fix | Delete
[515] Fix | Delete
if ( 'product_category' === $type || ( $use_current_loop && ! empty( $this->props['include_categories'] ) ) ) {
[516] Fix | Delete
$all_shop_categories = et_builder_get_shop_categories();
[517] Fix | Delete
$all_shop_categories_map = array();
[518] Fix | Delete
$raw_product_categories = self::filter_include_categories( $this->props['include_categories'], $post_id, 'product_cat' );
[519] Fix | Delete
[520] Fix | Delete
foreach ( $all_shop_categories as $term ) {
[521] Fix | Delete
if ( is_object( $term ) && is_a( $term, 'WP_Term' ) ) {
[522] Fix | Delete
$all_shop_categories_map[ $term->term_id ] = $term->slug;
[523] Fix | Delete
}
[524] Fix | Delete
}
[525] Fix | Delete
[526] Fix | Delete
$product_categories = array_values( $all_shop_categories_map );
[527] Fix | Delete
[528] Fix | Delete
if ( ! empty( $raw_product_categories ) ) {
[529] Fix | Delete
$product_categories = array_intersect_key(
[530] Fix | Delete
$all_shop_categories_map,
[531] Fix | Delete
array_flip( $raw_product_categories )
[532] Fix | Delete
);
[533] Fix | Delete
}
[534] Fix | Delete
}
[535] Fix | Delete
[536] Fix | Delete
// Recent was the default option in Divi once, so it is added here for the websites created before the change
[537] Fix | Delete
if ( 'default' === $orderby && ( 'default' === $type || 'recent' === $type ) ) {
[538] Fix | Delete
// Leave the attribute empty to allow WooCommerce to take over and use the default sorting.
[539] Fix | Delete
$orderby = '';
[540] Fix | Delete
}
[541] Fix | Delete
[542] Fix | Delete
if ( 'latest' === $type ) {
[543] Fix | Delete
$orderby = 'date-desc';
[544] Fix | Delete
}
[545] Fix | Delete
[546] Fix | Delete
if ( in_array( $orderby, array( 'price-desc', 'date-desc' ) ) ) {
[547] Fix | Delete
// Supported orderby arguments (as defined by WC_Query->get_catalog_ordering_args() ):
[548] Fix | Delete
// rand | date | price | popularity | rating | title
[549] Fix | Delete
$orderby = str_replace( '-desc', '', $orderby );
[550] Fix | Delete
// Switch to descending order if orderby is 'price-desc' or 'date-desc'
[551] Fix | Delete
$order = 'DESC';
[552] Fix | Delete
}
[553] Fix | Delete
[554] Fix | Delete
$ids = array();
[555] Fix | Delete
$wc_custom_view = '';
[556] Fix | Delete
$wc_custom_views = array(
[557] Fix | Delete
'sale' => array( 'on_sale', 'true' ),
[558] Fix | Delete
'best_selling' => array( 'best_selling', 'true' ),
[559] Fix | Delete
'top_rated' => array( 'top_rated', 'true' ),
[560] Fix | Delete
'featured' => array( 'visibility', 'featured' ),
[561] Fix | Delete
);
[562] Fix | Delete
[563] Fix | Delete
if ( et_()->includes( array_keys( $wc_custom_views ), $type ) ) {
[564] Fix | Delete
$custom_view_data = $wc_custom_views[ $type ];
[565] Fix | Delete
$wc_custom_view = sprintf( '%1$s="%2$s"', esc_attr( $custom_view_data[0] ), esc_attr( $custom_view_data[1] ) );
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
$shortcode = sprintf(
[569] Fix | Delete
'[products %1$s limit="%2$s" orderby="%3$s" columns="%4$s" %5$s order="%6$s" %7$s %8$s %9$s %10$s %11$s]',
[570] Fix | Delete
et_core_intentionally_unescaped( $wc_custom_view, 'fixed_string' ),
[571] Fix | Delete
esc_attr( $posts_number ),
[572] Fix | Delete
esc_attr( $orderby ),
[573] Fix | Delete
esc_attr( $columns ),
[574] Fix | Delete
$product_categories ? sprintf( 'category="%s"', esc_attr( implode( ',', $product_categories ) ) ) : '',
[575] Fix | Delete
esc_attr( $order ),
[576] Fix | Delete
$pagination ? 'paginate="true"' : '',
[577] Fix | Delete
$ids ? sprintf( 'ids="%s"', esc_attr( implode( ',', $ids ) ) ) : '',
[578] Fix | Delete
$product_tags ? sprintf( 'tag="%s"', esc_attr( implode( ',', $product_tags ) ) ) : '',
[579] Fix | Delete
$product_attribute ? sprintf( 'attribute="%s"', esc_attr( $product_attribute ) ) : '',
[580] Fix | Delete
$product_terms ? sprintf( 'terms="%s"', esc_attr( implode( ',', $product_terms ) ) ) : ''
[581] Fix | Delete
);
[582] Fix | Delete
[583] Fix | Delete
do_action( 'et_pb_shop_before_print_shop' );
[584] Fix | Delete
[585] Fix | Delete
global $wp_the_query;
[586] Fix | Delete
[587] Fix | Delete
$query_backup = $wp_the_query;
[588] Fix | Delete
[589] Fix | Delete
if ( $use_current_loop ) {
[590] Fix | Delete
add_filter( 'woocommerce_shortcode_products_query', array( $this, 'filter_products_query' ) );
[591] Fix | Delete
add_action( 'pre_get_posts', array( $this, 'apply_woo_widget_filters' ), 0 );
[592] Fix | Delete
}
[593] Fix | Delete
[594] Fix | Delete
$shop = do_shortcode( $shortcode );
[595] Fix | Delete
[596] Fix | Delete
if ( $use_current_loop ) {
[597] Fix | Delete
remove_action( 'pre_get_posts', array( $this, 'apply_woo_widget_filters' ), 0 );
[598] Fix | Delete
remove_filter( 'woocommerce_shortcode_products_query', array( $this, 'filter_products_query' ) );
[599] Fix | Delete
}
[600] Fix | Delete
[601] Fix | Delete
$wp_the_query = $query_backup;
[602] Fix | Delete
[603] Fix | Delete
do_action( 'et_pb_shop_after_print_shop' );
[604] Fix | Delete
[605] Fix | Delete
if ( '<div class="woocommerce columns-0"></div>' === $shop || et_()->starts_with( $shop, $shortcode ) ) {
[606] Fix | Delete
$shop = self::get_no_results_template();
[607] Fix | Delete
}
[608] Fix | Delete
[609] Fix | Delete
return $shop;
[610] Fix | Delete
}
[611] Fix | Delete
[612] Fix | Delete
/**
[613] Fix | Delete
* Get shop HTML for shop module
[614] Fix | Delete
*
[615] Fix | Delete
* @param array arguments that affect shop output
[616] Fix | Delete
* @param array passed conditional tag for update process
[617] Fix | Delete
* @param array passed current page params
[618] Fix | Delete
* @return string HTML markup for shop module
[619] Fix | Delete
*/
[620] Fix | Delete
static function get_shop_html( $args = array(), $conditional_tags = array(), $current_page = array() ) {
[621] Fix | Delete
$shop = new self();
[622] Fix | Delete
[623] Fix | Delete
do_action( 'et_pb_get_shop_html_before' );
[624] Fix | Delete
[625] Fix | Delete
$shop->props = $args;
[626] Fix | Delete
[627] Fix | Delete
// Force product loop to have 'product' class name. It appears that 'product' class disappears
[628] Fix | Delete
// when $this->get_shop() is being called for update / from admin-ajax.php
[629] Fix | Delete
add_filter( 'post_class', array( $shop, 'add_product_class_name' ) );
[630] Fix | Delete
[631] Fix | Delete
// Get product HTML
[632] Fix | Delete
$output = $shop->get_shop( array(), array(), $current_page );
[633] Fix | Delete
[634] Fix | Delete
// Remove 'product' class addition to product loop's post class
[635] Fix | Delete
remove_filter( 'post_class', array( $shop, 'add_product_class_name' ) );
[636] Fix | Delete
[637] Fix | Delete
do_action( 'et_pb_get_shop_html_after' );
[638] Fix | Delete
[639] Fix | Delete
return $output;
[640] Fix | Delete
}
[641] Fix | Delete
[642] Fix | Delete
[643] Fix | Delete
// WooCommerce changed the title tag from h3 to h2 in 3.0.0
[644] Fix | Delete
function get_title_selector() {
[645] Fix | Delete
$title_selector = 'li.product h3';
[646] Fix | Delete
[647] Fix | Delete
if ( class_exists( 'WooCommerce' ) ) {
[648] Fix | Delete
global $woocommerce;
[649] Fix | Delete
[650] Fix | Delete
if ( version_compare( $woocommerce->version, '3.0.0', '>=' ) ) {
[651] Fix | Delete
$title_selector = 'li.product h2';
[652] Fix | Delete
}
[653] Fix | Delete
}
[654] Fix | Delete
[655] Fix | Delete
return $title_selector;
[656] Fix | Delete
}
[657] Fix | Delete
[658] Fix | Delete
function render( $attrs, $content = null, $render_slug ) {
[659] Fix | Delete
$type = $this->props['type'];
[660] Fix | Delete
$include_categories = $this->props['include_categories'];
[661] Fix | Delete
$posts_number = $this->props['posts_number'];
[662] Fix | Delete
$orderby = $this->props['orderby'];
[663] Fix | Delete
$columns = $this->props['columns_number'];
[664] Fix | Delete
[665] Fix | Delete
$video_background = $this->video_background();
[666] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[667] Fix | Delete
[668] Fix | Delete
$sale_badge_color_hover = $this->get_hover_value( 'sale_badge_color' );
[669] Fix | Delete
$sale_badge_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'sale_badge_color' );
[670] Fix | Delete
$icon_hover_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'icon_hover_color' );
[671] Fix | Delete
$hover_overlay_color_value = et_pb_responsive_options()->get_property_values( $this->props, 'hover_overlay_color' );
[672] Fix | Delete
[673] Fix | Delete
$hover_icon = $this->props['hover_icon'];
[674] Fix | Delete
$hover_icon_values = et_pb_responsive_options()->get_property_values( $this->props, 'hover_icon' );
[675] Fix | Delete
$hover_icon_tablet = isset( $hover_icon_values['tablet'] ) ? $hover_icon_values['tablet'] : '';
[676] Fix | Delete
$hover_icon_phone = isset( $hover_icon_values['phone'] ) ? $hover_icon_values['phone'] : '';
[677] Fix | Delete
[678] Fix | Delete
// Sale Badge Color.
[679] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $sale_badge_color_values, '%%order_class%% span.onsale', 'background-color', $render_slug, ' !important;', 'color' );
[680] Fix | Delete
[681] Fix | Delete
if ( et_builder_is_hover_enabled( 'sale_badge_color', $this->props ) ) {
[682] Fix | Delete
ET_Builder_Element::set_style( $render_slug, array(
[683] Fix | Delete
'selector' => '%%order_class%%:hover span.onsale',
[684] Fix | Delete
'declaration' => sprintf(
[685] Fix | Delete
'background-color: %1$s !important;',
[686] Fix | Delete
esc_html( $sale_badge_color_hover )
[687] Fix | Delete
),
[688] Fix | Delete
) );
[689] Fix | Delete
}
[690] Fix | Delete
[691] Fix | Delete
// Icon Hover Color.
[692] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $icon_hover_color_values, '%%order_class%% .et_overlay:before', 'color', $render_slug, ' !important;', 'color' );
[693] Fix | Delete
[694] Fix | Delete
// Hover Overlay Color.
[695] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $hover_overlay_color_value, '%%order_class%% .et_overlay', array( 'background-color', 'border-color' ), $render_slug, ' !important;', 'color' );
[696] Fix | Delete
[697] Fix | Delete
// Images: Add CSS Filters and Mix Blend Mode rules (if set)
[698] Fix | Delete
if ( array_key_exists( 'image', $this->advanced_fields ) && array_key_exists( 'css', $this->advanced_fields['image'] ) ) {
[699] Fix | Delete
$this->add_classname( $this->generate_css_filters(
[700] Fix | Delete
$render_slug,
[701] Fix | Delete
'child_',
[702] Fix | Delete
self::$data_utils->array_get( $this->advanced_fields['image']['css'], 'main', '%%order_class%%' )
[703] Fix | Delete
) );
[704] Fix | Delete
}
[705] Fix | Delete
[706] Fix | Delete
$overlay_attributes = ET_Builder_Module_Helper_Overlay::render_attributes( array(
[707] Fix | Delete
'icon' => $hover_icon,
[708] Fix | Delete
'icon_tablet' => $hover_icon_tablet,
[709] Fix | Delete
'icon_phone' => $hover_icon_phone,
[710] Fix | Delete
) );
[711] Fix | Delete
[712] Fix | Delete
if ( class_exists( 'ET_Builder_Module_Helper_Woocommerce_Modules' ) ) {
[713] Fix | Delete
ET_Builder_Module_Helper_Woocommerce_Modules::add_star_rating_style(
[714] Fix | Delete
$render_slug,
[715] Fix | Delete
$this->props,
[716] Fix | Delete
'%%order_class%% ul.products li.product .star-rating',
[717] Fix | Delete
'%%order_class%% ul.products li.product:hover .star-rating'
[718] Fix | Delete
);
[719] Fix | Delete
}
[720] Fix | Delete
[721] Fix | Delete
// Module classnames
[722] Fix | Delete
$this->add_classname( array(
[723] Fix | Delete
$this->get_text_orientation_classname(),
[724] Fix | Delete
) );
[725] Fix | Delete
[726] Fix | Delete
if ( '0' === $columns ) {
[727] Fix | Delete
$this->add_classname( 'et_pb_shop_grid' );
[728] Fix | Delete
}
[729] Fix | Delete
[730] Fix | Delete
$shop_order = self::_get_index( array( self::INDEX_MODULE_ORDER, $render_slug ) );
[731] Fix | Delete
[732] Fix | Delete
$output = sprintf(
[733] Fix | Delete
'<div%2$s class="%3$s" %6$s data-shortcode_index="%7$s">
[734] Fix | Delete
%5$s
[735] Fix | Delete
%4$s
[736] Fix | Delete
%1$s
[737] Fix | Delete
</div>',
[738] Fix | Delete
$this->get_shop( array(), array(), array( 'id' => $this->get_the_ID() ) ),
[739] Fix | Delete
$this->module_id(),
[740] Fix | Delete
$this->module_classname( $render_slug ),
[741] Fix | Delete
$video_background,
[742] Fix | Delete
$parallax_image_background,
[743] Fix | Delete
et_core_esc_previously( $overlay_attributes ),
[744] Fix | Delete
esc_attr( $shop_order )
[745] Fix | Delete
);
[746] Fix | Delete
[747] Fix | Delete
return $output;
[748] Fix | Delete
}
[749] Fix | Delete
[750] Fix | Delete
/**
[751] Fix | Delete
* Filter the products query arguments.
[752] Fix | Delete
*
[753] Fix | Delete
* @since 4.0.5
[754] Fix | Delete
*
[755] Fix | Delete
* @param array $query_args
[756] Fix | Delete
*
[757] Fix | Delete
* @return array
[758] Fix | Delete
*/
[759] Fix | Delete
public function filter_products_query( $query_args ) {
[760] Fix | Delete
if ( is_search() ) {
[761] Fix | Delete
$query_args['s'] = get_search_query();
[762] Fix | Delete
}
[763] Fix | Delete
[764] Fix | Delete
if ( function_exists( 'WC' ) ) {
[765] Fix | Delete
$query_args['meta_query'] = WC()->query->get_meta_query( et_()->array_get( $query_args, 'meta_query', array() ), true );
[766] Fix | Delete
$query_args['tax_query'] = WC()->query->get_tax_query( et_()->array_get( $query_args, 'tax_query', array() ), true );
[767] Fix | Delete
[768] Fix | Delete
// Add fake cache-busting arguments as the filtering is actually done in self::apply_woo_widget_filters().
[769] Fix | Delete
$query_args['et_builder_filter_min_price'] = sanitize_text_field( et_()->array_get( $_GET, 'min_price', '' ) );
[770] Fix | Delete
$query_args['et_builder_filter_max_price'] = sanitize_text_field( et_()->array_get( $_GET, 'max_price', '' ) );
[771] Fix | Delete
}
[772] Fix | Delete
[773] Fix | Delete
return $query_args;
[774] Fix | Delete
}
[775] Fix | Delete
[776] Fix | Delete
/**
[777] Fix | Delete
* Filter the products shortcode query so Woo widget filters apply.
[778] Fix | Delete
*
[779] Fix | Delete
* @since 4.0.8
[780] Fix | Delete
*
[781] Fix | Delete
* @param WP_Query $query
[782] Fix | Delete
*/
[783] Fix | Delete
public function apply_woo_widget_filters( $query ) {
[784] Fix | Delete
global $wp_the_query;
[785] Fix | Delete
[786] Fix | Delete
// Trick Woo filters into thinking the products shortcode query is the
[787] Fix | Delete
// main page query as some widget filters have is_main_query checks.
[788] Fix | Delete
$wp_the_query = $query;
[789] Fix | Delete
[790] Fix | Delete
// Set a flag to track that the main query is falsified.
[791] Fix | Delete
$wp_the_query->et_pb_shop_query = true;
[792] Fix | Delete
[793] Fix | Delete
if ( function_exists( 'WC' ) ) {
[794] Fix | Delete
add_filter( 'posts_clauses', array( WC()->query, 'price_filter_post_clauses' ), 10, 2 );
[795] Fix | Delete
}
[796] Fix | Delete
}
[797] Fix | Delete
}
[798] Fix | Delete
[799] Fix | Delete
new ET_Builder_Module_Shop;
[800] Fix | Delete
[801] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function