%s %s WordPress %s  %s  %s %s .",
						esc_html( $plugin_info['Name'] ),
						esc_html__( 'requires', 'bestwebsoft' ),
						esc_html( $require_wp ),
						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_url( $admin_url ),
						esc_html__( 'Plugins page', 'bestwebsoft' )
					)
				);
			}
		} elseif ( version_compare( $wp_version, $require_wp, '<' ) ) {
			$bws_versions_notice_array[] = array(
				'name'    => $plugin_info['Name'],
				'version' => $require_wp,
			);
		}
	}
}
/**
 * Function display review block
 *
 * @echo string
 */
if ( ! function_exists( 'bws_plugin_reviews_block' ) ) {
	function bws_plugin_reviews_block( $plugin_name, $plugin_slug ) { ?>
		
		= 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 '
					
						';
			if ( $wp_version >= 4.6 ) {
				echo '
';
			}
						echo '' . esc_html__( 'WARNING: Illegal use notification', 'bestwebsoft' ) . '.  ' . 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' ) . ' ' . esc_html__( 'Learn More', 'bestwebsoft' ) . ' ';
			if ( $wp_version >= 4.6 ) {
				echo '
';
			}
						echo '
 
					 
				 ';
		} 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 '
					
						
					 
				 ';
		} 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 '
					
						';
			if ( $wp_version >= 4.6 ) {
				echo '
';
			}
			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 ) );
			} else {
				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 ) {
				echo '
';
			}
					echo '
 
					 
				 ';
		}
	}
}
/**
 * Function display admin notices
 *
 * @echo string
 */
if ( ! function_exists( 'bws_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 ) ) {
			/* get $bws_plugins */
			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'] ) ) {
						continue;
					}
					$single_banner_value = $bws_plugin_banner_go_pro[ $value[0] ];
					?>
					
					
				
					
						 
						
						' . esc_html__( $banner_value['plugin_name'] ) . '', esc_html__( $bstwbsftwppdtplgns_options['time_out'][ $banner_value['plugin_key'] ] ) ); ?> 
 
					 
				 
				 $value ) {
				?>
				
					%s %s WordPress %s  %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' )
					);
					?>
				
				
				
			
				
				
			
				 
				 $attr ) {
					if ( 1 !== $i ) {
						echo ' ,';
					}
					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 ] );
					$i++;
				}
				?>
				.
				 
				
			
			 $plugin_info,
			'prefix'      => $this_banner_prefix,
			'bws_link'    => $bws_link,
			'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';
			}
			bws_get_banner_array();
		}
	}
}
/**
 * Function update banner params
 *
 * @return global array
 */
if ( ! function_exists( 'bws_add_plugin_banner_timeout' ) ) {
	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,
			);
		}
	}
}
/**
 * Function settings for banner
 *
 * @return global array
 */
if ( ! function_exists( 'bws_plugin_banner_to_settings' ) ) {
	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'] ) {
			return;
		}
		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;
			if ( $is_network_admin ) {
				update_site_option( $plugin_options_name, $plugin_options );
			} else {
				update_option( $plugin_options_name, $plugin_options );
			}
			return;
		}
		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,
		);
	}
}
/**
 * Function display for feature banner
 *
 * @echo string
 */
if ( ! function_exists( 'bws_plugin_suggest_feature_banner' ) ) {
	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'] ) {
			return;
		}
		if ( ! isset( $plugin_options['first_install'] ) ) {
			$plugin_options['first_install'] = strtotime( 'now' );
			$update_option                   = $return = true;
		} elseif ( strtotime( '-2 week' ) < $plugin_options['first_install'] ) {
			$return = true;
		}
		if ( ! isset( $plugin_options['go_settings_counter'] ) ) {
			$plugin_options['go_settings_counter'] = 1;
			$update_option                         = $return = true;
		} elseif ( 20 > $plugin_options['go_settings_counter'] ) {
			$plugin_options['go_settings_counter'] = $plugin_options['go_settings_counter'] + 1;
			$update_option                         = $return = true;
		}
		if ( isset( $update_option ) ) {
			if ( $is_network_admin ) {
				update_site_option( $plugin_options_name, $plugin_options );
			} else {
				update_option( $plugin_options_name, $plugin_options );
			}
		}
		if ( isset( $return ) ) {
			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 );
			} else {
				update_option( $plugin_options_name, $plugin_options );
			}
			return;
		}
		if ( false === strrpos( $banner_url_or_slug, '/' ) ) {
			$banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png';
		}
		?>
		
		
		
		
		
		 esc_html__( 'You can always look at premium options by checking the "Pro Options" in the "Misc" tab.', 'bestwebsoft' ),
			'options' => $options,
		);
	}
}
/**
 * Function for check checkbox for hide premium options
 *
 * @return bool
 */
