: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( $is_network_admin ) {
update_site_option( $plugin_options_name, $plugin_options );
update_option( $plugin_options_name, $plugin_options );
if ( false === strrpos( $banner_url_or_slug, '/' ) ) {
$banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png';
$bws_plugin_banner_to_settings[] = array(
'plugin_info' => $plugin_info,
'plugin_options_name' => $plugin_options_name,
'banner_url' => $banner_url_or_slug,
'settings_url' => $settings_url,
'post_type_url' => $post_type_url,
if ( ! function_exists( 'bws_plugin_suggest_feature_banner' ) ) {
* Function display for feature banner
* @param array $plugin_info Plugin info.
* @param array $plugin_options_name Plugin option name.
* @param array $banner_url_or_slug Url or slug for icon.
function bws_plugin_suggest_feature_banner( $plugin_info, $plugin_options_name, $banner_url_or_slug ) {
$is_network_admin = is_network_admin();
$plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name );
if ( isset( $plugin_options['display_suggest_feature_banner'] ) && 0 === $plugin_options['display_suggest_feature_banner'] ) {
if ( ! isset( $plugin_options['first_install'] ) ) {
$plugin_options['first_install'] = strtotime( 'now' );
} elseif ( strtotime( '-2 week' ) < $plugin_options['first_install'] ) {
if ( ! isset( $plugin_options['go_settings_counter'] ) ) {
$plugin_options['go_settings_counter'] = 1;
} elseif ( 20 > $plugin_options['go_settings_counter'] ) {
$plugin_options['go_settings_counter'] = $plugin_options['go_settings_counter'] + 1;
if ( isset( $update_option ) ) {
if ( $is_network_admin ) {
update_site_option( $plugin_options_name, $plugin_options );
update_option( $plugin_options_name, $plugin_options );
if ( isset( $return ) ) {
if ( isset( $_POST[ 'bws_hide_suggest_feature_banner_' . $plugin_options_name ] ) && check_admin_referer( $plugin_info['Name'], 'bws_settings_nonce_name' ) ) {
$plugin_options['display_suggest_feature_banner'] = 0;
if ( $is_network_admin ) {
update_site_option( $plugin_options_name, $plugin_options );
update_option( $plugin_options_name, $plugin_options );
if ( false === strrpos( $banner_url_or_slug, '/' ) ) {
$banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png';
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
<div class="bws_banner_on_plugin_page bws_suggest_feature_banner">
<img title="" src="<?php echo esc_url( $banner_url_or_slug ); ?>" alt="" />
<strong><?php printf( esc_html__( 'Thank you for choosing %s plugin!', 'bestwebsoft' ), esc_html( $plugin_info['Name'] ) ); ?></strong><br />
<?php esc_html_e( "If you have a feature, suggestion or idea you'd like to see in the plugin, we'd love to hear about it!", 'bestwebsoft' ); ?>
<a target="_blank" href="https://support.bestwebsoft.com/hc/en-us/requests/new"><?php esc_html_e( 'Suggest a Feature', 'bestwebsoft' ); ?></a>
<form action="" method="post">
<button class="notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button>
<input type="hidden" name="bws_hide_suggest_feature_banner_<?php echo esc_html( $plugin_options_name ); ?>" value="hide" />
<?php wp_nonce_field( $plugin_info['Name'], 'bws_settings_nonce_name' ); ?>
if ( ! function_exists( 'bws_affiliate_postbox' ) ) {
* Function display affiliate postbox
function bws_affiliate_postbox() {
$dismissed = get_user_meta( get_current_user_id(), '_bws_affiliate_postbox_dismissed', true );
if ( ! empty( $dismissed ) && strtotime( '-3 month' ) < $dismissed ) {
if ( isset( $_POST['bws_hide_affiliate_banner'] ) && check_admin_referer( 'bws_affiliate_postbox', 'bws_settings_nonce_name' ) ) {
update_user_meta( get_current_user_id(), '_bws_affiliate_postbox_dismissed', strtotime( 'now' ) );
$bws_link = esc_url( 'https://bestwebsoft.com/affiliate/?utm_source=plugin&utm_medium=settings&utm_campaign=affiliate_program' );
<div id="bws-affiliate-postbox" class="postbox">
<form action="" method="post">
<button class="notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button>
<input type="hidden" name="bws_hide_affiliate_banner" value="hide" />
<?php wp_nonce_field( 'bws_affiliate_postbox', 'bws_settings_nonce_name' ); ?>
<h3><?php esc_html_e( 'Affiliate Program', 'bestwebsoft' ); ?></h3>
<div class="bws-affiliate-get"><?php printf( esc_html__( 'Get %s', 'bestwebsoft' ), '20%' ); ?></div>
<div><?php esc_html_e( 'from each BestWebSoft plugin and theme sale you refer', 'bestwebsoft' ); ?></div>
<img src="<?php echo esc_url( bws_menu_url( 'images/join-icon.svg' ) ); ?>" alt="" />
<div><?php esc_html_e( 'Join affiliate program', 'bestwebsoft' ); ?></div>
<img src="<?php echo esc_url( bws_menu_url( 'images/promote-icon.svg' ) ); ?>" alt="" />
<div><?php esc_html_e( 'Promote and sell products', 'bestwebsoft' ); ?></div>
<img src="<?php echo esc_url( bws_menu_url( 'images/earn-icon.svg' ) ); ?>" alt="" />
<div><?php esc_html_e( 'Get commission!', 'bestwebsoft' ); ?></div>
<div class="clear"></div>
<a class="button" href="<?php echo esc_url( $bws_link ); ?>" target="_blank"><?php esc_html_e( 'Start Now', 'bestwebsoft' ); ?></a>
if ( ! function_exists( 'bws_show_settings_notice' ) ) {
* Function display settings notice
function bws_show_settings_notice() {
<div id="bws_save_settings_notice" class="updated fade below-h2" style="display:none;">
<strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?></strong>: <?php esc_html_e( "The plugin's settings have been changed.", 'bestwebsoft' ); ?>
<a class="bws_save_anchor" href="#bws-submit-button"><?php esc_html_e( 'Save Changes', 'bestwebsoft' ); ?></a>
if ( ! function_exists( 'bws_hide_premium_options' ) ) {
* Function for hide premium options
* @param array $options Plugin options.
function bws_hide_premium_options( $options ) {
if ( ! isset( $options['hide_premium_options'] ) || ! is_array( $options['hide_premium_options'] ) ) {
$options['hide_premium_options'] = array();
$options['hide_premium_options'][] = get_current_user_id();
'message' => esc_html__( 'You can always look at premium options by checking the "Pro Options" in the "Misc" tab.', 'bestwebsoft' ),
if ( ! function_exists( 'bws_hide_premium_options_check' ) ) {
* Function for check checkbox for hide premium options
* @param array $options Plugin options.
function bws_hide_premium_options_check( $options ) {
if ( ! empty( $options['hide_premium_options'] ) && in_array( get_current_user_id(), $options['hide_premium_options'] ) ) {
if ( ! function_exists( 'bws_plugins_admin_init' ) ) {
* Function init fir dashboard
function bws_plugins_admin_init() {
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
if ( isset( $_GET['bws_activate_plugin'] ) && check_admin_referer( 'bws_activate_plugin' . sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) ) ) {
$plugin = isset( $_GET['bws_activate_plugin'] ) ? sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) : '';
$result = activate_plugin( $plugin, '', is_network_admin() );
if ( is_wp_error( $result ) ) {
if ( 'unexpected_output' === $result->get_error_code() ) {
$redirect = self_admin_url( 'admin.php?page=bws_panel&error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . $plugin );
wp_safe_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) );
wp_die( esc_html( $result ) );
if ( ! is_network_admin() ) {
$recent = (array) get_option( 'recently_activated' );
unset( $recent[ $plugin ] );
update_option( 'recently_activated', $recent );
$recent = (array) get_site_option( 'recently_activated' );
unset( $recent[ $plugin ] );
update_site_option( 'recently_activated', $recent );
* @deprecated 1.9.8 (15.12.2016)
$is_main_page = in_array( $page, array( 'bws_panel', 'bws_themes', 'bws_system_status' ) );
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
$current_page = 'admin.php?page=' . $page;
$current_page = isset( $_GET['tab'] ) ? 'admin.php?page=' . $page . '&tab=' . $tab : 'admin.php?page=' . $page;
wp_safe_redirect( self_admin_url( esc_url( $current_page . '&activate=true' ) ) );
if ( 'bws_panel' === $page || strpos( $page, '-bws-panel' ) ) {
bws_add_editor_buttons();
if ( ! function_exists( 'bws_admin_enqueue_scripts' ) ) {
* Function add scripts ans syles for dashboard
function bws_admin_enqueue_scripts() {
$bws_plugin_banner_go_pro, $bws_plugin_banner_timeout, $bstwbsftwppdtplgns_banner_array,
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
wp_enqueue_style( 'bws-admin-css', bws_menu_url( 'css/general_style.css' ), array(), '2.4.2' );
wp_enqueue_script( 'bws-admin-scripts', bws_menu_url( 'js/general_script.js' ), array( 'jquery', 'jquery-ui-tooltip' ) );
$plugin_dir = explode( '/', plugin_basename( __FILE__ ) )[0];
$plugin_file = array_keys( get_plugins( "/$plugin_dir" ) )[0];
$include_jquery_ui = false;
if ( ! empty( $bws_plugins ) ) {
$admin_page_free = $pagenow . '?page=' . str_replace( '-pro', '', $page );
foreach ( $bws_plugins as $bws_plugin ) {
if ( $admin_page_free === $bws_plugin['settings'] ) {
$include_jquery_ui = true;
if ( in_array( $page, array( 'bws_panel', 'bws_themes', 'bws_system_status', $plugin_file ) ) || $include_jquery_ui || strpos( $page, '-bws-panel' ) ) {
$jquery_ui_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.12.1';
if ( ! $wp_filesystem->exists( dirname( __FILE__ ) . '/css/jquery-ui-styles/' . $jquery_ui_version . '/' ) ) {
$jquery_ui_version = '1.12.1';
wp_enqueue_style( 'jquery-ui-style', bws_menu_url( 'css/jquery-ui-styles/' . $jquery_ui_version . '/jquery-ui.css', array(), $jquery_ui_version ) );
wp_enqueue_style( 'bws_menu_style', bws_menu_url( 'css/style.css' ), array(), '2.4.2' );
wp_enqueue_script( 'bws_menu_script', bws_menu_url( 'js/bws_menu.js' ), array(), '2.4.2', true );
wp_enqueue_script( 'theme-install' );
wp_enqueue_script( 'plugin-install' );
if ( 'plugins.php' === $hook_suffix ) {
if ( ! empty( $bws_plugin_banner_go_pro ) || ! empty( $bws_plugin_banner_timeout ) ) {
wp_enqueue_script( 'bws_menu_cookie', bws_menu_url( 'js/c_o_o_k_i_e.js' ) );
if ( ! empty( $bws_plugin_banner_go_pro ) ) {
foreach ( $bstwbsftwppdtplgns_banner_array as $value ) {
if ( isset( $bws_plugin_banner_go_pro[ $value[0] ] ) && ! isset( $_COOKIE[ $value[0] ] ) ) {
$prefix = $bws_plugin_banner_go_pro[ $value[0] ]['prefix'];
$script = "(function($) {
$(document).ready( function() {
var hide_message = $.cookie( '" . $prefix . "_hide_banner_on_plugin_page' );
if ( hide_message === 'true' ) {
$( '." . $prefix . "_message' ).css( 'display', 'none' );
$( '." . $prefix . "_message' ).css( 'display', 'block' );
$( '." . $prefix . "_close_icon' ).click( function() {
$( '." . $prefix . "_message' ).css( 'display', 'none' );
$.cookie( '" . $prefix . "_hide_banner_on_plugin_page', 'true', { expires: 32, secure: true } );
wp_register_script( $prefix . '_hide_banner_on_plugin_page', '' );
wp_enqueue_script( $prefix . '_hide_banner_on_plugin_page' );
wp_add_inline_script( $prefix . '_hide_banner_on_plugin_page', sprintf( $script ) );
if ( ! empty( $bws_plugin_banner_timeout ) ) {
$script = '(function($) {
$(document).ready( function() {';
foreach ( $bws_plugin_banner_timeout as $banner_value ) {
$script .= "var hide_message = $.cookie( '" . $banner_value['prefix'] . "_timeout_hide_banner_on_plugin_page' );
if ( hide_message === 'true' ) {
$( '." . $banner_value['prefix'] . "_message_timeout' ).css( 'display', 'none' );
$( '." . $banner_value['prefix'] . "_message_timeout' ).css( 'display', 'block' );
$( '." . $banner_value['prefix'] . "_close_icon' ).click( function() {
$( '." . $banner_value['prefix'] . "_message_timeout' ).css( 'display', 'none' );
$.cookie( '" . $banner_value['prefix'] . "_timeout_hide_banner_on_plugin_page', 'true', { expires: 30, secure: true } );
wp_register_script( 'plugin_banner_timeout_hide', '' );
wp_enqueue_script( 'plugin_banner_timeout_hide' );
wp_add_inline_script( 'plugin_banner_timeout_hide', sprintf( $script ) );
if ( ! defined( 'DOING_AJAX' ) ) {
wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
bws_add_deactivation_feedback_dialog_box();
if ( 'multilanguage-languages.php' === $page ) {
wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
if ( ! empty( $bws_shortcode_list ) ) {
/* TinyMCE Shortcode Plugin */
$script = "var bws_shortcode_button = {
'label': '" . esc_attr__( 'Add BWS Shortcode', 'bestwebsoft' ) . "',
'title': '" . esc_attr__( 'Add BWS Plugins Shortcode', 'bestwebsoft' ) . "',
foreach ( $bws_shortcode_list as $value ) {
if ( isset( $value['js_function'] ) ) {
$script .= "'" . $value['js_function'] . "',";
wp_register_script( 'bws_shortcode_button', '' );
wp_enqueue_script( 'bws_shortcode_button' );
wp_add_inline_script( 'bws_shortcode_button', sprintf( $script ) );
/* TinyMCE Shortcode Plugin */
if ( isset( $post_type ) && in_array( $post_type, array( 'post', 'page' ) ) ) {
'tooltip_id' => 'bws_shortcode_button_tooltip',
'css_selector' => '.mce-bws_shortcode_button',
'content' => '<h3>' . esc_html__( 'Add shortcode', 'bestwebsoft' ) . '</h3><p>' . esc_html__( "Add BestWebSoft plugins' shortcodes using this button.", 'bestwebsoft' ) . '</p>',
bws_add_tooltip_in_admin( $tooltip_args );
if ( ! function_exists( 'bws_enqueue_settings_scripts' ) ) {
* Add styles and scripts for Bws_Settings_Tabs
function bws_enqueue_settings_scripts() {
wp_enqueue_script( 'jquery-ui-resizable' );
wp_enqueue_script( 'jquery-ui-tabs' );
wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ), array(), '2.4.2' );
if ( ! function_exists( 'bws_plugins_admin_head' ) ) {
* Function add syles into admin head
function bws_plugins_admin_head() {
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
if ( 'bws_panel' === $page ) {
if ( ! function_exists( 'bws_plugins_admin_footer' ) ) {
* Function add syles into admin footer
function bws_plugins_admin_footer() {
$screen = get_current_screen();
if ( 'edit' === $screen->parent_base ) {
bws_shortcode_media_button_popup();
if ( ! function_exists( 'bws_plugins_include_codemirror' ) ) {
* Function add style and scripts for older version
function bws_plugins_include_codemirror() {
if ( version_compare( $wp_version, '4.9.0', '>=' ) ) {
wp_enqueue_style( 'wp-codemirror' );
wp_enqueue_script( 'wp-codemirror' );
if ( ! function_exists( 'bws_add_tooltip_in_admin' ) ) {
* @param array $tooltip_args Args for tooltip.
function bws_add_tooltip_in_admin( $tooltip_args = array() ) {
new BWS_Admin_Tooltip( $tooltip_args );