public function vtprd_pro_version_verify() { global $vtprd_license_options; //EDIT only if PRO plugin installed or active if (defined('VTPRD_PRO_VERSION')) { $carry_on = true; } else { $pro_plugin_is_installed = vtprd_check_pro_plugin_installed(); if ($pro_plugin_is_installed !== false) { $vtprd_license_options['pro_version'] = $pro_plugin_is_installed; } else { //PRO is not installed, nothing to do! return; } } //error_log( print_r( 'vtprd_pro_version_verify 001' , true ) ); //PICK up any defined values from active PRO. If inactive, the license_options value will have previously-loaded values //if ((defined('VTPRD_PRO_DIRNAME')) ) { //changed to PRO_VERSION because PRO_DIRNAME is now controlled in THIS file if (defined('VTPRD_PRO_VERSION')) { //error_log( print_r( 'vtprd_pro_version_verify 002' , true ) ); if ($vtprd_license_options['pro_version'] == VTPRD_PRO_VERSION && $vtprd_license_options['pro_minimum_free_version'] == VTPRD_PRO_MINIMUM_REQUIRED_FREE_VERSION) { //error_log( print_r( 'vtprd_pro_version_verify 003' , true ) ); $carry_on = true; //v1.1.6.6 } else { //error_log( print_r( 'vtprd_pro_version_verify 005' , true ) ); $vtprd_license_options['pro_version'] = VTPRD_PRO_VERSION; $vtprd_license_options['pro_minimum_free_version'] = VTPRD_PRO_MINIMUM_REQUIRED_FREE_VERSION; //update_option('vtprd_license_options', $vtprd_license_options); } } if ($vtprd_license_options['pro_version'] > '') { //error_log( print_r( 'vtprd_pro_version_verify 006' , true ) ); if (version_compare($vtprd_license_options['pro_version'], VTPRD_MINIMUM_PRO_VERSION) < 0) { //'<0' = 1st value is lower //error_log( print_r( 'vtprd_pro_version_verify 007' , true ) ); $vtprd_license_options['pro_plugin_version_status'] = 'Pro Version Error'; //$vtprd_license_options['state'] = 'pending'; //v1.1.6.3 changed from PRO deactivation to status change //$vtprd_license_options['status'] = 'invalid'; //v1.1.6.3 changed from PRO deactivation to status change } else { //error_log( print_r( 'vtprd_pro_version_verify 008' , true ) ); $vtprd_license_options['pro_plugin_version_status'] = 'valid'; } if ($vtprd_license_options['pro_plugin_version_status'] == 'valid') { //error_log( print_r( 'vtprd_pro_version_verify 009' , true ) ); if (version_compare(VTPRD_VERSION, $vtprd_license_options['pro_minimum_free_version']) < 0) { //'<0' = 1st value is lower //error_log( print_r( 'vtprd_pro_version_verify 010' , true ) ); $vtprd_license_options['pro_plugin_version_status'] = 'Free Version Error'; //$vtprd_license_options['state'] = 'pending'; //v1.1.6.3 changed from PRO deactivation to status change //$vtprd_license_options['status'] = 'invalid'; //v1.1.6.3 changed from PRO deactivation to status change } else { //error_log( print_r( 'vtprd_pro_version_verify 011' , true ) ); $vtprd_license_options['pro_plugin_version_status'] = 'valid'; } } //error_log( print_r( 'vtprd_pro_version_verify 012' , true ) ); update_option('vtprd_license_options', $vtprd_license_options); } //error_log( print_r( 'vtprd_pro_version_verify 013' , true ) ); return; }
/** * Renders a simple page to display for the menu item added above. */ function vtprd_license_options_cntl() { //v1.1.6.3 begin // From a URL anywhere in the site // looks for 'action=force_plugin_updates_check', // which executes a function which clears the TS and transfers to 'update-core.php' $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; if ($action == 'force_plugin_updates_check') { vtprd_force_plugin_updates_check(); } //v1.1.6.3 end //add help tab to this screen... //$vtprd_backbone->vtprd_add_help_tab (); $content = '<br><a href="' . VTPRD_DOCUMENTATION_PATH . '" title="Access Plugin Documentation">Access Plugin Documentation</a>'; $screen = get_current_screen(); $screen->add_help_tab(array('id' => 'vtprd-help-options', 'title' => 'Pricing Deals Settings Help', 'content' => $content)); global $vtprd_license_options; if (!$vtprd_license_options) { $vtprd_license_options = get_option('vtprd_license_options'); } //*********************************************** //*********************************************** //IF SUSPENDED //*********************************************** /* NOW DONE IN MAIN PLUGIN FILE if ($vtprd_license_options['state'] == 'suspended-by-vendor') { vtprd_deactivate_pro_plugin(); add_action( 'admin_notices', 'vtprd_license_error_notice' ); } */ //*********************************************** //*********************************************** ?> <style type="text/css"> #system-buttons {margin-top:0;} #system-info-textarea { width: 800px; height: 400px; font-family: Menlo,Monaco,monospace; background: 0 0; white-space: pre; overflow: auto; display: block; } .green { color: green; font-size: 18px; } .red { color: red; font-size: 14px; background-color: rgb(255, 235, 232) !important; margin: 5px 0 15px; border: 1px solid red; border-left: 4px solid red; box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); padding: 10px 12px 20px 12px; } .yellow { color: black; font-size: 14px; margin: 5px 0 15px; border: 4px solid yellow; border-left: 4px solid yellow; box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); padding: 10px 12px 20px 12px; background-color: RGB(255, 255, 180) !important; } .smallGreyText { color: gray; font-size: 12px; } .sub-label { color: grey; font-size: 11px !important; } .grey { color: grey; font-size: 11px !important; } .black { color: black; font-size: 11px !important; } .hidden-button { color:rgb(241, 241, 241) !important; margin-left: 50px; } .hidden-button:hover { color:white; } #reset-button .system-buttons-h4 { color:#F1F1F1; /*matches background*/ } #reset-button .system-buttons-h4:hover { color:#gray; } #reset-button .nuke_buttons, #reset-button input{ color:#F1F1F1; /*matches background*/ box-sizing: none; border: none; float: right; margin-right:200px; } #reset-button .nuke_buttons:hover, #reset-button input :hover { color:red; box-sizing: border-box; border: 1px solid black; } #show-info-button {margin-left:20px; padding:10px; text-decoration::none; border:1px solid gray; cursor: pointer; cursor: hand; font-weight:bold; font-size:16px;} #show-info-button:hover {color:red;} #show-licensing-info {display:none} #license-status-msg a {padding:5px; border:1px solid gray;} </style> <script type="text/javascript"> jQuery(document).ready(function($) { //**************************** // Show Discount Where //**************************** //first time in screen_init_Control(); //on CHANGE $("#radio-prod").click(function(){ //use 'change' rather than 'click' $(".production_url_for_test").hide("slow"); }); $("#radio-demo").click(function(){ //use 'change' rather than 'click' $(".production_url_for_test").hide("slow"); }); $("#radio-test").click(function(){ //use 'change' rather than 'click' $(".production_url_for_test").show("slow"); }); $("#show-info-button").click(function(){ $("#show-licensing-info").show("slow"); }); function screen_init_Control() { if($('#radio-prod').is(':checked')){ //use 'change' rather than 'click' $(".production_url_for_test").hide(); }; if($('#radio-demo').is(':checked')){ //use 'change' rather than 'click' $(".production_url_for_test").hide(); }; if($('#radio-test').is(':checked')){ //use 'change' rather than 'click' $(".production_url_for_test").show("slow"); }; $("#show-licensing-info").hide(); }; }); </script> <div class="wrap"> <div id="icon-themes" class="icon32"></div> <h2> <?php esc_attr_e('Pricing Deals Pro License Registration', 'vtprd'); ?> </h2> <?php if ($vtprd_license_options['prod_or_test'] == 'demo') { $item_name = VTPRD_ITEM_NAME . ' Demo'; } else { $item_name = VTPRD_ITEM_NAME; } if ($vtprd_license_options['expires'] > ' ') { if ($vtprd_license_options['expires'] == 'lifetime') { if ($vtprd_license_options['prod_or_test'] == 'demo') { ?> <p id="license-expiry-msg"><?php echo $item_name; ?> - 3-Day License </p> <?php } else { ?> <p id="license-expiry-msg"><?php echo $item_name; ?> - Lifetime License </p> <?php } } else { ?> <h2 id="license-expiry-msg" style="font-size: 1.5em;"><em><?php echo $item_name; ?> - License Expires:: <?php echo $vtprd_license_options['expires']; ?> </em> </h2> <?php } } /* else { if ( ($vtprd_license_options['status'] == 'valid') && ($vtprd_license_options['state'] == 'active') ) { //Lifetime license message from above } } */ ?> <?php settings_errors(); //shows errors entered with "add_settings_error" //valid status ONLY allows active or deactivated vtprd_maybe_license_state_message(); /*if ( isset( $_GET['settings-updated'] ) ) { echo "<div class='updated'><p>Theme settings updated successfully.</p></div>"; } */ ?> <form method="post" action="options.php"> <?php //WP functions to execute the registered settings! settings_fields('vtprd_license_options_group'); //activates the field settings setup below do_settings_sections('vtprd_license_options_page'); //activates the section settings setup below /* 3 buttons Activate Deactivate Save Licensing Report as TXT file ==>> straight to text file... */ // ********************************************************** // STATUS: valid / invalid / unregistered (default) // STATE: active (only if valid) / deactivated (only if valid) / pending (error but not yet suspended) / suspended-by-vendor / unregistered (default) // ********************************************************** ?> <p id="system-buttons"> <?php //v1.1.6 begin if refactored //valid status ONLY allows active or deactivated //VTPRD_PRO_VERSION only exists if PRO version is installed and active if (defined('VTPRD_PRO_VERSION')) { //if PRO is ACTIVE if ($vtprd_license_options['status'] == 'valid') { switch ($vtprd_license_options['state']) { case 'active': $this->vtprd_show_deactivate_button(); break; case 'deactivated': $this->vtprd_show_activate_button(); break; default: //can't be any other state!! break; } } else { //'invalid' OR 'unregistered' path ==>> can't have a state of active or deactivated switch ($vtprd_license_options['state']) { case 'unregistered': $this->vtprd_show_activate_button(); break; case 'pending': switch ($vtprd_license_options['last_action']) { case 'activate_license': case 'check_license': case ' ': case '': $this->vtprd_show_activate_button(); break; case 'deactivate_license': $this->vtprd_show_deactivate_button(); break; } break; case 'suspended-by-vendor': //carry on, no activate/deactivate showing break; default: //show suspended-by-vendor message break; } } } else { //PRO not currently ACTIVE if ($vtprd_license_options['state'] != 'suspended-by-vendor') { //suspended is handled elsewhere... $pro_plugin_is_installed = vtprd_check_pro_plugin_installed(); if ($pro_plugin_is_installed) { // $url = bloginfo('url'); v1.1.6 does crazy stuff in wp-admin!! ?> <br><br><br> <h3 class="red"> <strong> <?php _e(' - Activate the <em>', 'vtprd'); echo $item_name; _e('</em> on the <a href="' . $vtprd_license_options['home_url'] . '/wp-admin/plugins.php">Plugins page</a> - to show a Registration Button here.', 'vtprd'); ?> </strong> </h3> <?php } else { //PRO not currently installed ?> <br><br><br> <h3 class="yellow"> <?php _e(' - Install and Activate the <em>', 'vtprd'); echo $item_name; _e('</em> to show a Registration Button here.', 'vtprd'); ?> </h3> <?php } } } //v1.1.6 end $this->vtprd_show_clear_button(); ?> <br><br> <h3 class="title"><?php esc_attr_e('System Information', 'vtprd'); ?> </h3> <br><br><br> <h4 class="system-buttons-h4"><?php esc_attr_e('Show Licensing Info', 'vtprd'); ?> </h4> <br> <a id="show-info-button" href="javascript:void(0);" > <span> <?php esc_attr_e('Show Licensing Info', 'vtprd'); ?> </span></a> <br><br> <div id="show-licensing-info"> <p>To copy the system info, click below then press Ctrl + C (or Cmd + C for a Mac).</p> <?php if ($vtprd_license_options['prod_or_test'] == 'demo') { $item_name = VTPRD_ITEM_NAME . ' Demo'; } else { $item_name = VTPRD_ITEM_NAME; } if ($vtprd_license_options['updater_action_reduced_frequency']) { $updater_action_reduced_frequency = 'yes'; } else { $updater_action_reduced_frequency = 'no'; } $return = '### Begin Licensing Info ###' . "\n\n"; $return .= 'Home URL: ' . $vtprd_license_options['url'] . "\n"; $return .= 'Plugin Name: ' . $item_name . "\n"; $return .= 'Status: ' . $vtprd_license_options['status'] . "\n"; $return .= 'State: ' . $vtprd_license_options['state'] . "\n"; $return .= 'Message: ' . $vtprd_license_options['msg'] . "\n"; $return .= 'Key: ' . $vtprd_license_options['key'] . "\n"; $return .= 'Email: ' . $vtprd_license_options['email'] . "\n"; $return .= 'Activation Type: ' . $vtprd_license_options['prod_or_test'] . "\n"; $return .= 'Prod Site URL (if test): ' . $vtprd_license_options['prod_url_supplied_for_test_site'] . "\n"; $return .= 'Strikes: ' . $vtprd_license_options['strikes'] . "\n"; $return .= 'Last Action: ' . $vtprd_license_options['last_action'] . "\n"; $return .= 'Last good attempt: ' . $vtprd_license_options['last_successful_rego_date_time'] . "\n"; $return .= 'Last failed attempt: ' . $vtprd_license_options['last_failed_rego_date_time'] . "\n"; $return .= 'Expires: ' . $vtprd_license_options['expires'] . "\n"; $return .= 'Plugin Item ID: ' . VTPRD_ITEM_ID . "\n"; $return .= 'Plugin Item ID Demo: ' . VTPRD_ITEM_ID_DEMO . "\n"; $return .= 'Registering To: ' . VTPRD_STORE_URL . "\n"; $return .= 'Diagnostic Message: ' . $vtprd_license_options['diagnostic_msg'] . "\n"; $return .= 'Pro Current Version: ' . $vtprd_license_options['plugin_current_version'] . "\n"; //used by plugin updater only $return .= 'Pro New Version: ' . $vtprd_license_options['plugin_new_version'] . "\n"; $return .= 'Pro Version: ' . $vtprd_license_options['pro_version'] . "\n"; $return .= 'Pro Required Version: ' . VTPRD_MINIMUM_PRO_VERSION . "\n"; $return .= 'Pro Version Status: ' . $vtprd_license_options['pro_plugin_version_status'] . "\n"; $return .= 'Free Current Version: ' . VTPRD_VERSION . "\n"; $return .= 'Free Required Version: ' . $vtprd_license_options['pro_minimum_free_version'] . "\n"; $count = get_option('vtprd_license_count'); $return .= 'License Count: ' . $count . "\n"; $return .= 'Pro Deactivate Flag: ' . $vtprd_license_options['pro_deactivate'] . "\n"; // $return .= 'Updater Reduced Frequency:' . ' ' . $updater_action_reduced_frequency . "\n"; $last_check = get_option('vtprd_last_license_check_ts'); $last_check_formatted = is_numeric($last_check) ? date('Y-m-d H:i:s', $last_check) : $last_check; $return .= 'Last Check_License TS: ' . $last_check_formatted . "\n"; $return .= 'Home URL (for anchors): ' . $vtprd_license_options['home_url'] . "\n"; //v1.1.6.1 $return .= 'Rego Done Flag: ' . $vtprd_license_options['rego_done'] . "\n"; //v1.1.6.1 $return .= "\n \n \n"; $return .= 'Last Response from Host: <pre>' . print_r($vtprd_license_options['last_response_from_host'], true) . '</pre>' . "\n"; $return .= "\n \n \n"; $return .= 'Last Parameters sent to Host: <pre>' . print_r($vtprd_license_options['params_sent_to_host'], true) . '</pre>' . "\n"; ?> <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="edd-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo $return; ?> </textarea> <?php global $vtprd_license_options; //test if ( ($vtprd_setup_options['allow_license_info_reset'] == 'yes') && // ($vtprd_license_options['state'] == 'suspended-by-vendor') ) { ?> <span id="reset-button"> <h4 class="system-buttons-h4"><?php esc_attr_e('Reset Licensing Fatal Counter', 'vtprd'); ?> </h4> <input id="nuke-info-button" name="vtprd_license_options[reset_fatal_counter]" type="submit" class="buttons button-third" value="<?php esc_attr_e('Reset Licensing Fatal Counter', 'vtprd'); ?> " /> </span> <?php //test } ?> </div><!-- /#show-licensing-info --> </p> </form> </div><!-- /.wrap --> <?php }