Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module
File: SocialMediaFollow.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Social_Media_Follow extends ET_Builder_Module {
[2] Fix | Delete
function init() {
[3] Fix | Delete
$this->name = esc_html__( 'Social Media Follow', 'et_builder' );
[4] Fix | Delete
$this->plural = esc_html__( 'Social Media Follows', 'et_builder' );
[5] Fix | Delete
$this->slug = 'et_pb_social_media_follow';
[6] Fix | Delete
$this->vb_support = 'on';
[7] Fix | Delete
$this->child_slug = 'et_pb_social_media_follow_network';
[8] Fix | Delete
$this->child_item_text = esc_html__( 'Social Network', 'et_builder' );
[9] Fix | Delete
[10] Fix | Delete
$this->main_css_element = 'ul%%order_class%%';
[11] Fix | Delete
[12] Fix | Delete
$this->settings_modal_toggles = array(
[13] Fix | Delete
'general' => array(
[14] Fix | Delete
'toggles' => array(
[15] Fix | Delete
'icon' => esc_html__( 'Icon', 'et_builder' ),
[16] Fix | Delete
),
[17] Fix | Delete
),
[18] Fix | Delete
'advanced' => array(
[19] Fix | Delete
'toggles' => array(
[20] Fix | Delete
'alignment' => esc_html__( 'Alignment', 'et_builder' ),
[21] Fix | Delete
'icon' => esc_html__( 'Icon', 'et_builder' ),
[22] Fix | Delete
'text' => et_builder_i18n( 'Text' ),
[23] Fix | Delete
),
[24] Fix | Delete
),
[25] Fix | Delete
);
[26] Fix | Delete
[27] Fix | Delete
$this->custom_css_fields = array(
[28] Fix | Delete
'before' => array(
[29] Fix | Delete
'label' => et_builder_i18n( 'Before' ),
[30] Fix | Delete
'selector' => 'ul%%order_class%%:before',
[31] Fix | Delete
),
[32] Fix | Delete
'main_element' => array(
[33] Fix | Delete
'label' => et_builder_i18n( 'Main Element' ),
[34] Fix | Delete
'selector' => 'ul%%order_class%%',
[35] Fix | Delete
),
[36] Fix | Delete
'after' => array(
[37] Fix | Delete
'label' => et_builder_i18n( 'After' ),
[38] Fix | Delete
'selector' => 'ul%%order_class%%:after',
[39] Fix | Delete
),
[40] Fix | Delete
'social_follow' => array(
[41] Fix | Delete
'label' => esc_html__( 'Social Follow', 'et_builder' ),
[42] Fix | Delete
'selector' => 'li',
[43] Fix | Delete
),
[44] Fix | Delete
'social_icon' => array(
[45] Fix | Delete
'label' => esc_html__( 'Social Icon', 'et_builder' ),
[46] Fix | Delete
'selector' => 'li a.icon',
[47] Fix | Delete
),
[48] Fix | Delete
'follow_button' => array(
[49] Fix | Delete
'label' => esc_html__( 'Follow Button', 'et_builder' ),
[50] Fix | Delete
'selector' => 'li a.follow_button',
[51] Fix | Delete
),
[52] Fix | Delete
);
[53] Fix | Delete
[54] Fix | Delete
$this->advanced_fields = array(
[55] Fix | Delete
'borders' => array(
[56] Fix | Delete
'default' => array(
[57] Fix | Delete
'css' => array(
[58] Fix | Delete
'main' => array(
[59] Fix | Delete
'border_radii' => "{$this->main_css_element} a.icon",
[60] Fix | Delete
'border_styles' => "{$this->main_css_element} a",
[61] Fix | Delete
),
[62] Fix | Delete
),
[63] Fix | Delete
'defaults' => array(
[64] Fix | Delete
'border_radii' => 'on|3px|3px|3px|3px',
[65] Fix | Delete
'border_styles' => array(
[66] Fix | Delete
'width' => '0px',
[67] Fix | Delete
'color' => '#333333',
[68] Fix | Delete
'style' => 'solid',
[69] Fix | Delete
),
[70] Fix | Delete
),
[71] Fix | Delete
),
[72] Fix | Delete
),
[73] Fix | Delete
'box_shadow' => array(
[74] Fix | Delete
'default' => array(
[75] Fix | Delete
'css' => array(
[76] Fix | Delete
'main' => '%%order_class%% .et_pb_social_icon a',
[77] Fix | Delete
),
[78] Fix | Delete
),
[79] Fix | Delete
),
[80] Fix | Delete
'margin_padding' => array(
[81] Fix | Delete
'css' => array(
[82] Fix | Delete
'main' => 'ul%%order_class%%',
[83] Fix | Delete
'important' => array( 'custom_margin', 'custom_padding' ), // needed to overwrite last module margin-bottom styling and default ul padding on post
[84] Fix | Delete
),
[85] Fix | Delete
),
[86] Fix | Delete
'text' => array(
[87] Fix | Delete
'use_background_layout' => true,
[88] Fix | Delete
'text_orientation' => array(
[89] Fix | Delete
'exclude_options' => array( 'justified' ),
[90] Fix | Delete
),
[91] Fix | Delete
'options' => array(
[92] Fix | Delete
'text_orientation' => array(
[93] Fix | Delete
'label' => esc_html__( 'Module Alignment', 'et_builder' ),
[94] Fix | Delete
'toggle_slug' => 'alignment',
[95] Fix | Delete
'options_icon' => 'module_align',
[96] Fix | Delete
),
[97] Fix | Delete
'background_layout' => array(
[98] Fix | Delete
'default' => 'light',
[99] Fix | Delete
'hover' => 'tabs',
[100] Fix | Delete
),
[101] Fix | Delete
),
[102] Fix | Delete
),
[103] Fix | Delete
'fonts' => false,
[104] Fix | Delete
'button' => array(
[105] Fix | Delete
'button' => array(
[106] Fix | Delete
'label' => esc_html__( 'Follow Button', 'et_builder' ),
[107] Fix | Delete
'css' => array(
[108] Fix | Delete
'main' => "{$this->main_css_element} .follow_button",
[109] Fix | Delete
),
[110] Fix | Delete
'hide_icon' => true,
[111] Fix | Delete
'hide_custom_padding' => true,
[112] Fix | Delete
'no_rel_attr' => true,
[113] Fix | Delete
'text_size' => array(
[114] Fix | Delete
'default' => '14px',
[115] Fix | Delete
),
[116] Fix | Delete
'border_width' => array(
[117] Fix | Delete
'default' => '0px',
[118] Fix | Delete
),
[119] Fix | Delete
'box_shadow' => array(
[120] Fix | Delete
'css' => array(
[121] Fix | Delete
'main' => "{$this->main_css_element} .follow_button",
[122] Fix | Delete
),
[123] Fix | Delete
),
[124] Fix | Delete
),
[125] Fix | Delete
),
[126] Fix | Delete
'link_options' => false,
[127] Fix | Delete
);
[128] Fix | Delete
[129] Fix | Delete
$this->help_videos = array(
[130] Fix | Delete
array(
[131] Fix | Delete
'id' => '8b0BlM_rlHQ',
[132] Fix | Delete
'name' => esc_html__( 'An introduction to the Social Media Follow module', 'et_builder' ),
[133] Fix | Delete
),
[134] Fix | Delete
);
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
function get_fields() {
[138] Fix | Delete
$fields = array(
[139] Fix | Delete
'url_new_window' => array(
[140] Fix | Delete
'label' => esc_html__( 'Link Target', 'et_builder' ),
[141] Fix | Delete
'type' => 'select',
[142] Fix | Delete
'option_category' => 'configuration',
[143] Fix | Delete
'options' => array(
[144] Fix | Delete
'off' => esc_html__( 'In The Same Window', 'et_builder' ),
[145] Fix | Delete
'on' => esc_html__( 'In The New Tab', 'et_builder' ),
[146] Fix | Delete
),
[147] Fix | Delete
'toggle_slug' => 'icon',
[148] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
[149] Fix | Delete
'default_on_front' => 'on',
[150] Fix | Delete
),
[151] Fix | Delete
'follow_button' => array(
[152] Fix | Delete
'label' => esc_html__( 'Follow Button', 'et_builder' ),
[153] Fix | Delete
'type' => 'yes_no_button',
[154] Fix | Delete
'option_category' => 'configuration',
[155] Fix | Delete
'options' => array(
[156] Fix | Delete
'off' => et_builder_i18n( 'Off' ),
[157] Fix | Delete
'on' => et_builder_i18n( 'On' ),
[158] Fix | Delete
),
[159] Fix | Delete
'default_on_front' => 'off',
[160] Fix | Delete
'toggle_slug' => 'icon',
[161] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not to include the follow button next to the icon.', 'et_builder' ),
[162] Fix | Delete
'mobile_options' => true,
[163] Fix | Delete
'hover' => 'tabs',
[164] Fix | Delete
),
[165] Fix | Delete
'icon_color' => array(
[166] Fix | Delete
'label' => esc_html__( 'Icon Color', 'et_builder' ),
[167] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the social network icon.', 'et_builder' ),
[168] Fix | Delete
'type' => 'color-alpha',
[169] Fix | Delete
'custom_color' => true,
[170] Fix | Delete
'tab_slug' => 'advanced',
[171] Fix | Delete
'toggle_slug' => 'icon',
[172] Fix | Delete
'hover' => 'tabs',
[173] Fix | Delete
'mobile_options' => true,
[174] Fix | Delete
'sticky' => true,
[175] Fix | Delete
),
[176] Fix | Delete
'use_icon_font_size' => array(
[177] Fix | Delete
'label' => esc_html__( 'Use Custom Icon Size', 'et_builder' ),
[178] Fix | Delete
'description' => esc_html__( 'If you would like to control the size of the icon, you must first enable this option.', 'et_builder' ),
[179] Fix | Delete
'type' => 'yes_no_button',
[180] Fix | Delete
'options' => array(
[181] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[182] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[183] Fix | Delete
),
[184] Fix | Delete
'default_on_front' => 'off',
[185] Fix | Delete
'affects' => array(
[186] Fix | Delete
'icon_font_size',
[187] Fix | Delete
),
[188] Fix | Delete
'depends_show_if' => 'on',
[189] Fix | Delete
'tab_slug' => 'advanced',
[190] Fix | Delete
'toggle_slug' => 'icon',
[191] Fix | Delete
'option_category' => 'font_option',
[192] Fix | Delete
),
[193] Fix | Delete
'icon_font_size' => array(
[194] Fix | Delete
'label' => esc_html__( 'Icon Font Size', 'et_builder' ),
[195] Fix | Delete
'description' => esc_html__( 'Control the size of the icon by increasing or decreasing the font size.', 'et_builder' ),
[196] Fix | Delete
'type' => 'range',
[197] Fix | Delete
'option_category' => 'font_option',
[198] Fix | Delete
'tab_slug' => 'advanced',
[199] Fix | Delete
'toggle_slug' => 'icon',
[200] Fix | Delete
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
[201] Fix | Delete
'default' => '16px',
[202] Fix | Delete
'default_unit' => 'px',
[203] Fix | Delete
'default_on_front' => '',
[204] Fix | Delete
'range_settings' => array(
[205] Fix | Delete
'min' => '1',
[206] Fix | Delete
'max' => '120',
[207] Fix | Delete
'step' => '1',
[208] Fix | Delete
),
[209] Fix | Delete
'mobile_options' => true,
[210] Fix | Delete
'depends_show_if' => 'on',
[211] Fix | Delete
'responsive' => true,
[212] Fix | Delete
'sticky' => true,
[213] Fix | Delete
'hover' => 'tabs',
[214] Fix | Delete
),
[215] Fix | Delete
);
[216] Fix | Delete
return $fields;
[217] Fix | Delete
}
[218] Fix | Delete
[219] Fix | Delete
public function get_transition_fields_css_props() {
[220] Fix | Delete
$fields = parent::get_transition_fields_css_props();
[221] Fix | Delete
[222] Fix | Delete
$fields['icon_color'] = array( 'color' => '%%order_class%% li a.icon:before' );
[223] Fix | Delete
$fields['icon_font_size'] = array(
[224] Fix | Delete
'font-size' => '%%order_class%% li a.icon:before',
[225] Fix | Delete
'line-height' => '%%order_class%% li a.icon:before',
[226] Fix | Delete
'height' => '%%order_class%% li a.icon:before',
[227] Fix | Delete
'width' => '%%order_class%% li a.icon:before',
[228] Fix | Delete
'height' => '%%order_class%% li a.icon',
[229] Fix | Delete
'width' => '%%order_class%% li a.icon',
[230] Fix | Delete
);
[231] Fix | Delete
[232] Fix | Delete
return $fields;
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
function before_render() {
[236] Fix | Delete
global $et_pb_social_media_follow_link,
[237] Fix | Delete
$et_pb_social_media_follow_sticky;
[238] Fix | Delete
[239] Fix | Delete
$url_new_window = $this->props['url_new_window'];
[240] Fix | Delete
$follow_button = et_pb_multi_view_options( $this )->get_values( 'follow_button' );
[241] Fix | Delete
[242] Fix | Delete
$et_pb_social_media_follow_link = array(
[243] Fix | Delete
'url_new_window' => $url_new_window,
[244] Fix | Delete
'follow_button' => $follow_button,
[245] Fix | Delete
);
[246] Fix | Delete
[247] Fix | Delete
$et_pb_social_media_follow_sticky = et_pb_sticky_options()->is_sticky_module( $this->props );
[248] Fix | Delete
}
[249] Fix | Delete
[250] Fix | Delete
/**
[251] Fix | Delete
* Renders the module output.
[252] Fix | Delete
*
[253] Fix | Delete
* @param array $attrs List of attributes.
[254] Fix | Delete
* @param string $content Content being processed.
[255] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[256] Fix | Delete
*
[257] Fix | Delete
* @return string
[258] Fix | Delete
*/
[259] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[260] Fix | Delete
global $et_pb_social_media_follow_link;
[261] Fix | Delete
[262] Fix | Delete
$multi_view = et_pb_multi_view_options( $this );
[263] Fix | Delete
$video_background = $this->video_background();
[264] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[265] Fix | Delete
$use_icon_font_size = $this->props['use_icon_font_size'];
[266] Fix | Delete
$icon_font_size_values = et_pb_responsive_options()->get_property_values( $this->props, 'icon_font_size' );
[267] Fix | Delete
[268] Fix | Delete
// Icon Color.
[269] Fix | Delete
$this->generate_styles(
[270] Fix | Delete
array(
[271] Fix | Delete
'base_attr_name' => 'icon_color',
[272] Fix | Delete
'selector' => '%%order_class%% li.et_pb_social_icon a.icon:before',
[273] Fix | Delete
'selector_wrapper' => '%%order_class%% li a.icon',
[274] Fix | Delete
'hover_pseudo_selector_location' => 'suffix',
[275] Fix | Delete
'sticky_pseudo_selector_location' => 'prefix',
[276] Fix | Delete
'css_property' => 'color',
[277] Fix | Delete
'render_slug' => $render_slug,
[278] Fix | Delete
'type' => 'color',
[279] Fix | Delete
)
[280] Fix | Delete
);
[281] Fix | Delete
[282] Fix | Delete
// Icon Size.
[283] Fix | Delete
if ( 'off' !== $use_icon_font_size ) {
[284] Fix | Delete
// Calculate icon size + its wrapper dimension.
[285] Fix | Delete
$this->generate_styles(
[286] Fix | Delete
array(
[287] Fix | Delete
'base_attr_name' => 'icon_font_size',
[288] Fix | Delete
'selector' => '%%order_class%% li a.icon:before',
[289] Fix | Delete
'selector_wrapper' => '%%order_class%% li a.icon',
[290] Fix | Delete
'hover_pseudo_selector_location' => 'suffix',
[291] Fix | Delete
'sticky_pseudo_selector_location' => 'prefix',
[292] Fix | Delete
'render_slug' => $render_slug,
[293] Fix | Delete
'type' => 'range',
[294] Fix | Delete
'css_property' => 'right',
[295] Fix | Delete
[296] Fix | Delete
// processed attr value can't be directly assigned to single css property so
[297] Fix | Delete
// custom processor is needed to render this attr.
[298] Fix | Delete
'processor' => array(
[299] Fix | Delete
'ET_Builder_Module_Helper_Style_Processor',
[300] Fix | Delete
'process_social_media_icon_font_size',
[301] Fix | Delete
),
[302] Fix | Delete
)
[303] Fix | Delete
);
[304] Fix | Delete
}
[305] Fix | Delete
[306] Fix | Delete
// Get custom borders, if any
[307] Fix | Delete
$attrs = $this->props;
[308] Fix | Delete
[309] Fix | Delete
// Module classnames
[310] Fix | Delete
$this->add_classname(
[311] Fix | Delete
array(
[312] Fix | Delete
'clearfix',
[313] Fix | Delete
$this->get_text_orientation_classname(),
[314] Fix | Delete
)
[315] Fix | Delete
);
[316] Fix | Delete
[317] Fix | Delete
// Background layout class names.
[318] Fix | Delete
$background_layout_class_names = et_pb_background_layout_options()->get_background_layout_class( $this->props );
[319] Fix | Delete
$this->add_classname( $background_layout_class_names );
[320] Fix | Delete
[321] Fix | Delete
if ( $multi_view->has_value( 'follow_button', 'on' ) ) {
[322] Fix | Delete
$this->add_classname( 'has_follow_button' );
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
// Background layout data attributes.
[326] Fix | Delete
$data_background_layout = et_pb_background_layout_options()->get_background_layout_attrs( $this->props );
[327] Fix | Delete
[328] Fix | Delete
$muti_view_data_attr = $multi_view->render_attrs(
[329] Fix | Delete
array(
[330] Fix | Delete
'classes' => array(
[331] Fix | Delete
'has_follow_button' => array(
[332] Fix | Delete
'follow_button' => 'on',
[333] Fix | Delete
),
[334] Fix | Delete
),
[335] Fix | Delete
)
[336] Fix | Delete
);
[337] Fix | Delete
[338] Fix | Delete
$output = sprintf(
[339] Fix | Delete
'<ul%3$s class="%2$s"%6$s%7$s>
[340] Fix | Delete
%5$s
[341] Fix | Delete
%4$s
[342] Fix | Delete
%1$s
[343] Fix | Delete
</ul> <!-- .et_pb_counters -->',
[344] Fix | Delete
$this->content,
[345] Fix | Delete
$this->module_classname( $render_slug ),
[346] Fix | Delete
$this->module_id(),
[347] Fix | Delete
$video_background,
[348] Fix | Delete
$parallax_image_background, // #5
[349] Fix | Delete
et_core_esc_previously( $data_background_layout ),
[350] Fix | Delete
et_core_esc_previously( $muti_view_data_attr )
[351] Fix | Delete
);
[352] Fix | Delete
[353] Fix | Delete
return $output;
[354] Fix | Delete
}
[355] Fix | Delete
}
[356] Fix | Delete
[357] Fix | Delete
new ET_Builder_Module_Social_Media_Follow();
[358] Fix | Delete
[359] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function