Plugin Directory

Changeset 3241497


Ignore:
Timestamp:
02/16/2025 07:18:31 PM (6 weeks ago)
Author:
deetronix
Message:

Ver1.8

Location:
affiliate-coupons
Files:
683 added
8 edited

Legend:

Unmodified
Added
Removed
  • affiliate-coupons/trunk/affiliate-coupons.php

    r3180777 r3241497  
    44 * Plugin URI:      https://affcoups.com
    55 * Description:     The best WordPress coupon plugin which helps you to earn more affiliate money!
    6  * Version:         1.7.3
     6 * Version:         1.8
    77 * Author:          Affiliate Coupons
    88 * Author URI:      https://affcoups.com
     
    5151         * @var    string
    5252         */
    53         private $version = '1.7.3';
     53        private $version = '1.7.4';
    5454
    5555        /**
  • affiliate-coupons/trunk/includes/class-coupon.php

    r3150875 r3241497  
    527527        function get_code() {
    528528
    529             $code = get_post_meta( $this->id, AFFCOUPS_PREFIX . 'coupon_code', true );
    530 
    531             return ( ! empty ( $code ) ) ? $code : null;
    532         }
    533 
     529            $enable_multi_coupon_code = get_post_meta( $this->id, AFFCOUPS_PREFIX . 'enable_multi_coupon_code', true );
     530       
     531            if($enable_multi_coupon_code && affcoups_is_pro_version()){
     532                $file_id = get_post_meta( $this->id, AFFCOUPS_PREFIX . 'multi_coupon_code', true );
     533                if(empty($file_id))
     534                return;
     535                // Now process the CSV file: read, remove the first row, and save it
     536                $file_path = get_attached_file($file_id);
     537                // Check if the session is already set
     538                // Start the session to track the user
     539                if (session_status() == PHP_SESSION_NONE) {
     540                    // Start the session if it hasn't been started yet
     541                    session_start();
     542                }
     543               
     544
     545                // Check if the session ID exists, if not, create a new one
     546                if (!isset($_SESSION['session_id'])) {
     547                    $_SESSION['session_id'] = session_id();
     548                    }
     549
     550                // Open the CSV file
     551                if (($handle = fopen($file_path, 'r+')) !== FALSE) {
     552                    $rows = [];
     553                    $first_row = null;
     554
     555                    // Read the CSV content
     556                    while (($data = fgetcsv($handle)) !== FALSE) {
     557
     558                        // Capture the first row
     559                        if (!$first_row) {
     560                            $first_row = $data;
     561                            $code=$first_row[0];
     562
     563
     564                        } else {
     565                            $rows[] = $data;
     566                           
     567                        }
     568                    }
     569       
     570                    // Close the CSV file
     571                    fclose($handle);
     572            if (!isset($_SESSION['first_row_deleted']) || $_SESSION['first_row_deleted'] !== true) {
     573                    // Reopen the file for writing (truncate)
     574                    if (($handle = fopen($file_path, 'w')) !== FALSE) {
     575                        // Write the modified data (excluding the first row)
     576                        foreach ($rows as $row) {
     577                            fputcsv($handle, $row);
     578                        }
     579                        // Close the file after writing
     580                        fclose($handle);
     581                        $_SESSION['first_row_deleted'] = true;
     582                    }
     583                }
     584
     585            }
     586
     587           
     588            }else {
     589
     590                $code = get_post_meta( $this->id, AFFCOUPS_PREFIX . 'coupon_code', true );
     591            }
     592            return ( ! empty ( $code ) ) ? $code : NULL;
     593
     594        }
     595
     596
     597        // since 1.3.4 , one time coupon code display , multiple coupon codes
     598
     599       
    534600        /**
    535601         * Show  coupon code
  • affiliate-coupons/trunk/includes/coupon-metaboxes.php

    r2953480 r3241497  
    5454            'placeholder' => esc_html__( 'e.g. SUMMERTIME50OFF', 'affiliate-coupons' ),
    5555        ),
     56       
     57        array(
     58            'name'        => esc_html__( '  ', 'affiliate-coupons' ),
     59            'id'          => AFFCOUPS_PREFIX . 'enable_multi_coupon_code',
     60            'type' => 'checkbox',
     61            'desc' => esc_html__( 'Activate multicode coupon option', 'affiliate-coupons-pro' ),
     62            'std'  => 0,
     63        ),
     64
    5665        array(
    5766            'name'       => esc_html__( 'Valid from', 'affiliate-coupons' ),
     
    122131
    123132    $fields = apply_filters( 'affcoups_coupon_meta_box_details_fields', $fields );
     133    $fields = apply_filters( 'affcoups_coupon_meta_box_details_fields_multi_coupon_code',$fields);
     134
    124135
    125136    $meta_boxes[] = array(
     
    149160}
    150161add_filter( 'rwmb_meta_boxes', 'affcoups_register_coupon_meta_boxes' );
     162
     163
     164/**
     165 * Extend meta box "Multi coupon code " fields
     166 *
     167 * @param $fields
     168 * @return array
     169 */
     170
     171 function affcoups_pro_coupon_meta_box_details_fields_multi_coupon_code($fields) {
     172
     173    if(affcoups_is_pro_version()){
     174    $new_field = array(
     175         'name'        => esc_html__( 'Multi Discount Code', 'affiliate-coupons' ),
     176         'id'          => AFFCOUPS_PREFIX . 'multi_coupon_code',
     177         'type'        => 'file',
     178         'max_file_uploads' => 1,
     179    );
     180    }else{
     181    $new_field = array(
     182        'name'        => esc_html__( 'Multi Discount Codes', 'affiliate-coupons' ),
     183        'id'          => AFFCOUPS_PREFIX . 'multi_coupon_codes',
     184        'type'          => 'custom_html',
     185        'std'  =>   '<p class="affcoups-pro-feature">
     186        <span class="affcoups-pro-feature__badge">Pro Feature</span>
     187           <span class="affcoups-pro-feature__text">
     188               <strong> multicode coupon option </strong>
     189               is available in
     190               <a href= "https://affcoups.com/" target="_blank" rel="nofollow">Affiliate Coupons (PRO)</a>
     191           </span>
     192       </p>',
     193   );
     194}
     195    array_splice( $fields, 4, 0, [$new_field] ); // splice in at position 4
     196 
     197    return $fields;
     198 
     199 
     200 }
     201 
     202 add_filter( 'affcoups_coupon_meta_box_details_fields_multi_coupon_code', 'affcoups_pro_coupon_meta_box_details_fields_multi_coupon_code', 10 );
     203 
  • affiliate-coupons/trunk/includes/shortcodes.php

    r2953480 r3241497  
    177177            // Collect template settings
    178178            $template = ( ! empty( $template ) ) ? esc_html( $template ) : $template_default;
     179            $template=sanitize_file_name($template);
    179180            $grid_size = $grid_size_default;
    180181            $style = ( ! empty( $style ) ) ? esc_html( $style ) : $style_default;
  • affiliate-coupons/trunk/includes/template-functions.php

    r3180777 r3241497  
    192192 * @param Affcoups_Coupon $coupon
    193193 */
    194 function affcoups_tpl_the_coupon_code( $coupon ) {
     194function affcoups_tpl_the_coupon_code( $coupon,$show_code=false ) {
    195195   // $coupon_meta=get_post_meta($Coupon->post->ID);
    196196   // if ($coupon_meta['affcoups_click_to_reveal_disable'][0] )
    197197   // return $button_html;
    198    if ( !affcoups_is_pro_version() ){?>
     198   if ( !affcoups_is_pro_version() | $show_code){?>
    199199   <div class="affcoups-coupon__code">
    200200   <?php $coupon->the_code(); ?>
  • affiliate-coupons/trunk/readme.txt

    r3180777 r3241497  
    66Requires PHP: 5.6.0
    77Tested up to: 6.6.2
    8 Stable tag: 1.7.3
     8Stable tag: 1.7.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    108108
    109109== Changelog ==
     110
     111= Version 1.7.4 (16 Feb 2025 =
     112* fix : security vulnerability patched
     113* Tweak : added code to support pro feature
     114* Plugin tested upto WordPress v6.7.1
     115
    110116= Version 1.7.3 (03 Nov 2024) =
    111117* fix : warning undefined array key vendor_logo fixed 
  • affiliate-coupons/trunk/templates/list.php

    r3150875 r3241497  
    2020}
    2121
     22
     23
    2224do_action( 'affcoups_template_begin', $coupons, $args ); ?>
    2325
     
    2931
    3032            <div class="<?php $coupon->the_classes('affcoups-coupon' ); ?>"<?php $coupon->the_container(); ?>>
    31 
    32                 <?php affcoups_tpl_the_coupon_discount( $coupon ); ?>
    33 
     33            <div class="affcoups-vendor__logo_list"> <?php affcoups_tpl_the_vendor_logo( $coupon);  ?> </div>
     34           <?php
     35          //  <div style="position: absolute;  z-index:25; font-size: 34px;  width:100px; text-align:center; line-height:1;border:2px solid red;  font: size 5px;  white-space: pre-wrap;"> <?php  //echo $coupon->get_discount(); </div>
     36            ?>
    3437                <div class="affcoups-coupon__header">
    3538                    <?php affcoups_tpl_the_coupon_image( $coupon ); ?>
    3639                    <?php affcoups_tpl_the_coupon_types( $coupon ); ?>
    37                     <div class="affcoups-vendor__logo_list"> <?php affcoups_tpl_the_vendor_logo( $coupon);  ?> </div>
    3840                </div>
    3941
  • affiliate-coupons/trunk/templates/standard.php

    r3144879 r3241497  
    2929
    3030            <div class="<?php $coupon->the_classes('affcoups-coupon' ); ?>"<?php $coupon->the_container(); ?>>
     31            <div class="affcoups-vendor__logo_standard"> <?php affcoups_tpl_the_vendor_logo( $coupon);  ?> </div>
     32
    3133
    3234                <div class="affcoups-coupon__header">
     35
    3336                   
    34                 <div class="affcoups-vendor__logo_standard"> <?php affcoups_tpl_the_vendor_logo( $coupon);  ?> </div>
    3537                <?php affcoups_tpl_the_coupon_image( $coupon ); ?>
    3638                    <?php affcoups_tpl_the_coupon_discount( $coupon ); ?>
     39                   
    3740                </div>
    3841
Note: See TracChangeset for help on using the changeset viewer.