$value_plugin ) { foreach ( $value_plugin['category'] as $category_key ) { $bws_plugins_category[ $category_key ]['count'] = isset( $bws_plugins_category[ $category_key ]['count'] ) ? $bws_plugins_category[ $category_key ]['count'] + 1 : 1; } $is_installed = array_key_exists( $key_plugin, $all_plugins ); $is_pro_installed = false; if ( isset( $value_plugin['pro_version'] ) ) { $is_pro_installed = array_key_exists( $value_plugin['pro_version'], $all_plugins ); } /* check update_availible */ if ( ! empty( $update_availible_all ) && ! empty( $update_availible_all->response ) ) { if ( $is_pro_installed && array_key_exists( $value_plugin['pro_version'], $update_availible_all->response ) ) { unset( $bws_plugins[ $key_plugin ] ); $value_plugin['update_availible'] = $value_plugin['pro_version']; $bws_plugins_update_availible[ $key_plugin ] = $value_plugin; } else if ( $is_installed && array_key_exists( $key_plugin, $update_availible_all->response ) ) { unset( $bws_plugins[ $key_plugin ] ); $value_plugin['update_availible'] = $key_plugin; $bws_plugins_update_availible[ $key_plugin ] = $value_plugin; } } /* check expired */ if ( $is_pro_installed && isset( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) && strtotime( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) < strtotime( date( "m/d/Y" ) ) ) { unset( $bws_plugins[ $key_plugin ] ); $value_plugin['expired'] = $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ]; $bws_plugins_expired[ $key_plugin ] = $value_plugin; } } $bws_plugins = $bws_plugins_update_availible + $bws_plugins_expired + $bws_plugins; } else { foreach ( $bws_plugins as $key_plugin => $value_plugin ) { foreach ( $value_plugin['category'] as $category_key ) { $bws_plugins_category[ $category_key ]['count'] = isset( $bws_plugins_category[ $category_key ]['count'] ) ? $bws_plugins_category[ $category_key ]['count'] + 1 : 1; } } } /*** membership ***/ $bws_license_plugin = 'bws_get_list_for_membership'; $bws_license_key = isset( $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) ? $bstwbsftwppdtplgns_options[ $bws_license_plugin ] : ''; $update_membership_list = true; if ( isset( $_POST['bws_license_key'] ) ) $bws_license_key = sanitize_text_field( $_POST['bws_license_key'] ); if ( isset( $_SESSION['bws_membership_time_check'] ) && isset( $_SESSION['bws_membership_list'] ) && $_SESSION['bws_membership_time_check'] < strtotime( '+12 hours' ) ) { $update_membership_list = false; $plugins_array = $_SESSION['bws_membership_list']; } if ( ( $update_membership_list && ! empty( $bws_license_key ) ) || ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( plugin_basename(__FILE__), 'bws_license_nonce_name' ) ) ) { if ( '' != $bws_license_key ) { if ( strlen( $bws_license_key ) != 18 ) { $error = __( 'Wrong license key', 'bestwebsoft' ); } else { if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - (24 * 60 * 60) ) ) { $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1; } else { $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1; $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time(); } /* get Pro list */ $to_send = array(); $to_send["plugins"][ $bws_license_plugin ] = array(); $to_send["plugins"][ $bws_license_plugin ]["bws_license_key"] = $bws_license_key; $options = array( 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ), 'body' => array( 'plugins' => serialize( $to_send ) ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ); $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/update-check/1.0/', $options ); if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) { $error = __( "Something went wrong. Please try again later. If the error appears again, please contact us", 'bestwebsoft' ) . ' BestWebSoft. ' . __( "We are sorry for inconvenience.", 'bestwebsoft' ); } else { $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) ); if ( is_array( $response ) && !empty( $response ) ) { foreach ( $response as $key => $value ) { if ( "wrong_license_key" == $value->package ) { $error = __( "Wrong license key.", 'bestwebsoft' ); } elseif ( "wrong_domain" == $value->package ) { $error = __( 'This license key is bound to another site. Change it via personal Client Area.', 'bestwebsoft' ) . '' . __( 'Log in', 'bestwebsoft' ) . ''; } elseif ( "you_are_banned" == $value->package ) { $error = __( "Unfortunately, you have exceeded the number of available tries per day.", 'bestwebsoft' ); } elseif ( "time_out" == $value->package ) { $error = sprintf( __( "Unfortunately, Your license has expired. To continue getting top-priority support and plugin updates, you should extend it in your %s", 'bestwebsoft' ), ' Client Area' ); } elseif ( "duplicate_domen_for_trial" == $value->package ) { $error = __( "Unfortunately, the Pro licence was already installed to this domain. The Pro Trial license can be installed only once.", 'bestwebsoft' ); } elseif ( is_array( $value->package ) && ! empty( $value->package ) ) { $plugins_array = $_SESSION['bws_membership_list'] = $value->package; $_SESSION['bws_membership_time_check'] = strtotime( 'now' ); if ( isset( $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) && $bws_license_key == $bstwbsftwppdtplgns_options[ $bws_license_plugin ] ) { $message = __( 'The license key is valid.', 'bestwebsoft' ); if ( isset( $value->time_out ) && $value->time_out != '' ) $message .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $value->time_out . '.'; } else { $message = __( 'Congratulations! Pro Membership license is activated successfully.', 'bestwebsoft' ); } $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key; } } } else { $error = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.", 'bestwebsoft' ); } } if ( is_multisite() ) update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); else update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); } } else { $error = __( "Please enter your license key.", 'bestwebsoft' ); } } } elseif ( 'bws_system_status' == $page || 'system-status' == $tab ) { $all_plugins = get_plugins(); $active_plugins = get_option( 'active_plugins' ); $mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" ); if ( is_array( $mysql_info ) ) $sql_mode = $mysql_info[0]->Value; if ( empty( $sql_mode ) ) $sql_mode = __( 'Not set', 'bestwebsoft' ); $allow_url_fopen = ( ini_get( 'allow_url_fopen' ) ) ? __( 'On', 'bestwebsoft' ) : __( 'Off', 'bestwebsoft' ); $upload_max_filesize = ( ini_get( 'upload_max_filesize' ) )? ini_get( 'upload_max_filesize' ) : __( 'N/A', 'bestwebsoft' ); $post_max_size = ( ini_get( 'post_max_size' ) ) ? ini_get( 'post_max_size' ) : __( 'N/A', 'bestwebsoft' ); $max_execution_time = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : __( 'N/A', 'bestwebsoft' ); $memory_limit = ( ini_get( 'memory_limit' ) ) ? ini_get( 'memory_limit' ) : __( 'N/A', 'bestwebsoft' ); $wp_memory_limit = ( defined( 'WP_MEMORY_LIMIT' ) ) ? WP_MEMORY_LIMIT : __( 'N/A', 'bestwebsoft' ); $memory_usage = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . __( ' Mb', 'bestwebsoft' ) : __( 'N/A', 'bestwebsoft' ); $exif_read_data = ( is_callable( 'exif_read_data' ) ) ? __( 'Yes', 'bestwebsoft' ) . " ( V" . substr( phpversion( 'exif' ), 0,4 ) . ")" : __( 'No', 'bestwebsoft' ); $iptcparse = ( is_callable( 'iptcparse' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' ); $xml_parser_create = ( is_callable( 'xml_parser_create' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' ); $theme = ( function_exists( 'wp_get_theme' ) ) ? wp_get_theme() : get_theme( get_current_theme() ); if ( function_exists( 'is_multisite' ) ) { $multisite = is_multisite() ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' ); } else { $multisite = __( 'N/A', 'bestwebsoft' ); } $system_info = array( 'wp_environment' => array( 'name' => __( 'WordPress Environment', 'bestwebsoft' ), 'data' => array( __( 'Home URL', 'bestwebsoft' ) => home_url(), __( 'Website URL', 'bestwebsoft' ) => get_option( 'siteurl' ), __( 'WP Version', 'bestwebsoft' ) => $wp_version, __( 'WP Multisite', 'bestwebsoft' ) => $multisite, __( 'WP Memory Limit', 'bestwebsoft' ) => $wp_memory_limit, __( 'Active Theme', 'bestwebsoft' ) => $theme['Name'] . ' ' . $theme['Version'] . ' (' . sprintf( __( 'by %s', 'bestwebsoft' ), $theme['Author'] ) . ')' ), ), 'server_environment' => array( 'name' => __( 'Server Environment', 'bestwebsoft' ), 'data' => array( __( 'Operating System', 'bestwebsoft' ) => PHP_OS, __( 'Server', 'bestwebsoft' ) => $_SERVER["SERVER_SOFTWARE"], __( 'PHP Version', 'bestwebsoft' ) => PHP_VERSION, __( 'PHP Allow URL fopen', 'bestwebsoft' ) => $allow_url_fopen, __( 'PHP Memory Limit', 'bestwebsoft' ) => $memory_limit, __( 'Memory Usage', 'bestwebsoft' ) => $memory_usage, __( 'PHP Max Upload Size', 'bestwebsoft' ) => $upload_max_filesize, __( 'PHP Max Post Size', 'bestwebsoft' ) => $post_max_size, __( 'PHP Max Script Execute Time', 'bestwebsoft' ) => $max_execution_time, __( 'PHP Exif support', 'bestwebsoft' ) => $exif_read_data, __( 'PHP IPTC support', 'bestwebsoft' ) => $iptcparse, __( 'PHP XML support', 'bestwebsoft' ) => $xml_parser_create, '$_SERVER[HTTP_HOST]' => $_SERVER['HTTP_HOST'], '$_SERVER[SERVER_NAME]' => $_SERVER['SERVER_NAME'], ), ), 'db' => array( 'name' => __( 'Database', 'bestwebsoft' ), 'data' => array( __( 'WP DB version', 'bestwebsoft' ) => get_option( 'db_version' ), __( 'MySQL version', 'bestwebsoft' ) => $wpdb->get_var( "SELECT VERSION() AS version" ), __( 'SQL Mode', 'bestwebsoft' ) => $sql_mode, ), ), 'active_plugins' => array( 'name' => __( 'Active Plugins', 'bestwebsoft' ), 'data' => array(), 'count' => 0 ), 'inactive_plugins' => array( 'name' => __( 'Inactive Plugins', 'bestwebsoft' ), 'data' => array(), 'count' => 0 ) ); foreach ( $all_plugins as $path => $plugin ) { $name = str_replace( 'by BestWebSoft', '', $plugin['Name'] ); if ( is_plugin_active( $path ) ) { $system_info['active_plugins']['data'][ $name ] = sprintf( __( 'by %s', 'bestwebsoft' ), $plugin['Author'] ) . ' - ' . $plugin['Version']; $system_info['active_plugins']['count'] = $system_info['active_plugins']['count'] + 1; } else { $system_info['inactive_plugins']['data'][ $name ] = sprintf( __( 'by %s', 'bestwebsoft' ), $plugin['Author'] ) . ' - ' . $plugin['Version']; $system_info['inactive_plugins']['count'] = $system_info['inactive_plugins']['count'] + 1; } } 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' ) ) ) { if ( isset( $_REQUEST['bwsmn_form_email'] ) ) { $email = sanitize_email( $_REQUEST['bwsmn_form_email'] ); if ( '' == $email ) { $error = __( 'Please enter a valid email address.', 'bestwebsoft' ); } else { $message = sprintf( __( 'Email with system info is sent to %s.', 'bestwebsoft' ), $email ); } } else { $email = 'plugin_system_status@bestwebsoft.com'; $message = __( 'Thank you for contacting us.', 'bestwebsoft' ); } if ( $error == '' ) { $headers = 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\n"; $headers .= 'From: ' . get_option( 'admin_email' ); $message_text = 'System Info From ' . home_url() . ''; foreach ( $system_info as $info ) { if ( ! empty( $info['data'] ) ) { $message_text .= '

