Plugin Directory

Changeset 1109255


Ignore:
Timestamp:
03/10/2015 07:00:58 AM (11 years ago)
Author:
znaeff
Message:

Added renew message with button

Location:
cleantalk-spam-protect/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cleantalk-spam-protect/trunk/cleantalk-admin.php

    r1103993 r1109255  
    2626 */
    2727function ct_admin_init() {
    28     global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_showtime, $ct_plugin_name, $ct_options, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $ct_account_status_check;
     28    global $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $ct_account_status_check;
    2929
    3030    $ct_options = ct_get_options();
     
    3636        }
    3737    }
    38 
     38    $show_ct_notice_renew = false;
     39    if (isset($_COOKIE[$ct_notice_renew_label])) {
     40        if ($_COOKIE[$ct_notice_renew_label] == 1) {
     41            $show_ct_notice_renew = true;
     42        }
     43    }
     44///$aaa = strtotime("+24 minutes", time());
    3945    if (time() > $ct_options['next_account_status_check']) {
     46//    if (TRUE) {
    4047        $result = false;
    4148        if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
    42             $url = 'https://cleantalk.org/app_notice';
     49            $url = 'https://api.cleantalk.org';
    4350            $server_timeout = 2;
    4451            $data['auth_key'] = $ct_options['apikey'];
    45             $data['param'] = 'notice_paid_till';
     52            $data['method_name'] = 'notice_paid_till';
    4653
    4754            $ch = curl_init();
     
    6269            curl_close($ch);
    6370           
    64             $notice_check_timeout = $trial_notice_check_timeout;
    6571            if ($result) {
    6672                $result = json_decode($result, true);
     73                $result = $result['data']; // !!!!
     74//$result['show_notice'] = 1;
     75//$result['renew'] = 1;
     76
    6777                if (isset($result['show_notice'])) {
    6878                    if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
     79                        $notice_check_timeout = $trial_notice_check_timeout;
    6980                        $show_ct_notice_trial = true;
     81                    }
     82                    if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1) {
     83                        $notice_check_timeout = $account_notice_check_timeout;
     84                        $show_ct_notice_renew = true;
    7085                    }
    7186                   
     
    8196           
    8297            // Save next status request time
    83             $ct_options['next_account_status_check'] = strtotime("+$notice_check_timeout hours", time());
     98//            $ct_options['next_account_status_check'] = strtotime("+$notice_check_timeout hours", time());
     99            $ct_options['next_account_status_check'] = strtotime("+$notice_check_timeout minutes", time()); // MINUTES for debug
    84100            $ct_account_status_check = time();
    85101            update_option('cleantalk_settings', $ct_options);
     
    87103       
    88104        if ($result) {
    89             setcookie($ct_notice_trial_label, (string) $show_ct_notice_trial, strtotime("+$trial_notice_showtime minutes"), '/');
     105        if($show_ct_notice_trial == true){
     106            setcookie($ct_notice_trial_label, (string) $show_ct_notice_trial, strtotime("+$trial_notice_showtime minutes"), '/');
     107        }
     108        if($show_ct_notice_renew == true){
     109            setcookie($ct_notice_renew_label, (string) $show_ct_notice_renew, strtotime("+$renew_notice_showtime minutes"), '/');
     110        }
    90111        }
    91112    }
     
    263284 */
    264285function admin_notice_message(){
    265     global $show_ct_notice_trial, $show_ct_notice_online, $ct_plugin_name, $ct_options;
     286    global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $ct_plugin_name, $ct_options;
    266287
    267288    $user_token = '';
     
    278299    if ($show_notice && $show_ct_notice_trial) {
    279300        echo '<div class="updated"><h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a>", "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
     301        $show_notice = false;
     302    }
     303
     304    if ($show_notice && $show_ct_notice_renew) {
     305    $button_html = "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\">" . '<input type="button" class="button button-primary" value="RENEW ANTI-SPAM"  />' . "</a>";
     306        echo '<div class="updated"><h3>' . sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\"><b>next year</b></a>") . '<br /><br />' . $button_html . '</h3></div>';
    280307        $show_notice = false;
    281308    }
     
    453480    }
    454481
    455 
    456482    // Skip test call if the function executet during account status check
    457483    if ($ct_account_status_check > 0 && time() - $ct_account_status_check < 5) {
  • cleantalk-spam-protect/trunk/cleantalk-common.php

    r1104242 r1109255  
    11<?php
    22
    3 $ct_agent_version = 'wordpress-420';
     3$ct_agent_version = 'wordpress-421';
    44$ct_plugin_name = 'Anti-spam by CleanTalk';
    55$ct_checkjs_frm = 'ct_checkjs_frm';
     
    3636$show_ct_notice_trial = false;
    3737
     38// COOKIE label for renew notice flag
     39$ct_notice_renew_label = 'ct_notice_renew';
     40
     41// Flag to show renew notice
     42$show_ct_notice_renew = false;
     43
    3844// COOKIE label for online notice flag
    3945$ct_notice_online_label = 'ct_notice_online';
     
    5056// Trial notice show time in minutes
    5157$trial_notice_showtime = 10;
     58
     59// Renew notice show time in minutes
     60//$renew_notice_showtime = 10;
     61$renew_notice_showtime = 2;
    5262
    5363// COOKIE label for WP Landing Page proccessing result
Note: See TracChangeset for help on using the changeset viewer.