Changeset 3141427
- Timestamp:
- 08/26/2024 06:30:32 AM (18 months ago)
- Location:
- subscription
- Files:
-
- 3 added
- 2 deleted
- 35 edited
-
tags/1.1.2 (deleted)
-
tags/1.1.3 (deleted)
-
trunk/assets/css/admin.css (modified) (1 diff)
-
trunk/assets/js/admin.js (modified) (1 diff)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/includes/Admin.php (modified) (2 diffs)
-
trunk/includes/Admin/Order.php (modified) (2 diffs)
-
trunk/includes/Admin/Product.php (modified) (5 diffs)
-
trunk/includes/Admin/Settings.php (modified) (2 diffs)
-
trunk/includes/Admin/Subscriptions.php (modified) (7 diffs)
-
trunk/includes/Admin/views/product-form.php (modified) (2 diffs)
-
trunk/includes/Admin/views/related-subscriptions.php (modified) (2 diffs)
-
trunk/includes/Admin/views/settings.php (modified) (3 diffs)
-
trunk/includes/Api.php (modified) (1 diff)
-
trunk/includes/Frontend.php (modified) (3 diffs)
-
trunk/includes/Frontend/ActionController.php (modified) (4 diffs)
-
trunk/includes/Frontend/Cart.php (modified) (10 diffs)
-
trunk/includes/Frontend/Checkout.php (modified) (4 diffs)
-
trunk/includes/Frontend/MyAccount.php (modified) (5 diffs)
-
trunk/includes/Frontend/Order.php (modified) (2 diffs)
-
trunk/includes/Frontend/Product.php (modified) (3 diffs)
-
trunk/includes/Illuminate.php (modified) (2 diffs)
-
trunk/includes/Illuminate/Action.php (modified) (2 diffs)
-
trunk/includes/Illuminate/AutoRenewal.php (added)
-
trunk/includes/Illuminate/Block.php (added)
-
trunk/includes/Illuminate/Comments.php (modified) (1 diff)
-
trunk/includes/Illuminate/Email.php (modified) (2 diffs)
-
trunk/includes/Illuminate/Helper.php (modified) (3 diffs)
-
trunk/includes/Illuminate/Order.php (modified) (4 diffs)
-
trunk/includes/Illuminate/Stripe.php (added)
-
trunk/includes/functions.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/subscription.php (modified) (3 diffs)
-
trunk/templates/myaccount/single.php (modified) (6 diffs)
-
trunk/templates/myaccount/subscriptions.php (modified) (3 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subscription/trunk/assets/css/admin.css
r3132743 r3141427 2 2 content: "\f531" !important; 3 3 } 4 5 .subscrpt_field { 6 max-width: 480px; 7 display: flex; 8 flex-wrap: wrap; 9 } 10 11 .subscrpt_field > label { 12 width: 100%; 13 } 14 15 .subscrpt_field > input { 16 width: 70% !important; 17 margin-right: 5px !important; 18 } 19 20 .subscrpt_field > select { 21 width: 25%; 22 } 23 24 .subscrpt_field > small { 25 line-height: 14px; 26 margin-top: 5px !important; 27 } 28 29 .subscrpt-order-label { 30 background: #e1edf7; 31 color: #2683aa; 32 display: inline-block; 33 padding: 5px 10px; 34 font-weight: 500; 35 font-size: 14px; 36 margin-top: 10px; 37 clear: both; 38 margin-bottom: 5px; 39 } 40 41 @media (min-width: 1024px) { 42 .subscrpt_field > select { 43 width: 20%; 44 } 45 } -
subscription/trunk/assets/js/admin.js
r2927437 r3141427 32 32 if (subscrpt_renewal_process.val() === "manual") { 33 33 jQuery("#sdevs_renewal_cart_tr").show(); 34 jQuery("#subscrpt_stripe_auto_renew_tr").hide(); 35 jQuery("#subscrpt_auto_renewal_toggle_tr").hide(); 34 36 } else { 35 37 jQuery("#sdevs_renewal_cart_tr").hide(); 38 jQuery("#subscrpt_stripe_auto_renew_tr").show(); 39 jQuery("#subscrpt_auto_renewal_toggle_tr").show(); 36 40 } 37 41 }); 38 42 if (subscrpt_renewal_process.val() === "manual") { 39 43 jQuery("#sdevs_renewal_cart_tr").show(); 44 jQuery("#subscrpt_stripe_auto_renew_tr").hide(); 45 jQuery("#subscrpt_auto_renewal_toggle_tr").hide(); 40 46 } else { 41 47 jQuery("#sdevs_renewal_cart_tr").hide(); 48 jQuery("#subscrpt_stripe_auto_renew_tr").show(); 49 jQuery("#subscrpt_auto_renewal_toggle_tr").show(); 42 50 } 43 51 }); -
subscription/trunk/build/index.asset.php
r3133657 r3141427 1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-price-format', 'wp-i18n', 'wp-plugins'), 'version' => ' 9f3c21b6a4c081ac264d');1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-price-format', 'wp-i18n', 'wp-plugins'), 'version' => 'a790f80aaf5fa60e0dfd'); -
subscription/trunk/build/index.js
r3133657 r3141427 1 (()=>{"use strict";const e=window.React,t=window.wc.blocksCheckout,r=window.wc.blocksComponents, s=window.wp.plugins,i=window.wp.i18n,c=window.wc.priceFormat;(0,t.registerCheckoutFilters)("sdevs-subscription",{cartItemPrice:(e,t,r,s)=>{const{sdevs_subscription:i}=t,{cartItem:c}=r,{totals:n}=c;return void 0===n?e:"0"===n.line_total?"<price/> Due Today":i.type?`<price/> / ${i.time&&i.time>1?" "+i.time+"-":""}${i.type}`:e},subtotalPriceFormat:(e,t,r,s)=>{const{sdevs_subscription:i}=t;return i&&i.type?`<price/> every ${i.time&&1===i.time?" "+i.time+"-":""}${i.type}`:e}});const n=({cart:s,extensions:n})=>{if(0===Object.keys(n).length)return;const{cartTotals:o}=s,{sdevs_subscription:l}=n,a=(0,c.getCurrencyFromPriceResponse)(o);return 0!==l.length?(0,e.createElement)(t.TotalsItem,{className:"wc-block-components-totals-footer-item",label:(0,i.__)("Recurring totals","sdevs_subscrpt"),description:l.map((t=>(0,e.createElement)("div",{style:{margin:"20px 0",float:"right"}},(0,e.createElement)("div",{style:{fontSize:"18px"}},(0,e.createElement)(r.FormattedMonetaryAmount,{currency:a,value:parseInt(t.price,10)})," ","/"," ",t.time&&t.time>1?t.time+"-"+t.type+" ":t.type),(0,e.createElement)("small",null,t.description))))}):void 0};(0,s.registerPlugin)("sdevs-subscription",{render:()=>(0,e.createElement)(t.ExperimentalOrderMeta,null,(0,e.createElement)(n,null)),scope:"woocommerce-checkout"})})();1 (()=>{"use strict";const e=window.React,t=window.wc.blocksCheckout,r=window.wc.blocksComponents,n=window.wp.plugins,c=window.wp.i18n,s=window.wc.priceFormat;(0,t.registerCheckoutFilters)("sdevs-subscription",{cartItemPrice:(e,t,r,n)=>{const{sdevs_subscription:c}=t,{cartItem:s}=r,{totals:i}=s;return void 0===i?e:"0"===i.line_total?"<price/> Due Today":c.type?`<price/> / ${c.time&&c.time>1?" "+c.time+"-":""}${c.type}`:e},subtotalPriceFormat:(e,t,r,n)=>{const{sdevs_subscription:c}=t;return c&&c.type?`<price/> every ${c.time&&c.time>1?" "+c.time+"-":""}${c.type}`:e}});const i=({cart:n,extensions:i})=>{if(0===Object.keys(i).length)return;const{cartTotals:o}=n,{sdevs_subscription:l}=i,a=(0,s.getCurrencyFromPriceResponse)(o);return 0!==l.length?(0,e.createElement)(t.TotalsItem,{className:"wc-block-components-totals-footer-item",label:(0,c.__)("Recurring totals","sdevs_subscrpt"),description:(0,e.createElement)("div",{style:{display:"grid"}},l.map((t=>(0,e.createElement)("div",{style:{margin:"20px 0",float:"right"}},(0,e.createElement)("div",{style:{fontSize:"18px"}},(0,e.createElement)(r.FormattedMonetaryAmount,{currency:a,value:parseInt(t.price,10)})," ","/"," ",t.time&&t.time>1?t.time+"-"+t.type+" ":t.type),(0,e.createElement)("small",null,t.description),"yes"===t.can_user_cancel&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("br",null),(0,e.createElement)("small",null,"You can cancel subscription at any time! "))))))}):void 0};(0,n.registerPlugin)("sdevs-subscription",{render:()=>(0,e.createElement)(t.ExperimentalOrderMeta,null,(0,e.createElement)(i,null)),scope:"woocommerce-checkout"})})(); -
subscription/trunk/includes/Admin.php
r2927437 r3141427 11 11 use SpringDevs\Subscription\Admin\Subscriptions; 12 12 use SpringDevs\Subscription\Illuminate\Comments; 13 use SpringDevs\Subscription\Illuminate\Email;14 use SpringDevs\Subscription\Illuminate\Order;15 13 16 14 /** 17 15 * The admin class 18 16 */ 19 class Admin 20 { 21 17 class Admin { 22 18 23 19 /** 24 20 * Initialize the class 25 21 */ 26 public function __construct() 27 { 22 public function __construct() { 28 23 $this->dispatch_actions(); 29 24 new Required(); 30 new Illuminate();31 25 new Menu(); 32 26 new Product(); 33 27 new Subscriptions(); 34 new Order();35 28 new AdminOrder(); 36 29 new Comments(); 37 new Email();38 30 new Settings(); 39 31 new Links(); … … 45 37 * @return void 46 38 */ 47 public function dispatch_actions() 48 { 39 public function dispatch_actions() { 49 40 } 50 41 } -
subscription/trunk/includes/Admin/Order.php
r3083564 r3141427 17 17 public function __construct() { 18 18 add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); 19 add_action( 'woocommerce_admin_order_data_after_payment_info', array( $this, 'add_subscription_label' ) ); 20 } 21 22 /** 23 * Add subscriotion label after order title. 24 * 25 * @param \WC_Order $order Order object. 26 * 27 * @return void 28 */ 29 public function add_subscription_label( $order ) { 30 $histories = Helper::get_subscriptions_from_order( $order->get_id() ); 31 if ( count( $histories ) > 0 ) : 32 ?> 33 <div class="subscrpt-order-label"><?php echo esc_html_e( 'Subscription order', 'sdevs_subscrpt' ); ?></div> 34 <?php 35 endif; 19 36 } 20 37 … … 49 66 * 50 67 * @param mixed $order_post Current Order. 51 * @param mixed$info Meta box Info.68 * @param array $info Meta box Info. 52 69 */ 53 70 public function subscrpt_order_related( $order_post, $info ) { -
subscription/trunk/includes/Admin/Product.php
r3132743 r3141427 2 2 3 3 namespace SpringDevs\Subscription\Admin; 4 5 use SpringDevs\Subscription\Illuminate\Helper; 4 6 5 7 /** … … 19 21 add_filter( 'product_type_options', array( $this, 'add_product_type_options' ) ); 20 22 add_action( 'save_post_product', array( $this, 'save_subscrpt_data' ) ); 23 add_filter( 'woocommerce_get_price_html', array( $this, 'change_price_html' ), 10, 2 ); 24 } 25 26 /** 27 * Add trial, signup fee etc. with product price. 28 * 29 * @param string $price Price. 30 * @param \WC_Product $product Product. 31 * 32 * @return string 33 */ 34 public function change_price_html( $price, $product ) { 35 if ( $product->is_type( 'variable' ) || '' === $price || subscrpt_pro_activated() ) { 36 return $price; 37 } 38 39 $enabled = $product->get_meta( '_subscrpt_enabled' ); 40 if ( $enabled ) : 41 $type = Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) ); 42 $meta_trial_time = $product->get_meta( '_subscrpt_trial_timing_per' ); 43 $trial = null; 44 if ( ! empty( $meta_trial_time ) && $meta_trial_time > 0 ) { 45 $trial = '<br/> + Get ' . $meta_trial_time . ' ' . Helper::get_typos( $meta_trial_time, $product->get_meta( '_subscrpt_trial_timing_option' ) ) . ' free trial!'; 46 } 47 48 $price_html = $price . ' / ' . $type . $trial; 49 return $price_html; 50 else : 51 return $price; 52 endif; 21 53 } 22 54 … … 88 120 'years' => __( 'Yearly', 'sdevs_subscrpt' ), 89 121 ); 122 $trial_timing_types = get_timing_types(); 90 123 $subscrpt_timing = null; 124 $subscrpt_trial_time = null; 125 $subscrpt_trial_timing = null; 91 126 $subscrpt_cart_txt = 'subscribe'; 92 127 $subscrpt_user_cancell = 'yes'; 128 $subscrpt_limit = 'one'; 93 129 94 130 $screen = get_current_screen(); … … 97 133 if ( $product ) { 98 134 $subscrpt_timing = $product->get_meta( '_subscrpt_timing_option' ); 135 $subscrpt_trial_time = $product->get_meta( '_subscrpt_trial_timing_per' ); 136 $subscrpt_trial_timing = $product->get_meta( '_subscrpt_trial_timing_option' ); 99 137 $subscrpt_cart_txt = $product->get_meta( '_subscrpt_cart_btn_label' ); 100 138 $subscrpt_user_cancell = $product->get_meta( '_subscrpt_user_cancel' ); 139 $subscrpt_limit = $product->get_meta( '_subscrpt_limit' ); 101 140 } 102 141 } … … 126 165 remove_action( 'save_post_product', array( $this, 'save_subscrpt_data' ) ); 127 166 128 $subscrpt_enable = isset( $_POST['subscrpt_enable'] ); 129 $subscrpt_timing = sanitize_text_field( wp_unslash( $_POST['subscrpt_timing'] ) ); 130 $subscrpt_cart_txt = sanitize_text_field( wp_unslash( $_POST['subscrpt_cart_txt'] ) ); 131 $subscrpt_user_cancel = sanitize_text_field( wp_unslash( $_POST['subscrpt_user_cancel'] ) ); 132 $product = wc_get_product( $product_id ); 167 $subscrpt_enable = isset( $_POST['subscrpt_enable'] ); 168 $subscrpt_timing = sanitize_text_field( wp_unslash( $_POST['subscrpt_timing'] ) ); 169 $subscrpt_trial_time = sanitize_text_field( wp_unslash( $_POST['subscrpt_trial_time'] ) ); 170 $subscrpt_trial_timing = sanitize_text_field( wp_unslash( $_POST['subscrpt_trial_timing'] ) ); 171 $subscrpt_cart_txt = sanitize_text_field( wp_unslash( $_POST['subscrpt_cart_txt'] ) ); 172 $subscrpt_user_cancel = sanitize_text_field( wp_unslash( $_POST['subscrpt_user_cancel'] ) ); 173 $subscrpt_limit = isset( $_POST['subscrpt_limit'] ) ? sanitize_text_field( wp_unslash( $_POST['subscrpt_limit'] ) ) : null; 133 174 175 $product = wc_get_product( $product_id ); 134 176 $product->update_meta_data( '_subscrpt_enabled', $subscrpt_enable ); 135 177 $product->update_meta_data( '_subscrpt_timing_option', $subscrpt_timing ); 178 $product->update_meta_data( '_subscrpt_trial_timing_per', $subscrpt_trial_time ); 179 $product->update_meta_data( '_subscrpt_trial_timing_option', $subscrpt_trial_timing ); 136 180 $product->update_meta_data( '_subscrpt_cart_btn_label', $subscrpt_cart_txt ); 137 181 $product->update_meta_data( '_subscrpt_user_cancel', $subscrpt_user_cancel ); 182 $product->update_meta_data( '_subscrpt_limit', $subscrpt_limit ); 138 183 $product->save(); 139 184 -
subscription/trunk/includes/Admin/Settings.php
r2927437 r3141427 18 18 } 19 19 20 /** 21 * Register submenu on `Subscriptions` menu. 22 * 23 * @return void 24 */ 20 25 public function admin_menu() { 21 26 $post_type_link = 'edit.php?post_type=subscrpt_order'; … … 31 36 register_setting( 'subscrpt_settings', 'subscrpt_active_role' ); 32 37 register_setting( 'subscrpt_settings', 'subscrpt_unactive_role' ); 38 register_setting( 'subscrpt_settings', 'subscrpt_stripe_auto_renew' ); 39 register_setting( 'subscrpt_settings', 'subscrpt_auto_renewal_toggle' ); 40 33 41 do_action( 'subscrpt_register_settings', 'subscrpt_settings' ); 34 42 } -
subscription/trunk/includes/Admin/Subscriptions.php
r3132743 r3141427 116 116 */ 117 117 public function add_custom_columns_data( $column, $post_id ) { 118 $order_id = get_post_meta( $post_id, '_subscrpt_order_id', true ); 119 $start_date = get_post_meta( $post_id, '_subscrpt_start_date', true ); 120 $next_date = get_post_meta( $post_id, '_subscrpt_next_date', true ); 121 $order = wc_get_order( $order_id ); 118 $order_id = get_post_meta( $post_id, '_subscrpt_order_id', true ); 119 $order = wc_get_order( $order_id ); 122 120 if ( $order ) { 123 121 if ( 'subscrpt_start_date' === $column ) { 124 echo esc_html( gmdate( 'F d, Y', $start_date ) ); 122 $start_date = get_post_meta( $post_id, '_subscrpt_start_date', true ); 123 echo ! empty( $start_date ) ? esc_html( gmdate( 'F d, Y', $start_date ) ) : '-'; 125 124 } elseif ( 'subscrpt_customer' === $column ) { 126 125 ?> … … 134 133 <?php 135 134 } elseif ( 'subscrpt_next_date' === $column ) { 136 echo esc_html( gmdate( 'F d, Y', $next_date ) ); 135 $next_date = get_post_meta( $post_id, '_subscrpt_next_date', true ); 136 echo ! empty( $next_date ) ? esc_html( gmdate( 'F d, Y', $next_date ) ) : '-'; 137 137 } elseif ( 'subscrpt_status' === $column ) { 138 138 $status_obj = get_post_status_object( get_post_status( $post_id ) ); … … 287 287 */ 288 288 public function subscrpt_order_info() { 289 $order_id = get_post_meta( get_the_ID(), '_subscrpt_order_id', true ); 290 $order_item_id = get_post_meta( get_the_ID(), '_subscrpt_order_item_id', true ); 291 $start_date = get_post_meta( get_the_ID(), '_subscrpt_start_date', true ); 292 $next_date = get_post_meta( get_the_ID(), '_subscrpt_next_date', true ); 293 $order = wc_get_order( $order_id ); 289 $order_id = get_post_meta( get_the_ID(), '_subscrpt_order_id', true ); 290 $order_item_id = get_post_meta( get_the_ID(), '_subscrpt_order_item_id', true ); 291 $trial = get_post_meta( get_the_ID(), '_subscrpt_trial', true ); 292 $start_date = get_post_meta( get_the_ID(), '_subscrpt_start_date', true ); 293 $next_date = get_post_meta( get_the_ID(), '_subscrpt_next_date', true ); 294 $trial_start_date = get_post_meta( get_the_ID(), '_subscrpt_trial_started', true ); 295 $trial_end_date = get_post_meta( get_the_ID(), '_subscrpt_trial_ended', true ); 296 $trial_mode = get_post_meta( get_the_ID(), '_subscrpt_trial_mode', true ); 297 $order = wc_get_order( $order_id ); 294 298 if ( ! $order ) { 295 299 return; … … 314 318 'start_date' => array( 315 319 'label' => __( 'Started date', 'sdevs_subscrpt' ), 316 'value' => gmdate( 'F d, Y', $start_date ),320 'value' => ! empty( $start_date ) ? gmdate( 'F d, Y', $trial && $trial_start_date ? $trial_start_date : $start_date ) : '-', 317 321 ), 318 322 'next_date' => array( 319 323 'label' => __( 'Payment due date', 'sdevs_subscrpt' ), 320 'value' => gmdate( 'F d, Y', $next_date ),324 'value' => ! empty( $next_date ) ? gmdate( 'F d, Y', $trial && $trial_end_date && 'on' === $trial_mode ? $trial_end_date : ( $next_date ?? '-' ) ) : '-', 321 325 ), 322 326 'status' => array( … … 326 330 'payment_method' => array( 327 331 'label' => __( 'Payment Method', 'sdevs_subscrpt' ), 328 'value' => $order->get_payment_method_title(),332 'value' => empty( $order->get_payment_method_title() ) ? '-' : $order->get_payment_method_title(), 329 333 ), 330 334 'billing_address' => array( … … 337 341 ), 338 342 ); 339 $rows = apply_filters( 'subscrpt_admin_info_rows', $rows, get_the_ID(), $order ); 343 if ( $trial ) { 344 $rows = array_slice( $rows, 0, 3, true ) + array( 345 'trial' => array( 346 'label' => __( 'Trial', 'sdevs_subscrpt' ), 347 'value' => $trial, 348 ), 349 'trial_period' => array( 350 'label' => __( 'Trial Period', 'sdevs_subscrpt' ), 351 'value' => ( $trial_start_date && $trial_end_date ? ' [ ' . gmdate( 'F d, Y', $trial_start_date ) . ' - ' . gmdate( 'F d, Y', $trial_end_date ) . ' ] ' : __( 'Trial isn\'t activated yet! ', 'sdevs_subscrpt' ) ), 352 ), 353 ) + array_slice( $rows, 3, count( $rows ) - 1, true ); 354 } 355 356 if ( class_exists( 'WC_Stripe' ) && 'stripe' === $order->get_payment_method() ) { 357 $is_auto_renew = get_post_meta( get_the_ID(), '_subscrpt_auto_renew', true ); 358 $new_rows = array(); 359 foreach ( $rows as $key => $value ) { 360 $new_rows[ $key ] = $value; 361 if ( 'payment_method' === $key ) { 362 $new_rows['stripe_auto_renewal'] = array( 363 'label' => __( 'Stripe Auto Renewal', 'sdevs_subscrpt' ), 364 'value' => '0' !== $is_auto_renew ? 'On' : 'Off', 365 ); 366 } 367 } 368 369 $rows = $new_rows; 370 } 371 372 $rows = apply_filters( 'subscrpt_admin_info_rows', $rows, get_the_ID(), $order ); 340 373 341 374 include 'views/subscription-info.php'; … … 385 418 386 419 public function save_subscrpt_order( $post_id ) { 387 if ( wp_is_post_revision( $post_id ) ) { 388 return; 389 } 390 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { 391 return; 392 } 393 if ( ! isset( $_POST['subscrpt_order_action'] ) ) { 420 if ( wp_is_post_revision( $post_id ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! isset( $_POST['subscrpt_order_action'] ) ) { 394 421 return; 395 422 } -
subscription/trunk/includes/Admin/views/product-form.php
r3132743 r3141427 15 15 ) 16 16 ); 17 ?> 18 <p class="form-field subscrpt_field"> 19 <label for="subscrpt_trial_time"><?php esc_html_e( 'Offer a free trial of', 'sdevs_subscrpt' ); ?></label> 20 <input type="number" class="short" name="subscrpt_trial_time" id="subscrpt_trial_time" value="<?php echo esc_attr( $subscrpt_trial_time ); ?>" /> 21 <select name="subscrpt_trial_timing" id="subscrpt_trial_timing"> 22 <?php foreach ( $trial_timing_types as $timing_type ) : ?> 23 <option value="<?php echo esc_attr( $timing_type['value'] ); ?>" 24 <?php 25 if ( $subscrpt_trial_timing === $timing_type['value'] ) { 26 echo 'selected'; 27 } 28 ?> 29 ><?php echo esc_html( $timing_type['label'] ); ?></option> 30 <?php endforeach; ?> 31 </select> 32 <small class="description"><?php esc_html_e( 'You can offer a free trial of this subscription. In this way the user can purchase the subscription and will pay when the trial period expires.', 'sdevs_subscrpt' ); ?></small> 33 </p> 34 35 <?php 17 36 18 37 woocommerce_wp_text_input( … … 40 59 ) 41 60 ); 61 62 woocommerce_wp_select( 63 array( 64 'id' => 'subscrpt_limit', 65 'label' => __( 'Limit subscription', 'sdevs_subscrpt' ), 66 'options' => array( 67 'unlimited' => __( 'Do not limit', 'sdevs_subscrpt' ), 68 'one' => __( 'allow only one active subscription', 'sdevs_subscrpt' ), 69 'only_one' => __( 'allow only one subscription of any status', 'sdevs_subscrpt' ), 70 ), 71 'value' => $subscrpt_limit, 72 'description' => __( 'Set optional limits for this product subscription.', 'sdevs_subscrpt' ), 73 'desc_tip' => true, 74 ) 75 ); 42 76 ?> 43 77 </div> -
subscription/trunk/includes/Admin/views/related-subscriptions.php
r3132743 r3141427 22 22 $start_date = get_post_meta( $history->subscription_id, '_subscrpt_start_date', true ); 23 23 $next_date = get_post_meta( $history->subscription_id, '_subscrpt_next_date', true ); 24 $status_object = get_post_status_object( get_post_status( $history->subscription_id ) ); 24 25 ?> 25 26 <tr> … … 28 29 </td> 29 30 <td> 30 <?php echo null == $trial ? esc_html( date( 'F d, Y', $start_date )) : '+' . esc_html( $trial ) . ' ' . __( 'free trial', 'sdevs_subscrpt' ); ?>31 <?php echo null == $trial ? ( ! empty( $start_date ) ? esc_html( gmdate( 'F d, Y', $start_date ) ) : '-' ) : '+' . esc_html( $trial ) . ' ' . __( 'free trial', 'sdevs_subscrpt' ); ?> 31 32 </td> 32 33 <td><?php echo wp_kses_post( Helper::format_price_with_order_item( $price, $order_item->get_id() ) ); ?></td> 33 <td><?php echo esc_html( $trial == null ? date( 'F d, Y', $next_date ) : gmdate( 'F d, Y', $start_date )); ?></td>34 <td>< ?php echo esc_html( get_post_status( $history->subscription_id ) ); ?></td>34 <td><?php echo esc_html( ! empty( $start_date ) && ! empty( $next_date ) ? ( $trial == null ? gmdate( 'F d, Y', $next_date ) : gmdate( 'F d, Y', $start_date ) ) : '-' ); ?></td> 35 <td><span class="subscrpt-<?php echo esc_attr( $status_object->name ); ?>"><?php echo esc_html( $status_object->label ); ?></span></td> 35 36 </tr> 36 37 <?php -
subscription/trunk/includes/Admin/views/settings.php
r2927437 r3141427 15 15 </th> 16 16 <td> 17 <select name="subscrpt_renewal_process" id="subscrpt_renewal_process" 18 <?php 19 if ( ! subscrpt_pro_activated() ) { 20 echo esc_attr( 'disabled' );} 21 ?> 22 > 17 <select name="subscrpt_renewal_process" id="subscrpt_renewal_process"> 23 18 <option value="auto">Automatic</option> 24 19 <option value="manual" 25 20 <?php 26 if ( ! subscrpt_pro_activated() ||'manual' === get_option( 'subscrpt_renewal_process', 'auto' ) ) {21 if ( 'manual' === get_option( 'subscrpt_renewal_process', 'auto' ) ) { 27 22 echo esc_attr( 'selected' ); 28 23 } … … 30 25 >Manual</option> 31 26 </select> 32 <?php if ( ! subscrpt_pro_activated() ) : ?>33 <p style="color: red;" class="description"><?php echo wp_kses_post( '<b>Automatic</b> renewal is available for Pro version only !!' ); ?></p>34 <?php else : ?>35 27 <p class="description"><?php esc_html_e( 'How renewal process will be done after Subscription Expired !!', 'sdevs_subscrpt' ); ?></p> 36 <?php endif; ?>37 28 </td> 38 29 </tr> … … 74 65 </td> 75 66 </tr> 67 <tr id="subscrpt_stripe_auto_renew_tr" valign="top"> 68 <th scope="row" class="titledesc"><?php echo esc_html_e( 'Stripe Auto Renewal', 'sdevs_subscrpt' ); ?></th> 69 <td class="forminp forminp-checkbox"> 70 <fieldset> 71 <legend class="screen-reader-text"><span><?php echo esc_html_e( 'Accept Stripe Auto Renewals', 'sdevs_subscrpt' ); ?></span></legend> 72 <label for="subscrpt_stripe_auto_renew"> 73 <input name="subscrpt_stripe_auto_renew" id="subscrpt_stripe_auto_renew" type="checkbox" value="1" 74 <?php 75 if ( '1' === get_option( 'subscrpt_stripe_auto_renew', '1' ) ) { 76 echo 'checked'; 77 } 78 ?> 79 > <?php echo esc_html_e( 'Accept Stripe Auto Renewals', 'sdevs_subscrpt' ); ?> </label> 80 <p class="description"> 81 <?php 82 echo wp_kses_post( 83 sprintf( 84 /* translators: HTML tags */ 85 __( 86 '%1$s WooCommerce Stripe Payment Gateway %2$s plugin is required !', 87 'sdevs_subscrpt' 88 ), 89 '<a href="https://wordpress.org/plugins/woocommerce-gateway-stripe/" target="_blank">', 90 '</a>' 91 ) 92 ); 93 ?> 94 </p> 95 </fieldset> 96 </td> 97 </tr> 98 <tr id="subscrpt_auto_renewal_toggle_tr" valign="top"> 99 <th scope="row" class="titledesc"><?php echo esc_html_e( 'Auto Renewal Toggle', 'sdevs_subscrpt' ); ?></th> 100 <td class="forminp forminp-checkbox"> 101 <fieldset> 102 <legend class="screen-reader-text"><span><?php echo esc_html_e( 'Auto Renewal Toggle', 'sdevs_subscrpt' ); ?></span></legend> 103 <label for="subscrpt_auto_renewal_toggle"> 104 <input name="subscrpt_auto_renewal_toggle" id="subscrpt_auto_renewal_toggle" type="checkbox" value="1" 105 <?php 106 if ( '1' === get_option( 'subscrpt_auto_renewal_toggle', '1' ) ) { 107 echo 'checked'; 108 } 109 ?> 110 > <?php echo esc_html_e( 'Display the auto renewal toggle', 'sdevs_subscrpt' ); ?> </label> 111 <p class="description"><?php echo esc_html_e( 'Allow customers to turn on and off automatic renewals from their Subscription details page.', 'sdevs_subscrpt' ); ?></p> 112 </fieldset> 113 </td> 114 </tr> 76 115 <?php do_action( 'subscrpt_setting_fields' ); ?> 77 116 </tbody> -
subscription/trunk/includes/Api.php
r2708268 r3141427 12 12 * Initialize the class 13 13 */ 14 function __construct() {14 public function __construct() { 15 15 add_action( 'rest_api_init', array( $this, 'register_api' ) ); 16 16 } -
subscription/trunk/includes/Frontend.php
r3132743 r3141427 9 9 use SpringDevs\Subscription\Frontend\Order as FrontendOrder; 10 10 use SpringDevs\Subscription\Frontend\Product; 11 use SpringDevs\Subscription\Illuminate\Cron;12 use SpringDevs\Subscription\Illuminate\Email;13 use SpringDevs\Subscription\Illuminate\Order;14 11 15 12 /** … … 18 15 class Frontend { 19 16 20 21 17 /** 22 18 * Frontend constructor. 23 19 */ 24 20 public function __construct() { 25 new Illuminate();26 21 new Product(); 27 22 new Cart(); … … 30 25 new MyAccount(); 31 26 new Downloadable(); 32 new Order();33 new Email();34 27 } 35 28 } -
subscription/trunk/includes/Frontend/ActionController.php
r3132743 r3141427 5 5 6 6 use SpringDevs\Subscription\Illuminate\Action; 7 use SpringDevs\Subscription\Illuminate\Helper; 7 8 8 9 /** … … 12 13 */ 13 14 class ActionController { 14 15 15 16 16 /** … … 34 34 wp_die( esc_html( __( 'Sorry !! You cannot permit to access.', 'sdevs_subscrpt' ) ) ); 35 35 } 36 if ( 'renew' === $action && 'manual' === subscrpt_get_renewal_process() ) {37 $this->manual_renew_product( $subscrpt_id );36 if ( 'renew' === $action && ! subscrpt_is_auto_renew_enabled() ) { 37 $this->manual_renew_product( $subscrpt_id ); 38 38 } elseif ( 'cancelled' === $action ) { 39 $status = get_post_status( $subscrpt_id );40 $user_cancel = get_post_meta( $subscrpt_id, '_subscrpt_user_cancel', true );39 $status = get_post_status( $subscrpt_id ); 40 $user_cancel = get_post_meta( $subscrpt_id, '_subscrpt_user_cancel', true ); 41 41 if ( 'no' === $user_cancel ) { 42 42 return; … … 48 48 } elseif ( 'reactive' === $action ) { 49 49 Action::status( 'active', $subscrpt_id ); 50 } elseif ( 'renew-on' === $action ) { 51 update_post_meta( $subscrpt_id, '_subscrpt_auto_renew', 1 ); 52 } elseif ( 'renew-off' === $action ) { 53 update_post_meta( $subscrpt_id, '_subscrpt_auto_renew', 0 ); 54 } elseif ( 'renew' === $action && subscrpt_is_auto_renew_enabled() ) { 55 Helper::create_renewal_order( $subscrpt_id ); 50 56 } else { 51 57 do_action( 'subscrpt_execute_actions', $subscrpt_id, $action ); -
subscription/trunk/includes/Frontend/Cart.php
r3133657 r3141427 26 26 add_filter( 'woocommerce_add_cart_item_data', array( $this, 'set_renew_status' ), 10, 2 ); 27 27 add_action( 'woocommerce_check_cart_items', array( $this, 'check_cart_items' ) ); 28 add_filter( 'woocommerce_get_item_data', array( $this, 'set_line_item_meta' ), 10, 2 ); 29 add_action( 'woocommerce_before_calculate_totals', array( $this, 'add_calculation_price_filter' ) ); 30 add_action( 'woocommerce_calculate_totals', array( $this, 'remove_calculation_price_filter' ) ); 31 add_action( 'woocommerce_after_calculate_totals', array( $this, 'remove_calculation_price_filter' ) ); 32 add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'add_to_cart_validation' ), 10, 2 ); 33 } 34 35 /** 36 * Add to cart validation. 37 * 38 * @param bool $passed Passed ?. 39 * @param int $product_id Product Id. 40 * 41 * @return bool 42 */ 43 public function add_to_cart_validation( $passed, $product_id ) { 44 $cart_items = WC()->cart->cart_contents; 45 $error_notice = null; 46 $failed = false; 47 $product = wc_get_product( $product_id ); 48 $enabled = $product->get_meta( '_subscrpt_enabled' ); 49 foreach ( $cart_items as $key => $cart_item ) { 50 if ( isset( $cart_item['subscription'] ) ) { 51 if ( $enabled ) { 52 $error_notice = __( 'Currently You have an another Subscriptional product on cart !!', 'sdevs_subscrpt' ); 53 } else { 54 $error_notice = __( 'Currently You have Subscriptional product in a cart !!', 'sdevs_subscrpt' ); 55 } 56 $failed = true; 57 } elseif ( $enabled ) { 58 $failed = true; 59 $error_notice = __( 'Your cart isn\'t empty !!', 'sdevs_subscrpt' ); 60 } 61 } 62 63 if ( $failed ) { 64 wc_add_notice( $error_notice, 'error' ); 65 return false; 66 } 67 68 return $passed; 69 } 70 71 /** 72 * Add filter before cart calculation. 73 * 74 * @return void 75 */ 76 public function add_calculation_price_filter() { 77 add_filter( 'woocommerce_product_get_price', array( $this, 'set_prices_for_calculation' ), 100, 2 ); 78 } 79 80 /** 81 * Return 0 if product has trial. 82 * 83 * @param float $price Price. 84 * @param \WC_Product $product Product object. 85 * 86 * @return float 87 */ 88 public function set_prices_for_calculation( $price, $product ) { 89 if ( $product->get_meta( '_subscrpt_enabled' ) && $product->is_type( 'simple' ) ) { 90 $trial_time_per = $product->get_meta( '_subscrpt_trial_timing_per' ); 91 if ( ! empty( $trial_time_per ) && $trial_time_per > 0 && Helper::check_trial( $product->get_id() ) ) { 92 return 0; 93 } 94 } 95 return $price; 96 } 97 98 /** 99 * Remove filter after calculate calculation. 100 * 101 * @return void 102 */ 103 public function remove_calculation_price_filter() { 104 remove_filter( 'woocommerce_product_get_price', array( $this, 'set_prices_for_calculation' ), 100 ); 105 } 106 107 /** 108 * Set line item for display meta details. 109 * 110 * @param array $cart_item_data Cart Item Data. 111 * @param array $cart_item Cart Item. 112 * 113 * @return array 114 */ 115 public function set_line_item_meta( $cart_item_data, $cart_item ) { 116 if ( isset( $cart_item['subscription'] ) ) { 117 if ( $cart_item['subscription']['trial'] ) { 118 $cart_item_data[] = array( 119 'key' => __( 'Free Trial', 'sdevs_subscrpt' ), 120 'value' => $cart_item['subscription']['trial'], 121 'hidden' => true, 122 '__experimental_woocommerce_blocks_hidden' => false, 123 ); 124 } 125 } 126 127 return $cart_item_data; 28 128 } 29 129 … … 48 148 if ( isset( $value['subscription'] ) ) { 49 149 if ( $product->is_type( 'simple' ) ) { 50 if ( Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) ) !== $value['subscription']['type'] ) { 150 $product_trial_per = $product->get_meta( '_subscrpt_trial_timing_per' ); 151 $trial = null; 152 if ( Helper::check_trial( $product->get_id() ) ) { 153 $trial = ( $product_trial_per ? $product_trial_per . ' ' . Helper::get_typos( $product_trial_per ?? 1, $product->get_meta( '_subscrpt_trial_timing_option' ) ) 154 : null ); 155 } 156 if ( Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) ) !== $value['subscription']['type'] || $trial !== $value['subscription']['trial'] ) { 51 157 // remove the item. 52 158 wc_add_notice( __( 'An item which is no longer available was removed from your cart.', 'sdevs_subscrpt' ), 'error' ); … … 105 211 'readonly' => true, 106 212 'recurring_totals' => array( 107 'price' => array(213 'price' => array( 108 214 'description' => __( 'price of the subscription.', 'sdevs_subscrpt' ), 109 215 'type' => array( 'string' ), 110 216 'readonly' => true, 111 217 ), 112 'time' => array(218 'time' => array( 113 219 'description' => __( 'time of the subscription.', 'sdevs_subscrpt' ), 114 220 'type' => array( 'number' ), 115 221 'readonly' => true, 116 222 ), 117 'type' => array(223 'type' => array( 118 224 'description' => __( 'type of the subscription.', 'sdevs_subscrpt' ), 119 225 'type' => array( 'string' ), 120 226 'readonly' => true, 121 227 ), 122 'description' => array(228 'description' => array( 123 229 'description' => __( 'price of the subscription description.', 'sdevs_subscrpt' ), 230 'type' => array( 'string' ), 231 'readonly' => true, 232 ), 233 'can_user_cancel' => array( 234 'description' => __( 'Can User Cancel?', 'sdevs_subscrpt' ), 124 235 'type' => array( 'string' ), 125 236 'readonly' => true, … … 142 253 if ( isset( $cart_item['subscription'] ) && $cart_item['subscription']['type'] ) { 143 254 $cart_subscription = $cart_item['subscription']; 255 $start_date = Helper::start_date( $cart_subscription['trial'] ); 144 256 $next_date = Helper::next_date( 145 257 ( $cart_subscription['time'] ?? 1 ) . ' ' . $cart_subscription['type'], 146 258 $cart_subscription['trial'] 147 259 ); 148 $recurrings[] = apply_filters( 260 261 $recurrings[] = apply_filters( 149 262 'subscrpt_cart_recurring_data', 150 263 array( 151 'price' => ( $cart_item['subscription']['per_cost'] * $cart_item['quantity'] ) * 100, 152 'time' => $cart_subscription['time'], 153 'type' => $cart_subscription['type'], 154 'description' => 'Next billing on: ' . $next_date, 264 'price' => ( $cart_item['subscription']['per_cost'] * $cart_item['quantity'] ) * 100, 265 'time' => $cart_subscription['time'], 266 'type' => $cart_subscription['type'], 267 'description' => empty( $cart_subscription['trial'] ) ? 'Next billing on: ' . $next_date : 'First billing on: ' . $start_date, 268 'can_user_cancel' => $cart_item['data']->get_meta( '_subscrpt_user_cancel' ), 155 269 ), 156 270 $cart_item … … 219 333 if ( ! subscrpt_pro_activated() ) { 220 334 $item_data['time'] = null; 221 $item_data['trial'] = null;222 335 $item_data['signup_fee'] = null; 223 336 } … … 236 349 public function add_to_cart_item_data( $cart_item_data, $product_id ) { 237 350 $product = wc_get_product( $product_id ); 238 if ( $product->is_type( 'variable' ) ) {351 if ( ! $product->is_type( 'simple' ) ) { 239 352 return $cart_item_data; 240 353 } 241 354 $enabled = $product->get_meta( '_subscrpt_enabled' ); 242 355 if ( $enabled ) : 243 $price_type = $product->get_meta( '_subscrpt_timing_option' ); 244 $type = Helper::get_typos( 1, $price_type ); 245 $subscription_data = array(); 246 $subscription_data['time'] = null; 247 $subscription_data['type'] = $type; 248 $subscription_data['trial'] = null; 356 $price_type = $product->get_meta( '_subscrpt_timing_option' ); 357 $type = Helper::get_typos( 1, $price_type ); 358 $subscription_data = array(); 359 $subscription_data['time'] = null; 360 $subscription_data['type'] = $type; 361 $subscription_data['trial'] = null; 362 $trial_timing_per = $product->get_meta( '_subscrpt_trial_timing_per' ); 363 if ( $trial_timing_per && Helper::check_trial( $product->get_id() ) ) { 364 $subscription_data['trial'] = $trial_timing_per . ' ' . Helper::get_typos( $trial_timing_per, $product->get_meta( '_subscrpt_trial_timing_option' ) ); 365 } 249 366 $subscription_data['signup_fee'] = null; 250 367 $subscription_data['per_cost'] = $product->get_price(); 251 $cart_item_data['subscription'] = apply_filters( 'subscrpt_block_ cart_item_data', $subscription_data, $product, $cart_item_data );368 $cart_item_data['subscription'] = apply_filters( 'subscrpt_block_simple_cart_item_data', $subscription_data, $product, $cart_item_data ); 252 369 endif; 253 370 return $cart_item_data; … … 277 394 public function change_price_cart_html( $price, $cart_item ) { 278 395 $product = wc_get_product( $cart_item['product_id'] ); 279 if ( $product->is_type( 'variable' ) || subscrpt_pro_activated() ) {396 if ( ! $product->is_type( 'simple' ) ) { 280 397 return $price; 281 398 } … … 283 400 $enabled = $product->get_meta( '_subscrpt_enabled' ); 284 401 if ( $enabled ) : 285 $type = Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) ); 286 $price_html = $price . '/ ' . $type; 287 return $price_html; 402 $has_trial = Helper::check_trial( $product->get_id() ); 403 $trial = null; 404 $meta_trial_time = $product->get_meta( '_subscrpt_trial_timing_per' ); 405 if ( ! empty( $meta_trial_time ) && $meta_trial_time > 0 && $has_trial ) { 406 $trial = '<br/><small> + Get ' . $meta_trial_time . ' ' . Helper::get_typos( $meta_trial_time, $product->get_meta( '_subscrpt_trial_timing_option' ) ) . ' free trial!</small>'; 407 } 408 $timing_option = $product->get_meta( '_subscrpt_timing_option' ); 409 $type = Helper::get_typos( 1, $timing_option ); 410 411 return apply_filters( 'subscrpt_simple_price_html', ( $price . '/ ' . $type . $trial ), $product, $price, $timing_option, $trial ); 288 412 else : 289 413 return $price; … … 297 421 */ 298 422 public function add_rows_order_total() { 299 if ( subscrpt_pro_activated() ) {300 return;301 }302 423 $cart_items = WC()->cart->cart_contents; 303 $recurrs = array(); 304 foreach ( $cart_items as $cart_item ) { 305 $product = $cart_item['data']; 306 if ( ! $product->is_type( 'variable' ) && $product->get_meta( '_subscrpt_enabled' ) ) : 307 $type = Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) ); 308 $price_html = wc_price( $cart_item['line_subtotal'] ) . '/ ' . $type; 309 $start_date = null; 310 $next_date = Helper::next_date( 1 . ' ' . $type ); 311 $recurrs[] = apply_filters( 312 'subscrpt_single_recurring_item', 313 array( 314 'trial' => null, 315 'price_html' => $price_html, 316 'start_date' => $start_date, 317 'next_date' => $next_date, 318 ), 319 $product, 320 $cart_item 321 ); 322 endif; 323 } 424 $recurrs = Helper::get_recurrs_for_cart( $cart_items ); 324 425 if ( 0 === count( $recurrs ) ) { 325 426 return; … … 330 431 <td data-title="<?php esc_attr_e( 'Recurring totals', 'sdevs_subscrpt' ); ?>"> 331 432 <?php foreach ( $recurrs as $recurr ) : ?> 332 <?php if ( $recurr['trial'] ) : ?>333 433 <p> 334 434 <span><?php echo wp_kses_post( $recurr['price_html'] ); ?></span><br /> 335 <small><?php echo esc_html_e( 'First billing on', 'sdevs_subscrpt' ); ?>: <?php echo esc_html( $recurr['start_date'] ?? wp_date( get_option( 'date_format' ) ) ); ?></small> 435 <small><?php echo esc_html_e( ( $recurr['trial_status'] ? 'First billing on' : 'Next billing on' ), 'sdevs_subscrpt' ); ?>: <?php echo esc_html( $recurr['trial_status'] ? $recurr['start_date'] : $recurr['next_date'] ); ?></small> 436 <?php if ( 'yes' === $recurr['can_user_cancel'] ) : ?> 437 <br> 438 <small><?php echo esc_html_e( 'You can cancel subscription at any time!', 'sdevs_subscrpt' ); ?></small> 439 <?php endif; ?> 336 440 </p> 337 <?php else : ?>338 <p>339 <span><?php echo wp_kses_post( $recurr['price_html'] ); ?></span><br />340 <small><?php echo esc_html_e( 'Next billing on', 'sdevs_subscrpt' ); ?>: <?php echo wp_kses_post( $recurr['next_date'] ); ?></small>341 </p>342 <?php endif; ?>343 441 <?php endforeach; ?> 344 442 </td> -
subscription/trunk/includes/Frontend/Checkout.php
r3132743 r3141427 59 59 $product = wc_get_product( $order_item['product_id'] ); 60 60 61 if ( ! $product->is_type( 'variation' ) && ! subscrpt_pro_activated() ) {61 if ( $product->is_type( 'simple' ) && ! subscrpt_pro_activated() ) { 62 62 $enabled = $product->get_meta( '_subscrpt_enabled' ); 63 63 64 64 if ( $enabled ) { 65 65 $is_renew = isset( $order_item['renew_subscrpt'] ); 66 $type = Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) );67 66 68 $start_date = time();69 $next_date = sdevs_wp_strtotime( 1 . ' ' . $type, $start_date );70 67 $timing_option = $product->get_meta( '_subscrpt_timing_option' ); 68 $trial = null; 69 $has_trial = Helper::check_trial( $product->get_id() ); 70 71 $trial_per = $product->get_meta( '_subscrpt_trial_timing_per' ); 72 $trial_option = $product->get_meta( '_subscrpt_trial_timing_option' ); 73 if ( ! empty( $trial_per ) && $trial_per > 0 && ! $is_renew && $has_trial ) { 74 $trial = $trial_per . ' ' . Helper::get_typos( $trial_per, $trial_option ); 75 } 71 76 72 77 wc_update_order_item_meta( … … 74 79 '_subscrpt_meta', 75 80 array( 76 'time' => 1, 77 'type' => $timing_option, 78 'trial' => null, 79 'start_date' => $start_date, 80 'next_date' => $next_date, 81 'time' => 1, 82 'type' => $timing_option, 83 'trial' => $trial, 81 84 ) 82 85 ); … … 100 103 update_post_meta( $selected_subscription_id, '_subscrpt_timing_option', $timing_option ); 101 104 update_post_meta( $selected_subscription_id, '_subscrpt_price', $product->get_price() * $order_item['quantity'] ); 105 update_post_meta( $selected_subscription_id, '_subscrpt_user_cancel', $product->get_meta( '_subscrpt_user_cancel' ) ); 102 106 103 107 // order related. … … 106 110 107 111 // subscription related. 108 update_post_meta( $selected_subscription_id, '_subscrpt_start_date', $start_date ); 109 update_post_meta( $selected_subscription_id, '_subscrpt_next_date', $next_date ); 112 update_post_meta( $selected_subscription_id, '_subscrpt_trial', $trial ); 110 113 111 114 do_action( 'subscrpt_order_checkout', $selected_subscription_id, $order_item ); -
subscription/trunk/includes/Frontend/MyAccount.php
r3133657 r3141427 55 55 $next_date = get_post_meta( $id, '_subscrpt_next_date', true ); 56 56 $trial = get_post_meta( $id, '_subscrpt_trial', true ); 57 $trial_mode = get_post_meta( $id, '_subscrpt_trial_mode', true ); 57 58 58 59 $subscrpt_nonce = wp_create_nonce( 'subscrpt_nonce' ); … … 82 83 'url' => $order->get_checkout_payment_url(), 83 84 'label' => __( 'Pay now', 'sdevs_subscrpt' ), 85 ); 86 } 87 } 88 89 $is_auto_renew = get_post_meta( $id, '_subscrpt_auto_renew', true ); 90 $renewal_setting = get_option( 'subscrpt_auto_renewal_toggle', '1' ); 91 if ( '' === $is_auto_renew && '1' === $renewal_setting ) { 92 update_post_meta( $id, '_subscrpt_auto_renew', 1 ); 93 } 94 $saved_methods = wc_get_customer_saved_methods_list( get_current_user_id() ); 95 $has_methods = isset( $saved_methods['cc'] ); 96 if ( $has_methods && '1' === $renewal_setting && class_exists( 'WC_Stripe' ) && $order && 'stripe' === $order->get_payment_method() ) { 97 if ( '0' === $is_auto_renew ) { 98 $action_buttons['auto-renew-on'] = array( 99 'url' => subscrpt_get_action_url( 'renew-on', $subscrpt_nonce, $id ), 100 'label' => __( 'Turn on Auto Renewal', 'sdevs_subscrpt' ), 101 ); 102 } else { 103 $action_buttons['auto-renew-off'] = array( 104 'url' => subscrpt_get_action_url( 'renew-off', $subscrpt_nonce, $id ), 105 'label' => __( 'Turn off Auto Renewal', 'sdevs_subscrpt' ), 84 106 ); 85 107 } … … 96 118 'next_date' => $next_date, 97 119 'trial' => $trial, 120 'trial_mode' => empty( $trial_mode ) ? 'off' : $trial_mode, 98 121 'order' => $order, 99 122 'order_item' => $order_item, … … 119 142 * Change View Subscription Title 120 143 * 121 * @param String $title Title.122 * 123 * @return String144 * @param string $title Title. 145 * 146 * @return string 124 147 */ 125 148 public function change_single_title( string $title ): string { … … 131 154 * Change Subscription Lists Title 132 155 * 133 * @param String $title Title.134 * 135 * @return String156 * @param string $title Title. 157 * 158 * @return string 136 159 */ 137 160 public function change_lists_title( string $title ): string { -
subscription/trunk/includes/Frontend/Order.php
r3133657 r3141427 41 41 $post = $history->subscription_id; 42 42 $cost = get_post_meta( $post, '_subscrpt_price', true ); 43 $order = $order_item->get_order(); 44 $start_date = get_post_meta( $history->subscription_id, '_subscrpt_start_date', true ); 43 45 44 46 $trial_status = null !== $order_item_meta['trial']; … … 77 79 <tr> 78 80 <th scope="row"><?php esc_html_e( 'Next billing on', 'sdevs_subscrpt' ); ?>:</th> 79 <td><?php echo esc_html( gmdate( 'F d, Y', $order_item_meta['next_date'] ) ); ?></td>81 <td><?php echo $order->has_status( 'completed' ) ? esc_html( gmdate( 'F d, Y', get_post_meta( $history->subscription_id, '_subscrpt_next_date', true ) ) ) : '-'; ?></td> 80 82 </tr> 81 83 <?php } else { ?> 82 84 <tr> 83 85 <th scope="row"><?php esc_html_e( 'Trial', 'sdevs_subscrpt' ); ?>:</th> 84 <td><?php echo esc_html( $order_item_meta['trial']); ?></td>86 <td><?php echo esc_html( get_post_meta( $history->subscription_id, '_subscrpt_trial', true ) ); ?></td> 85 87 </tr> 86 88 <tr> 87 89 <th scope="row"><?php esc_html_e( 'First billing on', 'sdevs_subscrpt' ); ?>:</th> 88 <td><?php echo esc_html( gmdate( 'F d, Y', $order_item_meta['start_date'] ) ); ?></td>90 <td><?php echo ! empty( $start_date ) ? esc_html( gmdate( 'F d, Y', $start_date ) ) : '-'; ?></td> 89 91 </tr> 90 92 <?php } ?> -
subscription/trunk/includes/Frontend/Product.php
r3132743 r3141427 23 23 add_filter( 'woocommerce_store_api_product_quantity_maximum', array( $this, 'update_quantity_min_max' ), 10, 2 ); 24 24 add_action( 'woocommerce_after_cart_item_quantity_update', array( $this, 'validate_quantity_on_manual_renewal' ), 10, 2 ); 25 add_filter( 'woocommerce_is_purchasable', array( $this, 'check_if_purchasable' ), 20, 2 ); 26 add_action( 'woocommerce_single_product_summary', array( $this, 'text_if_active' ) ); 27 add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'remove_button_active_products' ), 10, 2 ); 28 } 29 30 /** 31 * Remove button if product already subscribed. 32 * 33 * @param mixed $button Button. 34 * @param \WC_Product $product Product. 35 * 36 * @return mixed 37 */ 38 public function remove_button_active_products( $button, $product ) { 39 if ( ! $product->is_type( 'simple' ) ) { 40 return $button; 41 } 42 $enabled = $product->get_meta( '_subscrpt_enabled' ); 43 if ( $enabled ) { 44 $limit = $product->get_meta( '_subscrpt_limit' ); 45 if ( 'one' === $limit ) { 46 $unexpired = Helper::subscription_exists( $product->get_id(), array( 'active', 'pending' ) ); 47 if ( $unexpired ) { 48 return; 49 } 50 } elseif ( 'only_one' === $limit && ! Helper::check_trial( $product->get_id() ) ) { 51 return; 52 } 53 } 54 55 return $button; 56 } 57 58 /** 59 * Display notice if already purchased. 60 */ 61 public function text_if_active() { 62 global $product; 63 if ( ! $product->is_type( 'simple' ) ) { 64 return; 65 } 66 $enabled = $product->get_meta( '_subscrpt_enabled' ); 67 if ( $enabled ) { 68 $limit = $product->get_meta( '_subscrpt_limit' ); 69 if ( 'unlimited' === $limit ) { 70 return; 71 } 72 if ( 'one' === $limit ) { 73 $unexpired = Helper::subscription_exists( $product->get_id(), array( 'active', 'pending' ) ); 74 if ( ! $unexpired ) { 75 return false; 76 } else { 77 echo '<strong>' . esc_html_e( 'You Already Subscribed These Product!', 'sdevs_subscrpt' ) . '</strong>'; 78 } 79 } 80 if ( 'only_one' === $limit ) { 81 if ( ! Helper::check_trial( $product->get_id() ) ) { 82 echo '<strong>' . esc_html_e( 'You Already Subscribed These Product!', 'sdevs_subscrpt' ) . '</strong>'; 83 } 84 } 85 } 86 } 87 88 /** 89 * Check if product pruchasable. 90 * 91 * @param boolean $is_purchasable True\False. 92 * @param \WC_Product $product Product. 93 * 94 * @return boolean 95 */ 96 public function check_if_purchasable( $is_purchasable, $product ) { 97 $enabled = $product->get_meta( '_subscrpt_enabled' ); 98 if ( $enabled ) { 99 $limit = $product->get_meta( '_subscrpt_limit' ); 100 if ( 'unlimited' === $limit ) { 101 return true; 102 } elseif ( 'only_one' === $limit ) { 103 return Helper::check_trial( $product->get_id() ); 104 } elseif ( 'one' === $limit ) { 105 return ! Helper::subscription_exists( $product->get_id(), array( 'active', 'pending' ) ); 106 } 107 } 108 return $is_purchasable; 25 109 } 26 110 … … 138 222 */ 139 223 public function change_price_html( $price, $product ) { 140 if ( $product->is_type( 'variable' ) || '' === $price || subscrpt_pro_activated()) {224 if ( ! $product->is_type( 'simple' ) || '' === $price ) { 141 225 return $price; 142 226 } … … 144 228 $enabled = $product->get_meta( '_subscrpt_enabled' ); 145 229 if ( $enabled ) : 146 $type = Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) ); 147 148 $price_html = $price . ' / ' . $type; 149 return $price_html; 230 $timing_option = $product->get_meta( '_subscrpt_timing_option' ); 231 $type = Helper::get_typos( 1, $timing_option ); 232 $meta_trial_time = $product->get_meta( '_subscrpt_trial_timing_per' ); 233 $has_trial = Helper::check_trial( $product->get_id() ); 234 $trial = null; 235 if ( ! empty( $meta_trial_time ) && $meta_trial_time > 0 && $has_trial ) { 236 $trial = '<br/><small> + Get ' . $meta_trial_time . ' ' . Helper::get_typos( $meta_trial_time, $product->get_meta( '_subscrpt_trial_timing_option' ) ) . ' free trial!</small>'; 237 } 238 239 return apply_filters( 'subscrpt_simple_price_html', ( $price . ' / ' . $type . $trial ), $product, $price, $timing_option, $trial ); 150 240 else : 151 241 return $price; -
subscription/trunk/includes/Illuminate.php
r3132743 r3141427 4 4 5 5 use SpringDevs\Subscription\Frontend\Checkout; 6 use SpringDevs\Subscription\Illuminate\AutoRenewal; 7 use SpringDevs\Subscription\Illuminate\Block; 6 8 use SpringDevs\Subscription\Illuminate\Cron; 9 use SpringDevs\Subscription\Illuminate\Email; 10 use SpringDevs\Subscription\Illuminate\Order; 7 11 use SpringDevs\Subscription\Illuminate\Post; 12 use SpringDevs\Subscription\Illuminate\Stripe; 8 13 9 14 /** … … 12 17 class Illuminate { 13 18 14 15 19 /** 16 20 * Initialize the Class. 17 21 */ 18 22 public function __construct() { 19 $this->dispatch_actions(); 23 $this->stripe_initialization(); 24 new Order(); 20 25 new Cron(); 21 26 new Post(); 27 new Block(); 22 28 new Checkout(); 29 new AutoRenewal(); 30 new Email(); 23 31 } 24 32 25 33 /** 26 * Dispatch and bind actions34 * Stripe Initialization. 27 35 * 28 36 * @return void 29 37 */ 30 public function dispatch_actions() { 31 add_action( 32 'woocommerce_blocks_loaded', 33 function () { 34 require_once __DIR__ . '/Illuminate/wc-block-integration.php'; 35 add_action( 36 'woocommerce_blocks_cart_block_registration', 37 function ( $integration_registry ) { 38 $integration_registry->register( new \Sdevs_Subscrpt_WC_Integration() ); 39 } 40 ); 41 add_action( 42 'woocommerce_blocks_checkout_block_registration', 43 function ( $integration_registry ) { 44 $integration_registry->register( new \Sdevs_Subscrpt_WC_Integration() ); 45 } 46 ); 47 } 48 ); 38 public function stripe_initialization() { 39 if ( function_exists( 'woocommerce_gateway_stripe' ) ) { 40 include_once dirname( WC_STRIPE_MAIN_FILE ) . '/includes/compat/trait-wc-stripe-subscriptions-utilities.php'; 41 include_once dirname( WC_STRIPE_MAIN_FILE ) . '/includes/compat/trait-wc-stripe-pre-orders.php'; 42 include_once dirname( WC_STRIPE_MAIN_FILE ) . '/includes/compat/trait-wc-stripe-subscriptions.php'; 43 include_once dirname( WC_STRIPE_MAIN_FILE ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; 44 45 new Stripe(); 46 } 49 47 } 50 48 } -
subscription/trunk/includes/Illuminate/Action.php
r3083564 r3141427 10 10 class Action { 11 11 12 13 12 /** 14 13 * Did when status changes. 15 14 * 16 15 * @param string $status Status. 17 * @param Int $subscription_id Subscription ID.16 * @param int $subscription_id Subscription ID. 18 17 * @param bool $write_comment Write comment?. 19 18 */ … … 93 92 ); 94 93 update_comment_meta( $comment_id, '_subscrpt_activity', 'Subscription Activated' ); 95 96 94 do_action( 'subscrpt_subscription_activated', $subscription_id ); 97 95 } -
subscription/trunk/includes/Illuminate/Comments.php
r2708268 r3141427 10 10 class Comments { 11 11 12 /** 13 * Initialize the class. 14 */ 12 15 public function __construct() { 13 16 add_action( 'admin_init', array( $this, 'remove_comments_metabox' ) ); 14 17 } 15 18 19 /** 20 * Remove Comments related metaboxes from `subscrpt_order` post. 21 * 22 * @return void 23 */ 16 24 public function remove_comments_metabox() { 17 25 remove_meta_box( 'commentsdiv', 'subscrpt_order', 'normal' ); -
subscription/trunk/includes/Illuminate/Email.php
r3070491 r3141427 34 34 <tr> 35 35 <h2><?php esc_html_e( 'Related Subscriptions', 'sdevs_subscrpt' ); ?></h2> 36 <?php 37 if ( ! $order->has_status( 'completed' ) ) : 38 ?> 39 <p><small>Your subscription will be activated when order status is completed.</small></p> 40 <?php endif; ?> 36 41 </tr> 37 42 <?php 38 43 foreach ( $histories as $history ) : 39 $item = $order->get_item( $history->order_item_id ); 40 $item_meta = wc_get_order_item_meta( $history->order_item_id, '_subscrpt_meta', true ); 41 $subscription_id = $history->subscription_id; 42 $has_trial = isset( $item_meta['trial'] ) && strlen( $item_meta['trial'] ) > 2; 44 $item = $order->get_item( $history->order_item_id ); 45 $item_meta = wc_get_order_item_meta( $history->order_item_id, '_subscrpt_meta', true ); 46 $subscription_id = $history->subscription_id; 47 $subscription_status_object = get_post_status_object( get_post_status( $subscription_id ) ); 48 $cost = get_post_meta( $subscription_id, '_subscrpt_price', true ); 49 $has_trial = isset( $item_meta['trial'] ) && strlen( $item_meta['trial'] ) > 2; 50 $start_date = get_post_meta( $subscription_id, '_subscrpt_start_date', true ); 51 $next_date = get_post_meta( $subscription_id, '_subscrpt_next_date', true ); 43 52 ?> 44 53 <tr> … … 51 60 </tr> 52 61 <tr> 53 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php _e( 'Status:', 'sdevs_subscrpt' ); ?> </th>54 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo get_post_status( $subscription_id); ?></td>62 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'Status:', 'sdevs_subscrpt' ); ?> </th> 63 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo esc_html( $subscription_status_object->label ); ?></td> 55 64 </tr> 56 65 <tr> 57 66 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"> 58 <?php _e( 'Recurring amount:', 'sdevs_subscrpt' ); ?> </th>59 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo Helper::format_price_with_order_item( $item->get_total(), $item->get_id() ); ?></td>67 <?php esc_html_e( 'Recurring amount:', 'sdevs_subscrpt' ); ?> </th> 68 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo wp_kses_post( Helper::format_price_with_order_item( $cost, $item->get_id() ) ); ?></td> 60 69 </tr> 61 70 <?php if ( ! $has_trial ) { ?> 62 71 <tr> 63 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php _e( 'Next billing on', 'sdevs_subscrpt' ); ?>: </th>64 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo date( 'F d, Y', $item_meta['next_date'] ); ?></td>72 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'Next billing on', 'sdevs_subscrpt' ); ?>: </th> 73 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo ! empty( $next_date ) ? esc_html( gmdate( 'F d, Y', $next_date ) ) : '-'; ?></td> 65 74 </tr> 66 75 <?php } else { ?> 67 76 <tr> 68 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php _e( 'Trial', 'sdevs_subscrpt' ); ?>: </th>77 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'Trial', 'sdevs_subscrpt' ); ?>: </th> 69 78 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo esc_html( $item_meta['trial'] ); ?></td> 70 79 </tr> 71 80 <tr> 72 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php _e( 'First billing on', 'sdevs_subscrpt' ); ?>: </th>73 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo date( 'F d, Y', $item_meta['start_date'] ); ?></td>81 <th class="td" scope="row" colspan="2" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'First billing on', 'sdevs_subscrpt' ); ?>: </th> 82 <td class="td" style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo ! empty( $start_date ) ? esc_html( gmdate( 'F d, Y', $start_date ) ) : '-'; ?></td> 74 83 </tr> 75 84 <?php } ?> -
subscription/trunk/includes/Illuminate/Helper.php
r3132743 r3141427 51 51 * Generate next date 52 52 * 53 * @param mixed$time Time.54 * @param Null|String $trial Trial.55 * 56 * @return String53 * @param string $time Time. 54 * @param null|string $trial Trial. 55 * 56 * @return string 57 57 */ 58 58 public static function next_date( $time, $trial = null ) { … … 239 239 * Get total subscriptions by product ID. 240 240 * 241 * @param Int $product_id Product ID.242 * @param String | array $status Status.241 * @param int $product_id Product ID. 242 * @param string | array $status Status. 243 243 * 244 244 * @return \WP_Post | false … … 353 353 return $subscription_id; 354 354 } 355 356 /** 357 * Get recurrings items from cart items. 358 * 359 * @param array $cart_items Cart items. 360 * 361 * @return array 362 */ 363 public static function get_recurrs_for_cart( $cart_items ) { 364 $recurrs = array(); 365 foreach ( $cart_items as $key => $cart_item ) { 366 $product = $cart_item['data']; 367 if ( $product->is_type( 'simple' ) && isset( $cart_item['subscription'] ) ) { 368 $cart_subscription = $cart_item['subscription']; 369 $type = $cart_subscription['type']; 370 371 $price_html = wc_price( $cart_subscription['per_cost'] * $cart_item['quantity'] ) . '/ ' . $type; 372 $recurrs[ $key ] = array( 373 'trial_status' => ! is_null( $cart_subscription['trial'] ), 374 'price_html' => $price_html, 375 'start_date' => self::start_date( $cart_subscription['trial'] ), 376 'next_date' => self::next_date( ( $cart_subscription['time'] ?? 1 ) . ' ' . $cart_subscription['type'], $cart_subscription['trial'] ), 377 'can_user_cancel' => $cart_item['data']->get_meta( '_subscrpt_user_cancel' ), 378 ); 379 } 380 } 381 382 return apply_filters( 'subscrpt_cart_recurring_items', $recurrs, $cart_items ); 383 } 384 385 /** 386 * Create renewal order when subscription expired. [wip] 387 * 388 * @param int $subscription_id Subscription ID. 389 * @throws \WC_Data_Exception Exception. 390 * @throws \Exception Exception. 391 */ 392 public static function create_renewal_order( $subscription_id ) { 393 $order_item_id = get_post_meta( $subscription_id, '_subscrpt_order_item_id', true ); 394 $order_id = wc_get_order_id_by_order_item_id( $order_item_id ); 395 $old_order = self::check_order_for_renewal( $order_id ); 396 397 if ( ! $old_order ) { 398 return; 399 } 400 401 $order_item = $old_order->get_item( $order_item_id ); 402 $subscription_price = get_post_meta( $subscription_id, '_subscrpt_price', true ); 403 $product_args = array( 404 'name' => $order_item->get_name(), 405 'subtotal' => $subscription_price, 406 'total' => $subscription_price, 407 ); 408 409 // creating new order. 410 $new_order_data = self::create_new_order_for_renewal( $old_order, $order_item, $product_args ); 411 if ( ! $new_order_data ) { 412 return; 413 } 414 $new_order = $new_order_data['order']; 415 $new_order_item_id = $new_order_data['order_item_id']; 416 417 self::create_renewal_history( $subscription_id, $new_order->get_id(), $new_order_item_id ); 418 update_post_meta( $subscription_id, '_subscrpt_order_id', $new_order->get_id() ); 419 update_post_meta( $subscription_id, '_subscrpt_order_item_id', $new_order_item_id ); 420 421 self::clone_order_metadata( $new_order, $old_order ); 422 self::clone_stripe_metadata_for_renewal( $subscription_id, $old_order, $new_order ); 423 424 $new_order->calculate_totals(); 425 $new_order->save(); 426 if ( ! is_admin() ) { 427 $message = 'Renewal Order(#' . $new_order->get_id() . ') Created.'; 428 if ( $new_order->has_status( 'pending' ) ) { 429 $message .= 'Please <a href="' . $new_order->get_checkout_payment_url() . '">Pay now</a>'; 430 } 431 wc_add_notice( $message, 'success' ); 432 } 433 434 do_action( 'subscrpt_after_create_renew_order', $new_order, $old_order, $subscription_id, false ); 435 } 436 437 /** 438 * Clone stripe metadata from old order. 439 * 440 * @param int $subscription_id Subscription Id. 441 * @param \WC_Order $old_order Old Order Object. 442 * @param \WC_Order $new_order New Order Object. 443 * 444 * @return void 445 */ 446 public static function clone_stripe_metadata_for_renewal( $subscription_id, $old_order, $new_order ) { 447 $is_auto_renew = get_post_meta( $subscription_id, '_subscrpt_auto_renew', true ); 448 $stripe_enabled = ( 'stripe' === $old_order->get_payment_method() && in_array( $is_auto_renew, array( 1, '1' ), true ) && subscrpt_is_auto_renew_enabled() && '1' === get_option( 'subscrpt_stripe_auto_renew', '1' ) ); 449 if ( $stripe_enabled ) { 450 $new_order->update_meta_data( '_stripe_customer_id', $old_order->get_meta( '_stripe_customer_id' ) ); 451 $new_order->update_meta_data( '_stripe_source_id', $old_order->get_meta( '_stripe_source_id' ) ); 452 $new_order->set_payment_method( $old_order->get_payment_method() ); 453 $new_order->set_payment_method_title( $old_order->get_payment_method_title() ); 454 } 455 } 456 457 /** 458 * Create history for renewal. 459 * 460 * @param int $subscription_id Subscription Id. 461 * @param int $new_order_id New Order Id. 462 * @param int $new_order_item_id New Order Item Id. 463 * 464 * @return void 465 */ 466 public static function create_renewal_history( $subscription_id, $new_order_id, $new_order_item_id ) { 467 global $wpdb; 468 $history_table = $wpdb->prefix . 'subscrpt_order_relation'; 469 $wpdb->insert( 470 $history_table, 471 array( 472 'subscription_id' => $subscription_id, 473 'order_id' => $new_order_id, 474 'order_item_id' => $new_order_item_id, 475 'type' => 'renew', 476 ) 477 ); 478 479 $comment_id = wp_insert_comment( 480 array( 481 'comment_author' => 'Subscription for WooCommerce', 482 'comment_content' => sprintf( 'Subscription Renewal order successfully created. order is %s', $new_order_id ), 483 'comment_post_ID' => $subscription_id, 484 'comment_type' => 'order_note', 485 ) 486 ); 487 update_comment_meta( $comment_id, '_subscrpt_activity', 'Renewal Order' ); 488 } 489 490 /** 491 * Create new order for renewal. 492 * 493 * @param \WC_Order $old_order Old Order Object. 494 * @param \WC_Order_Item $order_item Old Order Item Object. 495 * @param array $product_args Product args for add product. 496 * 497 * @return array|false 498 */ 499 public static function create_new_order_for_renewal( \WC_Order $old_order, \WC_Order_Item $order_item, array $product_args ) { 500 $product = $order_item->get_product(); 501 $user_id = $old_order->get_user_id(); 502 $new_order = wc_create_order( 503 array( 504 'customer_id' => $user_id, 505 'status' => 'pending', 506 ) 507 ); 508 $product_meta = apply_filters( 'subscrpt_renewal_item_meta', wc_get_order_item_meta( $order_item->get_id(), '_subscrpt_meta', true ), $product, $order_item ); 509 $product_args = apply_filters( 'subscrpt_renewal_product_args', $product_args, $product, $order_item ); 510 if ( ! $product_args ) { 511 return false; 512 } 513 514 $new_order_item_id = $new_order->add_product( 515 $product, 516 $order_item->get_quantity(), 517 $product_args 518 ); 519 wc_update_order_item_meta( 520 $new_order_item_id, 521 '_subscrpt_meta', 522 array( 523 'time' => $product_meta['time'], 524 'type' => $product_meta['type'], 525 'trial' => null, 526 ) 527 ); 528 529 return array( 530 'order' => $new_order, 531 'order_item_id' => $new_order_item_id, 532 ); 533 } 534 535 /** 536 * Check if old order is completed or deleted! 537 * 538 * @param mixed $old_order_id Old Order Id. 539 * 540 * @return \WC_Order|false 541 */ 542 public static function check_order_for_renewal( $old_order_id ) { 543 $old_order = wc_get_order( $old_order_id ); 544 if ( ! $old_order || 'completed' !== $old_order->get_status() ) { 545 if ( ! is_admin() ) { 546 return wc_add_notice( __( 'Subscription renewal isn\'t possible due to previous order not completed or deletion.', 'sdevs_subscrpt' ), 'error' ); 547 } 548 return false; 549 } 550 551 return $old_order; 552 } 553 554 /** 555 * Save meta-data from old order 556 * 557 * @param \WC_Order $new_order new order object. 558 * @param \WC_Order $old_order old order object. 559 * 560 * @return void 561 */ 562 public static function clone_order_metadata( $new_order, $old_order ) { 563 $new_order->set_customer_id( $old_order->get_customer_id() ); 564 $new_order->set_currency( $old_order->get_currency() ); 565 566 // 3 Add Billing Fields 567 $customer = new \WC_Customer( $old_order->get_customer_id() ); 568 $new_order->set_billing_city( $customer->get_billing_city() ); 569 $new_order->set_billing_state( $customer->get_billing_state() ); 570 $new_order->set_billing_postcode( $customer->get_billing_postcode() ); 571 $new_order->set_billing_email( $customer->get_billing_email() ); 572 $new_order->set_billing_phone( $customer->get_billing_phone() ); 573 $new_order->set_billing_address_1( $customer->get_billing_address_1() ); 574 $new_order->set_billing_address_2( $customer->get_billing_address_2() ); 575 $new_order->set_billing_country( $customer->get_billing_country() ); 576 $new_order->set_billing_first_name( $customer->get_billing_first_name() ); 577 $new_order->set_billing_last_name( $customer->get_billing_last_name() ); 578 $new_order->set_billing_company( $customer->get_billing_company() ); 579 580 // 4 Add Shipping Fields 581 $new_order->set_shipping_country( $customer->get_shipping_country() ); 582 $new_order->set_shipping_first_name( $customer->get_shipping_first_name() ); 583 $new_order->set_shipping_last_name( $customer->get_shipping_last_name() ); 584 $new_order->set_shipping_company( $customer->get_shipping_company() ); 585 $new_order->set_shipping_address_1( $customer->get_shipping_address_1() ); 586 $new_order->set_shipping_address_2( $customer->get_shipping_address_2() ); 587 $new_order->set_shipping_city( $customer->get_shipping_city() ); 588 $new_order->set_shipping_state( $customer->get_shipping_state() ); 589 $new_order->set_shipping_postcode( $customer->get_shipping_postcode() ); 590 } 355 591 } -
subscription/trunk/includes/Illuminate/Order.php
r3132743 r3141427 14 14 */ 15 15 public function __construct() { 16 // add_filter( 'woocommerce_order_formatted_line_subtotal', array( $this, 'format_order_price' ), 10, 3 );17 16 add_action( 'woocommerce_admin_order_item_headers', array( $this, 'register_custom_column' ) ); 18 17 add_action( 'woocommerce_admin_order_item_values', array( $this, 'add_column_value' ), 10, 2 ); … … 20 19 add_action( 'woocommerce_order_status_changed', array( $this, 'order_status_changed' ) ); 21 20 add_action( 'woocommerce_before_delete_order', array( $this, 'delete_the_subscription' ) ); 22 } 23 24 public function format_order_price( $subtotal, $item, $order ) { 25 $price_html = Helper::format_price_with_order_item( 26 $item->get_subtotal(), 27 $item->get_id(), 28 true 29 ); 30 31 if ( ! $price_html ) { 32 return $subtotal; 33 } 34 35 return $price_html; 21 add_action( 'subscrpt_subscription_activated', array( $this, 'generate_dates_for_subscription' ) ); 22 } 23 24 /** 25 * Generate start, next and trial dates. 26 * 27 * @param int $subscription_id Subscription Id. 28 * 29 * @return void 30 */ 31 public function generate_dates_for_subscription( $subscription_id ) { 32 $order_item_id = get_post_meta( $subscription_id, '_subscrpt_order_item_id', true ); 33 $subscription_history = Helper::get_subscription_from_order_item_id( $order_item_id ); 34 35 $order_item_meta = wc_get_order_item_meta( $order_item_id, '_subscrpt_meta' ); 36 $type = Helper::get_typos( 1, $order_item_meta['type'] ); 37 $trial = get_post_meta( $subscription_id, '_subscrpt_trial', true ); 38 if ( 'new' === $subscription_history->type ) { 39 $start_date = time(); 40 $next_date = sdevs_wp_strtotime( 1 . ' ' . $type, $start_date ); 41 if ( $trial && ! empty( $trial ) ) { 42 $trial_started = get_post_meta( $subscription_id, '_subscrpt_trial_started', true ); 43 $trial_ended = get_post_meta( $subscription_id, '_subscrpt_trial_ended', true ); 44 if ( empty( $trial_started ) && empty( $trial_ended ) ) { 45 $start_date = sdevs_wp_strtotime( $trial ); 46 update_post_meta( $subscription_id, '_subscrpt_trial_started', time() ); 47 update_post_meta( $subscription_id, '_subscrpt_trial_ended', $start_date ); 48 update_post_meta( $subscription_id, '_subscrpt_trial_mode', 'on' ); 49 $next_date = $start_date; 50 } 51 } 52 update_post_meta( $subscription_id, '_subscrpt_start_date', $start_date ); 53 } elseif ( 'renew' === $subscription_history->type ) { 54 if ( $trial ) { 55 delete_post_meta( $subscription_id, '_subscrpt_trial' ); 56 delete_post_meta( $subscription_id, '_subscrpt_trial_mode' ); 57 delete_post_meta( $subscription_id, '_subscrpt_trial_started' ); 58 delete_post_meta( $subscription_id, '_subscrpt_trial_ended' ); 59 } 60 $next_date = sdevs_wp_strtotime( 1 . ' ' . $type, time() ); 61 } elseif ( 'early-renew' === $subscription_history->type ) { 62 $next_date = sdevs_wp_strtotime( 1 . ' ' . $type, get_post_meta( $subscription_id, '_subscrpt_next_date', true ) ); 63 64 if ( $trial ) { 65 $trial_mode = get_post_meta( $subscription_id, '_subscrpt_trial_mode', true ); 66 if ( 'on' === $trial_mode ) { 67 update_post_meta( $subscription_id, '_subscrpt_trial_mode', 'extended' ); 68 $next_date = sdevs_wp_strtotime( 1 . ' ' . $type, get_post_meta( $subscription_id, '_subscrpt_trial_ended', true ) ); 69 } 70 } 71 } 72 update_post_meta( $subscription_id, '_subscrpt_next_date', $next_date ); 36 73 } 37 74 … … 99 136 */ 100 137 public function order_status_changed( $order_id ) { 101 $order = new \WC_Order( $order_id );138 $order = wc_get_order( $order_id ); 102 139 $post_status = 'active'; 103 140 … … 105 142 case 'on-hold': 106 143 case 'pending': 107 case 'processing':108 144 $post_status = 'pending'; 109 145 break; -
subscription/trunk/includes/functions.php
r3133657 r3141427 68 68 * Get renewal process settings. 69 69 * 70 * @return string70 * @return bool 71 71 */ 72 function subscrpt_get_renewal_process() { 73 if ( ! subscrpt_pro_activated() ) { 74 return 'manual'; 75 } else { 76 return get_option( 'subscrpt_renewal_process', 'auto' ); 77 } 72 function subscrpt_is_auto_renew_enabled() { 73 return 'auto' === get_option( 'subscrpt_renewal_process', 'auto' ); 78 74 } 79 75 … … 137 133 } 138 134 } 135 136 if ( ! function_exists( 'get_timing_types' ) ) { 137 /** 138 * Get labels. 139 * 140 * @param bool $key_value key_value. 141 * 142 * @return array 143 */ 144 function get_timing_types( $key_value = false ): array { 145 return $key_value ? array( 146 'days' => 'Daily', 147 'weeks' => 'Weekly', 148 'months' => 'Monthly', 149 'years' => 'Yearly', 150 ) : array( 151 array( 152 'label' => __( 'day(s)', 'sdevs_subscrpt' ), 153 'value' => 'days', 154 ), 155 array( 156 'label' => __( 'week(s)', 'sdevs_subscrpt' ), 157 'value' => 'weeks', 158 ), 159 array( 160 'label' => __( 'month(s)', 'sdevs_subscrpt' ), 161 'value' => 'months', 162 ), 163 array( 164 'label' => __( 'year(s)', 'sdevs_subscrpt' ), 165 'value' => 'years', 166 ), 167 ); 168 } 169 } -
subscription/trunk/readme.txt
r3133657 r3141427 81 81 == Changelog == 82 82 83 = 1.3 = 84 - **New**: Stripe renewal added. 85 - **New**: Trial feature added. 86 - **New**: Subscription limit added. 87 - **Fix**: Cancel by customer. 88 - **Update**: Improve user experience and bug fixing! 89 83 90 = 1.2.1 = 84 91 - **Fix**: pagination bug on `subscriptions` template. -
subscription/trunk/subscription.php
r3133657 r3141427 4 4 Plugin URI: https://wordpress.org/plugins/subscription 5 5 Description: Allow your customers to order once and get their products and services every month/week. 6 Version: 1. 2.16 Version: 1.3 7 7 Author: SpringDevs 8 8 Author URI: https://springdevs.com/ … … 60 60 * @var string 61 61 */ 62 const version = '1. 2.1';62 const version = '1.3.0'; 63 63 64 64 /** … … 186 186 } 187 187 188 if ( $this->is_request( 'ajax' ) ) { 189 // require_once SUBSCRPT_INCLUDES . '/class-ajax.php'; 190 } 188 $this->container['illuminate'] = new SpringDevs\Subscription\Illuminate(); 191 189 } 192 190 -
subscription/trunk/templates/myaccount/single.php
r3133657 r3141427 8 8 * @var string $next_date 9 9 * @var string|null $trial 10 * @var string|null $trial_mode 10 11 * @var stdClass $status 11 12 * @var array $action_buttons … … 34 35 margin-bottom: 10px; 35 36 } 37 .subscrpt_action_buttons { 38 display: flex; 39 flex-wrap: wrap; 40 gap: 10px; 41 } 36 42 </style> 37 43 <table class="woocommerce-table woocommerce-table--order-details shop_table order_details subscription_details"> … … 45 51 <td><span class="subscrpt-<?php echo esc_html( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></span></td> 46 52 </tr> 53 <?php if ( null != $trial && 'off' !== $trial ) : ?> 47 54 <tr> 48 <td><?php esc_html_e( ' Start date', 'sdevs_subscrpt' ); ?></td>49 <td><?php echo esc_html( gmdate( 'F d, Y', $start_date )); ?></td>55 <td><?php esc_html_e( 'Trial', 'sdevs_subscrpt' ); ?></td> 56 <td><?php echo esc_html( $trial ); ?></td> 50 57 </tr> 51 <?php if ( null == $trial ) : ?> 58 <?php endif; ?> 59 <tr> 60 <td><?php esc_html_e( ( 'null' == $trial || 'off' === $trial_mode ? 'Start date' : ( 'extended' === $trial_mode ? 'Trial End & Subscription Start' : 'Trial End & First Billing' ) ), 'sdevs_subscrpt' ); ?></td> 61 <td><?php echo esc_html( ! empty( $start_date ) ? gmdate( 'F d, Y', $start_date ) : '-' ); ?></td> 62 </tr> 63 <?php if ( null == $trial || in_array( $trial_mode, array( 'off', 'extended' ), true ) ) : ?> 52 64 <tr> 53 <td><?php esc_html_e( 'Next payment date', 'sdevs_subscrpt' ); ?></td> 54 <td><?php echo esc_html( gmdate( 'F d, Y', $next_date ) ); ?></td> 55 </tr> 56 <?php else : ?> 57 <tr> 58 <td><?php esc_html_e( 'Trial', 'sdevs_subscrpt' ); ?></td> 59 <td><?php echo esc_html( $trial ); ?></td> 60 </tr> 61 <tr> 62 <td><?php esc_html_e( 'Trial End & First Billing', 'sdevs_subscrpt' ); ?></td> 63 <td><?php echo esc_html( gmdate( 'F d, Y', $next_date ) ); ?></td> 65 <td> 66 <?php 67 esc_html_e( 'Next payment date', 'sdevs_subscrpt' ); 68 ?> 69 </td> 70 <td> 71 <?php echo esc_html( ! empty( $next_date ) ? gmdate( 'F d, Y', $next_date ) : '-' ); ?> 72 </td> 64 73 </tr> 65 74 <?php endif; ?> 75 <?php if ( ! empty( $order->get_payment_method_title() ) ) : ?> 66 76 <tr> 67 77 <td><?php esc_html_e( 'Payment', 'sdevs_subscrpt' ); ?></td> … … 70 80 </td> 71 81 </tr> 82 <?php endif; ?> 72 83 <?php if ( 0 < count( $action_buttons ) ) : ?> 73 84 <tr> 74 85 <td><?php echo esc_html_e( 'Actions', 'sdevs_subscrpt' ); ?></td> 75 <td >86 <td class="subscrpt_action_buttons"> 76 87 <?php foreach ( $action_buttons as $action_button ) : ?> 77 88 <a href="<?php echo esc_attr( $action_button['url'] ); ?>" class="button … … 123 134 <tfoot> 124 135 <tr> 125 <th scope="row"><?php _e( 'Subtotal', 'sdevs_subscrpt' ); ?>:</th>136 <th scope="row"><?php esc_html_e( 'Subtotal', 'sdevs_subscrpt' ); ?>:</th> 126 137 <td> 127 <span class="woocommerce-Price-amount amount"><?php echo w c_price( get_post_meta( $id, '_subscrpt_price', true ), array( 'currency' => $order->get_currency() ) ); ?></span>138 <span class="woocommerce-Price-amount amount"><?php echo wp_kses_post( wc_price( get_post_meta( $id, '_subscrpt_price', true ), array( 'currency' => $order->get_currency() ) ) ); ?></span> 128 139 </td> 129 140 </tr> 130 141 <tr> 131 <th scope="row"><?php _e( 'Renew', 'sdevs_subscrpt' ); ?>:</th>142 <th scope="row"><?php esc_html_e( 'Renew', 'sdevs_subscrpt' ); ?>:</th> 132 143 <td> 133 144 <span class="woocommerce-Price-amount amount"> … … 140 151 141 152 <section class="woocommerce-customer-details"> 142 <h2 class="woocommerce-column__title"><?php _e( 'Billing address', 'sdevs_subscrpt' ); ?></h2>153 <h2 class="woocommerce-column__title"><?php esc_html_e( 'Billing address', 'sdevs_subscrpt' ); ?></h2> 143 154 <address> 144 155 <?php echo wp_kses_post( $order->get_formatted_billing_address() ); ?> -
subscription/trunk/templates/myaccount/subscriptions.php
r3133657 r3141427 34 34 $order_item_id = get_post_meta( get_the_ID(), '_subscrpt_order_item_id', true ); 35 35 $trial = get_post_meta( get_the_ID(), '_subscrpt_trial', true ); 36 $trial_mode = get_post_meta( get_the_ID(), '_subscrpt_trial_mode', true ); 37 $trial_mode = empty( $trial_mode ) ? 'off' : $trial_mode; 36 38 $start_date = get_post_meta( get_the_ID(), '_subscrpt_start_date', true ); 37 39 $next_date = get_post_meta( get_the_ID(), '_subscrpt_next_date', true ); … … 45 47 ?> 46 48 <tr> 47 <td ><?php the_ID(); ?></td>48 <td ><span class="subscrpt-<?php echo esc_attr( $post_status_object->name ); ?>"><?php echo esc_html( strlen( $post_status_object->label ) > 9 ? substr( $post_status_object->label, 0, 6 ) . '...' : $post_status_object->label ); ?></span></td>49 <td ><a href="<?php echo esc_html( $product_link ); ?>" target="_blank"><?php echo esc_html( $product_name ); ?></a></td>50 <?php if ( null == $trial) : ?>51 <td ><?php echo esc_html( gmdate( 'F d, Y', $next_date )); ?></td>49 <td data-title="Subscription"><?php the_ID(); ?></td> 50 <td data-title="Status"><span class="subscrpt-<?php echo esc_attr( $post_status_object->name ); ?>"><?php echo esc_html( strlen( $post_status_object->label ) > 9 ? substr( $post_status_object->label, 0, 6 ) . '...' : $post_status_object->label ); ?></span></td> 51 <td data-title="Product"><a href="<?php echo esc_html( $product_link ); ?>" target="_blank"><?php echo esc_html( $product_name ); ?></a></td> 52 <?php if ( 'on' !== $trial_mode ) : ?> 53 <td data-title="Next Payment"><?php echo esc_html( $next_date ? gmdate( 'F d, Y', $next_date ) : '-' ); ?></td> 52 54 <?php else : ?> 53 <td ><small>First Billing : </small><?php echo esc_html( gmdate( 'F d, Y', $start_date ) ); ?></td>55 <td data-title="Next Payment"><small>First Billing : </small><?php echo esc_html( gmdate( 'F d, Y', $start_date ) ); ?></td> 54 56 <?php endif; ?> 55 <td ><?php echo wp_kses_post( $product_price_html ); ?></td>56 <td >57 <td data-title="Total"><?php echo wp_kses_post( $product_price_html ); ?></td> 58 <td data-title="Actions"> 57 59 <a href="<?php echo esc_html( wc_get_endpoint_url( 'view-subscription', get_the_ID(), wc_get_page_permalink( 'myaccount' ) ) ); ?>" class="woocommerce-button <?php echo esc_attr( $wp_button_class ); ?> button view"><span class="dashicons dashicons-visibility"></span></a> 58 60 </td> … … 61 63 endwhile; 62 64 wp_reset_postdata(); 65 else : 66 ?> 67 <tr> 68 <td colspan="6"> 69 <p style="text-align: center;"> 70 <?php echo esc_html_e( 'No subscriptions available yet.', 'sdevs_subscrpt' ); ?> 71 </p> 72 </td> 73 </tr> 74 <?php 63 75 endif; 64 76 ?> -
subscription/trunk/vendor/autoload.php
r3070491 r3141427 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit a869c88d1ec1e37aafbf64b8a247b087::getLoader();25 return ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7::getLoader(); -
subscription/trunk/vendor/composer/autoload_real.php
r3070491 r3141427 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit a869c88d1ec1e37aafbf64b8a247b0875 class ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit a869c88d1ec1e37aafbf64b8a247b087', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit a869c88d1ec1e37aafbf64b8a247b087', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit a869c88d1ec1e37aafbf64b8a247b087::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::getInitializer($loader)); 31 31 32 32 $loader->register(true); 33 33 34 $filesToLoad = \Composer\Autoload\ComposerStaticInit a869c88d1ec1e37aafbf64b8a247b087::$files;34 $filesToLoad = \Composer\Autoload\ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$files; 35 35 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 36 36 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
subscription/trunk/vendor/composer/autoload_static.php
r3070491 r3141427 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit a869c88d1ec1e37aafbf64b8a247b0877 class ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7 8 8 { 9 9 public static $files = array ( … … 32 32 { 33 33 return \Closure::bind(function () use ($loader) { 34 $loader->prefixLengthsPsr4 = ComposerStaticInit a869c88d1ec1e37aafbf64b8a247b087::$prefixLengthsPsr4;35 $loader->prefixDirsPsr4 = ComposerStaticInit a869c88d1ec1e37aafbf64b8a247b087::$prefixDirsPsr4;36 $loader->classMap = ComposerStaticInit a869c88d1ec1e37aafbf64b8a247b087::$classMap;34 $loader->prefixLengthsPsr4 = ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$prefixLengthsPsr4; 35 $loader->prefixDirsPsr4 = ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$prefixDirsPsr4; 36 $loader->classMap = ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$classMap; 37 37 38 38 }, null, ClassLoader::class); -
subscription/trunk/vendor/composer/installed.php
r3133657 r3141427 4 4 'pretty_version' => 'dev-next', 5 5 'version' => 'dev-next', 6 'reference' => ' da291e42231d59162fda05dacfa56a5747e8e0c8',6 'reference' => '7496a437c8b72c7e4f7653221e38f67fe809f0b8', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-next', 15 15 'version' => 'dev-next', 16 'reference' => ' da291e42231d59162fda05dacfa56a5747e8e0c8',16 'reference' => '7496a437c8b72c7e4f7653221e38f67fe809f0b8', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.