' . $info['name']; if ( isset( $info['count'] ) ) $message_text .= ' (' . $info['count'] . ')'; $message_text .= '

'; foreach ( $info['data'] as $key => $value ) { $message_text .= ''; } $message_text .= '
' . $key . '' . $value . '
'; } } $message_text .= ''; $result = wp_mail( $email, 'System Info From ' . home_url(), $message_text, $headers ); if ( $result != true ) $error = __( "Sorry, email message could not be delivered.", 'bestwebsoft' ); } } } ?>
•••
( time() - ( 24 * 60 * 60 ) ) ) { ?>
type="text" placeholder="" maxlength="100" name="bws_license_key" value="" />
>
>

unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ), $_GET['charsout'] ); else $errmsg = __( 'Plugin could not be activated because it triggered a fatal error.' ); ?>

activated.' ) ?>

' . __( 'Installing Plugin', 'bestwebsoft' ) . ': ' . $plugins_array[ $bws_license_plugin ]['name'] . ''; $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key; $url = $plugins_array[ $bws_license_plugin ]['link'] . '&download_from=5'; echo '

' . __( "Downloading install package from", 'bestwebsoft' ) . ' ' . $url . '

'; $uploadDir = wp_upload_dir(); $zip_name = explode( '/', $bws_license_plugin ); if ( !function_exists( 'curl_init' ) ) { $received_content = file_get_contents( $url ); } else { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); $received_content = curl_exec( $ch ); curl_close( $ch ); } if ( ! $received_content ) { $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' ); } else { if ( is_writable( $uploadDir["path"] ) ) { $file_put_contents = $uploadDir["path"] . "/" . $zip_name[0] . ".zip"; if ( file_put_contents( $file_put_contents, $received_content ) ) { @chmod( $file_put_contents, octdec( 755 ) ); echo '

' . __( 'Unpacking the package', 'bestwebsoft' ) . '...

'; if ( class_exists( 'ZipArchive' ) ) { $zip = new ZipArchive(); if ( $zip->open( $file_put_contents ) === TRUE ) { echo '

' . __( 'Installing the plugin', 'bestwebsoft' ) . '...

'; $zip->extractTo( WP_PLUGIN_DIR ); $zip->close(); } else { $error = __( "Failed to open the zip archive. Please, upload the plugin manually", 'bestwebsoft' ); } } elseif ( class_exists( 'Phar' ) ) { $phar = new PharData( $file_put_contents ); echo '

' . __( 'Installing the plugin', 'bestwebsoft' ) . '...

'; $phar->extractTo( WP_PLUGIN_DIR ); } else { $error = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually", 'bestwebsoft' ); } if ( empty( $error ) ) echo '

' . sprintf( __( 'The plugin %s is successfully installed.', 'bestwebsoft' ), '' . $plugins_array[ $bws_license_plugin ]['name'] . '' ) . '

'; @unlink( $file_put_contents ); } else { $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' ); } } else { $error = __( "UploadDir is not writable. Please, upload the plugin manually", 'bestwebsoft' ); } } if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) { echo '

' . __( 'Activate Plugin', 'bestwebsoft' ) . ' | ' . __( 'Return to BestWebSoft Panel', 'bestwebsoft' ) . '

'; } else { if ( empty( $error ) ) $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' ); echo '

