: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( ! defined( 'ABSPATH' ) ) {
* General functions for BestWebSoft plugins
require dirname( __FILE__ ) . '/deprecated.php';
require_once dirname( __FILE__ ) . '/deactivation-form.php';
if ( ! function_exists( 'bws_get_mofile' ) ) {
* Function to add 'bestwebsoft' slug for BWS_Menu MO file if BWS_Menu loaded from theme.
* @param string $mofile Mo file name.
* @param string $domain Domain name.
function bws_get_mofile( $mofile, $domain ) {
if ( 'bestwebsoft' === $domain ) {
return str_replace( $locale, "bestwebsoft-{$locale}", $mofile );
* Internationalization, first(!)
if ( isset( $bws_menu_source ) && 'themes' === $bws_menu_source ) {
add_filter( 'load_textdomain_mofile', 'bws_get_mofile', 10, 2 );
load_theme_textdomain( 'bestwebsoft', get_stylesheet_directory() . '/inc/bws_menu/languages' );
remove_filter( 'load_textdomain_mofile', 'bws_get_mofile' );
load_plugin_textdomain( 'bestwebsoft', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
if ( ! function_exists( 'bws_menu_url' ) ) {
* Function to getting url to current BWS_Menu.
* @param string $path Plugin path.
if ( ! isset( $bws_menu_source ) || 'plugins' === $bws_menu_source ) {
function bws_menu_url( $path = '' ) {
return plugins_url( $path, __FILE__ );
function bws_menu_url( $path = '' ) {
$bws_menu_current_dir = str_replace( '\\', '/', dirname( __FILE__ ) );
$bws_menu_abspath = str_replace( '\\', '/', ABSPATH );
$bws_menu_current_url = site_url( str_replace( $bws_menu_abspath, '', $bws_menu_current_dir ) );
return sprintf( '%s/%s', $bws_menu_current_url, $path );
if ( ! function_exists( 'bws_wp_min_version_check' ) ) {
* Function check if plugin is compatible with current WP version
* @param string $plugin_basename Plugin basename.
* @param array $plugin_info Plugin info.
* @param string $require_wp Wp version.
* @param string $min_wp (Optional) Flag for min WP version.
function bws_wp_min_version_check( $plugin_basename, $plugin_info, $require_wp, $min_wp = false ) {
global $wp_version, $bws_versions_notice_array;
if ( false === $min_wp ) {
if ( version_compare( $wp_version, $min_wp, '<' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( $plugin_basename ) ) {
deactivate_plugins( $plugin_basename );
$admin_url = ( function_exists( 'get_admin_url' ) ) ? get_admin_url( null, 'plugins.php' ) : esc_url( '/wp-admin/plugins.php' );
"<strong>%s</strong> %s <strong>WordPress %s</strong> %s <br /><br />%s <a href='%s'>%s</a>.",
esc_html( $plugin_info['Name'] ),
esc_html__( 'requires', 'bestwebsoft' ),
esc_html__( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'bestwebsoft' ),
esc_html__( 'Back to the WordPress', 'bestwebsoft' ),
esc_html__( 'Plugins page', 'bestwebsoft' )
} elseif ( version_compare( $wp_version, $require_wp, '<' ) ) {
$bws_versions_notice_array[] = array(
'name' => $plugin_info['Name'],
'version' => $require_wp,
if ( ! function_exists( 'bws_plugin_reviews_block' ) ) {
* Function display review block
* @param string $plugin_name Plugin name.
* @param string $plugin_slug Plugin slug.
function bws_plugin_reviews_block( $plugin_name, $plugin_slug ) { ?>
<div class="bws-plugin-reviews">
<div class="bws-plugin-reviews-rate">
<?php esc_html_e( 'Like the plugin?', 'bestwebsoft' ); ?>
<a href="https://wordpress.org/support/view/plugin-reviews/<?php echo esc_attr( $plugin_slug ); ?>?filter=5" target="_blank" title="<?php printf( esc_html__( '%s reviews', 'bestwebsoft' ), esc_html( sanitize_text_field( $plugin_name ) ) ); ?>">
<?php esc_html_e( 'Rate it', 'bestwebsoft' ); ?>
<span class="dashicons dashicons-star-filled"></span>
<span class="dashicons dashicons-star-filled"></span>
<span class="dashicons dashicons-star-filled"></span>
<span class="dashicons dashicons-star-filled"></span>
<span class="dashicons dashicons-star-filled"></span>
<div class="bws-plugin-reviews-support">
<?php esc_html_e( 'Need help?', 'bestwebsoft' ); ?>
<a href="https://support.bestwebsoft.com"><?php esc_html_e( 'Visit Help Center', 'bestwebsoft' ); ?></a>
<div class="bws-plugin-reviews-donate">
<?php esc_html_e( 'Want to support the plugin?', 'bestwebsoft' ); ?>
<a href="https://bestwebsoft.com/donate/"><?php esc_html_e( 'Donate', 'bestwebsoft' ); ?></a>
if ( ! function_exists( 'bws_plugin_update_row' ) ) {
* Function display license notification
* @param string $plugin_key Plugin key.
* @param string $link_slug (Optional) Link slug.
* @param string $free_plugin_name (Optional) Free version plugin name.
function bws_plugin_update_row( $plugin_key, $link_slug = false, $free_plugin_name = false ) {
global $bstwbsftwppdtplgns_options, $wp_version;
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $plugin_key ] ) ) {
$explode_plugin_key = explode( '/', $plugin_key );
$class = ( $wp_version >= 4.6 ) ? 'active' : '';
$style = ( $wp_version < 4.6 ) ? ' style="background-color: #FFEBE8;border-color: #CC0000;"' : '';
$div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : '';
echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . esc_attr( $class ) . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '">
<td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange">
<div class="update-message' . esc_attr( $div_class ) . '"' . wp_kses_post( $style ) . '>';
if ( $wp_version >= 4.6 ) {
echo '<strong>' . esc_html__( 'WARNING: Illegal use notification', 'bestwebsoft' ) . '.</strong> ' . esc_html__( 'You can use one license of the Pro plugin for one domain only. Please check and edit your license or domain if necessary using your personal Client Area. We strongly recommend you to solve the problem within 24 hours, otherwise the Pro plugin will be deactivated.', 'bestwebsoft' ) . ' <a target="_blank" href="https://support.bestwebsoft.com/hc/en-us/articles/204240089">' . esc_html__( 'Learn More', 'bestwebsoft' ) . '</a>';
if ( $wp_version >= 4.6 ) {
} elseif ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( gmdate( 'm/d/Y' ) ) ) {
$explode_plugin_key = explode( '/', $plugin_key );
$class = ( $wp_version >= 4.6 ) ? 'active' : '';
$style = ( $wp_version < 4.6 ) ? ' style="color: #8C0000;"' : '';
$div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : '';
echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . esc_attr( $class ) . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '">
<td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange">
<div class="update-message' . esc_attr( $div_class ) . '"' . wp_kses_post( $style ) . '>';
if ( $wp_version >= 4.6 ) {
if ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) && false !== $link_slug ) {
echo esc_html__( 'Notice: Your Pro Trial license has expired. To continue using the plugin, you should buy a Pro license', 'bestwebsoft' ) . ' - <a href="https://bestwebsoft.com/products/wordpress/plugins/' . esc_attr( $link_slug ) . '/">https://bestwebsoft.com/products/wordpress/plugins/' . esc_attr( $link_slug ) . '/</a>';
echo esc_html__( 'Your license has expired. To continue getting top-priority support and plugin updates, you should extend it.', 'bestwebsoft' ) . ' <a target="_new" href="https://support.bestwebsoft.com/entries/53487136">' . esc_html__( 'Learn more', 'bestwebsoft' ) . '</a>';
if ( $wp_version >= 4.6 ) {
} elseif ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) ) {
$explode_plugin_key = explode( '/', $plugin_key );
$class = ( $wp_version >= 4.6 ) ? 'active' : '';
$style = ( $wp_version < 4.6 ) ? ' style="color: #8C0000;"' : '';
$div_class = ( $wp_version >= 4.6 ) ? ' notice inline notice-warning notice-alt' : '';
echo '<tr class="bws-plugin-update-tr plugin-update-tr ' . esc_attr( $class ) . '" id="' . esc_attr( $explode_plugin_key[0] ) . '-update" data-slug="' . esc_attr( $explode_plugin_key[0] ) . '" data-plugin="' . esc_attr( $plugin_key ) . '">
<td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange">
<div class="update-message' . esc_attr( $div_class ) . '"' . wp_kses_post( $style ) . '>';
if ( $wp_version >= 4.6 ) {
if ( false !== $free_plugin_name ) {
printf( esc_html__( 'Notice: You are using the Pro Trial license of %s plugin.', 'bestwebsoft' ), esc_html( $free_plugin_name ) );
esc_html_e( 'Notice: You are using the Pro Trial license of plugin.', 'bestwebsoft' );
if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) ) {
echo ' ' . esc_html__( 'The Pro Trial license will expire on', 'bestwebsoft' ) . ' ' . esc_html( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) . '.';
if ( $wp_version >= 4.6 ) {
if ( ! function_exists( 'bws_admin_notices' ) ) {
* Function display admin notices
function bws_admin_notices() {
global $bws_versions_notice_array, $bws_plugin_banner_to_settings, $bstwbsftwppdtplgns_options, $bws_plugin_banner_go_pro, $bstwbsftwppdtplgns_banner_array, $bws_plugin_banner_timeout;
/* bws_plugin_banner_go_pro */
if ( ! empty( $bws_plugin_banner_go_pro ) ) {
require dirname( __FILE__ ) . '/product_list.php';
foreach ( $bstwbsftwppdtplgns_banner_array as $value ) {
if ( isset( $bws_plugin_banner_go_pro[ $value[0] ] ) && ! isset( $_COOKIE[ $value[0] ] ) ) {
if ( isset( $bws_plugins[ $value[1] ]['pro_version'] ) && is_plugin_active( $bws_plugins[ $value[1] ]['pro_version'] ) ) {
$single_banner_value = $bws_plugin_banner_go_pro[ $value[0] ];
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
<div class="<?php echo esc_attr( $single_banner_value['prefix'] ); ?>_message bws_banner_on_plugin_page bws_go_pro_banner" style="display: none;">
<button class="<?php echo esc_attr( $single_banner_value['prefix'] ); ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button>
<img title="" src="<?php echo esc_attr( $single_banner_value['banner_url'] ); ?>" alt="" />
<?php esc_html_e( 'It’s time to upgrade your', 'bestwebsoft' ); ?> <strong><?php echo esc_html( $single_banner_value['plugin_info']['Name'] ); ?> plugin</strong> <?php esc_html_e( 'to', 'bestwebsoft' ); ?> <strong>Pro</strong> <?php esc_html_e( 'version!', 'bestwebsoft' ); ?><br />
<span><?php esc_html_e( 'Extend standard plugin functionality with new great options.', 'bestwebsoft' ); ?></span>
<a class="button" target="_blank" href="<?php echo esc_url( $single_banner_value['bws_link'] ); ?>"><?php esc_html_e( 'Learn More', 'bestwebsoft' ); ?></a>
/* $bws_plugin_banner_timeout */
if ( ! empty( $bws_plugin_banner_timeout ) ) {
foreach ( $bws_plugin_banner_timeout as $banner_value ) {
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
<div class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_message_timeout bws_banner_on_plugin_page bws_banner_timeout" style="display:none;">
<button class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button>
<img title="" src="<?php echo esc_url( $banner_value['banner_url'] ); ?>" alt="" />
<div class="text"><?php printf( esc_html__( "Your license key for %1\$s expires on %2\$s and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ), '<strong>' . esc_html( $banner_value['plugin_name'] ) . '</strong>', esc_html( $bstwbsftwppdtplgns_options['time_out'][ $banner_value['plugin_key'] ] ) ); ?> <a target="_new" href="https://support.bestwebsoft.com/entries/53487136"><?php esc_html_e( 'Learn more', 'bestwebsoft' ); ?></a></div>
if ( ! empty( $bws_versions_notice_array ) ) {
foreach ( $bws_versions_notice_array as $key => $value ) {
'<strong>%s</strong> %s <strong>WordPress %s</strong> %s',
esc_html( $value['name'] ),
esc_html__( 'requires', 'bestwebsoft' ),
esc_html( $value['version'] ),
esc_html__( 'or higher! We do not guarantee that our plugin will work correctly. Please upgrade to WordPress latest version.', 'bestwebsoft' )
/* banner_to_settings notice */
if ( ! empty( $bws_plugin_banner_to_settings ) ) {
if ( 1 === count( $bws_plugin_banner_to_settings ) ) {
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
<div class="bws_banner_on_plugin_page bws_banner_to_settings">
<img title="" src="<?php echo esc_url( $bws_plugin_banner_to_settings[0]['banner_url'] ); ?>" alt="" />
<strong><?php printf( esc_html__( 'Thank you for installing %s plugin!', 'bestwebsoft' ), esc_html( $bws_plugin_banner_to_settings[0]['plugin_info']['Name'] ) ); ?></strong>
<?php esc_html_e( "Let's get started", 'bestwebsoft' ); ?>:
<a href="<?php echo esc_url( self_admin_url( $bws_plugin_banner_to_settings[0]['settings_url'] ) ); ?>"><?php esc_html_e( 'Settings', 'bestwebsoft' ); ?></a>
<?php if ( false !== $bws_plugin_banner_to_settings[0]['post_type_url'] ) { ?>
<?php esc_html_e( 'or', 'bestwebsoft' ); ?>
<a href="<?php echo esc_url( self_admin_url( $bws_plugin_banner_to_settings[0]['post_type_url'] ) ); ?>"><?php esc_html_e( 'Add New', '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_settings_notice_<?php echo esc_html( $bws_plugin_banner_to_settings[0]['plugin_options_name'] ); ?>" value="hide" />
<?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ); ?>
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
<div class="bws_banner_on_plugin_page bws_banner_to_settings_joint">
<form action="" method="post">
<button class="notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button>
<span class="dashicons dashicons-admin-plugins"></span>
<strong><?php esc_html_e( 'Thank you for installing plugins by BestWebSoft!', 'bestwebsoft' ); ?></strong>
<div class="hide-if-no-js bws-more-links">
<a href="#" class="bws-more"><?php esc_html_e( 'More Details', 'bestwebsoft' ); ?></a>
<a href="#" class="bws-less hidden"><?php esc_html_e( 'Less Details', 'bestwebsoft' ); ?></a>
<?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ); ?>
<div class="clear"></div>
<div class="bws-details hide-if-js">
<?php foreach ( $bws_plugin_banner_to_settings as $value ) { ?>
<strong><?php echo esc_html( str_replace( ' by BestWebSoft', '', $value['plugin_info']['Name'] ) ); ?></strong> <a href="<?php echo esc_url( self_admin_url( $value['settings_url'] ) ); ?>"><?php esc_html_e( 'Settings', 'bestwebsoft' ); ?></a>
<?php if ( false !== $value['post_type_url'] ) { ?>
 | <a target="_blank" href="<?php echo esc_url( self_admin_url( $value['post_type_url'] ) ); ?>"><?php esc_html_e( 'Add New', 'bestwebsoft' ); ?></a>
<input type="hidden" name="bws_hide_settings_notice_<?php echo esc_html( $value['plugin_options_name'] ); ?>" value="hide" />
* Show notices about deprecated_function
if ( ! empty( $bstwbsftwppdtplgns_options['deprecated_function'] ) ) {
<strong><?php esc_html_e( 'Deprecated function(-s) is used on the site here:', 'bestwebsoft' ); ?></strong>
foreach ( $bstwbsftwppdtplgns_options['deprecated_function'] as $function_name => $attr ) {
if ( ! empty( $attr['product-name'] ) ) {
echo esc_html( $attr['product-name'] );
} elseif ( ! empty( $attr['file'] ) ) {
echo esc_url( $attr['file'] );
unset( $bstwbsftwppdtplgns_options['deprecated_function'][ $function_name ] );
<?php esc_html_e( 'This function(-s) will be removed over time. Please update the product(-s).', 'bestwebsoft' ); ?>
update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
if ( ! function_exists( 'bws_plugin_banner_go_pro' ) ) {
* Function display banner
* @param array $plugin_options Plugin options array.
* @param array $plugin_info Plugin info array.
* @param string $this_banner_prefix Banner prefix.
* @param string $bws_link_slug Slug for link.
* @param string $link_key Key for plugin.
* @param string $link_pn PN for plugin.
* @param string $banner_url_or_slug Url or slug for icon.
function bws_plugin_banner_go_pro( $plugin_options, $plugin_info, $this_banner_prefix, $bws_link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
global $bws_plugin_banner_go_pro, $wp_version, $bstwbsftwppdtplgns_banner_array;
if ( ! isset( $plugin_options['first_install'] ) || strtotime( '-1 week' ) < $plugin_options['first_install'] ) {
$bws_link = esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $bws_link_slug . '/?k=' . $link_key . '&pn=' . $link_pn . '&v=' . $plugin_info['Version'] . '&wp_v=' . $wp_version );
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_go_pro[ $this_banner_prefix . '_hide_banner_on_plugin_page' ] = array(
'plugin_info' => $plugin_info,
'prefix' => $this_banner_prefix,
'banner_url' => $banner_url_or_slug,
if ( empty( $bstwbsftwppdtplgns_banner_array ) ) {
if ( ! function_exists( 'bws_get_banner_array' ) ) {
require_once dirname( __FILE__ ) . '/bws_menu.php';
if ( ! function_exists( 'bws_add_plugin_banner_timeout' ) ) {
* Function update banner params
* @param string $plugin_key Plugin key.
* @param string $plugin_prefix Plugin prefix.
* @param string $plugin_name Plugin name.
* @param string $banner_url_or_slug Url or slug for icon.
function bws_add_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug ) {
global $bws_plugin_banner_timeout;
if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( gmdate( 'm/d/Y' ) . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( gmdate( 'm/d/Y' ) ) ) ) {
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_timeout[] = array(
'plugin_key' => $plugin_key,
'prefix' => $plugin_prefix,
'plugin_name' => $plugin_name,
'banner_url' => $banner_url_or_slug,
if ( ! function_exists( 'bws_plugin_banner_to_settings' ) ) {
* Function settings for 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.
* @param array $settings_url Url for settings.
* @param array $post_type_url (Optional) Url for banner.
function bws_plugin_banner_to_settings( $plugin_info, $plugin_options_name, $banner_url_or_slug, $settings_url, $post_type_url = false ) {
global $bws_plugin_banner_to_settings;
$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_settings_notice'] ) && 0 === $plugin_options['display_settings_notice'] ) {
if ( isset( $_POST[ 'bws_hide_settings_notice_' . $plugin_options_name ] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_settings_nonce_name' ) ) {
$plugin_options['display_settings_notice'] = 0;