%s %s.",
$plugin_info['Name'],
__( 'requires', 'bestwebsoft' ),
$require_wp,
__( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'bestwebsoft' ),
__( 'Back to the WordPress', 'bestwebsoft' ),
$admin_url,
__( 'Plugins page', 'bestwebsoft' )
)
);
}
} elseif ( version_compare( $wp_version, $require_wp, "<" ) ) {
$bws_versions_notice_array[] = array( 'name' => $plugin_info['Name'], 'version' => $require_wp );
}
}
}
if ( ! function_exists( 'bws_admin_notices' ) ) {
function bws_admin_notices() {
global $bws_versions_notice_array, $bws_plugin_banner_to_settings;
/* versions notice */
if ( ! empty( $bws_versions_notice_array ) ) {
foreach ( $bws_versions_notice_array as $key => $value ) { ?>
%s %s WordPress %s %s",
$value['name'],
__( 'requires', 'bestwebsoft' ),
$value['version'],
__( 'or higher! We do not guarantee that our plugin will work correctly. Please upgrade to WordPress latest version.', 'bestwebsoft' )
);
?>
( 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();
}
/* download Pro */
if ( ! function_exists( 'get_plugins' ) )
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$all_plugins = get_plugins();
if ( ! array_key_exists( $bws_license_plugin, $all_plugins ) ) {
$current = get_site_transient( 'update_plugins' );
if ( is_array( $all_plugins ) && !empty( $all_plugins ) && isset( $current ) && is_array( $current->response ) ) {
$to_send = array();
$to_send["plugins"][ $bws_license_plugin ] = array();
$to_send["plugins"][ $bws_license_plugin ]["bws_license_key"] = $bws_license_key;
$to_send["plugins"][ $bws_license_plugin ]["bws_illegal_client"] = true;
$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 ) ) {
$result['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 ) {
$result['error'] = __( "Wrong license key", 'bestwebsoft' );
} elseif ( "wrong_domain" == $value->package ) {
$result['error'] = __( "This license key is bind to another site", 'bestwebsoft' );
} elseif ( "you_are_banned" == $value->package ) {
$result['error'] = __( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'bestwebsoft' );
} elseif ( "time_out" == $value->package ) {
$result['error'] = __( "Unfortunately, Your license has expired. To continue getting top-priority support and plugin updates you should extend it in your", 'bestwebsoft' ) . ' Client area';
} elseif ( "duplicate_domen_for_trial" == $value->package ) {
$result['error'] = __( "Unfortunately, the Pro licence was already installed to this domain. The Pro Trial license can be installed only once.", 'bestwebsoft' );
}
}
if ( empty( $result['error'] ) ) {
$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
$url = 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/downloads/?bws_first_download=' . $bws_license_plugin . '&bws_license_key=' . $bws_license_key . '&download_from=5';
$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 );
$received_content = curl_exec( $ch );
curl_close( $ch );
}
if ( ! $received_content ) {
$result['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 ) );
if ( class_exists( 'ZipArchive' ) ) {
$zip = new ZipArchive();
if ( $zip->open( $file_put_contents ) === TRUE ) {
$zip->extractTo( WP_PLUGIN_DIR );
$zip->close();
} else {
$result['error'] = __( "Failed to open the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
}
} elseif ( class_exists( 'Phar' ) ) {
$phar = new PharData( $file_put_contents );
$phar->extractTo( WP_PLUGIN_DIR );
} else {
$result['error'] = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually", 'bestwebsoft' );
}
@unlink( $file_put_contents );
} else {
$result['error'] = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
}
} else {
$result['error'] = __( "UploadDir is not writable. Please, upload the plugin manually", 'bestwebsoft' );
}
}
/* activate Pro */
if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) {
if ( is_multisite() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
/* if multisite and free plugin is network activated */
$active_plugins = get_site_option( 'active_sitewide_plugins' );
$active_plugins[ $bws_license_plugin ] = time();
update_site_option( 'active_sitewide_plugins', $active_plugins );
} else {
/* activate on a single blog */
$active_plugins = get_option( 'active_plugins' );
array_push( $active_plugins, $bws_license_plugin );
update_option( 'active_plugins', $active_plugins );
}
$result['pro_plugin_is_activated'] = true;
} elseif ( empty( $result['error'] ) ) {
$result['error'] = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
}
}
} else {
$result['error'] = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.", 'bestwebsoft' );
}
}
}
} else {
$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
/* activate Pro */
if ( ! is_plugin_active( $bws_license_plugin ) ) {
if ( is_multisite() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
/* if multisite and free plugin is network activated */
$network_wide = true;
} else {
/* activate on a single blog */
$network_wide = false;
}
activate_plugin( $bws_license_plugin, NULL, $network_wide );
$result['pro_plugin_is_activated'] = true;
}
}
if ( is_multisite() )
update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
else
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
}
} else {
$result['error'] = __( "Please, enter Your license key", 'bestwebsoft' );
}
}
return $result;
}
}
/**
* Function display GO PRO tab - for old plugin version
* @deprecated 1.7.6
*/
if ( ! function_exists( 'bws_go_pro_tab' ) ) {
function bws_go_pro_tab( $plugin_info, $plugin_basename, $page, $pro_page, $bws_license_plugin, $link_slug, $link_key, $link_pn, $pro_plugin_is_activated = false, $trial_days_number = false ) {
bws_go_pro_tab_show( false, $plugin_info, $plugin_basename, $page, $pro_page, $bws_license_plugin, $link_slug, $link_key, $link_pn, $pro_plugin_is_activated, $trial_days_number );
}
}
/**
* Function display GO PRO tab
*/
if ( ! function_exists( 'bws_go_pro_tab_show' ) ) {
function bws_go_pro_tab_show( $bws_hide_premium_options_check, $plugin_info, $plugin_basename, $page, $pro_page, $bws_license_plugin, $link_slug, $link_key, $link_pn, $pro_plugin_is_activated = false, $trial_days_number = false ) {
global $wp_version, $bstwbsftwppdtplgns_options;
$bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? stripslashes( esc_html( trim( $_POST['bws_license_key'] ) ) ) : "";
if ( $pro_plugin_is_activated ) { ?>
()
()
response ) ) {
$to_send = array();
$to_send["plugins"][ $plugin_basename ] = $plugins_all[ $plugin_basename ];
$to_send["plugins"][ $plugin_basename ]["bws_license_key"] = $license_key;
$to_send["plugins"][ $plugin_basename ]["bws_illegal_client"] = true;
$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 ) ) {
$result['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 ) {
$result['error'] = __( 'Wrong license key.', 'bestwebsoft' );
} else if ( "wrong_domain" == $value->package ) {
$result['error'] = __( 'This license key is bind to another site.', 'bestwebsoft' );
} else if ( "time_out" == $value->package ) {
$result['message'] = __( 'This license key is valid, but Your license has expired. If you want to update our plugin in future, you should extend the license.', 'bestwebsoft' );
} elseif ( "you_are_banned" == $value->package ) {
$result['error'] = __( "Unfortunately, you have exceeded the number of available tries.", 'bestwebsoft' );
} elseif ( "duplicate_domen_for_trial" == $value->package ) {
$result['error'] = __( "Unfortunately, the Pro Trial licence was already installed to this domain. The Pro Trial license can be installed only once.", 'bestwebsoft' );
}
if ( empty( $result['message'] ) && empty( $result['error'] ) ) {
if ( isset( $value->trial ) )
$result['message'] = __( 'The Pro Trial license key is valid.', 'bestwebsoft' );
else
$result['message'] = __( 'The license key is valid.', 'bestwebsoft' );
if ( isset( $value->time_out ) && $value->time_out != '' )
$result['message'] .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $value->time_out . '.';
if ( isset( $value->trial ) && $trial_plugin != false )
$result['message'] .= ' ' . sprintf( __( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), 'Pro' );
if ( isset( $value->trial ) ) {
$bstwbsftwppdtplgns_options['trial'][ $plugin_basename ] = 1;
} else {
unset( $bstwbsftwppdtplgns_options['trial'][ $plugin_basename ] );
}
}
if ( empty( $result['error'] ) ) {
if ( $bstwbsftwppdtplgns_options[ $plugin_basename ] != $license_key ) {
$bstwbsftwppdtplgns_options[ $plugin_basename ] = $license_key;
$bstwbsftwppdtplgns_options['time_out'][ $plugin_basename ] = $value->time_out;
if ( is_multisite() )
update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
else
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
$file = @fopen( dirname( dirname( __FILE__ ) ) . "/license_key.txt" , "w+" );
if ( $file ) {
@fwrite( $file, $license_key );
@fclose( $file );
}
}
}
}
} else {
$result['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 {
$result['error'] = __( 'Please, enter your license key', 'bestwebsoft' );
}
}
return $result;
}
}
if ( ! function_exists ( 'bws_check_pro_license_form' ) ) {
function bws_check_pro_license_form( $plugin_basename ) {
global $bstwbsftwppdtplgns_options;
$license_key = ( isset( $bstwbsftwppdtplgns_options[ $plugin_basename ] ) ) ? $bstwbsftwppdtplgns_options[ $plugin_basename ] : ''; ?>
' . __( 'WARNING: Illegal use notification', 'bestwebsoft' ) . '. ' . __( 'You can use one license of the Pro plugin for one domain only. Please check and edit your license or domain if necessary using you personal Client Area. We strongly recommend you to solve the problem within 24 hours, otherwise the Pro plugin will be deactivated.', 'bestwebsoft' ) . ' ' . __( 'Learn More', 'bestwebsoft' ) . '
';
if ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) && $link_slug != false ) {
echo __( 'Notice: Your Pro Trial license has expired. To continue using the plugin you should buy a Pro license', 'bestwebsoft' ) . ' - http://bestwebsoft.com/products/' . $link_slug . '/';
} else {
echo __( 'Your license has expired. To continue getting top-priority support and plugin updates you should extend it.', 'bestwebsoft' ) . ' ' . __( "Learn more", 'bestwebsoft' ) . '';
}
echo '
';
if ( $free_plugin_name != false ) {
echo sprintf( __( 'Notice: You are using the Pro Trial license of %s plugin.', 'bestwebsoft' ), $free_plugin_name );
} else {
_e( 'Notice: You are using the Pro Trial license of plugin.', 'bestwebsoft' );
}
if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) )
echo ' ' . __( "The Pro Trial license will expire on", 'bestwebsoft' ) . ' ' . $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] . '.';
echo '