if ( ! function_exists( 'bws_hide_premium_options_check' ) ) {
	function bws_hide_premium_options_check( $options ) {
		if ( ! empty( $options['hide_premium_options'] ) && in_array( get_current_user_id(), $options['hide_premium_options'] ) ) {
			return true;
		} else {
			return false;
		}
	}
}
/**
 * Function init fir dashboard
 */
if ( ! function_exists( 'bws_plugins_admin_init' ) ) {
	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 ) );
					exit();
				} else {
					wp_die( esc_html( $result ) );
				}
			}
			if ( ! is_network_admin() ) {
				$recent = (array) get_option( 'recently_activated' );
				unset( $recent[ $plugin ] );
				update_option( 'recently_activated', $recent );
			} else {
				$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'] ) ) : '';
			if ( $is_main_page ) {
				$current_page = 'admin.php?page=' . $page;
			} else {
				$current_page = isset( $_GET['tab'] ) ? 'admin.php?page=' . $page . '&tab=' . $tab : 'admin.php?page=' . $page;
			}
			/*end deprecated */
			wp_safe_redirect( self_admin_url( esc_url( $current_page . '&activate=true' ) ) );
			exit();
		}
		if ( 'bws_panel' === $page || strpos( $page, '-bws-panel' ) ) {
			if ( ! session_id() ) {
				@session_start();
			}
		}
		bws_add_editor_buttons();
	}
}
/**
 * Function add scripts ans syles for dashboard
 */
if ( ! function_exists( 'bws_admin_enqueue_scripts' ) ) {
	function bws_admin_enqueue_scripts() {
		global $wp_scripts, $hook_suffix,
			$post_type,
			$bws_plugin_banner_go_pro, $bws_plugin_banner_timeout, $bstwbsftwppdtplgns_banner_array,
			$bws_shortcode_list,
			$wp_filesystem;
		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
		$jquery_ui_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.12.1';
		WP_Filesystem();
		if ( ! $wp_filesystem->exists( dirname( __FILE__ ) . '/css/jquery-ui-styles/' . $jquery_ui_version . '/' ) ) {
			$jquery_ui_version = '1.12.1';
		}
		if ( 'et_divi_options' !== $page ) {
			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-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' ) );
		if ( in_array( $page, array( 'bws_panel', 'bws_themes', 'bws_system_status' ) ) || strpos( $page, '-bws-panel' ) ) {
			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' );
			add_thickbox();
			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' );
									} else {
										$( '." . $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 } );
									});
								});
							})(jQuery);";
							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 ) );
							break;
						}
					}
				}
				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' );
							} else {
								$( '." . $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 } );
							});";
					}
					$script .= '});
						})(jQuery);';
					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 ( ! 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' ) . "',
					'function_name': [";
			foreach ( $bws_shortcode_list as $value ) {
				if ( isset( $value['js_function'] ) ) {
					$script .= "'" . $value['js_function'] . "',";
				}
			}
			$script .= ']
				};';
			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_args = array(
					'tooltip_id'   => 'bws_shortcode_button_tooltip',
					'css_selector' => '.mce-bws_shortcode_button',
					'actions'      => array(
						'click'  => false,
						'onload' => true,
					),
					'content'      => '' . esc_html__( 'Add shortcode', 'bestwebsoft' ) . ' ' . esc_html__( "Add BestWebSoft plugins' shortcodes using this button.", 'bestwebsoft' ) . '
',
					'position'     => array(
						'edge' => 'right',
					),
					'set_timeout'  => 2000,
				);
				bws_add_tooltip_in_admin( $tooltip_args );
			}
		}
	}
}
/**
* add styles and scripts for Bws_Settings_Tabs
*
* @since 1.9.8
*/
if ( ! function_exists( 'bws_enqueue_settings_scripts' ) ) {
	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' );
	}
}
/**
 * Function add syles into admin head
 *
 * @since 1.9.8
 */
