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
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/module/woocomme...
File: Breadcrumb.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Breadcrumb class
[2] Fix | Delete
*
[3] Fix | Delete
* The ET_Builder_Module_Woocommerce_Breadcrumb Class is responsible for rendering the
[4] Fix | Delete
* Breadcrumb markup using the WooCommerce template.
[5] Fix | Delete
*
[6] Fix | Delete
* @package Divi\Builder
[7] Fix | Delete
*
[8] Fix | Delete
* @since 3.29
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Class representing WooCommerce Breadcrumb component.
[13] Fix | Delete
*/
[14] Fix | Delete
class ET_Builder_Module_Woocommerce_Breadcrumb extends ET_Builder_Module {
[15] Fix | Delete
/**
[16] Fix | Delete
* Home URL.
[17] Fix | Delete
*
[18] Fix | Delete
* @var string
[19] Fix | Delete
*/
[20] Fix | Delete
public static $home_url;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Initialize.
[24] Fix | Delete
*/
[25] Fix | Delete
public function init() {
[26] Fix | Delete
$this->name = esc_html__( 'Woo Breadcrumb', 'et_builder' );
[27] Fix | Delete
$this->plural = esc_html__( 'Woo Breadcrumbs', 'et_builder' );
[28] Fix | Delete
$this->slug = 'et_pb_wc_breadcrumb';
[29] Fix | Delete
$this->vb_support = 'on';
[30] Fix | Delete
$this->main_css_element = '%%order_class%% .woocommerce-breadcrumb';
[31] Fix | Delete
[32] Fix | Delete
$this->settings_modal_toggles = array(
[33] Fix | Delete
'general' => array(
[34] Fix | Delete
'toggles' => array(
[35] Fix | Delete
'main_content' => array(
[36] Fix | Delete
'title' => et_builder_i18n( 'Content' ),
[37] Fix | Delete
),
[38] Fix | Delete
),
[39] Fix | Delete
),
[40] Fix | Delete
'advanced' => array(
[41] Fix | Delete
'toggles' => array(
[42] Fix | Delete
'text' => array(
[43] Fix | Delete
'title' => et_builder_i18n( 'Text' ),
[44] Fix | Delete
'priority' => 45,
[45] Fix | Delete
'tabbed_subtoggles' => true,
[46] Fix | Delete
'bb_icons_support' => true,
[47] Fix | Delete
'sub_toggles' => array(
[48] Fix | Delete
'p' => array(
[49] Fix | Delete
'name' => 'P',
[50] Fix | Delete
'icon' => 'text-left',
[51] Fix | Delete
),
[52] Fix | Delete
'a' => array(
[53] Fix | Delete
'name' => 'A',
[54] Fix | Delete
'icon' => 'text-link',
[55] Fix | Delete
),
[56] Fix | Delete
),
[57] Fix | Delete
),
[58] Fix | Delete
),
[59] Fix | Delete
),
[60] Fix | Delete
);
[61] Fix | Delete
[62] Fix | Delete
$this->advanced_fields = array(
[63] Fix | Delete
'fonts' => array(
[64] Fix | Delete
'body' => array(
[65] Fix | Delete
'label' => et_builder_i18n( 'Text' ),
[66] Fix | Delete
'css' => array(
[67] Fix | Delete
'main' => '%%order_class%%, %%order_class%% .et_pb_module_inner, %%order_class%% .woocommerce-breadcrumb, %%order_class%% .woocommerce-breadcrumb a',
[68] Fix | Delete
'text_align' => '%%order_class%%',
[69] Fix | Delete
),
[70] Fix | Delete
'font_size' => array(
[71] Fix | Delete
'default' => '13px',
[72] Fix | Delete
),
[73] Fix | Delete
'line_height' => array(
[74] Fix | Delete
'default' => '1.7em',
[75] Fix | Delete
),
[76] Fix | Delete
'toggle_slug' => 'text',
[77] Fix | Delete
'sub_toggle' => 'p',
[78] Fix | Delete
'hide_text_align' => true,
[79] Fix | Delete
),
[80] Fix | Delete
'link' => array(
[81] Fix | Delete
'label' => et_builder_i18n( 'Link' ),
[82] Fix | Delete
'css' => array(
[83] Fix | Delete
'main' => '%%order_class%%.et_pb_wc_breadcrumb a, %%order_class%%.et_pb_wc_breadcrumb .woocommerce-breadcrumb a',
[84] Fix | Delete
),
[85] Fix | Delete
'font_size' => array(
[86] Fix | Delete
'default' => '14px',
[87] Fix | Delete
),
[88] Fix | Delete
'line_height' => array(
[89] Fix | Delete
'default' => '1.7em',
[90] Fix | Delete
),
[91] Fix | Delete
'toggle_slug' => 'text',
[92] Fix | Delete
'sub_toggle' => 'a',
[93] Fix | Delete
'hide_text_align' => true,
[94] Fix | Delete
),
[95] Fix | Delete
),
[96] Fix | Delete
'background' => array(
[97] Fix | Delete
'settings' => array(
[98] Fix | Delete
'color' => 'alpha',
[99] Fix | Delete
),
[100] Fix | Delete
),
[101] Fix | Delete
'margin_padding' => array(
[102] Fix | Delete
'css' => array(
[103] Fix | Delete
'margin' => '%%order_class%% .woocommerce-breadcrumb',
[104] Fix | Delete
'important' => 'all',
[105] Fix | Delete
),
[106] Fix | Delete
),
[107] Fix | Delete
'text' => array(
[108] Fix | Delete
'use_background_layout' => false,
[109] Fix | Delete
'sub_toggle' => 'p',
[110] Fix | Delete
'options' => array(
[111] Fix | Delete
'text_orientation' => array(
[112] Fix | Delete
'default' => 'left',
[113] Fix | Delete
),
[114] Fix | Delete
'background_layout' => array(
[115] Fix | Delete
'default' => 'light',
[116] Fix | Delete
),
[117] Fix | Delete
),
[118] Fix | Delete
),
[119] Fix | Delete
'text_shadow' => array(
[120] Fix | Delete
// Don't add text-shadow fields since they already are via font-options.
[121] Fix | Delete
'default' => false,
[122] Fix | Delete
),
[123] Fix | Delete
'button' => false,
[124] Fix | Delete
);
[125] Fix | Delete
[126] Fix | Delete
$this->help_videos = array(
[127] Fix | Delete
array(
[128] Fix | Delete
'id' => '7X03vBPYJ1o',
[129] Fix | Delete
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
[130] Fix | Delete
),
[131] Fix | Delete
);
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
/**
[135] Fix | Delete
* Includes any Module specific fields.
[136] Fix | Delete
*
[137] Fix | Delete
* Fields from Parent module that may be not needed are also removed.
[138] Fix | Delete
*
[139] Fix | Delete
* @since 4.0 Removed Hover options from Breadcrumb URL.
[140] Fix | Delete
*
[141] Fix | Delete
* @return array Parent's fields w/ module specific fields.
[142] Fix | Delete
*/
[143] Fix | Delete
public function get_fields() {
[144] Fix | Delete
// Content Toggle.
[145] Fix | Delete
$fields = array(
[146] Fix | Delete
'product' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
[147] Fix | Delete
'product',
[148] Fix | Delete
array(
[149] Fix | Delete
'default' => ET_Builder_Module_Helper_Woocommerce_Modules::get_product_default(),
[150] Fix | Delete
'computed_affects' => array(
[151] Fix | Delete
'__breadcrumb',
[152] Fix | Delete
),
[153] Fix | Delete
)
[154] Fix | Delete
),
[155] Fix | Delete
'product_filter' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
[156] Fix | Delete
'product_filter',
[157] Fix | Delete
array(
[158] Fix | Delete
'computed_affects' => array(
[159] Fix | Delete
'__breadcrumb',
[160] Fix | Delete
),
[161] Fix | Delete
)
[162] Fix | Delete
),
[163] Fix | Delete
'breadcrumb_home_text' => array(
[164] Fix | Delete
'label' => esc_html__( 'Home Text', 'et_builder' ),
[165] Fix | Delete
'type' => 'text',
[166] Fix | Delete
'option_category' => 'basic_option',
[167] Fix | Delete
'description' => esc_html__( 'Here you can create the breadcrumb text for the Home page.', 'et_builder' ),
[168] Fix | Delete
'toggle_slug' => 'main_content',
[169] Fix | Delete
'default' => __( 'Home', 'et_builder' ),
[170] Fix | Delete
'mobile_options' => true,
[171] Fix | Delete
'hover' => 'tabs',
[172] Fix | Delete
'dynamic_content' => 'text',
[173] Fix | Delete
),
[174] Fix | Delete
'breadcrumb_home_url' => array(
[175] Fix | Delete
'label' => esc_html__( 'Home Link', 'et_builder' ),
[176] Fix | Delete
'type' => 'text',
[177] Fix | Delete
'option_category' => 'basic_option',
[178] Fix | Delete
'description' => esc_html__( 'Here you can create the link for the Home page.', 'et_builder' ),
[179] Fix | Delete
'toggle_slug' => 'main_content',
[180] Fix | Delete
'default' => get_home_url(),
[181] Fix | Delete
'mobile_options' => true,
[182] Fix | Delete
'dynamic_content' => 'url',
[183] Fix | Delete
),
[184] Fix | Delete
'breadcrumb_separator' => array(
[185] Fix | Delete
'label' => esc_html__( 'Separator', 'et_builder' ),
[186] Fix | Delete
'type' => 'text',
[187] Fix | Delete
'option_category' => 'basic_option',
[188] Fix | Delete
'description' => esc_html__( 'Here you can set the Breadcrumb separator.', 'et_builder' ),
[189] Fix | Delete
'toggle_slug' => 'main_content',
[190] Fix | Delete
'default' => ' / ',
[191] Fix | Delete
'dynamic_content' => 'text',
[192] Fix | Delete
),
[193] Fix | Delete
'__breadcrumb' => array(
[194] Fix | Delete
'type' => 'computed',
[195] Fix | Delete
'computed_callback' => array(
[196] Fix | Delete
'ET_Builder_Module_Woocommerce_Breadcrumb',
[197] Fix | Delete
'get_breadcrumb',
[198] Fix | Delete
),
[199] Fix | Delete
'computed_depends_on' => array(
[200] Fix | Delete
'product',
[201] Fix | Delete
'product_filter',
[202] Fix | Delete
),
[203] Fix | Delete
),
[204] Fix | Delete
);
[205] Fix | Delete
[206] Fix | Delete
return $fields;
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
/**
[210] Fix | Delete
* Get breadcrumb
[211] Fix | Delete
*
[212] Fix | Delete
* @since 3.29
[213] Fix | Delete
*
[214] Fix | Delete
* @param array $args Additional arguments.
[215] Fix | Delete
*
[216] Fix | Delete
* @return string
[217] Fix | Delete
*/
[218] Fix | Delete
public static function get_breadcrumb( $args = array() ) {
[219] Fix | Delete
global $post, $product, $wp_query;
[220] Fix | Delete
[221] Fix | Delete
$defaults = array(
[222] Fix | Delete
'product' => 'current',
[223] Fix | Delete
'breadcrumb_home_text' => __( 'Home', 'et_builder' ),
[224] Fix | Delete
'breadcrumb_home_url' => get_home_url(),
[225] Fix | Delete
'breadcrumb_separator' => '/',
[226] Fix | Delete
);
[227] Fix | Delete
[228] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[229] Fix | Delete
[230] Fix | Delete
$args['breadcrumb_separator'] = esc_html( $args['breadcrumb_separator'] );
[231] Fix | Delete
[232] Fix | Delete
/*
[233] Fix | Delete
* Replace update-able string in visual builder with text placeholder which can be
[234] Fix | Delete
* easily replaced by builder for quick interaction on field change
[235] Fix | Delete
*
[236] Fix | Delete
* The `et_fb_is_resolve_post_content_callback_ajax()` check is added to enable
[237] Fix | Delete
* Product Breadcrumb dynamic content field.
[238] Fix | Delete
*
[239] Fix | Delete
* Breadcrumb customization is not required when resolving dynamic content field.
[240] Fix | Delete
* Hence we exclude customizations if the AJAX request is to resolve dynamic content fields.
[241] Fix | Delete
*/
[242] Fix | Delete
$main_query_post_id = ET_Post_Stack::get_main_post_id();
[243] Fix | Delete
$layout_post_id = ET_Builder_Element::get_layout_id();
[244] Fix | Delete
$is_fb = et_core_is_fb_enabled() && $main_query_post_id === $layout_post_id;
[245] Fix | Delete
[246] Fix | Delete
if ( ! et_fb_is_resolve_post_content_callback_ajax() && ( $is_fb || et_fb_is_builder_ajax() || et_fb_is_computed_callback_ajax() ) ) {
[247] Fix | Delete
$args = wp_parse_args(
[248] Fix | Delete
array(
[249] Fix | Delete
'breadcrumb_home_text' => '%HOME_TEXT%',
[250] Fix | Delete
'breadcrumb_home_url' => '%HOME_URL%',
[251] Fix | Delete
'breadcrumb_separator' => '%SEPARATOR%',
[252] Fix | Delete
),
[253] Fix | Delete
$args
[254] Fix | Delete
);
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
// Update home URL which is rendered inside breadcrumb function and pluggable via filter.
[258] Fix | Delete
self::$home_url = $args['breadcrumb_home_url'];
[259] Fix | Delete
add_filter(
[260] Fix | Delete
'woocommerce_breadcrumb_home_url',
[261] Fix | Delete
array( 'ET_Builder_Module_Woocommerce_Breadcrumb', 'modify_home_url' )
[262] Fix | Delete
);
[263] Fix | Delete
[264] Fix | Delete
$breadcrumb = et_builder_wc_render_module_template(
[265] Fix | Delete
'woocommerce_breadcrumb',
[266] Fix | Delete
$args,
[267] Fix | Delete
array(
[268] Fix | Delete
'product',
[269] Fix | Delete
'post',
[270] Fix | Delete
'wp_query',
[271] Fix | Delete
)
[272] Fix | Delete
);
[273] Fix | Delete
[274] Fix | Delete
// Reset home URL.
[275] Fix | Delete
self::$home_url = get_home_url();
[276] Fix | Delete
remove_filter(
[277] Fix | Delete
'woocommerce_breadcrumb_home_url',
[278] Fix | Delete
array( 'ET_Builder_Module_Woocommerce_Breadcrumb', 'modify_home_url' )
[279] Fix | Delete
);
[280] Fix | Delete
[281] Fix | Delete
return $breadcrumb;
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
/**
[285] Fix | Delete
* Modify home url
[286] Fix | Delete
*
[287] Fix | Delete
* @since 3.29
[288] Fix | Delete
*
[289] Fix | Delete
* @return string
[290] Fix | Delete
*/
[291] Fix | Delete
public static function modify_home_url() {
[292] Fix | Delete
return self::$home_url;
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
/**
[296] Fix | Delete
* Adds Multi view attributes to the Inner wrapper.
[297] Fix | Delete
*
[298] Fix | Delete
* Since we do not have control over the WooCommerce Breadcrumb markup, we inject Multi view
[299] Fix | Delete
* attributes on to the Inner wrapper.
[300] Fix | Delete
*
[301] Fix | Delete
* Inner wrapper is selected to inject the Multi view attributes because, there is already
[302] Fix | Delete
* a lot going on w/ the Outer wrapper.
[303] Fix | Delete
*
[304] Fix | Delete
* @param array $inner_wrapper_attrs
[305] Fix | Delete
*
[306] Fix | Delete
* @return array
[307] Fix | Delete
*/
[308] Fix | Delete
public function add_multi_view_attrs( $inner_wrapper_attrs ) {
[309] Fix | Delete
$multi_view = et_pb_multi_view_options( $this );
[310] Fix | Delete
[311] Fix | Delete
/*
[312] Fix | Delete
* Breadcrumb separator cannot have Multi-view options as it is not enclosed in a HTML tag.
[313] Fix | Delete
* Element being enclose in a tag is essential for the Multi-view options to work.
[314] Fix | Delete
*/
[315] Fix | Delete
$multi_view_attrs = $multi_view->render_attrs( array(
[316] Fix | Delete
'content' => '{{breadcrumb_home_text}}',
[317] Fix | Delete
'attrs' => array(
[318] Fix | Delete
'href' => '{{breadcrumb_home_url}}',
[319] Fix | Delete
'data-breadcrumb-separator' => '{{breadcrumb_separator}}',
[320] Fix | Delete
),
[321] Fix | Delete
'target' => '%%order_class%% .woocommerce-breadcrumb a:first-child',
[322] Fix | Delete
), false, null, true );
[323] Fix | Delete
[324] Fix | Delete
if ( $multi_view_attrs && is_array( $multi_view_attrs ) ) {
[325] Fix | Delete
$inner_wrapper_attrs = array_merge( $inner_wrapper_attrs, $multi_view_attrs );
[326] Fix | Delete
}
[327] Fix | Delete
[328] Fix | Delete
return $inner_wrapper_attrs;
[329] Fix | Delete
}
[330] Fix | Delete
[331] Fix | Delete
/**
[332] Fix | Delete
* Renders the module output.
[333] Fix | Delete
*
[334] Fix | Delete
* @param array $attrs List of attributes.
[335] Fix | Delete
* @param string $content Content being processed.
[336] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[337] Fix | Delete
*
[338] Fix | Delete
* @return string
[339] Fix | Delete
*/
[340] Fix | Delete
public function render( $attrs, $content = null, $render_slug ) {
[341] Fix | Delete
ET_Builder_Module_Helper_Woocommerce_Modules::process_background_layout_data( $render_slug, $this );
[342] Fix | Delete
[343] Fix | Delete
$this->add_classname( $this->get_text_orientation_classname() );
[344] Fix | Delete
[345] Fix | Delete
$output = self::get_breadcrumb( $this->props );
[346] Fix | Delete
[347] Fix | Delete
// Render empty string if no output is generated to avoid unwanted vertical space.
[348] Fix | Delete
if ( '' === $output ) {
[349] Fix | Delete
return '';
[350] Fix | Delete
}
[351] Fix | Delete
[352] Fix | Delete
add_filter( "et_builder_module_{$render_slug}_inner_wrapper_attrs", array( $this, 'add_multi_view_attrs' ) );
[353] Fix | Delete
[354] Fix | Delete
return $this->_render_module_wrapper( $output, $render_slug );
[355] Fix | Delete
}
[356] Fix | Delete
}
[357] Fix | Delete
[358] Fix | Delete
new ET_Builder_Module_Woocommerce_Breadcrumb();
[359] Fix | Delete
[360] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function