Changeset 3365148
- Timestamp:
- 09/21/2025 06:58:21 AM (6 months ago)
- Location:
- edd-custom-checkout-fields
- Files:
-
- 10 added
- 5 edited
-
tags/1.4.3 (added)
-
tags/1.4.3/assets (added)
-
tags/1.4.3/assets/click-here-rtl.png (added)
-
tags/1.4.3/assets/click-here.png (added)
-
tags/1.4.3/class-fields-generator.php (added)
-
tags/1.4.3/index.php (added)
-
tags/1.4.3/languages (added)
-
tags/1.4.3/languages/ecf-fa_IR.mo (added)
-
tags/1.4.3/languages/ecf-fa_IR.po (added)
-
tags/1.4.3/readme.txt (added)
-
trunk/class-fields-generator.php (modified) (2 diffs)
-
trunk/index.php (modified) (11 diffs)
-
trunk/languages/ecf-fa_IR.mo (modified) (previous)
-
trunk/languages/ecf-fa_IR.po (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
edd-custom-checkout-fields/trunk/class-fields-generator.php
r2694443 r3365148 5 5 { 6 6 private static $instance = null; 7 /** 8 * @var array|array[] 9 */ 10 private $fields; 7 11 8 12 public static function get_instance($slug = '_slug', $text_domain = 'ecf') … … 168 172 .field_type_paragraph .f_desc, 169 173 .field_type_paragraph .f_show_admin, 170 .field_type_paragraph .f_id 171 { 174 .field_type_paragraph .f_id { 172 175 display: none; 173 176 } -
edd-custom-checkout-fields/trunk/index.php
r2763952 r3365148 1 1 <?php 2 2 /* 3 Plugin Name: EDD custom checkout fields3 Plugin Name: Custom checkout fields for EDD 4 4 Description: Add custom fields to edd checkout form 5 Plugin URI: http://wp-master.ir 6 Author: Omid Shamlu 7 Author URI: http://wp-master.ir 8 Version: 1.4.1 9 License: GPL2 5 Plugin URI: https://wp-master.ir 6 Author: Omid Shamloo 7 Author URI: https://wp-master.ir 8 Version: 1.4.3 10 9 Text Domain: ecf 10 Domain Path: /languages 11 Requires PHP: 7.0 12 Requires Plugins: easy-digital-downloads 11 13 */ 12 14 … … 14 16 * Changes: 15 17 * 1.4.1 : fixed not working in new EDD version 18 * 1.4.2 : fixed not working when user logged in 19 * 1.4.3 : Some fixes and change plugin name due trademark alert from plugins@wordpress.org 16 20 */ 17 21 defined('ABSPATH') or die('No script kiddies please!'); 18 22 19 $defs = array( 20 'ecf_url' => plugin_dir_url(__FILE__), 21 'ecf_dir' => plugin_dir_path(__FILE__), 22 ); 23 foreach ($defs as $def_name => $def_val) { 24 define($def_name, $def_val); 25 } 26 23 /** 24 * defines 25 */ 26 define('ecf_url', plugin_dir_url(__FILE__)); 27 define('ecf_dir', plugin_dir_path(__FILE__)); 28 29 /** 30 * activate action 31 * like redirect to admin settings and ... 32 */ 33 register_activation_hook(__FILE__, ['wpm_edd_custom_fields', 'activation_hook']); 34 /** 35 * plugins loaded action 36 */ 37 add_action('plugins_loaded', ['wpm_edd_custom_fields', 'plugins_loaded']); 27 38 28 39 /** … … 54 65 } 55 66 56 load_plugin_textdomain('ecf', false, dirname(plugin_basename(__FILE__)) . '/languages'); 57 __('EDD custom checkout fields', 'ecf'); 58 __('Add custom fields to edd checkout form', 'ecf'); 67 /** 68 * load textdomain 69 */ 70 $this->load_plugin_textdomain(); 71 59 72 /** 60 73 * admin menu … … 82 95 } 83 96 97 public static function load_plugin_textdomain() 98 { 99 load_plugin_textdomain('ecf', false, dirname(plugin_basename(__FILE__)) . '/languages'); 100 __('EDD custom checkout fields', 'ecf'); 101 __('Custom checkout fields for EDD', 'ecf'); 102 __('Add custom fields to edd checkout form', 'ecf'); 103 } 104 105 public static function plugins_loaded() 106 { 107 108 if (get_option('wpm_ecf_redirect_after_activation_option', false)) { 109 delete_option('wpm_ecf_redirect_after_activation_option'); 110 exit(wp_redirect(admin_url('edit.php?post_type=download&page=edd-custom-fields'))); 111 } 112 113 } 114 115 public static function activation_hook() 116 { 117 add_option('wpm_ecf_redirect_after_activation_option', true); 118 } 119 84 120 public function make_fields($fields, $prefix = 'edd-') 85 121 { … … 92 128 } 93 129 $this->fields = $fields; 94 add_action('edd_purchase_form_user_info_fields', array($this, 'wpm_edd_display_checkout_fields')); 130 if (!is_user_logged_in()) { 131 add_action('edd_purchase_form_user_info_fields', array($this, 'wpm_edd_display_checkout_fields')); 132 } else { 133 /** 134 * @since 1.4.2 135 */ 136 137 add_action('edd_purchase_form_after_user_info', array($this, 'wpm_edd_display_checkout_fields')); 138 } 95 139 add_filter('edd_purchase_form_required_fields', array($this, 'wpm_edd_required_checkout_fields')); 96 140 add_action('edd_checkout_error_checks', array($this, 'wpm_edd_validate_checkout_fields'), 10, 2); … … 106 150 add_filter('edd_payments_table_column', array($this, 'edd_payments_table_column'), 10, 3); 107 151 108 } 109 110 public function wpm_edd_display_checkout_fields() 152 /** 153 * @since 1.4.2 154 * Add custom fields data to purchase session data 155 */ 156 add_filter('edd_purchase_data_before_gateway', [$this, 'wpm_edd_custom_fields_data_to_purchase_data'], 10, 2); 157 } 158 159 function wpm_edd_custom_fields_data_to_purchase_data($purchase_data, $valid_data) 160 { 161 $payment_id = ''; 162 $fields = $this->fields; 163 foreach ($fields as $field) { 164 extract($field); 165 if (strpos($id, 'ecf_') !== false) { 166 $id = 'edd_' . $this->prefix . $id; 167 } 168 $purchase_data[$id] = isset($_POST[$id]) ? sanitize_text_field($_POST[$id]) : ''; 169 // edd_update_payment_meta($payment_id, $id, $payment_meta[$id]); 170 } 171 172 // die(var_export($purchase_data, 1)); 173 return $purchase_data; 174 } 175 176 public function wpm_edd_display_checkout_fields($customer = false) 111 177 { 112 178 $fields = $this->fields; … … 266 332 public function wpm_edd_store_custom_fields($payment_meta) 267 333 { 334 // die(var_export($payment_meta, 1)); 268 335 if (did_action('edd_purchase')) { 269 336 $fields = $this->fields; 270 337 foreach ($fields as $field) { 271 338 extract($field); 272 if (strpos($id, 'ecf_') === false) { 273 $id = $id; 274 } else { 339 if (strpos($id, 'ecf_') !== false) { 275 340 $id = 'edd_' . $this->prefix . $id; 276 341 } 277 342 $payment_meta[$id] = isset($_POST[$id]) ? sanitize_text_field($_POST[$id]) : ''; 343 // edd_update_payment_meta($payment_id, $id, $payment_meta[$id]); 278 344 } 279 345 } … … 351 417 <div class="column-container"> 352 418 <div class="column"> 353 <strong>' . $title . ': </strong> 419 <strong>' . $title . ': </strong> <br> 354 420 ' . $_val . ' 355 421 </div> … … 439 505 } 440 506 441 add_action(' plugins_loaded', 'load_wpm_edd_custom_fields');507 add_action('init', 'load_wpm_edd_custom_fields'); 442 508 function load_wpm_edd_custom_fields() 443 509 { … … 447 513 unset($_ecf_custom_fields['last_saved']); 448 514 if (is_array($_ecf_custom_fields) && !empty($_ecf_custom_fields)) { 515 449 516 $_fields = array(); 450 517 foreach ($_ecf_custom_fields['type'] as $index => $value) { … … 519 586 } 520 587 588 521 589 } -
edd-custom-checkout-fields/trunk/languages/ecf-fa_IR.po
r2694443 r3365148 2 2 msgstr "" 3 3 "Project-Id-Version: custom price payment\n" 4 "POT-Creation-Date: 202 2-03-15 21:09+0330\n"5 "PO-Revision-Date: 202 2-03-15 21:10+0330\n"4 "POT-Creation-Date: 2025-09-20 23:59+0330\n" 5 "PO-Revision-Date: 2025-09-20 23:59+0330\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: wp-master.ir\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 2.3\n" 12 "Plural-Forms: nplurals=1; plural=0;\n" 13 "X-Generator: Poedit 3.4.2\n" 13 14 "X-Poedit-Basepath: ..\n" 14 "Plural-Forms: nplurals=1; plural=0;\n"15 15 "X-Poedit-KeywordsList: __;_e\n" 16 16 "X-Poedit-SourceCharset: UTF-8\n" … … 26 26 msgstr "متن چند خطی" 27 27 28 #: class-fields-generator.php:30 class-fields-generator.php:4 6028 #: class-fields-generator.php:30 class-fields-generator.php:458 29 29 msgid "Checkbox" 30 30 msgstr "گزینه انتخابی" 31 31 32 #: class-fields-generator.php:34 class-fields-generator.php:44 732 #: class-fields-generator.php:34 class-fields-generator.php:445 33 33 msgid "Paragraph" 34 34 msgstr "پاراگراف" 35 35 36 #: class-fields-generator.php: 4236 #: class-fields-generator.php:38 37 37 msgid "ComboBox" 38 38 msgstr "لیست باز شو" 39 39 40 #: class-fields-generator.php:21 140 #: class-fields-generator.php:210 41 41 msgid "+Add Field" 42 42 msgstr "+افزودن فیلد" 43 43 44 #: class-fields-generator.php:21 644 #: class-fields-generator.php:215 45 45 msgid "Click to add new field" 46 46 msgstr "برای افزودن فیلد جدید کلیک کنید" 47 47 48 #: class-fields-generator.php:25 348 #: class-fields-generator.php:252 49 49 msgid "Save" 50 50 msgstr "ذخیره" 51 51 52 #: class-fields-generator.php:28 6 class-fields-generator.php:30052 #: class-fields-generator.php:285 class-fields-generator.php:299 53 53 msgid "Are You Sure?" 54 54 msgstr "برای حذف مطمئن هستید؟" 55 55 56 #: class-fields-generator.php:34 756 #: class-fields-generator.php:345 57 57 msgid "Untitled" 58 58 msgstr "بدون عنوان" 59 59 60 #: class-fields-generator.php:3 5160 #: class-fields-generator.php:349 61 61 msgid "Field Type" 62 62 msgstr "انتخاب نوع فیلد" 63 63 64 #: class-fields-generator.php:35 364 #: class-fields-generator.php:351 65 65 msgid "Select Field Type" 66 66 msgstr "انتخاب نوع فیلد" 67 67 68 #: class-fields-generator.php:36 368 #: class-fields-generator.php:361 69 69 msgid "General" 70 70 msgstr "تنظیمات عمومی" 71 71 72 #: class-fields-generator.php:36 472 #: class-fields-generator.php:362 73 73 msgid "Field Name" 74 74 msgstr "نام فیلد" 75 75 76 #: class-fields-generator.php:36 976 #: class-fields-generator.php:367 77 77 msgid "Required?" 78 msgstr " (الزامی)"78 msgstr "الزامی ؟" 79 79 80 #: class-fields-generator.php:37 780 #: class-fields-generator.php:375 81 81 msgid "Show in edd admin table?" 82 82 msgstr "نمایش در جداول ادمین؟" 83 83 84 #: class-fields-generator.php:38 584 #: class-fields-generator.php:383 85 85 msgid "Description" 86 86 msgstr "توضیحات" 87 87 88 #: class-fields-generator.php:38 988 #: class-fields-generator.php:387 89 89 msgid "Custom ID" 90 90 msgstr "آی دی اختصاصی" 91 91 92 #: class-fields-generator.php:39 292 #: class-fields-generator.php:390 93 93 msgid "to match with any older functions.php codes" 94 94 msgstr "" … … 96 96 "استفاده کنید آی دی آن را وارد کنید" 97 97 98 #: class-fields-generator.php: 400 class-fields-generator.php:42098 #: class-fields-generator.php:398 class-fields-generator.php:418 99 99 msgid "Textbox" 100 100 msgstr "متن تک خطی" 101 101 102 #: class-fields-generator.php:40 2 class-fields-generator.php:422102 #: class-fields-generator.php:400 class-fields-generator.php:420 103 103 msgid "Default Value" 104 104 msgstr "مقدار پیش فرض" 105 105 106 #: class-fields-generator.php:40 9 class-fields-generator.php:428106 #: class-fields-generator.php:407 class-fields-generator.php:426 107 107 msgid "Placeholder" 108 108 msgstr "عنوان نگه دارنده" 109 109 110 #: class-fields-generator.php:43 5110 #: class-fields-generator.php:433 111 111 msgid "ReadOnly" 112 msgstr " "112 msgstr "فقط خواندنی" 113 113 114 #: class-fields-generator.php:44 9114 #: class-fields-generator.php:447 115 115 msgid "Content" 116 116 msgstr "محتوا" 117 117 118 #: class-fields-generator.php:46 9118 #: class-fields-generator.php:467 119 119 msgid "Combobox" 120 120 msgstr "لیست باز شو" 121 121 122 #: index.php:5 2122 #: index.php:59 123 123 msgid "EDD custom checkout fields" 124 124 msgstr "فیلد سفارشی برای فرم خرید EDD" 125 125 126 #: index.php:53 126 #: index.php:60 127 msgid "Custom checkout fields for EDD" 128 msgstr "فیلد سفارشی برای فرم خرید EDD" 129 130 #: index.php:61 127 131 msgid "Add custom fields to edd checkout form" 128 132 msgstr "به فرم پرداخت خرید در EDD فیلدهای دلخواه اضافه کنید." 129 133 130 #: index.php: 64134 #: index.php:72 131 135 msgid "checkout fields" 132 136 msgstr "فیلد های پرداخت" 133 137 134 #: index.php:1 55138 #: index.php:193 135 139 msgid "select one" 136 140 msgstr "فقط خواندنی" 137 141 138 #: index.php: 190142 #: index.php:228 139 143 msgid "Please check out this field" 140 144 msgstr "لطفا در پر کردن این فیلد دقت کنید" 141 145 142 #: index.php:2 32146 #: index.php:270 143 147 msgid "Please Fill This Field:" 144 148 msgstr "لطفا در پر کردن این فیلد دقت کنید:" 145 149 146 #: index.php:2 41150 #: index.php:279 147 151 msgid "Please Check This Field Value:" 148 152 msgstr "لطفا در پر کردن این فیلد دقت کنید:" 149 153 150 #: index.php:3 05154 #: index.php:342 index.php:345 151 155 msgid "Other Information" 152 156 msgstr "اطلاعات دیگر" 153 157 154 #: index.php: 461158 #: index.php:523 155 159 msgid "Optional" 156 160 msgstr "اختیاری" -
edd-custom-checkout-fields/trunk/readme.txt
r2763952 r3365148 1 === EDD custom checkout fields===1 === Custom checkout fields for EDD === 2 2 Contributors: goback2 3 Donate link: http ://wp-master.ir3 Donate link: https://wp-master.ir/pay 4 4 Tags: edd,easy digital downloads,edd custom field,custom checkout,checkout 5 5 Requires at least: 4.6 6 Tested up to: 6. 0.17 Stable tag: trunk6 Tested up to: 6.8.2 7 Stable tag: 1.4.3 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 By ** EDD custom checkout fields** , you can add custom fields to the EDD checkout page and get information from users.15 By **Custom checkout fields for EDD** , you can add custom fields to the EDD checkout page and get information from users. 16 16 17 17 Supported fields:
Note: See TracChangeset
for help on using the changeset viewer.