if ( ! function_exists( 'bws_plugins_admin_head' ) ) {
	function bws_plugins_admin_head() {
		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
		if ( $page === 'bws_panel' ) {
			?>
			
				
			 
			=' ) ) {
			wp_enqueue_style( 'wp-codemirror' );
			wp_enqueue_script( 'wp-codemirror' );
		} else {
			wp_enqueue_style( 'codemirror.css', bws_menu_url( 'css/codemirror.css' ), array(), '2.4.2' );
			wp_enqueue_script( 'codemirror.js', bws_menu_url( 'js/codemirror.js' ), array( 'jquery' ), '2.4.2' );
		}
	}
}
/**
 * Tooltip block
 */
if ( ! function_exists( 'bws_add_tooltip_in_admin' ) ) {
	function bws_add_tooltip_in_admin( $tooltip_args = array() ) {
		new BWS_Admin_Tooltip( $tooltip_args );
	}
}
/**
 * Class for Tooltip
 *
 * @since 1.9.8
 */
if ( ! class_exists( 'BWS_Admin_Tooltip' ) ) {
	class BWS_Admin_Tooltip {
		private $tooltip_args;
		public function __construct( $tooltip_args ) {
			global $bstwbsftwppdtplgns_tooltip_script_add;
			/* Default arguments */
			$tooltip_args_default = array(
				'tooltip_id'   => false,
				'css_selector' => false,
				'actions'      => array(
					'click'  => true,
					'onload' => false,
				),
				'buttons'      => array(
					'close' => array(
						'type' => 'dismiss',
						'text' => esc_html__( 'Close', 'bestwebsoft' ),
					),
				),
				'position'     => array(
					'edge'     => 'top',
					'align'    => 'center',
					'pos-left' => 0,
					'pos-top'  => 0,
					'zindex'   => 10000,
				),
				'set_timeout'  => 0,
			);
			$tooltip_args         = array_merge( $tooltip_args_default, $tooltip_args );
			/* Check that our merged array has default values */
			foreach ( $tooltip_args_default as $arg_key => $arg_value ) {
				if ( is_array( $arg_value ) ) {
					foreach ( $arg_value as $key => $value ) {
						if ( ! isset( $tooltip_args[ $arg_key ][ $key ] ) ) {
							$tooltip_args[ $arg_key ][ $key ] = $tooltip_args_default[ $arg_key ][ $key ];
						}
					}
				}
			}
			/* Check if tooltip is dismissed */
			if ( true === $tooltip_args['actions']['onload'] ) {
				if ( in_array( $tooltip_args['tooltip_id'], array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ) ) ) {
					$tooltip_args['actions']['onload'] = false;
				}
			}
			/* Check entered data */
			if ( false === $tooltip_args['tooltip_id'] || false === $tooltip_args['css_selector'] || ( false === $tooltip_args['actions']['click'] && false === $tooltip_args['actions']['onload'] ) ) {
				/* if not enough data to output a tooltip or both actions (click, onload) are false */
				return;
			} else {
				/* check position */
				if ( ! in_array( $tooltip_args['position']['edge'], array( 'left', 'right', 'top', 'bottom' ) ) ) {
					$tooltip_args['position']['edge'] = 'top';
				}
				if ( ! in_array( $tooltip_args['position']['align'], array( 'top', 'bottom', 'left', 'right', 'center' ) ) ) {
					$tooltip_args['position']['align'] = 'center';
				}
			}
			/* fix position */
			switch ( $tooltip_args['position']['edge'] ) {
				case 'left':
				case 'right':
					switch ( $tooltip_args['position']['align'] ) {
						case 'top':
						case 'bottom':
							$tooltip_args['position']['align'] = 'center';
							break;
					}
					break;
				case 'top':
				case 'bottom':
					if ( 'left' === $tooltip_args['position']['align'] ) {
						$tooltip_args['position']['pos-left'] -= 65;
					}
					break;
			}
			$this->tooltip_args = $tooltip_args;
			/* add styles and scripts */
			wp_enqueue_style( 'wp-pointer' );
			wp_enqueue_script( 'wp-pointer' );
			/* add script that displays our tooltip */
			if ( ! isset( $bstwbsftwppdtplgns_tooltip_script_add ) ) {
				wp_enqueue_script( 'bws-tooltip-script', bws_menu_url( 'js/bws_tooltip.js' ), array(), '2.4.2' );
				$bstwbsftwppdtplgns_tooltip_script_add = true;
			}
			$tooltip_args = $this->tooltip_args;
			$script = '(function($) {
					$(document).ready( function() {
						$.bwsTooltip( ' . wp_json_encode( $tooltip_args ) . ' );
					})
				})(jQuery);';
			wp_register_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'], '' );
			wp_enqueue_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'] );
			wp_add_inline_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'], sprintf( $script ) );
		}
	}
}
/**
 * Function display confirm
 *
 * @since 1.9.8
 */
