Пример #1
0
 function discount_api_template($template)
 {
     global $wp_query;
     global $wpdb;
     $token = get_option('retargeting_token');
     if (isset($wp_query->query['retargeting']) && $wp_query->query['retargeting'] == 'discounts') {
         if (isset($wp_query->query['key']) && isset($wp_query->query['value']) && isset($wp_query->query['type']) && isset($wp_query->query['count'])) {
             if ($wp_query->query['key'] != "" && $wp_query->query['key'] == $token && $wp_query->query['value'] != "" && $wp_query->query['type'] != "" && $wp_query->query['count'] != "") {
                 if (!in_array($wp_query->query['type'], array(0, 1, 2))) {
                     echo json_encode(array("status" => false, "error" => "0003: Invalid Type!"));
                     exit;
                 }
                 echo generate_coupons($wp_query->query['count']);
                 exit;
             } else {
                 echo json_encode(array("status" => false, "error" => "0002: Invalid Parameters!"));
                 exit;
             }
         } else {
             echo json_encode(array("status" => false, "error" => "0001: Missing Parameters!"));
             exit;
         }
     }
 }
 function discount_api_template($template)
 {
     global $wp_query;
     if (isset($wp_query->query['retargeting']) && $wp_query->query['retargeting'] == 'discounts') {
         if (isset($wp_query->query['key']) && isset($wp_query->query['value']) && isset($wp_query->query['type']) && isset($wp_query->query['count'])) {
             if ($wp_query->query['key'] != "" && $wp_query->query['key'] == $this->token && $wp_query->query['value'] != "" && $wp_query->query['type'] != "" && $wp_query->query['count'] != "") {
                 //daca totul este ok, genereaza si afiseaza codurile de reducere
                 echo generate_coupons($wp_query->query['count']);
                 exit;
             } else {
                 echo json_encode(array("status" => false, "error" => "0002: Invalid Parameters!"));
                 exit;
             }
         } else {
             echo json_encode(array("status" => false, "error" => "0001: Missing Parameters!"));
             exit;
         }
     }
 }
Пример #3
0
}
////////////////////////////// MAIN ///////////////////////////////////
$vars = get_input_vars();
extract($vars, EXTR_OVERWRITE);
$start = intval($vars['start']);
$count = 20;
switch (@$vars['action']) {
    case '':
        display_batches_list();
        break;
    case 'generate_form':
        display_generate_form();
        break;
    case 'generate':
        if (validate_generate_form()) {
            generate_coupons();
        }
        break;
    case 'view_batch':
        view_batch();
        break;
    case 'edit_batch':
        edit_batch();
        break;
    case 'save_batch':
        save_batch();
        break;
    case 'delete_batch':
        delete_batch();
        break;
    case 'view_coupon':