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-button-generator.php
<?php
[0] Fix | Delete
[1] Fix | Delete
// Preventing to direct access
[2] Fix | Delete
defined( 'ABSPATH' ) OR die( 'Direct access not acceptable!' );
[3] Fix | Delete
[4] Fix | Delete
[5] Fix | Delete
class WWS_Button_Generator {
[6] Fix | Delete
[7] Fix | Delete
public function __construct() {
[8] Fix | Delete
add_action( 'wp_enqueue_scripts', array( $this, 'shortcode_fonts' ) );
[9] Fix | Delete
add_shortcode( 'whatsappsupport', array($this, 'plugin_shortcode') );
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Custom google font in shortcode support button
[14] Fix | Delete
* @since 1.2
[15] Fix | Delete
*/
[16] Fix | Delete
public function shortcode_fonts() {
[17] Fix | Delete
[18] Fix | Delete
wp_register_style(
[19] Fix | Delete
'wws-shortcode-font-lobster',
[20] Fix | Delete
'https://fonts.googleapis.com/css?family=Lobster');
[21] Fix | Delete
[22] Fix | Delete
wp_register_style(
[23] Fix | Delete
'wws-shortcode-font-bree',
[24] Fix | Delete
'https://fonts.googleapis.com/css?family=Bree+Serif');
[25] Fix | Delete
[26] Fix | Delete
wp_register_style(
[27] Fix | Delete
'wws-shortcode-font-satisfy',
[28] Fix | Delete
'https://fonts.googleapis.com/css?family=Satisfy');
[29] Fix | Delete
[30] Fix | Delete
wp_register_style(
[31] Fix | Delete
'wws-shortcode-font-oswald',
[32] Fix | Delete
'https://fonts.googleapis.com/css?family=Oswald');
[33] Fix | Delete
[34] Fix | Delete
wp_register_style(
[35] Fix | Delete
'wws-shortcode-font-ubuntu',
[36] Fix | Delete
'https://fonts.googleapis.com/css?family=Ubuntu');
[37] Fix | Delete
[38] Fix | Delete
wp_register_style(
[39] Fix | Delete
'wws-shortcode-font-dancing',
[40] Fix | Delete
'https://fonts.googleapis.com/css?family=Dancing+Script');
[41] Fix | Delete
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Plugin shortcode main function
[47] Fix | Delete
* @param array $atts WordPress shortcode array
[48] Fix | Delete
* @return html
[49] Fix | Delete
* @since 1.2
[50] Fix | Delete
*/
[51] Fix | Delete
function plugin_shortcode($atts) {
[52] Fix | Delete
$a = shortcode_atts( array(
[53] Fix | Delete
'number' => '911234567890',
[54] Fix | Delete
'group' => 'XYZ123456789',
[55] Fix | Delete
'text' => 'Contact Us',
[56] Fix | Delete
'text-color' => '#fff',
[57] Fix | Delete
'text-bold' => 'inherit',
[58] Fix | Delete
'font' => 'inherit',
[59] Fix | Delete
'bg-color' => '#22c15e',
[60] Fix | Delete
'message' => 'Hello...',
[61] Fix | Delete
'full-width' => 'no',
[62] Fix | Delete
'on-mobile' => 'yes',
[63] Fix | Delete
'on-desktop' => 'yes',
[64] Fix | Delete
'font' => 'inherit',
[65] Fix | Delete
), $atts );
[66] Fix | Delete
[67] Fix | Delete
switch ( $a['font'] ) {
[68] Fix | Delete
[69] Fix | Delete
case 'Lobster':
[70] Fix | Delete
wp_enqueue_style( 'wws-shortcode-font-lobster' );
[71] Fix | Delete
$a['font'] = "'Lobster', cursive";
[72] Fix | Delete
break;
[73] Fix | Delete
[74] Fix | Delete
case 'Bree Serif':
[75] Fix | Delete
wp_enqueue_style( 'wws-shortcode-font-satisfy' );
[76] Fix | Delete
$a['font'] = "'Satisfy', cursive";
[77] Fix | Delete
break;
[78] Fix | Delete
[79] Fix | Delete
case 'Satisfy':
[80] Fix | Delete
wp_enqueue_style( 'wws-shortcode-font-bree' );
[81] Fix | Delete
$a['font'] = "'Bree Serif', serif";
[82] Fix | Delete
break;
[83] Fix | Delete
[84] Fix | Delete
case 'Oswald':
[85] Fix | Delete
wp_enqueue_style( 'wws-shortcode-font-oswald' );
[86] Fix | Delete
$a['font'] = "'Oswald', sans-serif";
[87] Fix | Delete
break;
[88] Fix | Delete
[89] Fix | Delete
case 'Ubuntu':
[90] Fix | Delete
wp_enqueue_style( 'wws-shortcode-font-ubuntu' );
[91] Fix | Delete
$a['font'] = "'Ubuntu', sans-serif";
[92] Fix | Delete
break;
[93] Fix | Delete
[94] Fix | Delete
case 'Dancing Script':
[95] Fix | Delete
wp_enqueue_style( 'wws-shortcode-font-dancing' );
[96] Fix | Delete
$a['font'] = "'Dancing Script', cursive";
[97] Fix | Delete
break;
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
if ( wp_is_mobile() != true ) { // desktop
[101] Fix | Delete
$url = "https://web.whatsapp.com/send?phone={$a['number']}&text={$a['message']}";
[102] Fix | Delete
if ( $a['on-desktop'] == 'no' ) {
[103] Fix | Delete
return;
[104] Fix | Delete
}
[105] Fix | Delete
} else { // mobile
[106] Fix | Delete
$url = "https://api.whatsapp.com/send?phone={$a['number']}&text={$a['message']}";
[107] Fix | Delete
if ( $a['on-mobile'] == 'no' ) {
[108] Fix | Delete
return;
[109] Fix | Delete
}
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ( $a['group'] != 'XYZ123456789' ) {
[113] Fix | Delete
$url = "https://chat.whatsapp.com/{$a['group']}";
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
ob_start(); ?>
[117] Fix | Delete
[118] Fix | Delete
<a href="<?php echo esc_url( $url ) ?>"
[119] Fix | Delete
class="wws-shortcode-btn"
[120] Fix | Delete
target="_blank"
[121] Fix | Delete
style="font-family: <?php echo esc_html( $a['font'] ) ?>; font-weight: <?php echo esc_html( $a['text-bold'] ) ?>; background-color: <?php echo esc_html( $a['bg-color'] ) ?>; <?php echo ( $a['full-width'] == 'yes' ) ? 'display: flex' : 'display: inline-flex'; ?>; color: <?php echo esc_html( $a['text-color'] ) ?>;"
[122] Fix | Delete
data-wws-button-number="<?php echo esc_attr( $a['number'] ); ?>"
[123] Fix | Delete
data-wws-button-message="<?php echo esc_attr( $a['message'] ); ?>">
[124] Fix | Delete
<?php echo WWS_Icons::get( 'whatsapp' ); ?> <?php echo esc_html( $a['text'] ) ?>
[125] Fix | Delete
</a>
[126] Fix | Delete
[127] Fix | Delete
<?php
[128] Fix | Delete
return ob_get_clean();
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
[132] Fix | Delete
} // end of WWS_Button_Generator
[133] Fix | Delete
[134] Fix | Delete
$wws_button_generator = new WWS_Button_Generator;
[135] Fix | Delete
[136] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function