if ( ! function_exists( 'bws_form_restore_default_confirm' ) ) {
	function bws_form_restore_default_confirm( $plugin_basename ) {
		?>
		
		
			
			
		 
		
			' . $content . ' 
		';
	}
}
/**
 * Function add help tab
 *
 * @since 1.9.8
 */
if ( ! function_exists( 'bws_help_tab' ) ) {
	function bws_help_tab( $screen, $args ) {
		$url = ( ! empty( $args['section'] ) ) ? 'https://support.bestwebsoft.com/hc/en-us/sections/' . $args['section'] : 'https://support.bestwebsoft.com/';
		$content = '' . __( 'Visit Help Center', 'bestwebsoft' ) . ' 
';
		$screen->add_help_tab(
			array(
				'id'      => $args['id'] . '_help_tab',
				'title'   => esc_html__( 'FAQ', 'bestwebsoft' ),
				'content' => wp_kses_post( $content ),
			)
		);
		$screen->set_help_sidebar(
			'' . esc_html__( 'For more information:', 'bestwebsoft' ) . ' 
' .
			'' . esc_html__( 'Documentation', 'bestwebsoft' ) . ' 
' .
			'' . esc_html__( 'Video Instructions', 'bestwebsoft' ) . ' 
' .
			'' . esc_html__( 'Submit a Request', 'bestwebsoft' ) . ' 
'
		);
	}
}
/**
 * Function add css and js
 *
 * @since 1.9.8
 */
if ( ! function_exists( 'bws_enqueue_custom_code_css_js' ) ) {
	function bws_enqueue_custom_code_css_js() {
		global $bstwbsftwppdtplgns_options;
		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
		}
		if ( ! empty( $bstwbsftwppdtplgns_options['custom_code'] ) ) {
			$is_multisite = is_multisite();
			if ( $is_multisite ) {
				$blog_id = get_current_blog_id();
			}
			if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.css'] ) ) {
				wp_enqueue_style( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.css'], array(), '2.4.2' );
			} elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.css'] ) ) {
				wp_enqueue_style( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.css'], array(), '2.4.2' );
			}
			if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.js'] ) ) {
				wp_enqueue_script( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.js'], array(), '2.4.2' );
			} elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.js'] ) ) {
				wp_enqueue_script( 'bws-custom-style', $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.js'], array(), '2.4.2' );
			}
		}
	}
}
/**
 * Function add custom php code
 *
 * @since 1.9.8
 */
