Changeset 3241497
- Timestamp:
- 02/16/2025 07:18:31 PM (6 weeks ago)
- Location:
- affiliate-coupons
- Files:
-
- 683 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
affiliate-coupons/trunk/affiliate-coupons.php
r3180777 r3241497 4 4 * Plugin URI: https://affcoups.com 5 5 * Description: The best WordPress coupon plugin which helps you to earn more affiliate money! 6 * Version: 1. 7.36 * Version: 1.8 7 7 * Author: Affiliate Coupons 8 8 * Author URI: https://affcoups.com … … 51 51 * @var string 52 52 */ 53 private $version = '1.7. 3';53 private $version = '1.7.4'; 54 54 55 55 /** -
affiliate-coupons/trunk/includes/class-coupon.php
r3150875 r3241497 527 527 function get_code() { 528 528 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 534 600 /** 535 601 * Show coupon code -
affiliate-coupons/trunk/includes/coupon-metaboxes.php
r2953480 r3241497 54 54 'placeholder' => esc_html__( 'e.g. SUMMERTIME50OFF', 'affiliate-coupons' ), 55 55 ), 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 56 65 array( 57 66 'name' => esc_html__( 'Valid from', 'affiliate-coupons' ), … … 122 131 123 132 $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 124 135 125 136 $meta_boxes[] = array( … … 149 160 } 150 161 add_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 177 177 // Collect template settings 178 178 $template = ( ! empty( $template ) ) ? esc_html( $template ) : $template_default; 179 $template=sanitize_file_name($template); 179 180 $grid_size = $grid_size_default; 180 181 $style = ( ! empty( $style ) ) ? esc_html( $style ) : $style_default; -
affiliate-coupons/trunk/includes/template-functions.php
r3180777 r3241497 192 192 * @param Affcoups_Coupon $coupon 193 193 */ 194 function affcoups_tpl_the_coupon_code( $coupon ) {194 function affcoups_tpl_the_coupon_code( $coupon,$show_code=false ) { 195 195 // $coupon_meta=get_post_meta($Coupon->post->ID); 196 196 // if ($coupon_meta['affcoups_click_to_reveal_disable'][0] ) 197 197 // return $button_html; 198 if ( !affcoups_is_pro_version() ){?>198 if ( !affcoups_is_pro_version() | $show_code){?> 199 199 <div class="affcoups-coupon__code"> 200 200 <?php $coupon->the_code(); ?> -
affiliate-coupons/trunk/readme.txt
r3180777 r3241497 6 6 Requires PHP: 5.6.0 7 7 Tested up to: 6.6.2 8 Stable tag: 1.7. 38 Stable tag: 1.7.4 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 108 108 109 109 == 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 110 116 = Version 1.7.3 (03 Nov 2024) = 111 117 * fix : warning undefined array key vendor_logo fixed -
affiliate-coupons/trunk/templates/list.php
r3150875 r3241497 20 20 } 21 21 22 23 22 24 do_action( 'affcoups_template_begin', $coupons, $args ); ?> 23 25 … … 29 31 30 32 <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 ?> 34 37 <div class="affcoups-coupon__header"> 35 38 <?php affcoups_tpl_the_coupon_image( $coupon ); ?> 36 39 <?php affcoups_tpl_the_coupon_types( $coupon ); ?> 37 <div class="affcoups-vendor__logo_list"> <?php affcoups_tpl_the_vendor_logo( $coupon); ?> </div>38 40 </div> 39 41 -
affiliate-coupons/trunk/templates/standard.php
r3144879 r3241497 29 29 30 30 <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 31 33 32 34 <div class="affcoups-coupon__header"> 35 33 36 34 <div class="affcoups-vendor__logo_standard"> <?php affcoups_tpl_the_vendor_logo( $coupon); ?> </div>35 37 <?php affcoups_tpl_the_coupon_image( $coupon ); ?> 36 38 <?php affcoups_tpl_the_coupon_discount( $coupon ); ?> 39 37 40 </div> 38 41
Note: See TracChangeset
for help on using the changeset viewer.