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/wp-conte.../plugins/wordpres.../includes
File: class-wws-enqueue-scripts.php
<?php
[0] Fix | Delete
[1] Fix | Delete
// Exit if accessed directly
[2] Fix | Delete
defined( 'ABSPATH' ) || exit;
[3] Fix | Delete
[4] Fix | Delete
/**
[5] Fix | Delete
* WWS_Enqueue_Scripts class responsable to load all the scripts and styles.
[6] Fix | Delete
*/
[7] Fix | Delete
class WWS_Enqueue_Scripts {
[8] Fix | Delete
[9] Fix | Delete
public function __construct() {
[10] Fix | Delete
add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_scripts' ), 200 );
[11] Fix | Delete
add_action( 'wp_enqueue_scripts', array( $this, 'public_dynamic_resources'), 200 );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Load all the required frontend scripts
[16] Fix | Delete
* @return void
[17] Fix | Delete
* @since 1.3
[18] Fix | Delete
*/
[19] Fix | Delete
public function public_enqueue_scripts() {
[20] Fix | Delete
// Get the template
[21] Fix | Delete
$template = apply_filters( 'wws_enqueue_css_layout', get_option( 'wws_layout' ) );
[22] Fix | Delete
[23] Fix | Delete
/**
[24] Fix | Delete
* Inputmask jQuery plugin by RobinHerbots.
[25] Fix | Delete
*
[26] Fix | Delete
* @version 5.0.6-beta.32
[27] Fix | Delete
* @link https://github.com/RobinHerbots/Inputmask/
[28] Fix | Delete
*/
[29] Fix | Delete
wp_enqueue_script( 'wws-input-mask', WWS_PLUGIN_URL . 'assets/libraries/inputmask/jquery.inputmask.min.js', array( 'jquery' ), '5.0.6-beta.32', true );
[30] Fix | Delete
[31] Fix | Delete
// Load public scripts
[32] Fix | Delete
wp_enqueue_style( 'wws-public-style', WWS_PLUGIN_URL . 'assets/css/wws-public-style.css', array(), WWS_PLUGIN_VER );
[33] Fix | Delete
wp_enqueue_script( 'wws-public-script', WWS_PLUGIN_URL . 'assets/js/wws-public-script.js', array( 'jquery' ), WWS_PLUGIN_VER, true );
[34] Fix | Delete
wp_localize_script( 'wws-public-script', 'wwsObj', array(
[35] Fix | Delete
'support_number' => esc_html( apply_filters( 'wws_support_contact_number', get_option( 'wws_contact_number' ) ) ),
[36] Fix | Delete
'auto_popup' => get_option('wws_auto_popup'),
[37] Fix | Delete
'auto_popup_time' => intval( get_option( 'wws_auto_popup_time' ) ),
[38] Fix | Delete
'plugin_url' => esc_url( WWS_PLUGIN_URL ),
[39] Fix | Delete
'is_mobile' => ( wp_is_mobile() ) ? '1' : '0',
[40] Fix | Delete
'current_page_id' => get_the_ID(),
[41] Fix | Delete
'current_page_url' => get_permalink(),
[42] Fix | Delete
'popup_layout' => apply_filters( 'wws_current_layout', intval( get_option( 'wws_layout' ) ) ),
[43] Fix | Delete
'group_invitation_id' => esc_html( get_option('wws_group_id') ),
[44] Fix | Delete
'admin_url' => admin_url( 'admin-ajax.php?ver=' . uniqid() ),
[45] Fix | Delete
'scroll_lenght' => esc_html( get_option('wws_scroll_length') ),
[46] Fix | Delete
'pre_defined_text' => str_replace(
[47] Fix | Delete
array( '{title}', '{url}', '{br}' ),
[48] Fix | Delete
array( get_the_title(), get_permalink(), '%0A' ),
[49] Fix | Delete
esc_html( apply_filters( 'wws_predefined_text', get_option( 'wws_predefined_text' ) ) )
[50] Fix | Delete
),
[51] Fix | Delete
'is_debug' => get_option( 'wws_debug_status' ),
[52] Fix | Delete
'fb_ga_click_tracking' => json_encode( array(
[53] Fix | Delete
'fb_click_tracking_status' => get_option( 'wws_fb_click_tracking_status' ),
[54] Fix | Delete
'fb_click_tracking_event_name' => get_option( 'wws_fb_click_tracking_event_name' ),
[55] Fix | Delete
'fb_click_tracking_event_label' => get_option( 'wws_fb_click_tracking_event_label' ),
[56] Fix | Delete
'ga_click_tracking_status' => get_option( 'wws_ga_click_tracking_status' ),
[57] Fix | Delete
'ga_click_tracking_event_name' => get_option( 'wws_ga_click_tracking_event_name' ),
[58] Fix | Delete
'ga_click_tracking_event_category' => get_option( 'wws_ga_click_tracking_event_category' ),
[59] Fix | Delete
'ga_click_tracking_event_label' => get_option( 'wws_ga_click_tracking_event_label' ),
[60] Fix | Delete
) ),
[61] Fix | Delete
'is_gdpr' => get_option( 'wws_gdpr_status' ),
[62] Fix | Delete
'numberMasking' => get_option( 'wws_number_masking' ),
[63] Fix | Delete
'whatsapp_mobile_api' => apply_filters( 'wws_whatsapp_mobile_api_url', 'https://api.whatsapp.com' ),
[64] Fix | Delete
'whatsapp_desktop_api' => apply_filters( 'wws_whatsapp_desktop_api_url', 'https://web.whatsapp.com' ),
[65] Fix | Delete
'version' => WWS_PLUGIN_VER,
[66] Fix | Delete
'security_token' => wp_create_nonce( "wws-security-token" ),
[67] Fix | Delete
) );
[68] Fix | Delete
[69] Fix | Delete
// Load CSS for template
[70] Fix | Delete
wp_enqueue_style( 'wws-public-template', WWS_PLUGIN_URL . 'assets/css/wws-public-template-'. intval( $template ) .'.css', array(), WWS_PLUGIN_VER );
[71] Fix | Delete
[72] Fix | Delete
// Load jQuery if 'enabled' in developer settings.
[73] Fix | Delete
if ( 'yes' === get_option( 'wws_enqueue_jquery' ) ) {
[74] Fix | Delete
wp_enqueue_script( 'jquery' );
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* public dynamic js,css in wp_head
[82] Fix | Delete
* @since 1.2
[83] Fix | Delete
*/
[84] Fix | Delete
public function public_dynamic_resources() {
[85] Fix | Delete
[86] Fix | Delete
$x_axis_offset = get_option( 'wws_x_axis_offset' );
[87] Fix | Delete
$y_axis_offset = get_option( 'wws_y_axis_offset' );
[88] Fix | Delete
[89] Fix | Delete
$dynamic_css = '';
[90] Fix | Delete
[91] Fix | Delete
// Dynamic bg color
[92] Fix | Delete
$dynamic_css .= '.wws--bg-color {
[93] Fix | Delete
background-color: ' . esc_html( get_option( 'wws_layout_background_color' ) ) . ';
[94] Fix | Delete
}';
[95] Fix | Delete
[96] Fix | Delete
// Dynamic text color
[97] Fix | Delete
$dynamic_css .= '.wws--text-color {
[98] Fix | Delete
color: ' . esc_html( get_option( 'wws_layout_text_color' ) ) . ';
[99] Fix | Delete
}';
[100] Fix | Delete
[101] Fix | Delete
// RTL CSS
[102] Fix | Delete
if ( 'yes' === get_option( 'wws_rtl_status' ) ) {
[103] Fix | Delete
[104] Fix | Delete
$dynamic_css .= '.wws-popup-container * { direction: rtl; }
[105] Fix | Delete
#wws-layout-1 .wws-popup__header,
[106] Fix | Delete
#wws-layout-2 .wws-popup__header,
[107] Fix | Delete
#wws-layout-6 .wws-popup__header {
[108] Fix | Delete
display: flex;
[109] Fix | Delete
flex-direction: row-reverse;
[110] Fix | Delete
}
[111] Fix | Delete
#wws-layout-1 .wws-popup__input-wrapper { float: left; }';
[112] Fix | Delete
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
// Scroll length CSS
[116] Fix | Delete
if ( get_option( 'wws_scroll_length' ) ) {
[117] Fix | Delete
$dynamic_css .= '.wws-popup-container { display: none; }';
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
// Display only icon CSS
[121] Fix | Delete
if ( '' === get_option( 'wws_trigger_button_text' ) ) {
[122] Fix | Delete
$dynamic_css .= '.wws-popup__open-btn {
[123] Fix | Delete
display: flex;
[124] Fix | Delete
justify-content: center;
[125] Fix | Delete
align-items: center;
[126] Fix | Delete
width: 56px;
[127] Fix | Delete
height: 56px;
[128] Fix | Delete
border-radius: 50%;
[129] Fix | Delete
margin-top: 10px;
[130] Fix | Delete
cursor: pointer;
[131] Fix | Delete
}
[132] Fix | Delete
.wws-popup__open-btn svg {
[133] Fix | Delete
height: auto;
[134] Fix | Delete
width: 30px;
[135] Fix | Delete
}';
[136] Fix | Delete
} else {
[137] Fix | Delete
$dynamic_css .= '.wws-popup__open-btn {
[138] Fix | Delete
padding: 8px 20px;
[139] Fix | Delete
font-size: 15px;
[140] Fix | Delete
border-radius: 20px;
[141] Fix | Delete
display: inline-block;
[142] Fix | Delete
margin-top: 15px;
[143] Fix | Delete
cursor: pointer;
[144] Fix | Delete
}';
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
// Dynamic CSS according to Mobile
[148] Fix | Delete
if ( wp_is_mobile() == true ) {
[149] Fix | Delete
if ( get_option( 'wws_mobile_location' ) == 'tl' ) {
[150] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[151] Fix | Delete
left: ' . intval( $x_axis_offset ) . 'px;
[152] Fix | Delete
top: ' . intval( $y_axis_offset ) . 'px;
[153] Fix | Delete
}
[154] Fix | Delete
.wws-popup__open-btn { float: left; }';
[155] Fix | Delete
}
[156] Fix | Delete
if ( get_option( 'wws_mobile_location' ) == 'tc' ) {
[157] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[158] Fix | Delete
top: ' . intval( $y_axis_offset ) . 'px;
[159] Fix | Delete
left: 0;
[160] Fix | Delete
right: 0;
[161] Fix | Delete
margin-left: auto;
[162] Fix | Delete
margin-right: auto;
[163] Fix | Delete
}
[164] Fix | Delete
.wws-popup { margin: 0 auto; }
[165] Fix | Delete
.wws-popup__footer { text-align: center; }';
[166] Fix | Delete
}
[167] Fix | Delete
if ( get_option( 'wws_mobile_location' ) == 'tr' ) {
[168] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[169] Fix | Delete
right: ' . intval( $x_axis_offset ) . 'px;
[170] Fix | Delete
top: ' . intval( $y_axis_offset ) . 'px;
[171] Fix | Delete
}
[172] Fix | Delete
.wws-popup__open-btn { float: right; }';
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
if ( get_option( 'wws_mobile_location' ) == 'bl' ) {
[176] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[177] Fix | Delete
left: ' . intval( $x_axis_offset ) . 'px;
[178] Fix | Delete
bottom: ' . intval( $y_axis_offset ) . 'px;
[179] Fix | Delete
}
[180] Fix | Delete
.wws-popup__open-btn { float: left; }';
[181] Fix | Delete
}
[182] Fix | Delete
if ( get_option( 'wws_mobile_location' ) == 'bc' ) {
[183] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[184] Fix | Delete
bottom: ' . intval( $y_axis_offset ) . 'px;
[185] Fix | Delete
left: 0;
[186] Fix | Delete
right: 0;
[187] Fix | Delete
margin-left: auto;
[188] Fix | Delete
margin-right: auto;
[189] Fix | Delete
}
[190] Fix | Delete
.wws-popup { margin: 0 auto; }
[191] Fix | Delete
.wws-popup__footer { text-align: center; }';
[192] Fix | Delete
}
[193] Fix | Delete
if ( get_option( 'wws_mobile_location' ) == 'br' ) {
[194] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[195] Fix | Delete
right: ' . intval( $x_axis_offset ) . 'px;
[196] Fix | Delete
bottom: ' . intval( $y_axis_offset ) . 'px;
[197] Fix | Delete
}
[198] Fix | Delete
.wws-popup__open-btn { float: right; }';
[199] Fix | Delete
}
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
// Dynamic CSS according to Desktop
[203] Fix | Delete
if ( wp_is_mobile() != true ) {
[204] Fix | Delete
if ( get_option( 'wws_desktop_location' ) == 'tl' ) {
[205] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[206] Fix | Delete
left: ' . intval( $x_axis_offset ) . 'px;
[207] Fix | Delete
top: ' . intval( $y_axis_offset ) . 'px;
[208] Fix | Delete
}
[209] Fix | Delete
.wws-popup__open-btn { float: left; }
[210] Fix | Delete
.wws-gradient--position {
[211] Fix | Delete
top: 0;
[212] Fix | Delete
left: 0;
[213] Fix | Delete
background: radial-gradient(ellipse at top left, rgba(29, 39, 54, 0.2) 0, rgba(29, 39, 54, 0) 72%);
[214] Fix | Delete
}';
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
if ( get_option( 'wws_desktop_location' ) == 'tc' ) {
[218] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[219] Fix | Delete
top: ' . intval( $y_axis_offset ) . 'px;
[220] Fix | Delete
left: 0;
[221] Fix | Delete
right: 0;
[222] Fix | Delete
margin-left: auto;
[223] Fix | Delete
margin-right: auto;
[224] Fix | Delete
}
[225] Fix | Delete
.wws-popup__footer { text-align: center; }
[226] Fix | Delete
.wws-popup { margin: 0 auto; }
[227] Fix | Delete
.wws-gradient--position {
[228] Fix | Delete
top: 0;
[229] Fix | Delete
left: 0;
[230] Fix | Delete
right: 0;
[231] Fix | Delete
margin-left: auto;
[232] Fix | Delete
margin-right: auto;
[233] Fix | Delete
background: radial-gradient(ellipse at top, rgba(29, 39, 54, 0.2) 0, rgba(29, 39, 54, 0) 72%);
[234] Fix | Delete
}';
[235] Fix | Delete
}
[236] Fix | Delete
if ( get_option( 'wws_desktop_location' ) == 'tr' ) {
[237] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[238] Fix | Delete
right: ' . intval( $x_axis_offset ) . 'px;
[239] Fix | Delete
top: ' . intval( $y_axis_offset ) . 'px;
[240] Fix | Delete
}
[241] Fix | Delete
.wws-popup__open-btn { float: right; }
[242] Fix | Delete
.wws-gradient--position {
[243] Fix | Delete
top: 0;
[244] Fix | Delete
right: 0;
[245] Fix | Delete
background: radial-gradient(ellipse at top right, rgba(29, 39, 54, 0.2) 0, rgba(29, 39, 54, 0) 72%);
[246] Fix | Delete
}';
[247] Fix | Delete
}
[248] Fix | Delete
if ( get_option( 'wws_desktop_location' ) == 'bl' ) {
[249] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[250] Fix | Delete
left: ' . intval( $x_axis_offset ) . 'px;
[251] Fix | Delete
bottom: ' . intval( $y_axis_offset ) . 'px;
[252] Fix | Delete
}
[253] Fix | Delete
.wws-popup__open-btn { float: left; }
[254] Fix | Delete
.wws-gradient--position {
[255] Fix | Delete
bottom: 0;
[256] Fix | Delete
left: 0;
[257] Fix | Delete
background: radial-gradient(ellipse at bottom left, rgba(29, 39, 54, 0.2) 0, rgba(29, 39, 54, 0) 72%);
[258] Fix | Delete
}';
[259] Fix | Delete
}
[260] Fix | Delete
if ( get_option( 'wws_desktop_location' ) == 'bc' ) {
[261] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[262] Fix | Delete
bottom: ' . intval( $y_axis_offset ) . 'px;
[263] Fix | Delete
left: 0;
[264] Fix | Delete
right: 0;
[265] Fix | Delete
margin-left: auto;
[266] Fix | Delete
margin-right: auto;
[267] Fix | Delete
}
[268] Fix | Delete
.wws-popup__footer { text-align: center; }
[269] Fix | Delete
.wws-popup { margin: 0 auto; }
[270] Fix | Delete
.wws-gradient--position {
[271] Fix | Delete
bottom: 0;
[272] Fix | Delete
left: 0;
[273] Fix | Delete
right: 0;
[274] Fix | Delete
margin-left: auto;
[275] Fix | Delete
margin-right: auto;
[276] Fix | Delete
background: radial-gradient(ellipse at bottom, rgba(29, 39, 54, 0.2) 0, rgba(29, 39, 54, 0) 72%);
[277] Fix | Delete
}';
[278] Fix | Delete
}
[279] Fix | Delete
if ( get_option( 'wws_desktop_location' ) == 'br' ) {
[280] Fix | Delete
$dynamic_css .= '.wws-popup-container--position {
[281] Fix | Delete
right: ' . intval( $x_axis_offset ) . 'px;
[282] Fix | Delete
bottom: ' . intval( $y_axis_offset ) . 'px;
[283] Fix | Delete
}
[284] Fix | Delete
.wws-popup__open-btn { float: right; }
[285] Fix | Delete
.wws-gradient--position {
[286] Fix | Delete
bottom: 0;
[287] Fix | Delete
right: 0;
[288] Fix | Delete
background: radial-gradient(ellipse at bottom right, rgba(29, 39, 54, 0.2) 0, rgba(29, 39, 54, 0) 72%);
[289] Fix | Delete
}';
[290] Fix | Delete
}
[291] Fix | Delete
}
[292] Fix | Delete
if ( 'yes' === get_option( 'wws_trigger_button_only_icon' ) ) {
[293] Fix | Delete
$dynamic_css .= '@media( max-width: 720px ) {
[294] Fix | Delete
.wws-popup__open-btn {
[295] Fix | Delete
padding: 0 !important;
[296] Fix | Delete
width: 60px !important;
[297] Fix | Delete
height: 60px !important;
[298] Fix | Delete
border-radius: 50% !important;
[299] Fix | Delete
display: flex !important;
[300] Fix | Delete
justify-content: center !important;
[301] Fix | Delete
align-items: center !important;
[302] Fix | Delete
font-size: 30px !important;
[303] Fix | Delete
}
[304] Fix | Delete
.wws-popup__open-btn > svg {
[305] Fix | Delete
padding-right: 0;
[306] Fix | Delete
width: 30px;
[307] Fix | Delete
height: 30px;
[308] Fix | Delete
}
[309] Fix | Delete
.wws-popup__open-btn span { display: none; }
[310] Fix | Delete
}';
[311] Fix | Delete
}
[312] Fix | Delete
$dynamic_css .= wp_kses_post( get_option( 'wws_custom_css' ) );
[313] Fix | Delete
[314] Fix | Delete
wp_add_inline_style( 'wws-public-style', $dynamic_css );
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
} // end of class WWS_Enqueue_Scripts
[318] Fix | Delete
[319] Fix | Delete
$wws_enqueue_scripts = new WWS_Enqueue_Scripts;
[320] Fix | Delete
[321] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function