' . $error . '

'; echo '

' . __( 'Return to BestWebSoft Panel', 'bestwebsoft' ) . '

'; } } else { $category_href = $current_page; if ( 'all' != $plugin_category ) $category_href .= '&category=' . $plugin_category; ?>

$value_plugin ) { if ( 'all' != $plugin_category && isset( $bws_plugins_category[ $plugin_category ] ) && ! in_array( $plugin_category, $value_plugin['category'] ) ) continue; $key_plugin_explode = explode( '/', $key_plugin ); $icon = isset( $value_plugin['icon'] ) ? $value_plugin['icon'] : '//ps.w.org/' . $key_plugin_explode[0] . '/assets/icon-128x128.png'; $is_pro_isset = isset( $value_plugin['pro_version'] ); $is_installed = array_key_exists( $key_plugin, $all_plugins ); $is_active = in_array( $key_plugin, $active_plugins ) || isset( $sitewide_active_plugins[ $key_plugin ] ); $is_pro_installed = $is_pro_active = false; if ( $is_pro_isset ) { $is_pro_installed = array_key_exists( $value_plugin['pro_version'], $all_plugins ); $is_pro_active = in_array( $value_plugin['pro_version'], $active_plugins ) || isset( $sitewide_active_plugins[ $value_plugin['pro_version'] ] ); } if ( ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] && ! $is_pro_installed && ! $is_installed ) || ( isset( $_GET['sub'] ) && 'not_installed' == $_GET['sub'] && ( $is_pro_installed || $is_installed ) ) ) continue; $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"'; $nothing_found = false; ?>
>
v ' . $all_plugins[ $value_plugin['pro_version'] ]['Version'] . ''; } elseif ( $is_installed ) { echo 'v ' . $all_plugins[ $key_plugin ]['Version'] . ''; } else { echo '' . __( 'Not installed', 'bestwebsoft' ) . ''; } if ( ! empty( $value_plugin['expired'] ) ) { echo ' - ' . __( 'Renew to get updates', 'bestwebsoft' ) . ''; } elseif ( ! empty( $value_plugin['update_availible'] ) ) { $r = $update_availible_all->response[ $value_plugin['update_availible'] ]; echo ' - ' . sprintf( __( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . ''; } ?>
100 ) ? mb_substr( $value_plugin['description'], 0, 100 ) . '...' : $value_plugin['description']; ?>

$theme ) { $installed_theme = wp_get_theme( $theme->slug ); ?>
slug . '.png'; ?>" alt="" />

name; ?>

exists() ) { if ( $wp_version < '4.6' ) { ?>


>

>

$value ) { ?>