wp/wp-content/plugins/portfolio/bws_menu/bws_menu.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 <?php
     1 <?php
     2 /*
     2 /**
     3 * Function for displaying BestWebSoft menu
     3  * Function for displaying BestWebSoft menu
     4 * Version: 2.3.4
     4  * Version: 2.4.2
     5 */
     5  */
     6 
     6 
     7 if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) )
     7 if ( ! function_exists( 'bws_admin_enqueue_scripts' ) ) {
     8 	require_once( dirname( __FILE__ ) . '/bws_functions.php' );
     8 	require_once dirname( __FILE__ ) . '/bws_functions.php';
       
     9 }
     9 
    10 
    10 if ( ! function_exists( 'bws_add_menu_render' ) ) {
    11 if ( ! function_exists( 'bws_add_menu_render' ) ) {
    11 	function bws_add_menu_render() {
    12 	function bws_add_menu_render() {
    12 		global $wpdb, $wp_version, $bstwbsftwppdtplgns_options;
    13 		global $wpdb, $wp_version, $bstwbsftwppdtplgns_options;
    13 		$error = $message = '';
    14 		$error = $message = '';
    14 
    15 
    15 		/**
    16 		/**
    16 		 * @deprecated 1.9.8 (15.12.2016)
    17 		 * @deprecated 1.9.8 (15.12.2016)
    17 		 */
    18 		 */
    18 		$is_main_page = in_array( $_GET['page'], array( 'bws_panel', 'bws_themes', 'bws_system_status' ) );
    19 		$is_main_page = isset( $_GET['page'] ) && in_array( $_GET['page'], array( 'bws_panel', 'bws_themes', 'bws_system_status' ) );
    19 		$page = wp_unslash( $_GET['page'] );
    20 		$page         = sanitize_text_field( wp_unslash( $_GET['page'] ) );
    20 		$tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : '';
    21 		$tab          = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
    21 
    22 
    22 		if ( $is_main_page )
    23 		if ( $is_main_page ) {
    23 			$current_page = 'admin.php?page=' . $page;
    24 			$current_page = 'admin.php?page=' . $page;
    24 		else
    25 		} else {
    25 			$current_page = isset( $_GET['tab'] ) ? 'admin.php?page=' . $page . '&tab=' . $tab : 'admin.php?page=' . $page;
    26 			$current_page = isset( $_GET['tab'] ) ? 'admin.php?page=' . $page . '&tab=' . $tab : 'admin.php?page=' . $page;
    26 
    27 		}
    27 		if ( 'bws_panel' == $page || ( ! $is_main_page && '' == $tab ) ) {
    28 
    28 
    29 		if ( 'bws_panel' === $page || ( ! $is_main_page && '' === $tab ) ) {
    29 			if ( ! function_exists( 'is_plugin_active_for_network' ) )
    30 
    30 				require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    31 			if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
    31 
    32 				require_once ABSPATH . 'wp-admin/includes/plugin.php';
    32 			/* get $bws_plugins */
    33 			}
    33 			require( dirname( __FILE__ ) . '/product_list.php' );
    34 
    34 
    35 			/* Get $bws_plugins */
    35 			$all_plugins = get_plugins();
    36 			require dirname( __FILE__ ) . '/product_list.php';
    36 			$active_plugins = get_option( 'active_plugins' );
    37 
       
    38 			$all_plugins             = get_plugins();
       
    39 			$active_plugins          = get_option( 'active_plugins' );
    37 			$sitewide_active_plugins = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'active_sitewide_plugins' ) : array();
    40 			$sitewide_active_plugins = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'active_sitewide_plugins' ) : array();
    38 			$update_availible_all = get_site_transient( 'update_plugins' );
    41 			$update_availible_all    = get_site_transient( 'update_plugins' );
    39 
    42 
    40 			$plugin_category = isset( $_GET['category'] ) ? esc_attr( $_GET['category'] ) : 'all';
    43 			$plugin_category = isset( $_GET['category'] ) ? sanitize_text_field( wp_unslash( $_GET['category'] ) ) : 'all';
    41 
    44 
    42 			if ( ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] ) || ! isset( $_GET['sub'] ) ) {
    45 			if ( ( isset( $_GET['sub'] ) && 'installed' === sanitize_text_field( wp_unslash( $_GET['sub'] ) ) ) || ! isset( $_GET['sub'] ) ) {
    43 				$bws_plugins_update_availible = $bws_plugins_expired = array();
    46 				$bws_plugins_update_availible = $bws_plugins_expired = array();
    44 				foreach ( $bws_plugins as $key_plugin => $value_plugin ) {
    47 				foreach ( $bws_plugins as $key_plugin => $value_plugin ) {
    45 
    48 
    46 					foreach ( $value_plugin['category'] as $category_key ) {
    49 					foreach ( $value_plugin['category'] as $category_key ) {
    47 						$bws_plugins_category[ $category_key ]['count'] = isset( $bws_plugins_category[ $category_key ]['count'] ) ? $bws_plugins_category[ $category_key ]['count'] + 1 : 1;
    50 						$bws_plugins_category[ $category_key ]['count'] = isset( $bws_plugins_category[ $category_key ]['count'] ) ? $bws_plugins_category[ $category_key ]['count'] + 1 : 1;
    48 					}
    51 					}
    49 
    52 
    50 					$is_installed = array_key_exists( $key_plugin, $all_plugins );
    53 					$is_installed     = array_key_exists( $key_plugin, $all_plugins );
    51 					$is_pro_installed = false;
    54 					$is_pro_installed = false;
    52 					if ( isset( $value_plugin['pro_version'] ) ) {
    55 					if ( isset( $value_plugin['pro_version'] ) ) {
    53 						$is_pro_installed = array_key_exists( $value_plugin['pro_version'], $all_plugins );
    56 						$is_pro_installed = array_key_exists( $value_plugin['pro_version'], $all_plugins );
    54 					}
    57 					}
    55 					/* check update_availible */
    58 					/* Check update_availible */
    56 					if ( ! empty( $update_availible_all ) && ! empty( $update_availible_all->response ) ) {
    59 					if ( ! empty( $update_availible_all ) && ! empty( $update_availible_all->response ) ) {
    57 						if ( $is_pro_installed && array_key_exists( $value_plugin['pro_version'], $update_availible_all->response ) ) {
    60 						if ( $is_pro_installed && array_key_exists( $value_plugin['pro_version'], $update_availible_all->response ) ) {
    58 							unset( $bws_plugins[ $key_plugin ] );
    61 							unset( $bws_plugins[ $key_plugin ] );
    59 							$value_plugin['update_availible'] = $value_plugin['pro_version'];
    62 							$value_plugin['update_availible']            = $value_plugin['pro_version'];
    60 							$bws_plugins_update_availible[ $key_plugin ] = $value_plugin;
    63 							$bws_plugins_update_availible[ $key_plugin ] = $value_plugin;
    61 						} else if ( $is_installed && array_key_exists( $key_plugin, $update_availible_all->response ) ) {
    64 						} elseif ( $is_installed && array_key_exists( $key_plugin, $update_availible_all->response ) ) {
    62 							unset( $bws_plugins[ $key_plugin ] );
    65 							unset( $bws_plugins[ $key_plugin ] );
    63 							$value_plugin['update_availible'] = $key_plugin;
    66 							$value_plugin['update_availible']            = $key_plugin;
    64 							$bws_plugins_update_availible[ $key_plugin ] = $value_plugin;
    67 							$bws_plugins_update_availible[ $key_plugin ] = $value_plugin;
    65 						}
    68 						}
    66 					}
    69 					}
    67 					/* check expired */
    70 					/* Check expired */
    68 					if ( $is_pro_installed && isset( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) &&
    71 					if ( $is_pro_installed && isset( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) &&
    69 					     strtotime( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) < strtotime( date( "m/d/Y" ) ) ) {
    72 						 strtotime( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) < strtotime( gmdate( 'm/d/Y' ) ) ) {
    70 						unset( $bws_plugins[ $key_plugin ] );
    73 						unset( $bws_plugins[ $key_plugin ] );
    71 						$value_plugin['expired'] = $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ];
    74 						$value_plugin['expired']            = $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ];
    72 						$bws_plugins_expired[ $key_plugin ] = $value_plugin;
    75 						$bws_plugins_expired[ $key_plugin ] = $value_plugin;
    73 					}
    76 					}
    74 				}
    77 				}
    75 				$bws_plugins = $bws_plugins_update_availible + $bws_plugins_expired + $bws_plugins;
    78 				$bws_plugins = $bws_plugins_update_availible + $bws_plugins_expired + $bws_plugins;
    76 			} else {
    79 			} else {
    79 						$bws_plugins_category[ $category_key ]['count'] = isset( $bws_plugins_category[ $category_key ]['count'] ) ? $bws_plugins_category[ $category_key ]['count'] + 1 : 1;
    82 						$bws_plugins_category[ $category_key ]['count'] = isset( $bws_plugins_category[ $category_key ]['count'] ) ? $bws_plugins_category[ $category_key ]['count'] + 1 : 1;
    80 					}
    83 					}
    81 				}
    84 				}
    82 			}
    85 			}
    83 
    86 
    84 			/*** membership ***/
    87 			/*** Membership */
    85 			$bws_license_plugin = 'bws_get_list_for_membership';
    88 			$bws_license_plugin     = 'bws_get_list_for_membership';
    86 			$bws_license_key = isset( $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) ? $bstwbsftwppdtplgns_options[ $bws_license_plugin ] : '';
    89 			$bws_license_key        = isset( $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) ? $bstwbsftwppdtplgns_options[ $bws_license_plugin ] : '';
    87 			$update_membership_list = true;
    90 			$update_membership_list = true;
    88 
    91 
    89 			if ( isset( $_POST['bws_license_key'] ) )
    92 			if ( isset( $_POST['bws_license_key'] ) ) {
    90 				$bws_license_key = sanitize_text_field( $_POST['bws_license_key'] );
    93 				$bws_license_key = sanitize_text_field( wp_unslash( $_POST['bws_license_key'] ) );
       
    94 			}
    91 
    95 
    92 			if ( isset( $_SESSION['bws_membership_time_check'] ) && isset( $_SESSION['bws_membership_list'] ) && $_SESSION['bws_membership_time_check'] < strtotime( '+12 hours' ) ) {
    96 			if ( isset( $_SESSION['bws_membership_time_check'] ) && isset( $_SESSION['bws_membership_list'] ) && $_SESSION['bws_membership_time_check'] < strtotime( '+12 hours' ) ) {
    93 				$update_membership_list = false;
    97 				$update_membership_list = false;
    94 				$plugins_array = $_SESSION['bws_membership_list'];
    98 				$plugins_array          = $_SESSION['bws_membership_list'];
    95 			}
    99 			}
    96 
   100 
    97 			if ( ( $update_membership_list && ! empty( $bws_license_key ) ) || ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( plugin_basename(__FILE__), 'bws_license_nonce_name' ) ) ) {
   101 			if ( ( $update_membership_list && ! empty( $bws_license_key ) ) || ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_license_nonce_name' ) ) ) {
    98 
   102 
    99 				if ( '' != $bws_license_key ) {
   103 				if ( '' !== $bws_license_key ) {
   100 					if ( strlen( $bws_license_key ) != 18 ) {
   104 					if ( 18 !== strlen( $bws_license_key ) ) {
   101 						$error = __( 'Wrong license key', 'bestwebsoft' );
   105 						$error = __( 'Wrong license key', 'bestwebsoft' );
   102 					} else {
   106 					} else {
   103 
   107 
   104 						if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - (24 * 60 * 60) ) ) {
   108 						if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
   105 							$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
   109 							$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
   106 						} else {
   110 						} else {
   107 							$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
   111 							$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
   108 							$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time();
   112 							$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time']  = time();
   109 						}
   113 						}
   110 
   114 
   111 						/* get Pro list */
   115 						/* get Pro list */
   112 						$to_send = array();
   116 						$to_send                                   = array();
   113 						$to_send["plugins"][ $bws_license_plugin ] = array();
   117 						$to_send['plugins'][ $bws_license_plugin ] = array();
   114 						$to_send["plugins"][ $bws_license_plugin ]["bws_license_key"] = $bws_license_key;
   118 						$to_send['plugins'][ $bws_license_plugin ]['bws_license_key'] = $bws_license_key;
   115 						$options = array(
   119 						$options      = array(
   116 							'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
   120 							'timeout'    => ( ( defined( 'DOING_CRON' ) && DOING_CRON ) ? 30 : 3 ),
   117 							'body' => array( 'plugins' => serialize( $to_send ) ),
   121 							'body'       => array( 'plugins' => serialize( $to_send ) ),
   118 							'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
   122 							'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ),
       
   123 						);
   119 						$raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
   124 						$raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
   120 
   125 
   121 						if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
   126 						if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) {
   122 							$error = __( "Something went wrong. Please try again later. If the error appears again, please contact us", 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com">BestWebSoft</a>. ' . __( "We are sorry for inconvenience.", 'bestwebsoft' );
   127 							$error = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com">BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
   123 						} else {
   128 						} else {
   124 							$response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
   129 							$response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
   125 
   130 
   126 							if ( is_array( $response ) && !empty( $response ) ) {
   131 							if ( is_array( $response ) && ! empty( $response ) ) {
   127 								foreach ( $response as $key => $value ) {
   132 								foreach ( $response as $key => $value ) {
   128 									if ( "wrong_license_key" == $value->package ) {
   133 									if ( 'wrong_license_key' === $value->package ) {
   129 										$error = __( "Wrong license key.", 'bestwebsoft' );
   134 										$error = __( 'Wrong license key.', 'bestwebsoft' );
   130 									} elseif ( "wrong_domain" == $value->package ) {
   135 									} elseif ( 'wrong_domain' === $value->package ) {
   131 										$error = __( 'This license key is bound to another site. Change it via personal Client Area.', 'bestwebsoft' ) . '<a target="_blank" href="https://bestwebsoft.com/client-area">' . __( 'Log in', 'bestwebsoft' ) . '</a>';
   136 										$error = __( 'This license key is bound to another site. Change it via personal Client Area.', 'bestwebsoft' ) . '<a target="_blank" href="https://bestwebsoft.com/client-area">' . __( 'Log in', 'bestwebsoft' ) . '</a>';
   132 									} elseif ( "you_are_banned" == $value->package ) {
   137 									} elseif ( 'you_are_banned' === $value->package ) {
   133 										$error = __( "Unfortunately, you have exceeded the number of available tries per day.", 'bestwebsoft' );
   138 										$error = __( 'Unfortunately, you have exceeded the number of available tries per day.', 'bestwebsoft' );
   134 									} elseif ( "time_out" == $value->package ) {
   139 									} elseif ( 'time_out' === $value->package ) {
   135 										$error = sprintf( __( "Unfortunately, Your license has expired. To continue getting top-priority support and plugin updates, you should extend it in your %s", 'bestwebsoft' ), ' <a href="https://bestwebsoft.com/client-area">Client Area</a>' );
   140 										$error = sprintf( __( 'Unfortunately, Your license has expired. To continue getting top-priority support and plugin updates, you should extend it in your %s', 'bestwebsoft' ), ' <a href="https://bestwebsoft.com/client-area">Client Area</a>' );
   136 									} elseif ( "duplicate_domen_for_trial" == $value->package ) {
   141 									} elseif ( 'duplicate_domen_for_trial' === $value->package ) {
   137 										$error = __( "Unfortunately, the Pro licence was already installed to this domain. The Pro Trial license can be installed only once.", 'bestwebsoft' );
   142 										$error = __( 'Unfortunately, the Pro licence was already installed to this domain. The Pro Trial license can be installed only once.', 'bestwebsoft' );
   138 									} elseif ( is_array( $value->package ) && ! empty( $value->package ) ) {
   143 									} elseif ( is_array( $value->package ) && ! empty( $value->package ) ) {
   139 										$plugins_array = $_SESSION['bws_membership_list'] = $value->package;
   144 										$plugins_array                         = $_SESSION['bws_membership_list'] = $value->package;
   140 										$_SESSION['bws_membership_time_check'] = strtotime( 'now' );
   145 										$_SESSION['bws_membership_time_check'] = strtotime( 'now' );
   141 
   146 
   142 										if ( isset( $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) && $bws_license_key == $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) {
   147 										if ( isset( $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) && $bws_license_key === $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) {
   143 											$message = __( 'The license key is valid.', 'bestwebsoft' );
   148 											$message = __( 'The license key is valid.', 'bestwebsoft' );
   144 											if ( isset( $value->time_out ) && $value->time_out != '' )
   149 											if ( isset( $value->time_out ) && '' !== $value->time_out ) {
   145 												$message .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $value->time_out . '.';
   150 												$message .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $value->time_out . '.';
       
   151 											}
   146 										} else {
   152 										} else {
   147 											$message = __( 'Congratulations! Pro Membership license is activated successfully.', 'bestwebsoft' );
   153 											$message = __( 'Congratulations! Pro Membership license is activated successfully.', 'bestwebsoft' );
   148 										}
   154 										}
   149 
   155 
   150 										$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
   156 										$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
   151 									}
   157 									}
   152 								}
   158 								}
   153 							} else {
   159 							} else {
   154 								$error = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.", 'bestwebsoft' );
   160 								$error = __( 'Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.', 'bestwebsoft' );
   155 							}
   161 							}
   156 						}
   162 						}
   157 
   163 
   158 						if ( is_multisite() )
   164 						if ( is_multisite() ) {
   159 							update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   165 							update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   160 						else
   166 						} else {
   161 							update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   167 							update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
       
   168 						}
   162 					}
   169 					}
   163 				} else {
   170 				} else {
   164 					$error = __( "Please enter your license key.", 'bestwebsoft' );
   171 					$error = __( 'Please enter your license key.', 'bestwebsoft' );
   165 				}
   172 				}
   166 			}
   173 			}
   167 		} elseif ( 'bws_system_status' == $page || 'system-status' == $tab ) {
   174 		} elseif ( 'bws_system_status' === $page || 'system-status' === $tab ) {
   168 
   175 
   169 			$all_plugins = get_plugins();
   176 			$all_plugins    = get_plugins();
   170 			$active_plugins = get_option( 'active_plugins' );
   177 			$active_plugins = get_option( 'active_plugins' );
   171 			$mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
   178 			$mysql_info     = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
   172 			if ( is_array( $mysql_info ) )
   179 			if ( is_array( $mysql_info ) ) {
   173 				$sql_mode = $mysql_info[0]->Value;
   180 				$sql_mode = $mysql_info[0]->Value;
   174 			if ( empty( $sql_mode ) )
   181 			}
       
   182 			if ( empty( $sql_mode ) ) {
   175 				$sql_mode = __( 'Not set', 'bestwebsoft' );
   183 				$sql_mode = __( 'Not set', 'bestwebsoft' );
   176 
   184 			}
   177 			$allow_url_fopen = ( ini_get( 'allow_url_fopen' ) ) ? __( 'On', 'bestwebsoft' ) : __( 'Off', 'bestwebsoft' );
   185 
   178 			$upload_max_filesize = ( ini_get( 'upload_max_filesize' ) )? ini_get( 'upload_max_filesize' ) : __( 'N/A', 'bestwebsoft' );
   186 			$allow_url_fopen     = ( ini_get( 'allow_url_fopen' ) ) ? __( 'On', 'bestwebsoft' ) : __( 'Off', 'bestwebsoft' );
   179 			$post_max_size = ( ini_get( 'post_max_size' ) ) ? ini_get( 'post_max_size' ) : __( 'N/A', 'bestwebsoft' );
   187 			$upload_max_filesize = ( ini_get( 'upload_max_filesize' ) ) ? ini_get( 'upload_max_filesize' ) : __( 'N/A', 'bestwebsoft' );
   180 			$max_execution_time = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : __( 'N/A', 'bestwebsoft' );
   188 			$post_max_size       = ( ini_get( 'post_max_size' ) ) ? ini_get( 'post_max_size' ) : __( 'N/A', 'bestwebsoft' );
   181 			$memory_limit = ( ini_get( 'memory_limit' ) ) ? ini_get( 'memory_limit' ) : __( 'N/A', 'bestwebsoft' );
   189 			$max_execution_time  = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : __( 'N/A', 'bestwebsoft' );
   182 			$wp_memory_limit = ( defined( 'WP_MEMORY_LIMIT' ) ) ? WP_MEMORY_LIMIT : __( 'N/A', 'bestwebsoft' );
   190 			$memory_limit        = ( ini_get( 'memory_limit' ) ) ? ini_get( 'memory_limit' ) : __( 'N/A', 'bestwebsoft' );
   183 			$memory_usage = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . ' ' . __( 'Mb', 'bestwebsoft' ) : __( 'N/A', 'bestwebsoft' );
   191 			$wp_memory_limit     = ( defined( 'WP_MEMORY_LIMIT' ) ) ? WP_MEMORY_LIMIT : __( 'N/A', 'bestwebsoft' );
   184 			$exif_read_data = ( is_callable( 'exif_read_data' ) ) ? __( 'Yes', 'bestwebsoft' ) . " ( V" . substr( phpversion( 'exif' ), 0,4 ) . ")" : __( 'No', 'bestwebsoft' );
   192 			$memory_usage        = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . ' ' . __( 'Mb', 'bestwebsoft' ) : __( 'N/A', 'bestwebsoft' );
   185 			$iptcparse = ( is_callable( 'iptcparse' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
   193 			$exif_read_data      = ( is_callable( 'exif_read_data' ) ) ? __( 'Yes', 'bestwebsoft' ) . ' ( V' . substr( phpversion( 'exif' ), 0, 4 ) . ')' : __( 'No', 'bestwebsoft' );
   186 			$xml_parser_create = ( is_callable( 'xml_parser_create' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
   194 			$iptcparse           = ( is_callable( 'iptcparse' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
   187 			$theme = ( function_exists( 'wp_get_theme' ) ) ? wp_get_theme() : get_theme( get_current_theme() );
   195 			$xml_parser_create   = ( is_callable( 'xml_parser_create' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
       
   196 			$theme               = wp_get_theme();
   188 
   197 
   189 			if ( function_exists( 'is_multisite' ) ) {
   198 			if ( function_exists( 'is_multisite' ) ) {
   190 				$multisite = is_multisite() ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
   199 				$multisite = is_multisite() ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
   191 			} else {
   200 			} else {
   192 				$multisite = __( 'N/A', 'bestwebsoft' );
   201 				$multisite = __( 'N/A', 'bestwebsoft' );
   194 
   203 
   195 			$system_info = array(
   204 			$system_info = array(
   196 				'wp_environment' => array(
   205 				'wp_environment' => array(
   197 					'name' => __( 'WordPress Environment', 'bestwebsoft' ),
   206 					'name' => __( 'WordPress Environment', 'bestwebsoft' ),
   198 					'data' => array(
   207 					'data' => array(
   199 						__( 'Home URL', 'bestwebsoft' )						=> home_url(),
   208 						__( 'Home URL', 'bestwebsoft' )         => home_url(),
   200 						__( 'Website URL', 'bestwebsoft' )					=> get_option( 'siteurl' ),
   209 						__( 'Website URL', 'bestwebsoft' )      => get_option( 'siteurl' ),
   201 						__( 'WP Version', 'bestwebsoft' )					=> $wp_version,
   210 						__( 'WP Version', 'bestwebsoft' )       => $wp_version,
   202 						__( 'WP Multisite', 'bestwebsoft' )					=> $multisite,
   211 						__( 'WP Multisite', 'bestwebsoft' )     => $multisite,
   203 						__( 'WP Memory Limit', 'bestwebsoft' )				=> $wp_memory_limit,
   212 						__( 'WP Memory Limit', 'bestwebsoft' )  => $wp_memory_limit,
   204 						__( 'Active Theme', 'bestwebsoft' )					=> $theme['Name'] . ' ' . $theme['Version'] . ' (' . sprintf( __( 'by %s', 'bestwebsoft' ), $theme['Author'] ) . ')'
   213 						__( 'Active Theme', 'bestwebsoft' )     => $theme['Name'] . ' ' . $theme['Version'] . ' (' . sprintf( __( 'by %s', 'bestwebsoft' ), $theme['Author'] ) . ')',
   205 					),
   214 					),
   206 				),
   215 				),
   207 				'server_environment' => array(
   216 				'server_environment' => array(
   208 					'name' => __( 'Server Environment', 'bestwebsoft' ),
   217 					'name' => __( 'Server Environment', 'bestwebsoft' ),
   209 					'data' => array(
   218 					'data' => array(
   210 						__( 'Operating System', 'bestwebsoft' )				=> PHP_OS,
   219 						__( 'Operating System', 'bestwebsoft' )      => PHP_OS,
   211 						__( 'Server', 'bestwebsoft' )						=> $_SERVER["SERVER_SOFTWARE"],
   220 						__( 'Server', 'bestwebsoft' )                => isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_email( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '',
   212 						__( 'PHP Version', 'bestwebsoft' )					=> PHP_VERSION,
   221 						__( 'PHP Version', 'bestwebsoft' )           => PHP_VERSION,
   213 						__( 'PHP Allow URL fopen', 'bestwebsoft' )			=> $allow_url_fopen,
   222 						__( 'PHP Allow URL fopen', 'bestwebsoft' )   => $allow_url_fopen,
   214 						__( 'PHP Memory Limit', 'bestwebsoft' )				=> $memory_limit,
   223 						__( 'PHP Memory Limit', 'bestwebsoft' )      => $memory_limit,
   215 						__( 'Memory Usage', 'bestwebsoft' )					=> $memory_usage,
   224 						__( 'Memory Usage', 'bestwebsoft' )          => $memory_usage,
   216 						__( 'PHP Max Upload Size', 'bestwebsoft' )			=> $upload_max_filesize,
   225 						__( 'PHP Max Upload Size', 'bestwebsoft' )   => $upload_max_filesize,
   217 						__( 'PHP Max Post Size', 'bestwebsoft' )			=> $post_max_size,
   226 						__( 'PHP Max Post Size', 'bestwebsoft' )     => $post_max_size,
   218 						__( 'PHP Max Script Execute Time', 'bestwebsoft' )	=> $max_execution_time,
   227 						__( 'PHP Max Script Execute Time', 'bestwebsoft' ) => $max_execution_time,
   219 						__( 'PHP Exif support', 'bestwebsoft' )				=> $exif_read_data,
   228 						__( 'PHP Exif support', 'bestwebsoft' )      => $exif_read_data,
   220 						__( 'PHP IPTC support', 'bestwebsoft' )				=> $iptcparse,
   229 						__( 'PHP IPTC support', 'bestwebsoft' )      => $iptcparse,
   221 						__( 'PHP XML support', 'bestwebsoft' )				=> $xml_parser_create,
   230 						__( 'PHP XML support', 'bestwebsoft' )       => $xml_parser_create,
   222 						'$_SERVER[HTTP_HOST]'								=> $_SERVER['HTTP_HOST'],
   231 						'$_SERVER[HTTP_HOST]'                        => isset( $_SERVER['HTTP_HOST'] ) ? sanitize_email( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '',
   223 						'$_SERVER[SERVER_NAME]'								=> $_SERVER['SERVER_NAME'],
   232 						'$_SERVER[SERVER_NAME]'                      => isset( $_SERVER['SERVER_NAME'] ) ? sanitize_email( wp_unslash( $_SERVER['SERVER_NAME'] ) ) : '',
   224 					),
   233 					),
   225 				),
   234 				),
   226 				'db'	=> array(
   235 				'db' => array(
   227 					'name' => __( 'Database', 'bestwebsoft' ),
   236 					'name' => __( 'Database', 'bestwebsoft' ),
   228 					'data' => array(
   237 					'data' => array(
   229 						__( 'WP DB version', 'bestwebsoft' )	=> get_option( 'db_version' ),
   238 						__( 'WP DB version', 'bestwebsoft' ) => get_option( 'db_version' ),
   230 						__( 'MySQL version', 'bestwebsoft' )	=> $wpdb->get_var( "SELECT VERSION() AS version" ),
   239 						__( 'MySQL version', 'bestwebsoft' ) => $wpdb->get_var( 'SELECT VERSION() AS version' ),
   231 						__( 'SQL Mode', 'bestwebsoft' )			=> $sql_mode,
   240 						__( 'SQL Mode', 'bestwebsoft' )      => $sql_mode,
   232 					),
   241 					),
   233 				),
   242 				),
   234 				'active_plugins'	=> array(
   243 				'active_plugins' => array(
   235 					'name' 	=> __( 'Active Plugins', 'bestwebsoft' ),
   244 					'name'  => __( 'Active Plugins', 'bestwebsoft' ),
   236 					'data' 	=> array(),
   245 					'data'  => array(),
   237 					'count'	=> 0
   246 					'count' => 0,
   238 				),
   247 				),
   239 				'inactive_plugins'	=> array(
   248 				'inactive_plugins' => array(
   240 					'name' 	=> __( 'Inactive Plugins', 'bestwebsoft' ),
   249 					'name'  => __( 'Inactive Plugins', 'bestwebsoft' ),
   241 					'data' 	=> array(),
   250 					'data'  => array(),
   242 					'count'	=> 0
   251 					'count' => 0,
   243 				)
   252 				),
   244 			);
   253 			);
   245 
   254 
   246 			foreach ( $all_plugins as $path => $plugin ) {
   255 			foreach ( $all_plugins as $path => $plugin ) {
   247 				$name = str_replace( 'by BestWebSoft', '', $plugin['Name'] );
   256 				$name = str_replace( 'by BestWebSoft', '', $plugin['Name'] );
   248 				if ( is_plugin_active( $path ) ) {
   257 				if ( is_plugin_active( $path ) ) {
   249 					$system_info['active_plugins']['data'][ $name ] = sprintf( __( 'by %s', 'bestwebsoft' ), $plugin['Author'] ) . ' - ' . $plugin['Version'];
   258 					$system_info['active_plugins']['data'][ $name ] = sprintf( __( 'by %s', 'bestwebsoft' ), $plugin['Author'] ) . ' - ' . $plugin['Version'];
   250 					$system_info['active_plugins']['count'] = $system_info['active_plugins']['count'] + 1;
   259 					$system_info['active_plugins']['count']         = $system_info['active_plugins']['count'] + 1;
   251 				} else {
   260 				} else {
   252 					$system_info['inactive_plugins']['data'][ $name ] = sprintf( __( 'by %s', 'bestwebsoft' ), $plugin['Author'] ) . ' - ' . $plugin['Version'];
   261 					$system_info['inactive_plugins']['data'][ $name ] = sprintf( __( 'by %s', 'bestwebsoft' ), $plugin['Author'] ) . ' - ' . $plugin['Version'];
   253 					$system_info['inactive_plugins']['count'] = $system_info['inactive_plugins']['count'] + 1;
   262 					$system_info['inactive_plugins']['count']         = $system_info['inactive_plugins']['count'] + 1;
   254 				}
   263 				}
   255 			}
   264 			}
   256 
   265 
   257 			if ( ( isset( $_REQUEST['bwsmn_form_submit'] ) && check_admin_referer( plugin_basename(__FILE__), 'bwsmn_nonce_submit' ) ) || ( isset( $_REQUEST['bwsmn_form_submit_custom_email'] ) && check_admin_referer( plugin_basename(__FILE__), 'bwsmn_nonce_submit_custom_email' ) ) ) {
   266 			if ( ( isset( $_REQUEST['bwsmn_form_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bwsmn_nonce_submit' ) ) || ( isset( $_REQUEST['bwsmn_form_submit_custom_email'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bwsmn_nonce_submit_custom_email' ) ) ) {
   258 				if ( isset( $_REQUEST['bwsmn_form_email'] ) ) {
   267 				if ( isset( $_REQUEST['bwsmn_form_email'] ) ) {
   259 					$email = sanitize_email( $_REQUEST['bwsmn_form_email'] );
   268 					$email = sanitize_email( wp_unslash( $_REQUEST['bwsmn_form_email'] ) );
   260 					if ( '' == $email ) {
   269 					if ( '' === $email ) {
   261 						$error = __( 'Please enter a valid email address.', 'bestwebsoft' );
   270 						$error = __( 'Please enter a valid email address.', 'bestwebsoft' );
   262 					} else {
   271 					} else {
   263 						$message = sprintf( __( 'Email with system info is sent to %s.', 'bestwebsoft' ), $email );
   272 						$message = sprintf( __( 'Email with system info is sent to %s.', 'bestwebsoft' ), $email );
   264 					}
   273 					}
   265 				} else {
   274 				} else {
   266 					$email = 'plugin_system_status@bestwebsoft.com';
   275 					$email   = 'plugin_system_status@bestwebsoft.com';
   267 					$message = __( 'Thank you for contacting us.', 'bestwebsoft' );
   276 					$message = __( 'Thank you for contacting us.', 'bestwebsoft' );
   268 				}
   277 				}
   269 
   278 
   270 				if ( $error == '' ) {
   279 				if ( '' === $error ) {
   271 					$headers  = 'MIME-Version: 1.0' . "\n";
   280 					$headers      = 'MIME-Version: 1.0' . "\n";
   272 					$headers .= 'Content-type: text/html; charset=utf-8' . "\n";
   281 					$headers     .= 'Content-type: text/html; charset=utf-8' . "\n";
   273 					$headers .= 'From: ' . get_option( 'admin_email' );
   282 					$headers     .= 'From: ' . get_option( 'admin_email' );
   274 					$message_text = '<html><head><title>System Info From ' . home_url() . '</title></head><body>';
   283 					$message_text = '<html><head><title>System Info From ' . home_url() . '</title></head><body>';
   275 					foreach ( $system_info as $info ) {
   284 					foreach ( $system_info as $info ) {
   276 						if ( ! empty( $info['data'] ) ) {
   285 						if ( ! empty( $info['data'] ) ) {
   277 							$message_text .= '<h4>' . $info['name'];
   286 							$message_text .= '<h4>' . $info['name'];
   278 							if ( isset( $info['count'] ) )
   287 							if ( isset( $info['count'] ) ) {
   279 								$message_text .= ' (' . $info['count'] . ')';
   288 								$message_text .= ' (' . $info['count'] . ')';
       
   289 							}
   280 							$message_text .= '</h4><table>';
   290 							$message_text .= '</h4><table>';
   281 							foreach ( $info['data'] as $key => $value ) {
   291 							foreach ( $info['data'] as $key => $value ) {
   282 								$message_text .= '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>';
   292 								$message_text .= '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>';
   283 							}
   293 							}
   284 							$message_text .= '</table>';
   294 							$message_text .= '</table>';
   285 						}
   295 						}
   286 					}
   296 					}
   287 					$message_text .= '</body></html>';
   297 					$message_text .= '</body></html>';
   288 					$result = wp_mail( $email, 'System Info From ' . home_url(), $message_text, $headers );
   298 					$result        = wp_mail( $email, 'System Info From ' . esc_url( home_url() ), wp_kses( $message_text ), $headers );
   289 					if ( $result != true )
   299 					if ( true !== $result ) {
   290 						$error = __( "Sorry, email message could not be delivered.", 'bestwebsoft' );
   300 						$error = __( 'Sorry, email message could not be delivered.', 'bestwebsoft' );
       
   301 					}
   291 				}
   302 				}
   292 			}
   303 			}
   293 		} ?>
   304 		} ?>
   294         <div class="bws-wrap">
   305 		<div class="bws-wrap">
   295             <div class="bws-header">
   306 			<div class="bws-header">
   296                 <div class="bws-title">
   307 				<div class="bws-title">
   297                     <a href="<?php echo ( $is_main_page ) ? self_admin_url( 'admin.php?page=bws_panel' ) : esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>">
   308 					<a href="<?php echo ( $is_main_page ) ? esc_url( self_admin_url( 'admin.php?page=bws_panel' ) ) : esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>">
   298                         <span class="bws-logo bwsicons bwsicons-bws-logo"></span>
   309 						<span class="bws-logo bwsicons bwsicons-bws-logo"></span>
   299                         BestWebSoft
   310 						BestWebSoft
   300                         <span>panel</span>
   311 						<span>panel</span>
   301                     </a>
   312 					</a>
   302                 </div>
   313 				</div>
   303                 <div class="bws-menu-item-icon">&#8226;&#8226;&#8226;</div>
   314 				<div class="bws-menu-item-icon">&#8226;&#8226;&#8226;</div>
   304                 <div class="bws-nav-tab-wrapper">
   315 				<div class="bws-nav-tab-wrapper">
   305 					<?php if ( $is_main_page ) { ?>
   316 					<?php if ( $is_main_page ) { ?>
   306                         <a class="bws-nav-tab<?php if ( 'bws_panel' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_panel' ); ?>"><?php _e( 'Plugins', 'bestwebsoft' ); ?></a>
   317 						<a class="bws-nav-tab <?php
   307                         <a class="bws-nav-tab<?php if ( 'bws_themes' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_themes' ); ?>"><?php _e( 'Themes', 'bestwebsoft' ); ?></a>
   318 						if ( 'bws_panel' === $page ) {
   308                         <a class="bws-nav-tab<?php if ( 'bws_system_status' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_system_status' ); ?>"><?php _e( 'System status', 'bestwebsoft' ); ?></a>
   319 							echo esc_attr( ' bws-nav-tab-active' );
       
   320 						}
       
   321 						?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=bws_panel' ) ); ?>"><?php esc_html_e( 'Plugins', 'bestwebsoft' );
       
   322 						?>
       
   323 						</a>
       
   324 						<!-- pls -->
       
   325 						<a class="bws-nav-tab <?php
       
   326 						if ( 'bws_themes' === $page ) {
       
   327 							echo esc_attr( ' bws-nav-tab-active' );
       
   328 						}
       
   329 						?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=bws_themes' ) ); ?>"><?php esc_html_e( 'Themes', 'bestwebsoft' ); ?></a>
       
   330 						<a class="bws-nav-tab <?php
       
   331 						if ( 'bws_system_status' === $page ) {
       
   332 							echo esc_attr( ' bws-nav-tab-active' );
       
   333 						} 
       
   334 						?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=bws_system_status' ) ); ?>"><?php esc_html_e( 'System status', 'bestwebsoft' );
       
   335 						?>
       
   336 						</a>
   309 					<?php } else { ?>
   337 					<?php } else { ?>
   310                         <a class="bws-nav-tab<?php if ( ! isset( $_GET['tab'] ) ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>"><?php _e( 'Plugins', 'bestwebsoft' ); ?></a>
   338 						<a class="bws-nav-tab <?php
   311                         <a class="bws-nav-tab<?php if ( 'themes' == $tab ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=themes' ) ); ?>"><?php _e( 'Themes', 'bestwebsoft' ); ?></a>
   339 						if ( ! isset( $_GET['tab'] ) ) {
   312                         <a class="bws-nav-tab<?php if ( 'system-status' == $tab ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=system-status' ) ); ?>"><?php _e( 'System status', 'bestwebsoft' ); ?></a>
   340 							echo esc_attr( ' bws-nav-tab-active' );
       
   341 						} 
       
   342 						?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>"><?php esc_html_e( 'Plugins', 'bestwebsoft' ); 
       
   343 						?>
       
   344 						</a>
       
   345 						<!-- pls -->
       
   346 						<a class="bws-nav-tab <?php
       
   347 						if ( 'themes' === $tab ) {
       
   348 							echo esc_attr( ' bws-nav-tab-active' );
       
   349 						}
       
   350 						?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=themes' ) ); ?>"><?php esc_html_e( 'Themes', 'bestwebsoft' );
       
   351 						?>
       
   352 						</a>
       
   353 						 <!-- end pls -->
       
   354 						<a class="bws-nav-tab <?php
       
   355 						if ( 'system-status' === $tab ) {
       
   356 							echo esc_attr( ' bws-nav-tab-active' );
       
   357 						}
       
   358 						?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=system-status' ) ); ?>"><?php esc_html_e( 'System status', 'bestwebsoft' );
       
   359 						?>
       
   360 						</a>
   313 					<?php } ?>
   361 					<?php } ?>
   314                 </div>
   362 				</div>
   315                 <div class="bws-help-links-wrapper">
   363 				<!-- pls -->
   316                     <a href="https://support.bestwebsoft.com" target="_blank"><?php _e( 'Support', 'bestwebsoft' ); ?></a>
   364 				<div class="bws-help-links-wrapper">
   317                     <a href="https://bestwebsoft.com/client-area" target="_blank" title="<?php _e( 'Manage purchased licenses & subscriptions', 'bestwebsoft' ); ?>">Client Area</a>
   365 					<a href="https://support.bestwebsoft.com" target="_blank"><?php esc_html_e( 'Support', 'bestwebsoft' ); ?></a>
   318                 </div>
   366 					<a href="https://bestwebsoft.com/client-area" target="_blank" title="<?php esc_html_e( 'Manage purchased licenses & subscriptions', 'bestwebsoft' ); ?>">Client Area</a>
   319                 <div class="clear"></div>
   367 				</div>
   320             </div>
   368 				<!-- end pls -->
   321 			<?php if ( ( 'bws_panel' == $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) && ! isset( $_POST['bws_plugin_action_submit'] ) ) { ?>
   369 				<div class="clear"></div>
   322                 <div class="bws-membership-wrap">
   370 			</div>
   323                     <div class="bws-membership-backround"></div>
   371 			<?php if ( ( 'bws_panel' === $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) && ! isset( $_POST['bws_plugin_action_submit'] ) ) { ?>
   324                     <div class="bws-membership">
   372 				<div class="bws-membership-wrap">
   325                         <div class="bws-membership-title"><?php printf( __( 'Get Access to %s+ Premium Plugins', 'bestwebsoft' ), '30' ); ?></div>
   373 					<div class="bws-membership-backround"></div>
   326                         <form class="bws-membership-form" method="post" action="">
   374 					<div class="bws-membership">
   327                             <span class="bws-membership-link"><a target="_blank" href="https://bestwebsoft.com/membership/"><?php _e( 'Subscribe to Pro Membership', 'bestwebsoft' ); ?></a> <?php _e( 'or', 'bestwebsoft' ); ?></span>
   375 						<div class="bws-membership-title"><?php printf( esc_html__( 'Get Access to %s+ Premium Plugins', 'bestwebsoft' ), '30' ); ?></div>
   328 							<?php if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) &&
   376 						<form class="bws-membership-form" method="post" action="">
   329 							           '5' < $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] &&
   377 							<span class="bws-membership-link"><a target="_blank" href="https://bestwebsoft.com/membership/"><?php esc_html_e( 'Subscribe to Pro Membership', 'bestwebsoft' ); ?></a> <?php esc_html_e( 'or', 'bestwebsoft' ); ?></span>
   330 							           $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) { ?>
   378 							<?php
   331                                 <div class="bws_form_input_wrap">
   379 							if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) &&
   332                                     <input disabled="disabled" type="text" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key); ?>" />
   380 								'5' < $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] &&
   333                                     <div class="bws_error"><?php _e( "Unfortunately, you have exceeded the number of available tries per day.", 'bestwebsoft' ); ?></div>
   381 								$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
   334                                 </div>
   382 								?>
   335                                 <input disabled="disabled" type="submit" class="bws-button" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
   383 								<div class="bws_form_input_wrap">
       
   384 									<input disabled="disabled" type="text" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
       
   385 									<div class="bws_error"><?php esc_html_e( 'Unfortunately, you have exceeded the number of available tries per day.', 'bestwebsoft' ); ?></div>
       
   386 								</div>
       
   387 								<input disabled="disabled" type="submit" class="bws-button" value="<?php esc_html_e( 'Check license key', 'bestwebsoft' ); ?>" />
   336 							<?php } else { ?>
   388 							<?php } else { ?>
   337                                 <div class="bws_form_input_wrap">
   389 								<div class="bws_form_input_wrap">
   338                                     <input <?php if ( "" != $error ) echo 'class="bws_input_error"'; ?> type="text" placeholder="<?php _e( 'Enter your license key', 'bestwebsoft' ); ?>" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
   390 									<input 
   339                                     <div class="bws_error" <?php if ( "" == $error ) echo 'style="display:none"'; ?>><?php echo $error; ?></div>
   391 									<?php
   340                                 </div>
   392 									if ( '' !== $error ) {
   341                                 <input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $bws_license_plugin ); ?>" />
   393 										echo 'class="bws_input_error"';}
   342                                 <input type="hidden" name="bws_license_submit" value="submit" />
   394 									?>
       
   395 										type="text" placeholder="<?php esc_html_e( 'Enter your license key', 'bestwebsoft' ); ?>" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
       
   396 									<div class="bws_error" 
       
   397 									<?php
       
   398 									if ( '' === $error ) {
       
   399 										echo 'style="display:none"';}
       
   400 									?>
       
   401 									><?php echo esc_html( $error ); ?></div>
       
   402 								</div>
       
   403 								<input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $bws_license_plugin ); ?>" />
       
   404 								<input type="hidden" name="bws_license_submit" value="submit" />
   343 								<?php if ( empty( $plugins_array ) ) { ?>
   405 								<?php if ( empty( $plugins_array ) ) { ?>
   344                                     <input type="submit" class="bws-button" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
   406 									<input type="submit" class="bws-button" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
   345 								<?php } else { ?>
   407 								<?php } else { ?>
   346                                     <input type="submit" class="bws-button" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
   408 									<input type="submit" class="bws-button" value="<?php esc_html_e( 'Check license key', 'bestwebsoft' ); ?>" />
   347 								<?php } ?>
   409 								<?php } ?>
   348 								<?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_nonce_name' ); ?>
   410 								<?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_license_nonce_name' ); ?>
   349 							<?php } ?>
   411 							<?php } ?>
   350                         </form>
   412 						</form>
   351                         <div class="clear"></div>
   413 						<div class="clear"></div>
   352                     </div>
   414 					</div>
   353                 </div>
   415 				</div>
   354 			<?php } ?>
   416 			<?php } ?>
   355             <div class="bws-wrap-content wrap">
   417 			<!-- end pls -->
   356 				<?php if ( 'bws_panel' == $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) { ?>
   418 			<div class="bws-wrap-content wrap">
   357                     <div class="updated notice is-dismissible inline" <?php if ( '' == $message || '' != $error ) echo 'style="display:none"'; ?>><p><?php echo $message; ?></p></div>
   419 				<?php if ( 'bws_panel' === $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) { ?>
   358                     <h1>
   420 					<div class="updated notice is-dismissible inline" 
   359 						<?php _e( 'Plugins', 'bestwebsoft' ); ?>
   421 					<?php
   360                         <a href="<?php echo self_admin_url( 'plugin-install.php?tab=upload' ); ?>" class="upload page-title-action add-new-h2"><?php _e( 'Upload Plugin', 'bestwebsoft' ); ?></a>
   422 					if ( '' === $message || '' !== $error ) {
   361                     </h1>
   423 						echo 'style="display:none"';}
   362 					<?php if ( isset( $_GET['error'] ) ) {
   424 					?>
   363 						if ( isset( $_GET['charsout'] ) )
   425 					><p><?php echo esc_html( $message ); ?></p></div>
   364 							$errmsg = sprintf( __( 'The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ), $_GET['charsout'] );
   426 					<h1>
   365 						else
   427 						<?php esc_html_e( 'Plugins', 'bestwebsoft' ); ?>
   366 							$errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' ); ?>
   428 						<a href="<?php echo esc_url( self_admin_url( 'plugin-install.php?tab=upload' ) ); ?>" class="upload page-title-action add-new-h2"><?php esc_html_e( 'Upload Plugin', 'bestwebsoft' ); ?></a>
   367                         <div id="message" class="error is-dismissible"><p><?php echo $errmsg; ?></p></div>
   429 					</h1>
       
   430 					<?php
       
   431 					if ( isset( $_GET['error'] ) ) {
       
   432 						if ( isset( $_GET['charsout'] ) ) {
       
   433 							$errmsg = sprintf( __( 'The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ), intval( $_GET['charsout'] ) );
       
   434 						} else {
       
   435 							$errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' );
       
   436 						}
       
   437 						?>
       
   438 						<div id="message" class="error is-dismissible"><p><?php echo wp_kses( $errmsg ); ?></p></div>
   368 					<?php } elseif ( isset( $_GET['activate'] ) ) { ?>
   439 					<?php } elseif ( isset( $_GET['activate'] ) ) { ?>
   369                         <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>activated</strong>.' ) ?></p></div>
   440 						<div id="message" class="updated notice is-dismissible"><p><?php esc_html_e( 'Plugin <strong>activated</strong>.' ); ?></p></div>
   370 					<?php }
   441 						<?php
   371 
   442 					}
   372 					if ( isset( $_POST['bws_plugin_action_submit'] ) && isset( $_POST['bws_install_plugin'] ) && check_admin_referer( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ) ) {
   443 
   373 
   444 					if ( isset( $_POST['bws_plugin_action_submit'] ) && isset( $_POST['bws_install_plugin'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_license_install_nonce_name' ) ) {
   374 						$bws_license_plugin = sanitize_text_field( $_POST['bws_install_plugin'] );
   445 
       
   446 						$bws_license_plugin = sanitize_text_field( wp_unslash( $_POST['bws_install_plugin'] ) );
   375 
   447 
   376 						$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
   448 						$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
   377 						if ( is_multisite() )
   449 						if ( is_multisite() ) {
   378 							update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   450 							update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   379 						else
   451 						} else {
   380 							update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   452 							update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   381 
   453 						}
   382 						$url = $plugins_array[ $bws_license_plugin ]['link'] . '&download_from=5'; ?>
   454 
   383 						<h2><?php _e( 'Download Pro Plugin', 'bestwebsoft' ); ?></h2>		
   455 						$url = $plugins_array[ $bws_license_plugin ]['link'] . '&download_from=5';
       
   456 						?>
       
   457 						<h2><?php esc_html_e( 'Download Pro Plugin', 'bestwebsoft' ); ?></h2>		
   384 						<p>
   458 						<p>
   385 							<strong><?php _e( 'Your Pro plugin is ready', 'bestwebsoft' ); ?></strong>
   459 							<strong><?php esc_html_e( 'Your Pro plugin is ready', 'bestwebsoft' ); ?></strong>
   386 							<br>
   460 							<br>
   387 							<?php _e( 'Your plugin has been zipped, and now is ready to download.', 'bestwebsoft' ); ?>
   461 							<?php esc_html_e( 'Your plugin has been zipped, and now is ready to download.', 'bestwebsoft' ); ?>
   388 						</p>
   462 						</p>
   389 						<p>
   463 						<p>
   390 							<a class="button button-secondary" target="_parent" href="<?php echo esc_url( $url ); ?>"><?php _e( 'Download Now', 'bestwebsoft' ); ?></a>
   464 							<a class="button button-secondary" target="_parent" href="<?php echo esc_url( $url ); ?>"><?php esc_html_e( 'Download Now', 'bestwebsoft' ); ?></a>
   391 						</p>
   465 						</p>
   392 						<br>
   466 						<br>
   393 						<p>
   467 						<p>
   394 							<strong><?php _e( 'Need help installing the plugin?', 'bestwebsoft' ); ?></strong>
   468 							<strong><?php esc_html_e( 'Need help installing the plugin?', 'bestwebsoft' ); ?></strong>
   395 							<br>
   469 							<br>
   396 							<a target="_blank" href="https://docs.google.com/document/d/1-hvn6WRvWnOqj5v5pLUk7Awyu87lq5B_dO-Tv-MC9JQ/"><?php _e( 'How to install WordPress plugin from your admin Dashboard (ZIP archive)', 'bestwebsoft' ); ?></a>
   470 							<a target="_blank" href="https://bestwebsoft.com/documentation/how-to-install-a-wordpress-product/how-to-install-a-wordpress-plugin/"><?php esc_html_e( 'How to install WordPress plugin from your admin Dashboard (ZIP archive)', 'bestwebsoft' ); ?></a>
   397 						</p>						
   471 						</p>						
   398 						<p>
   472 						<p>
   399 							<strong><?php _e( 'Get Started', 'bestwebsoft' ); ?></strong>
   473 							<strong><?php esc_html_e( 'Get Started', 'bestwebsoft' ); ?></strong>
   400 							<br>
   474 							<br>
   401 							<a target="_blank" href="https://drive.google.com/drive/u/0/folders/0B5l8lO-CaKt9VGh0a09vUjNFNjA"><?php _e( 'Documentation', 'bestwebsoft' ); ?></a>
   475 							<a target="_blank" href="https://bestwebsoft.com/documentation/"><?php esc_html_e( 'Documentation', 'bestwebsoft' ); ?></a>
   402 							<br>
   476 							<br>
   403 							<a target="_blank" href="https://www.youtube.com/user/bestwebsoft"><?php _e( 'Video Instructions', 'bestwebsoft' ); ?></a>
   477 							<a target="_blank" href="https://www.youtube.com/user/bestwebsoft"><?php esc_html_e( 'Video Instructions', 'bestwebsoft' ); ?></a>
   404 							<br>
   478 							<br>
   405 							<a target="_blank" href="https://support.bestwebsoft.com"><?php _e( 'Knowledge Base', 'bestwebsoft' ); ?></a>
   479 							<a target="_blank" href="https://support.bestwebsoft.com"><?php esc_html_e( 'Knowledge Base', 'bestwebsoft' ); ?></a>
   406 						</p>
   480 						</p>
   407 						<p>
   481 						<p>
   408 							<strong><?php _e( 'Licenses & Domains', 'bestwebsoft' ); ?></strong>
   482 							<strong><?php esc_html_e( 'Licenses & Domains', 'bestwebsoft' ); ?></strong>
   409 							<br>
   483 							<br>
   410 							<?php printf( 'Manage your license(-s) and change domain names using the %s at BestWebSoft.',
   484 							<?php
   411 							'<a target="_blank" href="https://bestwebsoft.com/client-area">' . __( 'Client Area', 'bestwebsoft' ) . '</a>' ); ?>
   485 							printf(
       
   486 								'Manage your license(-s) and change domain names using the %s at BestWebSoft.',
       
   487 								'<a target="_blank" href="https://bestwebsoft.com/client-area">' . esc_html__( 'Client Area', 'bestwebsoft' ) . '</a>'
       
   488 							);
       
   489 							?>
   412 						</p>
   490 						</p>
   413 						<p><a href="<?php echo esc_url( self_admin_url( $current_page ) ); ?>" target="_parent"><?php _e( 'Return to BestWebSoft Panel', 'bestwebsoft' ); ?></a></p>
   491 						<p><a href="<?php echo esc_url( self_admin_url( $current_page ) ); ?>" target="_parent"><?php esc_html_e( 'Return to BestWebSoft Panel', 'bestwebsoft' ); ?></a></p>
   414 					<?php } else {
   492 						<?php
       
   493 					} else {
   415 						$category_href = $current_page;
   494 						$category_href = $current_page;
   416 						if ( 'all' != $plugin_category )
   495 						if ( 'all' !== $plugin_category ) {
   417 							$category_href .= '&category=' . $plugin_category; ?>
   496 							$category_href .= '&category=' . $plugin_category;
   418                         <ul class="subsubsub">
   497 						}
   419                             <li>
   498 						?>
   420                                 <a <?php if ( ! isset( $_GET['sub'] ) ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?></a>
   499 						<ul class="subsubsub">
   421                             </li> |
   500 							<li>
   422                             <li>
   501 								<a 
   423                                 <a <?php if ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href . '&sub=installed' ) ); ?>"><?php _e( 'Installed', 'bestwebsoft' ); ?></a>
   502 								<?php
   424                             </li> |
   503 								if ( ! isset( $_GET['sub'] ) ) {
   425                             <li>
   504 									echo 'class="current" ';}
   426                                 <a <?php if ( isset( $_GET['sub'] ) && 'not_installed' == $_GET['sub'] ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href . '&sub=not_installed' ) ); ?>"><?php _e( 'Not Installed', 'bestwebsoft' ); ?></a>
   505 								?>
   427                             </li>
   506 								href="<?php echo esc_url( self_admin_url( $category_href ) ); ?>"><?php esc_html_e( 'All', 'bestwebsoft' ); ?></a>
   428                         </ul>
   507 							</li> |
   429                         <div class="clear"></div>
   508 							<li>
   430                         <div class="bws-filter-top">
   509 								<a 
   431                             <h2>
   510 								<?php
   432                                 <span class="bws-toggle-indicator"></span>
   511 								if ( isset( $_GET['sub'] ) && 'installed' === sanitize_text_field( wp_unslash( $_GET['sub'] ) ) ) {
   433 								<?php _e( 'Filter results', 'bestwebsoft' ); ?>
   512 									echo 'class="current" ';}
   434                             </h2>
   513 								?>
   435                             <div class="bws-filter-top-inside">
   514 								href="<?php echo esc_url( self_admin_url( $category_href . '&sub=installed' ) ); ?>"><?php esc_html_e( 'Installed', 'bestwebsoft' ); ?></a>
   436                                 <div class="bws-filter-title"><?php _e( 'Category', 'bestwebsoft' ); ?></div>
   515 							</li> |
   437                                 <ul class="bws-category">
   516 							<li>
   438                                     <li>
   517 								<a 
   439 										<?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( $_GET['sub'], array( 'installed', 'not_installed' ) ) ) ? '&sub=' . $_GET['sub'] : ''; ?>
   518 								<?php
   440                                         <a <?php if ( 'all' == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url(self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?>
   519 								if ( isset( $_GET['sub'] ) && 'not_installed' === sanitize_text_field( wp_unslash( $_GET['sub'] ) ) ) {
   441                                             <span>(<?php echo count( $bws_plugins ); ?>)</span>
   520 									echo 'class="current" ';}
   442                                         </a>
   521 								?>
   443                                     </li>
   522 								href="<?php echo esc_url( self_admin_url( $category_href . '&sub=not_installed' ) ); ?>"><?php esc_html_e( 'Not Installed', 'bestwebsoft' ); ?></a>
       
   523 							</li>
       
   524 						</ul>
       
   525 						<div class="clear"></div>
       
   526 						<div class="bws-filter-top">
       
   527 							<h2>
       
   528 								<span class="bws-toggle-indicator"></span>
       
   529 															<?php esc_html_e( 'Filter results', 'bestwebsoft' ); ?>
       
   530 							</h2>
       
   531 							<div class="bws-filter-top-inside">
       
   532 								<div class="bws-filter-title"><?php esc_html_e( 'Category', 'bestwebsoft' ); ?></div>
       
   533 								<ul class="bws-category">
       
   534 									<li>
       
   535 										<?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( sanitize_text_field( wp_unslash( $_GET['sub'] ) ), array( 'installed', 'not_installed' ) ) ) ? '&sub=' . sanitize_text_field( wp_unslash( $_GET['sub'] ) ) : ''; ?>
       
   536 										<a 
       
   537 										<?php
       
   538 										if ( 'all' === $plugin_category ) {
       
   539 											echo ' class="bws-active"';}
       
   540 										?>
       
   541 											href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php esc_html_e( 'All', 'bestwebsoft' ); ?>
       
   542 												<span>(<?php echo count( $bws_plugins ); ?>)</span>
       
   543 										</a>
       
   544 									</li>
   444 									<?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
   545 									<?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
   445                                         <li>
   546 										<li>
   446                                             <a <?php if ( $category_key == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo $category_value['name']; ?>
   547 											<a 
   447                                                 <span>(<?php echo $category_value['count']; ?>)</span>
   548 											<?php
   448                                             </a>
   549 											if ( $category_key === $plugin_category ) {
   449                                         </li>
   550 												echo ' class="bws-active"';}
       
   551 											?>
       
   552 												href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo esc_html( $category_value['name'] ); ?>
       
   553 													<span>(<?php echo intval( $category_value['count'] ); ?>)</span>
       
   554 											</a>
       
   555 										</li>
   450 									<?php } ?>
   556 									<?php } ?>
   451                                 </ul>
   557 								</ul>
   452                             </div>
   558 							</div>
   453                         </div>
   559 						</div>
   454                         <div class="bws-products">
   560 						<div class="bws-products">
   455 							<?php $nothing_found = true;
   561 							<?php
       
   562 							$nothing_found = true;
   456 							foreach ( $bws_plugins as $key_plugin => $value_plugin ) {
   563 							foreach ( $bws_plugins as $key_plugin => $value_plugin ) {
   457 
   564 
   458 								if ( 'all' != $plugin_category && isset( $bws_plugins_category[ $plugin_category ] ) && ! in_array( $plugin_category, $value_plugin['category'] ) )
   565 								if ( 'all' !== $plugin_category && isset( $bws_plugins_category[ $plugin_category ] ) && ! in_array( $plugin_category, $value_plugin['category'] ) ) {
   459 									continue;
   566 									continue;
       
   567 								}
   460 
   568 
   461 								$key_plugin_explode = explode( '/', $key_plugin );
   569 								$key_plugin_explode = explode( '/', $key_plugin );
   462 
   570 
   463 								$icon = isset( $value_plugin['icon'] ) ? $value_plugin['icon'] : '//ps.w.org/' . $key_plugin_explode[0] . '/assets/icon-256x256.png';
   571 								$icon         = isset( $value_plugin['icon'] ) ? $value_plugin['icon'] : '//ps.w.org/' . $key_plugin_explode[0] . '/assets/icon-256x256.png';
   464 								$is_pro_isset = isset( $value_plugin['pro_version'] );
   572 								$is_pro_isset = isset( $value_plugin['pro_version'] );
   465 								$is_installed = array_key_exists( $key_plugin, $all_plugins );
   573 								$is_installed = array_key_exists( $key_plugin, $all_plugins );
   466 								$is_active = in_array( $key_plugin, $active_plugins ) || isset( $sitewide_active_plugins[ $key_plugin ] );
   574 								$is_active    = in_array( $key_plugin, $active_plugins ) || isset( $sitewide_active_plugins[ $key_plugin ] );
   467 
   575 
   468 								$is_pro_installed = $is_pro_active = false;
   576 								$is_pro_installed = $is_pro_active = false;
   469 								if ( $is_pro_isset ) {
   577 								if ( $is_pro_isset ) {
   470 									$is_pro_installed = array_key_exists( $value_plugin['pro_version'], $all_plugins );
   578 									$is_pro_installed = array_key_exists( $value_plugin['pro_version'], $all_plugins );
   471 									$is_pro_active = in_array( $value_plugin['pro_version'], $active_plugins ) || isset( $sitewide_active_plugins[ $value_plugin['pro_version'] ] );
   579 									$is_pro_active    = in_array( $value_plugin['pro_version'], $active_plugins ) || isset( $sitewide_active_plugins[ $value_plugin['pro_version'] ] );
   472 								}
   580 								}
   473 
   581 
   474 								if ( ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] && ! $is_pro_installed && ! $is_installed ) ||
   582 								if ( ( isset( $_GET['sub'] ) && 'installed' === sanitize_text_field( wp_unslash( $_GET['sub'] ) ) && ! $is_pro_installed && ! $is_installed ) ||
   475 								     ( isset( $_GET['sub'] ) && 'not_installed' == $_GET['sub'] && ( $is_pro_installed || $is_installed ) ) )
   583 									( isset( $_GET['sub'] ) && 'not_installed' === sanitize_text_field( wp_unslash( $_GET['sub'] ) ) && ( $is_pro_installed || $is_installed ) ) ) {
   476 									continue;
   584 									continue;
       
   585 								}
   477 
   586 
   478 								$link_attr = isset( $value_plugin['install_url'] ) ? 'href="' . esc_url( $value_plugin['install_url'] ) . '" target="_blank"' : 'href="' . esc_url( self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $key_plugin_explode[0] . '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal"';
   587 								$link_attr = isset( $value_plugin['install_url'] ) ? 'href="' . esc_url( $value_plugin['install_url'] ) . '" target="_blank"' : 'href="' . esc_url( self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $key_plugin_explode[0] . '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal"';
   479 
   588 
   480 								$nothing_found = false; ?>
   589 								$nothing_found = false;
   481                                 <div class="bws_product_box<?php if ( $is_active || $is_pro_active ) echo ' bws_product_active'; ?>">
   590 								?>
   482                                     <div class="bws_product_image">
   591 									<div class="bws_product_box
   483                                         <a <?php echo $link_attr; ?>><img src="<?php echo $icon; ?>"/></a>
   592 									<?php
   484                                     </div>
   593 									if ( $is_active || $is_pro_active ) {
   485                                     <div class="bws_product_content">
   594 										echo esc_attr( ' bws_product_active' );}
   486                                         <div class="bws_product_title"><a <?php echo $link_attr; ?>><?php echo $value_plugin['name']; ?></a></div>
   595 									?>
   487                                         <div class="bws-version">
   596 									">
       
   597 										<div class="bws_product_image">
       
   598 											<a <?php echo wp_kses_data( $link_attr ); ?>><img src="<?php echo esc_url( $icon ); ?>"/></a>
       
   599 										</div>
       
   600 									<div class="bws_product_content">
       
   601 										<div class="bws_product_title"><a <?php echo wp_kses_data( $link_attr ); ?>><?php echo esc_html( $value_plugin['name'] ); ?></a></div>
       
   602 											<div class="bws-version">
       
   603 												<?php
       
   604 												if ( $is_pro_installed ) {
       
   605 													echo '<span';
       
   606 													if ( ! empty( $value_plugin['expired'] ) || ! empty( $value_plugin['update_availible'] ) ) {
       
   607 														echo ' class="bws-update-available"';
       
   608 													}
       
   609 													echo '>v ' . esc_attr( $all_plugins[ $value_plugin['pro_version'] ]['Version'] ) . '</span>';
       
   610 												} elseif ( $is_installed ) {
       
   611 													echo '<span';
       
   612 													if ( ! empty( $value_plugin['expired'] ) || ! empty( $value_plugin['update_availible'] ) ) {
       
   613 														echo ' class="bws-update-available"';
       
   614 													}
       
   615 													echo '>v ' . esc_attr( $all_plugins[ $key_plugin ]['Version'] ) . '</span>';
       
   616 												} else {
       
   617 													echo '<span>' . esc_html__( 'Not installed', 'bestwebsoft' ) . '</span>';
       
   618 												}
       
   619 
       
   620 												if ( ! empty( $value_plugin['expired'] ) ) {
       
   621 													echo ' - <a class="bws-update-now" href="https://support.bestwebsoft.com/hc/en-us/articles/202356359" target="_blank">' . esc_html__( 'Renew to get updates', 'bestwebsoft' ) . '</a>';
       
   622 												} elseif ( ! empty( $value_plugin['update_availible'] ) ) {
       
   623 													$r = $update_availible_all->response[ $value_plugin['update_availible'] ];
       
   624 													echo ' - <a class="bws-update-now" href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $value_plugin['update_availible'] ), 'upgrade-plugin_' . $value_plugin['update_availible'] ) ) . '" class="update-link" aria-label="' . sprintf( esc_html__( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . '">' . sprintf( esc_html__( 'Update to v %s', 'bestwebsoft' ), esc_html( $r->new_version ) ) . '</a>';
       
   625 												}
       
   626 												?>
       
   627 											</div>
       
   628 											<div class="bws_product_description">
       
   629 												<?php echo ( strlen( $value_plugin['description'] ) > 100 ) ? esc_html( mb_substr( $value_plugin['description'], 0, 100 ) ) . '...' : esc_html( $value_plugin['description'] ); ?>
       
   630 											</div>
       
   631 											<div class="bws_product_links">
       
   632 												<?php
       
   633 												if ( $is_active || $is_pro_active ) {
       
   634 													if ( $is_pro_isset ) {
       
   635 														if ( ! $is_pro_installed ) {
       
   636 															if ( ! empty( $plugins_array ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) {
       
   637 																?>
       
   638 																<form method="post" action="">
       
   639 																	<input type="submit" class="button button-secondary" value="<?php esc_html_e( 'Get Pro', 'bestwebsoft' ); ?>" />
       
   640 																	<input type="hidden" name="bws_plugin_action_submit" value="submit" />
       
   641 																	<input type="hidden" name="bws_install_plugin" value="<?php echo esc_attr( $value_plugin['pro_version'] ); ?>" />
       
   642 																	<?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_license_install_nonce_name' ); ?>
       
   643 																</form>
       
   644 															<?php } else { ?>
       
   645 																<a class="button button-secondary bws_upgrade_button" href="<?php echo esc_url( $bws_plugins[ $key_plugin ]['purchase'] ); ?>" target="_blank"><?php esc_html_e( 'Upgrade to Pro', 'bestwebsoft' ); ?></a>
       
   646 																<?php
       
   647 															}
       
   648 														}
       
   649 													} else {
       
   650 														?>
       
   651 														<a class="bws_donate" href="https://bestwebsoft.com/donate/" target="_blank"><?php esc_html_e( 'Donate', 'bestwebsoft' ); ?></a> <span>|</span>
       
   652 														<?php
       
   653 													}
       
   654 
       
   655 													if ( $is_pro_active ) {
       
   656 														?>
       
   657 														<a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]['pro_settings'] ) ); ?>"><?php esc_html_e( 'Settings', 'bestwebsoft' ); ?></a>
       
   658 													<?php } else { ?>
       
   659 														<a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]['settings'] ) ); ?>"><?php esc_html_e( 'Settings', 'bestwebsoft' ); ?></a>
       
   660 														<?php
       
   661 													}
       
   662 												} else {
       
   663 													if ( $is_pro_installed ) {
       
   664 														?>
       
   665 														<a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $value_plugin['pro_version'] ), 'bws_activate_plugin' . $value_plugin['pro_version'] ) ); ?>" title="<?php esc_html_e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php esc_html_e( 'Activate', 'bestwebsoft' ); ?></a>
       
   666 													<?php } elseif ( ! empty( $plugins_array ) && isset( $value_plugin['pro_version'] ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
       
   667 														<form method="post" action="">
       
   668 															<input type="submit" class="button button-secondary" value="<?php esc_html_e( 'Get Pro', 'bestwebsoft' ); ?>" />
       
   669 															<input type="hidden" name="bws_plugin_action_submit" value="submit" />
       
   670 															<input type="hidden" name="bws_install_plugin" value="<?php echo esc_url( $value_plugin['pro_version'] ); ?>" />
       
   671 															<?php wp_nonce_field( plugin_basename( __FILE__ ), 'bws_license_install_nonce_name' ); ?>
       
   672 														</form>
       
   673 													<?php } elseif ( $is_installed ) { ?>
       
   674 														<a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $key_plugin ), 'bws_activate_plugin' . $key_plugin ) ); ?>" title="<?php esc_html_e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php esc_html_e( 'Activate', 'bestwebsoft' ); ?></a>
       
   675 														<?php
       
   676 													} else {
       
   677 														$install_url = isset( $value_plugin['install_url'] ) ? $value_plugin['install_url'] : network_admin_url( 'plugin-install.php?tab=search&type=term&s=' . str_replace( array( ' ', '-' ), '+', str_replace( '&', '', $value_plugin['name'] ) ) . '+BestWebSoft&plugin-search-input=Search+Plugins' );
       
   678 														?>
       
   679 														<a class="button button-secondary" href="<?php echo esc_url( $install_url ); ?>" title="<?php esc_html_e( 'Install this plugin', 'bestwebsoft' ); ?>" target="_blank"><?php esc_html_e( 'Install Now', 'bestwebsoft' ); ?></a>
       
   680 														<?php
       
   681 													}
       
   682 												}
       
   683 												?>
       
   684 											</div>
       
   685 										</div>
       
   686 									<div class="clear"></div>
       
   687 								</div>
       
   688 								<?php
       
   689 							}
       
   690 							if ( $nothing_found ) {
       
   691 								?>
       
   692 								<p class="description"><?php esc_html_e( 'Nothing found. Try another criteria.', 'bestwebsoft' ); ?></p>
       
   693 							<?php } ?>
       
   694 						</div>
       
   695 						<div id="bws-filter-wrapper">
       
   696 							<div class="bws-filter">
       
   697 								<div class="bws-filter-title"><?php esc_html_e( 'Category', 'bestwebsoft' ); ?></div>
       
   698 								<ul class="bws-category">
       
   699 									<li>
       
   700 										<?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( sanitize_text_field( wp_unslash( $_GET['sub'] ) ), array( 'installed', 'not_installed' ) ) ) ? '&sub=' . sanitize_text_field( wp_unslash( $_GET['sub'] ) ) : ''; ?>
       
   701 										<a 
       
   702 										<?php
       
   703 										if ( 'all' === $plugin_category ) {
       
   704 											echo ' class="bws-active"';}
       
   705 										?>
       
   706 											href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php esc_html_e( 'All', 'bestwebsoft' ); ?>
       
   707 											<span>(<?php echo count( $bws_plugins ); ?>)</span>
       
   708 										</a>
       
   709 									</li>
       
   710 									<?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
       
   711 										<li>
       
   712 											<a 
   488 											<?php
   713 											<?php
   489 											if ( $is_pro_installed ) {
   714 											if ( $category_key === $plugin_category ) {
   490 												echo '<span';
   715 												echo ' class="bws-active"';}
   491 												if ( ! empty( $value_plugin['expired'] ) || ! empty( $value_plugin['update_availible'] ) )
   716 											?>
   492 													echo ' class="bws-update-available"';
   717 												href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo esc_html( $category_value['name'] ); ?>
   493 												echo '>v ' . $all_plugins[ $value_plugin['pro_version'] ]['Version'] . '</span>';
   718 												<span>(<?php echo intval( $category_value['count'] ); ?>)</span>
   494 											} elseif ( $is_installed ) {
   719 											</a>
   495 												echo '<span';
   720 										</li>
   496 												if ( ! empty( $value_plugin['expired'] ) || ! empty( $value_plugin['update_availible'] ) )
   721 									<?php } ?>
   497 													echo ' class="bws-update-available"';
   722 								</ul>
   498 												echo '>v ' . $all_plugins[ $key_plugin ]['Version'] . '</span>';
   723 							</div>
   499 											} else {
   724 						</div><!-- #bws-filter-wrapper -->
   500 												echo '<span>' . __( 'Not installed', 'bestwebsoft' ) . '</span>';
   725 						<div class="clear"></div>
       
   726 						<?php
       
   727 					}
       
   728 				} elseif ( 'bws_themes' === $page || 'themes' === $tab ) {
       
   729 					require dirname( __FILE__ ) . '/product_list.php';
       
   730 					?>
       
   731 					<h1><?php esc_html_e( 'Themes', 'bestwebsoft' ); ?></h1>
       
   732 					<div id="availablethemes" class="bws-availablethemes">
       
   733 						<div class="theme-browser content-filterable rendered">
       
   734 							<div class="themes wp-clearfix">
       
   735 								<?php
       
   736 								foreach ( $themes as $key => $theme ) {
       
   737 									$installed_theme = wp_get_theme( $theme->slug );
       
   738 									?>
       
   739 									<div class="theme" tabindex="0">
       
   740 										<div class="theme-screenshot">
       
   741 											<img src="<?php echo esc_url( bws_menu_url( 'icons/themes/' ) . $theme->slug . '.png' ); ?>" alt="" />
       
   742 										</div>
       
   743 										<div class="theme-author"><?php printf( esc_html__( 'By %s', 'bestwebsoft' ), 'BestWebSoft' ); ?></div>
       
   744 										<h3 class="theme-name"><?php echo esc_html( $theme->name ); ?></h3>
       
   745 										<div class="theme-actions">
       
   746 											<a class="button button-secondary preview install-theme-preview" href="<?php echo esc_url( $theme->href ); ?>" target="_blank"><?php esc_html_e( 'Learn More', 'bestwebsoft' ); ?></a>
       
   747 										</div>
       
   748 										<?php
       
   749 										if ( $installed_theme->exists() ) {
       
   750 											if ( $wp_version < '4.6' ) {
       
   751 												?>
       
   752 												<div class="theme-installed"><?php esc_html_e( 'Already Installed', 'bestwebsoft' ); ?></div>
       
   753 											<?php } else { ?>
       
   754 												<div class="notice notice-success notice-alt inline"><p><?php esc_html_e( 'Installed', 'bestwebsoft' ); ?></p></div>
       
   755 												<?php
   501 											}
   756 											}
   502 
   757 										}
   503 											if ( ! empty( $value_plugin['expired'] ) ) {
   758 										?>
   504 												echo ' - <a class="bws-update-now" href="https://support.bestwebsoft.com/hc/en-us/articles/202356359" target="_blank">' . __( 'Renew to get updates', 'bestwebsoft' ) . '</a>';
   759 									</div>
   505 											} elseif ( ! empty( $value_plugin['update_availible'] ) ) {
   760 								<?php } ?>
   506 												$r = $update_availible_all->response[ $value_plugin['update_availible'] ];
   761 								<br class="clear" />
   507 												echo ' - <a class="bws-update-now" href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $value_plugin['update_availible'] ), 'upgrade-plugin_' . $value_plugin['update_availible'] ) ) . '" class="update-link" aria-label="' . sprintf( __( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . '">' . sprintf( __( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . '</a>';
   762 							</div>
   508 											} ?>
   763 						</div>
   509                                         </div>
   764 						<p><a class="bws_browse_link" href="https://bestwebsoft.com/products/wordpress/themes/" target="_blank"><?php esc_html_e( 'Browse More WordPress Themes', 'bestwebsoft' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a></p>
   510                                         <div class="bws_product_description">
   765 					</div>
   511 											<?php echo ( strlen( $value_plugin['description'] ) > 100 ) ? mb_substr( $value_plugin['description'], 0, 100 ) . '...' : $value_plugin['description']; ?>
   766 				<?php } elseif ( 'bws_system_status' === $page || 'system-status' === $tab ) { ?>
   512                                         </div>
   767 					<h1><?php esc_html_e( 'System status', 'bestwebsoft' ); ?></h1>
   513                                         <div class="bws_product_links">
   768 					<div class="updated fade notice is-dismissible inline" 
   514 											<?php if ( $is_active || $is_pro_active ) {
   769 					<?php
   515 												if ( $is_pro_isset ) {
   770 					if ( ! ( isset( $_REQUEST['bwsmn_form_submit'] ) || isset( $_REQUEST['bwsmn_form_submit_custom_email'] ) ) || '' !== $error ) {
   516 													if ( ! $is_pro_installed ) {
   771 						echo 'style="display:none"';}
   517 														if ( ! empty( $plugins_array ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
   772 					?>
   518                                                             <form method="post" action="">
   773 					><p><strong><?php echo esc_html( $message ); ?></strong></p></div>
   519                                                                 <input type="submit" class="button button-secondary" value="<?php _e( 'Get Pro', 'bestwebsoft' ); ?>" />
   774 					<div class="error" 
   520                                                                 <input type="hidden" name="bws_plugin_action_submit" value="submit" />
   775 					<?php
   521                                                                 <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
   776 					if ( '' === $error ) {
   522 																<?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
   777 						echo 'style="display:none"';}
   523                                                             </form>
   778 					?>
   524 														<?php } else { ?>
   779 					><p><strong><?php echo esc_html( $error ); ?></strong></p></div>
   525                                                             <a class="button button-secondary bws_upgrade_button" href="<?php echo esc_url( $bws_plugins[ $key_plugin ]['purchase'] ); ?>" target="_blank"><?php _e( 'Upgrade to Pro', 'bestwebsoft' ); ?></a>
   780 					<form method="post" action="">
   526 														<?php }
   781 						<p>
   527 													}
   782 							<input type="hidden" name="bwsmn_form_submit" value="submit" />
   528 												} else { ?>
   783 							<input type="submit" class="button-primary" value="<?php esc_html_e( 'Send to support', 'bestwebsoft' ); ?>" />
   529                                                     <a class="bws_donate" href="https://bestwebsoft.com/donate/" target="_blank"><?php _e( 'Donate', 'bestwebsoft' ); ?></a> <span>|</span>
   784 							<?php wp_nonce_field( plugin_basename( __FILE__ ), 'bwsmn_nonce_submit' ); ?>
   530 												<?php }
   785 						</p>
   531 
   786 					</form>
   532 												if ( $is_pro_active ) { ?>
   787 					<form method="post" action="">
   533                                                     <a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]["pro_settings"] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a>
   788 						<p>
   534 												<?php } else { ?>
   789 							<input type="hidden" name="bwsmn_form_submit_custom_email" value="submit" />
   535                                                     <a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]["settings"] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a>
   790 							<input type="submit" class="button" value="<?php esc_html_e( 'Send to custom email &#187;', 'bestwebsoft' ); ?>" />
   536 												<?php }
   791 							<input type="text" maxlength="250" value="" name="bwsmn_form_email" />
   537 											} else {
   792 							<?php wp_nonce_field( plugin_basename( __FILE__ ), 'bwsmn_nonce_submit_custom_email' ); ?>
   538 												if ( $is_pro_installed ) { ?>
   793 						</p>
   539                                                     <a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $value_plugin['pro_version'] ), 'bws_activate_plugin' . $value_plugin['pro_version'] ) ); ?>" title="<?php _e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php _e( 'Activate', 'bestwebsoft' ); ?></a>
   794 					</form>
   540 												<?php } elseif ( ! empty( $plugins_array ) && isset( $value_plugin['pro_version'] ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
   795 					<?php foreach ( $system_info as $info ) { ?>
   541                                                     <form method="post" action="">
   796 						<table class="widefat bws-system-info" cellspacing="0">
   542                                                         <input type="submit" class="button button-secondary" value="<?php _e( 'Get Pro', 'bestwebsoft' ); ?>" />
   797 							<thead>
   543                                                         <input type="hidden" name="bws_plugin_action_submit" value="submit" />
   798 							<tr>
   544                                                         <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
   799 								<th colspan="2">
   545 														<?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
   800 									<strong>
   546                                                     </form>
   801 										<?php
   547 												<?php } elseif ( $is_installed ) { ?>
   802 										echo esc_html( $info['name'] );
   548                                                     <a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $key_plugin ), 'bws_activate_plugin' . $key_plugin ) ); ?>" title="<?php _e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php _e( 'Activate', 'bestwebsoft' ); ?></a>
   803 										if ( isset( $info['count'] ) ) {
   549 												<?php } else {
   804 											echo ' (' . intval( $info['count'] ) . ')';
   550 													$install_url = isset( $value_plugin['install_url'] ) ? $value_plugin['install_url'] : network_admin_url( 'plugin-install.php?tab=search&type=term&s=' . str_replace( array( ' ', '-' ), '+', str_replace( '&', '', $value_plugin['name'] ) ) . '+BestWebSoft&plugin-search-input=Search+Plugins' ); ?>
   805 										}
   551                                                     <a class="button button-secondary" href="<?php echo esc_url( $install_url ); ?>" title="<?php _e( 'Install this plugin', 'bestwebsoft' ); ?>" target="_blank"><?php _e( 'Install Now', 'bestwebsoft' ); ?></a>
   806 										?>
   552 												<?php }
   807 									</strong>
   553 											} ?>
   808 								</th>
   554                                         </div>
   809 							</tr>
   555                                     </div>
   810 							</thead>
   556                                     <div class="clear"></div>
   811 							<tbody>
   557                                 </div>
   812 							<?php foreach ( $info['data'] as $key => $value ) { ?>
   558 							<?php }
   813 								<tr>
   559 							if ( $nothing_found ) { ?>
   814 									<td scope="row"><?php echo esc_attr( $key ); ?></td>
   560                                 <p class="description"><?php _e( 'Nothing found. Try another criteria.', 'bestwebsoft' ); ?></p>
   815 									<td scope="row"><?php echo esc_html( $value ); ?></td>
       
   816 								</tr>
   561 							<?php } ?>
   817 							<?php } ?>
   562                         </div>
   818 							</tbody>
   563                         <div id="bws-filter-wrapper">
   819 						</table>
   564                             <div class="bws-filter">
   820 						<?php
   565                                 <div class="bws-filter-title"><?php _e( 'Category', 'bestwebsoft' ); ?></div>
   821 					}
   566                                 <ul class="bws-category">
   822 				}
   567                                     <li>
   823 				?>
   568 										<?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( $_GET['sub'], array( 'installed', 'not_installed' ) ) ) ? '&sub=' . $_GET['sub'] : ''; ?>
   824 			</div>
   569                                         <a <?php if ( 'all' == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?>
   825 		</div>
   570                                             <span>(<?php echo count( $bws_plugins ); ?>)</span>
   826 		<?php
   571                                         </a>
   827 	}
   572                                     </li>
       
   573 									<?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
       
   574                                         <li>
       
   575                                             <a <?php if ( $category_key == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo $category_value['name']; ?>
       
   576                                                 <span>(<?php echo $category_value['count']; ?>)</span>
       
   577                                             </a>
       
   578                                         </li>
       
   579 									<?php } ?>
       
   580                                 </ul>
       
   581                             </div>
       
   582                         </div><!-- #bws-filter-wrapper -->
       
   583                         <div class="clear"></div>
       
   584 					<?php }
       
   585 				} elseif ( 'bws_themes' == $page || 'themes' == $tab ) {
       
   586 					require( dirname( __FILE__ ) . '/product_list.php' ); ?>
       
   587                     <h1><?php _e( 'Themes', 'bestwebsoft' ); ?></h1>
       
   588                     <div id="availablethemes" class="bws-availablethemes">
       
   589                         <div class="theme-browser content-filterable rendered">
       
   590                             <div class="themes wp-clearfix">
       
   591 								<?php foreach ( $themes as $key => $theme ) {
       
   592 									$installed_theme = wp_get_theme( $theme->slug ); ?>
       
   593                                     <div class="theme" tabindex="0">
       
   594                                         <div class="theme-screenshot">
       
   595                                             <img src="<?php echo bws_menu_url( "icons/themes/" ) . $theme->slug . '.png'; ?>" alt="" />
       
   596                                         </div>
       
   597                                         <div class="theme-author"><?php printf( __( 'By %s', 'bestwebsoft' ), 'BestWebSoft' ); ?></div>
       
   598                                         <h3 class="theme-name"><?php echo $theme->name; ?></h3>
       
   599                                         <div class="theme-actions">
       
   600                                             <a class="button button-secondary preview install-theme-preview" href="<?php echo esc_url( $theme->href ); ?>" target="_blank"><?php _e( 'Learn More', 'bestwebsoft' ); ?></a>
       
   601                                         </div>
       
   602 										<?php if ( $installed_theme->exists() ) {
       
   603 											if ( $wp_version < '4.6' ) { ?>
       
   604                                                 <div class="theme-installed"><?php _e( 'Already Installed', 'bestwebsoft' ); ?></div>
       
   605 											<?php } else { ?>
       
   606                                                 <div class="notice notice-success notice-alt inline"><p><?php _e( 'Installed', 'bestwebsoft' ); ?></p></div>
       
   607 											<?php }
       
   608 										} ?>
       
   609                                     </div>
       
   610 								<?php } ?>
       
   611                                 <br class="clear" />
       
   612                             </div>
       
   613                         </div>
       
   614                         <p><a class="bws_browse_link" href="https://bestwebsoft.com/products/wordpress/themes/" target="_blank"><?php _e( 'Browse More WordPress Themes', 'bestwebsoft' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a></p>
       
   615                     </div>
       
   616 				<?php } elseif ( 'bws_system_status' == $page || 'system-status' == $tab ) { ?>
       
   617                     <h1><?php _e( 'System status', 'bestwebsoft' ); ?></h1>
       
   618                     <div class="updated fade notice is-dismissible inline" <?php if ( ! ( isset( $_REQUEST['bwsmn_form_submit'] ) || isset( $_REQUEST['bwsmn_form_submit_custom_email'] ) ) || $error != "" ) echo 'style="display:none"'; ?>><p><strong><?php echo $message; ?></strong></p></div>
       
   619                     <div class="error" <?php if ( "" == $error ) echo 'style="display:none"'; ?>><p><strong><?php echo $error; ?></strong></p></div>
       
   620                     <form method="post" action="">
       
   621                         <p>
       
   622                             <input type="hidden" name="bwsmn_form_submit" value="submit" />
       
   623                             <input type="submit" class="button-primary" value="<?php _e( 'Send to support', 'bestwebsoft' ) ?>" />
       
   624 							<?php wp_nonce_field( plugin_basename(__FILE__), 'bwsmn_nonce_submit' ); ?>
       
   625                         </p>
       
   626                     </form>
       
   627                     <form method="post" action="">
       
   628                         <p>
       
   629                             <input type="hidden" name="bwsmn_form_submit_custom_email" value="submit" />
       
   630                             <input type="submit" class="button" value="<?php _e( 'Send to custom email &#187;', 'bestwebsoft' ) ?>" />
       
   631                             <input type="text" maxlength="250" value="" name="bwsmn_form_email" />
       
   632 							<?php wp_nonce_field( plugin_basename(__FILE__), 'bwsmn_nonce_submit_custom_email' ); ?>
       
   633                         </p>
       
   634                     </form>
       
   635 					<?php foreach ( $system_info as $info ) { ?>
       
   636                         <table class="widefat bws-system-info" cellspacing="0">
       
   637                             <thead>
       
   638                             <tr>
       
   639                                 <th colspan="2">
       
   640                                     <strong>
       
   641 										<?php echo $info['name'];
       
   642 										if ( isset( $info['count'] ) )
       
   643 											echo ' (' . $info['count'] . ')'; ?>
       
   644                                     </strong>
       
   645                                 </th>
       
   646                             </tr>
       
   647                             </thead>
       
   648                             <tbody>
       
   649 							<?php foreach ( $info['data'] as $key => $value ) { ?>
       
   650                                 <tr>
       
   651                                     <td scope="row"><?php echo $key; ?></td>
       
   652                                     <td scope="row"><?php echo $value; ?></td>
       
   653                                 </tr>
       
   654 							<?php } ?>
       
   655                             </tbody>
       
   656                         </table>
       
   657 					<?php }
       
   658 				} ?>
       
   659             </div>
       
   660         </div>
       
   661 	<?php }
       
   662 }
   828 }
   663 
   829 
   664 if ( ! function_exists( 'bws_get_banner_array' ) ) {
   830 if ( ! function_exists( 'bws_get_banner_array' ) ) {
   665 	function bws_get_banner_array() {
   831 	function bws_get_banner_array() {
   666 		global $bstwbsftwppdtplgns_banner_array;
   832 		global $bstwbsftwppdtplgns_banner_array;
   698 			array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ),
   864 			array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ),
   699 			array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ),
   865 			array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ),
   700 			array( 'cptch_hide_banner_on_plugin_page', 'captcha-bws/captcha-bws.php', '3.8.4' ),
   866 			array( 'cptch_hide_banner_on_plugin_page', 'captcha-bws/captcha-bws.php', '3.8.4' ),
   701 			array( 'gllr_hide_banner_on_plugin_page', 'gallery-plugin/gallery-plugin.php', '3.9.1' ),
   867 			array( 'gllr_hide_banner_on_plugin_page', 'gallery-plugin/gallery-plugin.php', '3.9.1' ),
   702 			array( 'cntctfrm_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.62' ),
   868 			array( 'cntctfrm_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.62' ),
   703             array( 'bwscrrntl_hide_banner_on_plugin_page', 'bws-car-rental/bws-car-rental.php', '0.0.1' ),
   869 			array( 'bwscrrntl_hide_banner_on_plugin_page', 'bws-car-rental/bws-car-rental.php', '0.0.1' ),
   704 			array( 'rtng_hide_banner_on_plugin_page', 'rating-bws/rating-bws.php', '1.0.0' ),
   870 			array( 'rtng_hide_banner_on_plugin_page', 'rating-bws/rating-bws.php', '1.0.0' ),
   705 			array( 'prflxtrflds_hide_banner_on_plugin_page', 'profile-extra-fields/profile-extra-fields.php', '1.1.3' ),
   871 			array( 'prflxtrflds_hide_banner_on_plugin_page', 'profile-extra-fields/profile-extra-fields.php', '1.1.3' ),
   706 			array( 'psttcsv_hide_banner_on_plugin_page', 'post-to-csv/post-to-csv.php', '1.3.4' ),
   872 			array( 'psttcsv_hide_banner_on_plugin_page', 'post-to-csv/post-to-csv.php', '1.3.4' ),
   707 			array( 'cstmdmnpg_hide_banner_on_plugin_page', 'custom-admin-page/custom-admin-page.php', '1.0.0' )
   873 			array( 'cstmdmnpg_hide_banner_on_plugin_page', 'custom-admin-page/custom-admin-page.php', '1.0.0' ),
   708 		);
   874 		);
   709 	}
   875 	}
   710 }
   876 }