if ( ! function_exists( 'bws_enqueue_custom_code_php' ) ) {
	function bws_enqueue_custom_code_php() {
		if ( is_admin() ) {
			return;
		}
		global $bstwbsftwppdtplgns_options;
		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
		}
		if ( ! empty( $bstwbsftwppdtplgns_options['custom_code'] ) ) {
			$is_multisite = is_multisite();
			if ( $is_multisite ) {
				$blog_id = get_current_blog_id();
			}
			if ( ! $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ) ) {
				if ( file_exists( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] ) ) {
					if ( ! defined( 'BWS_GLOBAL' ) ) {
						define( 'BWS_GLOBAL', true );
					}
					require_once $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'];
				} else {
					unset( $bstwbsftwppdtplgns_options['custom_code']['bws-custom-code.php'] );
					if ( $is_multisite ) {
						update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
					} else {
						update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
					}
				}
			} elseif ( $is_multisite && ! empty( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ) ) {
				if ( file_exists( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] ) ) {
					if ( ! defined( 'BWS_GLOBAL' ) ) {
						define( 'BWS_GLOBAL', true );
					}
					require_once $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'];
				} else {
					unset( $bstwbsftwppdtplgns_options['custom_code'][ $blog_id ]['bws-custom-code.php'] );
					if ( $is_multisite ) {
						update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
					} else {
						update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
					}
				}
			}
		}
	}
}
/**
 * Function delete plugin
 *
 * @since 1.9.8
 */
if ( ! function_exists( 'bws_delete_plugin' ) ) {
	function bws_delete_plugin( $basename ) {
		global $bstwbsftwppdtplgns_options;
		$is_multisite = is_multisite();
		if ( $is_multisite ) {
			$blog_id = get_current_blog_id();
		}
		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
			$bstwbsftwppdtplgns_options = ( $is_multisite ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
		}
		/* remove bws_menu versions */
		unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $basename ] );
		/* remove track usage data */
		if ( isset( $bstwbsftwppdtplgns_options['bws_menu']['track_usage']['products'][ $basename ] ) ) {
			unset( $bstwbsftwppdtplgns_options['bws_menu']['track_usage']['products'][ $basename ] );
		}
		/* if empty ['bws_menu']['version'] - there is no other bws plugins - delete all */
		if ( empty( $bstwbsftwppdtplgns_options['bws_menu']['version'] ) ) {
			/* remove options */
			if ( $is_multisite ) {
				delete_site_option( 'bstwbsftwppdtplgns_options' );
			} else {
				delete_option( 'bstwbsftwppdtplgns_options' );
			}
			/* remove custom_code */
			if ( $is_multisite ) {
				global $wpdb;
				$old_blog = $wpdb->blogid;
				/* Get all blog ids */
				$blogids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" );
				foreach ( $blogids as $blog_id ) {
					switch_to_blog( $blog_id );
					$upload_dir = wp_upload_dir();
					$folder     = $upload_dir['basedir'] . '/bws-custom-code';
					if ( file_exists( $folder ) && is_dir( $folder ) ) {
						array_map( 'unlink', glob( "$folder/*" ) );
						rmdir( $folder );
					}
				}
				switch_to_blog( $old_blog );
			} else {
				$upload_dir = wp_upload_dir();
				$folder     = $upload_dir['basedir'] . '/bws-custom-code';
				if ( file_exists( $folder ) && is_dir( $folder ) ) {
					array_map( 'unlink', glob( "$folder/*" ) );
					rmdir( $folder );
				}
			}
		}
	}
}
add_action( 'admin_init', 'bws_plugins_admin_init' );
add_action( 'admin_enqueue_scripts', 'bws_admin_enqueue_scripts' );
add_action( 'admin_head', 'bws_plugins_admin_head' );
add_action( 'admin_footer', 'bws_plugins_admin_footer' );
add_action( 'admin_notices', 'bws_admin_notices', 30 );
add_action( 'wp_enqueue_scripts', 'bws_enqueue_custom_code_css_js', 20 );
bws_enqueue_custom_code_php();