Edit File by line
/home/barbar84/www/wp-conte.../plugins/breadcru.../includes/modules/DiviBrea...
File: DiviBreadcrumbs.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class LWP_DiviBreadcrumbs extends ET_Builder_Module {
[2] Fix | Delete
[3] Fix | Delete
public $slug = 'lwp_divi_breadcrumbs';
[4] Fix | Delete
public $vb_support = 'on';
[5] Fix | Delete
[6] Fix | Delete
protected $module_credits = array(
[7] Fix | Delete
'module_uri' => 'http://www.learnhowwp.com/divi-breadcrumbs-module',
[8] Fix | Delete
'author' => 'Learn How WP',
[9] Fix | Delete
'author_uri' => 'http://www.learnhowwp.com/',
[10] Fix | Delete
);
[11] Fix | Delete
[12] Fix | Delete
public function init() {
[13] Fix | Delete
$this->name = esc_html__( 'Breadcrumbs', 'lwp-divi-breadcrumbs' );
[14] Fix | Delete
$this->icon = '=';
[15] Fix | Delete
$this->main_css_element = '%%order_class%%';
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
public function get_fields() {
[19] Fix | Delete
[20] Fix | Delete
$et_accent_color = et_builder_accent_color();
[21] Fix | Delete
[22] Fix | Delete
return array(
[23] Fix | Delete
'home_text' => array(
[24] Fix | Delete
'default' => esc_html__( 'Home', 'lwp-divi-breadcrumbs' ),
[25] Fix | Delete
'label' => esc_html__( 'Home Text', 'lwp-divi-breadcrumbs' ),
[26] Fix | Delete
'type' => 'text',
[27] Fix | Delete
'option_category' => 'basic_option',
[28] Fix | Delete
'description' => esc_html__( 'The default Home text in the Breadcrumbs', 'lwp-divi-breadcrumbs' ),
[29] Fix | Delete
'toggle_slug' => 'main_content',
[30] Fix | Delete
),
[31] Fix | Delete
'before_text' => array(
[32] Fix | Delete
'label' => esc_html__( 'Before Text', 'lwp-divi-breadcrumbs' ),
[33] Fix | Delete
'type' => 'text',
[34] Fix | Delete
'option_category' => 'basic_option',
[35] Fix | Delete
'description' => esc_html__( 'The text before the Breadcrumbs', 'lwp-divi-breadcrumbs' ),
[36] Fix | Delete
'toggle_slug' => 'main_content',
[37] Fix | Delete
),
[38] Fix | Delete
'font_icon' => array(
[39] Fix | Delete
'label' => esc_html__( 'Separator Icon', 'lwp-divi-breadcrumbs' ),
[40] Fix | Delete
'type' => 'et_font_icon_select',
[41] Fix | Delete
'renderer' => 'et_pb_get_font_icon_list',
[42] Fix | Delete
'option_category' => 'basic_option',
[43] Fix | Delete
'class' => array( 'et-pb-font-icon' ),
[44] Fix | Delete
'toggle_slug' => 'icon',
[45] Fix | Delete
'description' => esc_html__( 'Choose the icon for the separator.', 'lwp-divi-breadcrumbs' ),
[46] Fix | Delete
),
[47] Fix | Delete
'use_before_icon' => array(
[48] Fix | Delete
'label' => esc_html__( 'Add Before Icon', 'et_builder' ),
[49] Fix | Delete
'type' => 'yes_no_button',
[50] Fix | Delete
'option_category' => 'basic_option',
[51] Fix | Delete
'toggle_slug' => 'icon',
[52] Fix | Delete
'options' => array(
[53] Fix | Delete
'off' => esc_html__( 'No', 'et_builder' ),
[54] Fix | Delete
'on' => esc_html__( 'Yes', 'et_builder' ),
[55] Fix | Delete
),
[56] Fix | Delete
),
[57] Fix | Delete
'before_icon' => array(
[58] Fix | Delete
'label' => esc_html__( 'Separator Icon', 'lwp-divi-breadcrumbs' ),
[59] Fix | Delete
'type' => 'et_font_icon_select',
[60] Fix | Delete
'renderer' => 'et_pb_get_font_icon_list',
[61] Fix | Delete
'option_category' => 'basic_option',
[62] Fix | Delete
'class' => array( 'et-pb-font-icon' ),
[63] Fix | Delete
'toggle_slug' => 'icon',
[64] Fix | Delete
'description' => esc_html__( 'Choose the icon for the separator.', 'lwp-divi-breadcrumbs' ),
[65] Fix | Delete
'show_if' => array(
[66] Fix | Delete
'use_before_icon' => 'on',
[67] Fix | Delete
),
[68] Fix | Delete
),
[69] Fix | Delete
'link_color' => array(
[70] Fix | Delete
'label' => esc_html__('Link Color', 'lwp-divi-breadcrumbs' ),
[71] Fix | Delete
'type' => 'color-alpha',
[72] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the links in the breadcrumbs.', 'lwp-divi-breadcrumbs' ),
[73] Fix | Delete
'toggle_slug' => 'breadcrumbs',
[74] Fix | Delete
'hover' => 'tabs',
[75] Fix | Delete
'tab_slug' => 'advanced',
[76] Fix | Delete
),
[77] Fix | Delete
'separator_color' => array(
[78] Fix | Delete
'label' => esc_html__('Separator Color', 'lwp-divi-breadcrumbs' ),
[79] Fix | Delete
'type' => 'color-alpha',
[80] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the Separator in the breadcrumbs.', 'lwp-divi-breadcrumbs' ),
[81] Fix | Delete
'toggle_slug' => 'breadcrumbs',
[82] Fix | Delete
'tab_slug' => 'advanced',
[83] Fix | Delete
),
[84] Fix | Delete
'current_text_color' => array(
[85] Fix | Delete
'label' => esc_html__('Current Text Color', 'lwp-divi-breadcrumbs' ),
[86] Fix | Delete
'type' => 'color-alpha',
[87] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the Current Text in the breadcrumbs.', 'lwp-divi-breadcrumbs' ),
[88] Fix | Delete
'toggle_slug' => 'breadcrumbs',
[89] Fix | Delete
'tab_slug' => 'advanced',
[90] Fix | Delete
),
[91] Fix | Delete
);
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
public function get_settings_modal_toggles() {
[95] Fix | Delete
return array(
[96] Fix | Delete
'advanced' => array(
[97] Fix | Delete
'toggles' => array(
[98] Fix | Delete
'breadcrumbs' => array(
[99] Fix | Delete
'priority' => 24,
[100] Fix | Delete
'title' => 'Breadcrumbs Styles',
[101] Fix | Delete
),
[102] Fix | Delete
),
[103] Fix | Delete
),
[104] Fix | Delete
);
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
public function render( $attrs, $content = null, $render_slug ) {
[108] Fix | Delete
[109] Fix | Delete
$home_text = esc_html($this->props['home_text']);
[110] Fix | Delete
$before_text = esc_html($this->props['before_text']);
[111] Fix | Delete
$link_color = $this->props['link_color'];
[112] Fix | Delete
$separator_color = $this->props['separator_color'];
[113] Fix | Delete
$current_text_color = $this->props['current_text_color'];
[114] Fix | Delete
$font_icon = $this->props['font_icon'];
[115] Fix | Delete
$link_color_hover = $this->get_hover_value( 'link_color' );
[116] Fix | Delete
$before_icon = $this->props['before_icon'];
[117] Fix | Delete
[118] Fix | Delete
$before_html='';
[119] Fix | Delete
[120] Fix | Delete
if($font_icon=='') //If an Icon is not set then use the default icon
[121] Fix | Delete
$font_icon='%%24%%';
[122] Fix | Delete
[123] Fix | Delete
$separator_icon=esc_attr( et_pb_process_font_icon($font_icon)); //Processing the Breacrumbs Icon
[124] Fix | Delete
[125] Fix | Delete
if($before_icon!=''){
[126] Fix | Delete
$before_icon=esc_attr( et_pb_process_font_icon($before_icon)); //Processing the Before Icon
[127] Fix | Delete
$before_html=sprintf('<span class="before-icon et-pb-icon">%1$s</span>',$before_icon);
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
$breadcrumbs = lwp_get_hansel_and_gretel_breadcrumbs($home_text,$before_text,$separator_icon); //Generating the Breadcrumbs
[131] Fix | Delete
[132] Fix | Delete
if($current_text_color!=''){
[133] Fix | Delete
$current_text_color='color:'.$current_text_color.';';
[134] Fix | Delete
[135] Fix | Delete
//Styles for current text
[136] Fix | Delete
ET_Builder_Element::set_style( $render_slug, array(
[137] Fix | Delete
'selector' => '%%order_class%% .lwp-breadcrumbs .current',
[138] Fix | Delete
'declaration' => sprintf('%1$s',esc_attr($current_text_color)),
[139] Fix | Delete
) );
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
if($link_color!=''){
[143] Fix | Delete
$link_color='color:'.$link_color.';';
[144] Fix | Delete
[145] Fix | Delete
//Styles for link
[146] Fix | Delete
ET_Builder_Element::set_style( $render_slug, array(
[147] Fix | Delete
'selector' => '%%order_class%% .lwp-breadcrumbs a',
[148] Fix | Delete
'declaration' => sprintf('%1$s',esc_attr($link_color)),
[149] Fix | Delete
) );
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
if($separator_color!=''){
[153] Fix | Delete
$separator_color='color:'.$separator_color.';';
[154] Fix | Delete
//Styles for separator
[155] Fix | Delete
ET_Builder_Element::set_style( $render_slug, array(
[156] Fix | Delete
'selector' => '%%order_class%% .lwp-breadcrumbs .separator',
[157] Fix | Delete
'declaration' => sprintf('%1$s',esc_attr($separator_color)),
[158] Fix | Delete
) );
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
if($link_color_hover!=''){
[162] Fix | Delete
$link_color_hover='color:'.$link_color_hover.';';
[163] Fix | Delete
ET_Builder_Element::set_style( $render_slug, array(
[164] Fix | Delete
'selector' => '%%order_class%% .lwp-breadcrumbs a:hover',
[165] Fix | Delete
'declaration' => sprintf('%1$s',esc_attr($link_color_hover)),
[166] Fix | Delete
) );
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
[170] Fix | Delete
return sprintf(
[171] Fix | Delete
'<div class="lwp-breadcrumbs">%2$s %1$s</div>'
[172] Fix | Delete
,$breadcrumbs,$before_html);
[173] Fix | Delete
}
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
new LWP_DiviBreadcrumbs;
[177] Fix | Delete
[178] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function