Plugin Directory

Changeset 3141427


Ignore:
Timestamp:
08/26/2024 06:30:32 AM (18 months ago)
Author:
ok9xnirab
Message:

v1.3 released

Location:
subscription
Files:
3 added
2 deleted
35 edited

Legend:

Unmodified
Added
Removed
  • subscription/trunk/assets/css/admin.css

    r3132743 r3141427  
    22  content: "\f531" !important;
    33}
     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  
    3232    if (subscrpt_renewal_process.val() === "manual") {
    3333      jQuery("#sdevs_renewal_cart_tr").show();
     34      jQuery("#subscrpt_stripe_auto_renew_tr").hide();
     35      jQuery("#subscrpt_auto_renewal_toggle_tr").hide();
    3436    } else {
    3537      jQuery("#sdevs_renewal_cart_tr").hide();
     38      jQuery("#subscrpt_stripe_auto_renew_tr").show();
     39      jQuery("#subscrpt_auto_renewal_toggle_tr").show();
    3640    }
    3741  });
    3842  if (subscrpt_renewal_process.val() === "manual") {
    3943    jQuery("#sdevs_renewal_cart_tr").show();
     44    jQuery("#subscrpt_stripe_auto_renew_tr").hide();
     45    jQuery("#subscrpt_auto_renewal_toggle_tr").hide();
    4046  } else {
    4147    jQuery("#sdevs_renewal_cart_tr").hide();
     48    jQuery("#subscrpt_stripe_auto_renew_tr").show();
     49    jQuery("#subscrpt_auto_renewal_toggle_tr").show();
    4250  }
    4351});
  • 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  
    1111use SpringDevs\Subscription\Admin\Subscriptions;
    1212use SpringDevs\Subscription\Illuminate\Comments;
    13 use SpringDevs\Subscription\Illuminate\Email;
    14 use SpringDevs\Subscription\Illuminate\Order;
    1513
    1614/**
    1715 * The admin class
    1816 */
    19 class Admin
    20 {
    21 
     17class Admin {
    2218
    2319    /**
    2420     * Initialize the class
    2521     */
    26     public function __construct()
    27     {
     22    public function __construct() {
    2823        $this->dispatch_actions();
    2924        new Required();
    30         new Illuminate();
    3125        new Menu();
    3226        new Product();
    3327        new Subscriptions();
    34         new Order();
    3528        new AdminOrder();
    3629        new Comments();
    37         new Email();
    3830        new Settings();
    3931        new Links();
     
    4537     * @return void
    4638     */
    47     public function dispatch_actions()
    48     {
     39    public function dispatch_actions() {
    4940    }
    5041}
  • subscription/trunk/includes/Admin/Order.php

    r3083564 r3141427  
    1717    public function __construct() {
    1818        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;
    1936    }
    2037
     
    4966     *
    5067     * @param mixed $order_post Current Order.
    51      * @param mixed $info Meta box Info.
     68     * @param array $info Meta box Info.
    5269     */
    5370    public function subscrpt_order_related( $order_post, $info ) {
  • subscription/trunk/includes/Admin/Product.php

    r3132743 r3141427  
    22
    33namespace SpringDevs\Subscription\Admin;
     4
     5use SpringDevs\Subscription\Illuminate\Helper;
    46
    57/**
     
    1921        add_filter( 'product_type_options', array( $this, 'add_product_type_options' ) );
    2022        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;
    2153    }
    2254
     
    88120                    'years'  => __( 'Yearly', 'sdevs_subscrpt' ),
    89121                );
     122                $trial_timing_types    = get_timing_types();
    90123                $subscrpt_timing       = null;
     124                $subscrpt_trial_time   = null;
     125                $subscrpt_trial_timing = null;
    91126                $subscrpt_cart_txt     = 'subscribe';
    92127                $subscrpt_user_cancell = 'yes';
     128                $subscrpt_limit        = 'one';
    93129
    94130                $screen = get_current_screen();
     
    97133                    if ( $product ) {
    98134                        $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' );
    99137                        $subscrpt_cart_txt     = $product->get_meta( '_subscrpt_cart_btn_label' );
    100138                        $subscrpt_user_cancell = $product->get_meta( '_subscrpt_user_cancel' );
     139                        $subscrpt_limit        = $product->get_meta( '_subscrpt_limit' );
    101140                    }
    102141                }
     
    126165        remove_action( 'save_post_product', array( $this, 'save_subscrpt_data' ) );
    127166
    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;
    133174
     175        $product = wc_get_product( $product_id );
    134176        $product->update_meta_data( '_subscrpt_enabled', $subscrpt_enable );
    135177        $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 );
    136180        $product->update_meta_data( '_subscrpt_cart_btn_label', $subscrpt_cart_txt );
    137181        $product->update_meta_data( '_subscrpt_user_cancel', $subscrpt_user_cancel );
     182        $product->update_meta_data( '_subscrpt_limit', $subscrpt_limit );
    138183        $product->save();
    139184
  • subscription/trunk/includes/Admin/Settings.php

    r2927437 r3141427  
    1818    }
    1919
     20    /**
     21     * Register submenu on `Subscriptions` menu.
     22     *
     23     * @return void
     24     */
    2025    public function admin_menu() {
    2126        $post_type_link = 'edit.php?post_type=subscrpt_order';
     
    3136        register_setting( 'subscrpt_settings', 'subscrpt_active_role' );
    3237        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
    3341        do_action( 'subscrpt_register_settings', 'subscrpt_settings' );
    3442    }
  • subscription/trunk/includes/Admin/Subscriptions.php

    r3132743 r3141427  
    116116     */
    117117    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 );
    122120        if ( $order ) {
    123121            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 ) ) : '-';
    125124            } elseif ( 'subscrpt_customer' === $column ) {
    126125                ?>
     
    134133                <?php
    135134            } 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 ) ) : '-';
    137137            } elseif ( 'subscrpt_status' === $column ) {
    138138                $status_obj = get_post_status_object( get_post_status( $post_id ) );
     
    287287     */
    288288    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 );
    294298        if ( ! $order ) {
    295299            return;
     
    314318            'start_date'       => array(
    315319                '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 ) : '-',
    317321            ),
    318322            'next_date'        => array(
    319323                '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 ?? '-' ) ) : '-',
    321325            ),
    322326            'status'           => array(
     
    326330            'payment_method'   => array(
    327331                '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(),
    329333            ),
    330334            'billing_address'  => array(
     
    337341            ),
    338342        );
    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 );
    340373
    341374        include 'views/subscription-info.php';
     
    385418
    386419    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'] ) ) {
    394421            return;
    395422        }
  • subscription/trunk/includes/Admin/views/product-form.php

    r3132743 r3141427  
    1515        )
    1616    );
     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
    1736
    1837    woocommerce_wp_text_input(
     
    4059        )
    4160    );
     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    );
    4276    ?>
    4377</div>
  • subscription/trunk/includes/Admin/views/related-subscriptions.php

    r3132743 r3141427  
    2222                $start_date    = get_post_meta( $history->subscription_id, '_subscrpt_start_date', true );
    2323                $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 ) );
    2425            ?>
    2526                <tr>
     
    2829                    </td>
    2930                    <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' ); ?>
    3132                    </td>
    3233                    <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>
    3536                </tr>
    3637                <?php
  • subscription/trunk/includes/Admin/views/settings.php

    r2927437 r3141427  
    1515                    </th>
    1616                    <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">
    2318                            <option value="auto">Automatic</option>
    2419                            <option value="manual"
    2520                            <?php
    26                             if ( ! subscrpt_pro_activated() || 'manual' === get_option( 'subscrpt_renewal_process', 'auto' ) ) {
     21                            if ( 'manual' === get_option( 'subscrpt_renewal_process', 'auto' ) ) {
    2722                                echo esc_attr( 'selected' );
    2823                            }
     
    3025                            >Manual</option>
    3126                        </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 : ?>
    3527                        <p class="description"><?php esc_html_e( 'How renewal process will be done after Subscription Expired !!', 'sdevs_subscrpt' ); ?></p>
    36                         <?php endif; ?>
    3728                    </td>
    3829                </tr>
     
    7465                    </td>
    7566                </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>
    76115                <?php do_action( 'subscrpt_setting_fields' ); ?>
    77116            </tbody>
  • subscription/trunk/includes/Api.php

    r2708268 r3141427  
    1212     * Initialize the class
    1313     */
    14     function __construct() {
     14    public function __construct() {
    1515        add_action( 'rest_api_init', array( $this, 'register_api' ) );
    1616    }
  • subscription/trunk/includes/Frontend.php

    r3132743 r3141427  
    99use SpringDevs\Subscription\Frontend\Order as FrontendOrder;
    1010use SpringDevs\Subscription\Frontend\Product;
    11 use SpringDevs\Subscription\Illuminate\Cron;
    12 use SpringDevs\Subscription\Illuminate\Email;
    13 use SpringDevs\Subscription\Illuminate\Order;
    1411
    1512/**
     
    1815class Frontend {
    1916
    20 
    2117    /**
    2218     * Frontend constructor.
    2319     */
    2420    public function __construct() {
    25         new Illuminate();
    2621        new Product();
    2722        new Cart();
     
    3025        new MyAccount();
    3126        new Downloadable();
    32         new Order();
    33         new Email();
    3427    }
    3528}
  • subscription/trunk/includes/Frontend/ActionController.php

    r3132743 r3141427  
    55
    66use SpringDevs\Subscription\Illuminate\Action;
     7use SpringDevs\Subscription\Illuminate\Helper;
    78
    89/**
     
    1213 */
    1314class ActionController {
    14 
    1515
    1616    /**
     
    3434            wp_die( esc_html( __( 'Sorry !! You cannot permit to access.', 'sdevs_subscrpt' ) ) );
    3535        }
    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 );
    3838        } 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 );
    4141            if ( 'no' === $user_cancel ) {
    4242                return;
     
    4848        } elseif ( 'reactive' === $action ) {
    4949            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 );
    5056        } else {
    5157            do_action( 'subscrpt_execute_actions', $subscrpt_id, $action );
  • subscription/trunk/includes/Frontend/Cart.php

    r3133657 r3141427  
    2626        add_filter( 'woocommerce_add_cart_item_data', array( $this, 'set_renew_status' ), 10, 2 );
    2727        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;
    28128    }
    29129
     
    48148                if ( isset( $value['subscription'] ) ) {
    49149                    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'] ) {
    51157                            // remove the item.
    52158                            wc_add_notice( __( 'An item which is no longer available was removed from your cart.', 'sdevs_subscrpt' ), 'error' );
     
    105211                'readonly'         => true,
    106212                'recurring_totals' => array(
    107                     'price'       => array(
     213                    'price'           => array(
    108214                        'description' => __( 'price of the subscription.', 'sdevs_subscrpt' ),
    109215                        'type'        => array( 'string' ),
    110216                        'readonly'    => true,
    111217                    ),
    112                     'time'        => array(
     218                    'time'            => array(
    113219                        'description' => __( 'time of the subscription.', 'sdevs_subscrpt' ),
    114220                        'type'        => array( 'number' ),
    115221                        'readonly'    => true,
    116222                    ),
    117                     'type'        => array(
     223                    'type'            => array(
    118224                        'description' => __( 'type of the subscription.', 'sdevs_subscrpt' ),
    119225                        'type'        => array( 'string' ),
    120226                        'readonly'    => true,
    121227                    ),
    122                     'description' => array(
     228                    'description'     => array(
    123229                        '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' ),
    124235                        'type'        => array( 'string' ),
    125236                        'readonly'    => true,
     
    142253                if ( isset( $cart_item['subscription'] ) && $cart_item['subscription']['type'] ) {
    143254                    $cart_subscription = $cart_item['subscription'];
     255                    $start_date        = Helper::start_date( $cart_subscription['trial'] );
    144256                    $next_date         = Helper::next_date(
    145257                        ( $cart_subscription['time'] ?? 1 ) . ' ' . $cart_subscription['type'],
    146258                        $cart_subscription['trial']
    147259                    );
    148                     $recurrings[]      = apply_filters(
     260
     261                    $recurrings[] = apply_filters(
    149262                        'subscrpt_cart_recurring_data',
    150263                        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' ),
    155269                        ),
    156270                        $cart_item
     
    219333        if ( ! subscrpt_pro_activated() ) {
    220334            $item_data['time']       = null;
    221             $item_data['trial']      = null;
    222335            $item_data['signup_fee'] = null;
    223336        }
     
    236349    public function add_to_cart_item_data( $cart_item_data, $product_id ) {
    237350        $product = wc_get_product( $product_id );
    238         if ( $product->is_type( 'variable' ) ) {
     351        if ( ! $product->is_type( 'simple' ) ) {
    239352            return $cart_item_data;
    240353        }
    241354        $enabled = $product->get_meta( '_subscrpt_enabled' );
    242355        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            }
    249366            $subscription_data['signup_fee'] = null;
    250367            $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 );
    252369        endif;
    253370        return $cart_item_data;
     
    277394    public function change_price_cart_html( $price, $cart_item ) {
    278395        $product = wc_get_product( $cart_item['product_id'] );
    279         if ( $product->is_type( 'variable' ) || subscrpt_pro_activated() ) {
     396        if ( ! $product->is_type( 'simple' ) ) {
    280397            return $price;
    281398        }
     
    283400        $enabled = $product->get_meta( '_subscrpt_enabled' );
    284401        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 );
    288412        else :
    289413            return $price;
     
    297421     */
    298422    public function add_rows_order_total() {
    299         if ( subscrpt_pro_activated() ) {
    300             return;
    301         }
    302423        $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 );
    324425        if ( 0 === count( $recurrs ) ) {
    325426            return;
     
    330431            <td data-title="<?php esc_attr_e( 'Recurring totals', 'sdevs_subscrpt' ); ?>">
    331432                <?php foreach ( $recurrs as $recurr ) : ?>
    332                     <?php if ( $recurr['trial'] ) : ?>
    333433                        <p>
    334434                            <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; ?>
    336440                        </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; ?>
    343441                <?php endforeach; ?>
    344442            </td>
  • subscription/trunk/includes/Frontend/Checkout.php

    r3132743 r3141427  
    5959            $product = wc_get_product( $order_item['product_id'] );
    6060
    61             if ( ! $product->is_type( 'variation' ) && ! subscrpt_pro_activated() ) {
     61            if ( $product->is_type( 'simple' ) && ! subscrpt_pro_activated() ) {
    6262                $enabled = $product->get_meta( '_subscrpt_enabled' );
    6363
    6464                if ( $enabled ) {
    6565                    $is_renew = isset( $order_item['renew_subscrpt'] );
    66                     $type     = Helper::get_typos( 1, $product->get_meta( '_subscrpt_timing_option' ) );
    6766
    68                     $start_date    = time();
    69                     $next_date     = sdevs_wp_strtotime( 1 . ' ' . $type, $start_date );
    7067                    $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                    }
    7176
    7277                    wc_update_order_item_meta(
     
    7479                        '_subscrpt_meta',
    7580                        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,
    8184                        )
    8285                    );
     
    100103                        update_post_meta( $selected_subscription_id, '_subscrpt_timing_option', $timing_option );
    101104                        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' ) );
    102106
    103107                        // order related.
     
    106110
    107111                        // 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 );
    110113
    111114                        do_action( 'subscrpt_order_checkout', $selected_subscription_id, $order_item );
  • subscription/trunk/includes/Frontend/MyAccount.php

    r3133657 r3141427  
    5555        $next_date   = get_post_meta( $id, '_subscrpt_next_date', true );
    5656        $trial       = get_post_meta( $id, '_subscrpt_trial', true );
     57        $trial_mode  = get_post_meta( $id, '_subscrpt_trial_mode', true );
    5758
    5859        $subscrpt_nonce = wp_create_nonce( 'subscrpt_nonce' );
     
    8283                    'url'   => $order->get_checkout_payment_url(),
    8384                    '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' ),
    84106                );
    85107            }
     
    96118                'next_date'       => $next_date,
    97119                'trial'           => $trial,
     120                'trial_mode'      => empty( $trial_mode ) ? 'off' : $trial_mode,
    98121                'order'           => $order,
    99122                'order_item'      => $order_item,
     
    119142     * Change View Subscription Title
    120143     *
    121      * @param String $title Title.
    122      *
    123      * @return String
     144     * @param string $title Title.
     145     *
     146     * @return string
    124147     */
    125148    public function change_single_title( string $title ): string {
     
    131154     * Change Subscription Lists Title
    132155     *
    133      * @param String $title Title.
    134      *
    135      * @return String
     156     * @param string $title Title.
     157     *
     158     * @return string
    136159     */
    137160    public function change_lists_title( string $title ): string {
  • subscription/trunk/includes/Frontend/Order.php

    r3133657 r3141427  
    4141                    $post         = $history->subscription_id;
    4242                    $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 );
    4345
    4446                    $trial_status = null !== $order_item_meta['trial'];
     
    7779                            <tr>
    7880                                <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>
    8082                            </tr>
    8183                        <?php } else { ?>
    8284                            <tr>
    8385                                <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>
    8587                            </tr>
    8688                            <tr>
    8789                                <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>
    8991                            </tr>
    9092                        <?php } ?>
  • subscription/trunk/includes/Frontend/Product.php

    r3132743 r3141427  
    2323        add_filter( 'woocommerce_store_api_product_quantity_maximum', array( $this, 'update_quantity_min_max' ), 10, 2 );
    2424        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;
    25109    }
    26110
     
    138222     */
    139223    public function change_price_html( $price, $product ) {
    140         if ( $product->is_type( 'variable' ) || '' === $price || subscrpt_pro_activated() ) {
     224        if ( ! $product->is_type( 'simple' ) || '' === $price ) {
    141225            return $price;
    142226        }
     
    144228        $enabled = $product->get_meta( '_subscrpt_enabled' );
    145229        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 );
    150240        else :
    151241            return $price;
  • subscription/trunk/includes/Illuminate.php

    r3132743 r3141427  
    44
    55use SpringDevs\Subscription\Frontend\Checkout;
     6use SpringDevs\Subscription\Illuminate\AutoRenewal;
     7use SpringDevs\Subscription\Illuminate\Block;
    68use SpringDevs\Subscription\Illuminate\Cron;
     9use SpringDevs\Subscription\Illuminate\Email;
     10use SpringDevs\Subscription\Illuminate\Order;
    711use SpringDevs\Subscription\Illuminate\Post;
     12use SpringDevs\Subscription\Illuminate\Stripe;
    813
    914/**
     
    1217class Illuminate {
    1318
    14 
    1519    /**
    1620     * Initialize the Class.
    1721     */
    1822    public function __construct() {
    19         $this->dispatch_actions();
     23        $this->stripe_initialization();
     24        new Order();
    2025        new Cron();
    2126        new Post();
     27        new Block();
    2228        new Checkout();
     29        new AutoRenewal();
     30        new Email();
    2331    }
    2432
    2533    /**
    26      * Dispatch and bind actions
     34     * Stripe Initialization.
    2735     *
    2836     * @return void
    2937     */
    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        }
    4947    }
    5048}
  • subscription/trunk/includes/Illuminate/Action.php

    r3083564 r3141427  
    1010class Action {
    1111
    12 
    1312    /**
    1413     * Did when status changes.
    1514     *
    1615     * @param string $status Status.
    17      * @param Int    $subscription_id Subscription ID.
     16     * @param int    $subscription_id Subscription ID.
    1817     * @param bool   $write_comment Write comment?.
    1918     */
     
    9392        );
    9493        update_comment_meta( $comment_id, '_subscrpt_activity', 'Subscription Activated' );
    95 
    9694        do_action( 'subscrpt_subscription_activated', $subscription_id );
    9795    }
  • subscription/trunk/includes/Illuminate/Comments.php

    r2708268 r3141427  
    1010class Comments {
    1111
     12    /**
     13     * Initialize the class.
     14     */
    1215    public function __construct() {
    1316        add_action( 'admin_init', array( $this, 'remove_comments_metabox' ) );
    1417    }
    1518
     19    /**
     20     * Remove Comments related metaboxes from `subscrpt_order` post.
     21     *
     22     * @return void
     23     */
    1624    public function remove_comments_metabox() {
    1725        remove_meta_box( 'commentsdiv', 'subscrpt_order', 'normal' );
  • subscription/trunk/includes/Illuminate/Email.php

    r3070491 r3141427  
    3434                        <tr>
    3535                            <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; ?>
    3641                        </tr>
    3742                        <?php
    3843                        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 );
    4352                            ?>
    4453                                <tr>
     
    5160                                </tr>
    5261                                <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>
    5564                                </tr>
    5665                                <tr>
    5766                                    <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>
    6069                                </tr>
    6170                                <?php if ( ! $has_trial ) { ?>
    6271                                    <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>
    6574                                    </tr>
    6675                                <?php } else { ?>
    6776                                    <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>
    6978                                        <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>
    7079                                    </tr>
    7180                                    <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>
    7483                                    </tr>
    7584                                <?php } ?>
  • subscription/trunk/includes/Illuminate/Helper.php

    r3132743 r3141427  
    5151     * Generate next date
    5252     *
    53      * @param mixed       $time Time.
    54      * @param Null|String $trial Trial.
    55      *
    56      * @return String
     53     * @param string      $time Time.
     54     * @param null|string $trial Trial.
     55     *
     56     * @return string
    5757     */
    5858    public static function next_date( $time, $trial = null ) {
     
    239239     * Get total subscriptions by product ID.
    240240     *
    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.
    243243     *
    244244     * @return \WP_Post | false
     
    353353        return $subscription_id;
    354354    }
     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    }
    355591}
  • subscription/trunk/includes/Illuminate/Order.php

    r3132743 r3141427  
    1414     */
    1515    public function __construct() {
    16         // add_filter( 'woocommerce_order_formatted_line_subtotal', array( $this, 'format_order_price' ), 10, 3 );
    1716        add_action( 'woocommerce_admin_order_item_headers', array( $this, 'register_custom_column' ) );
    1817        add_action( 'woocommerce_admin_order_item_values', array( $this, 'add_column_value' ), 10, 2 );
     
    2019        add_action( 'woocommerce_order_status_changed', array( $this, 'order_status_changed' ) );
    2120        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 );
    3673    }
    3774
     
    99136     */
    100137    public function order_status_changed( $order_id ) {
    101         $order       = new \WC_Order( $order_id );
     138        $order       = wc_get_order( $order_id );
    102139        $post_status = 'active';
    103140
     
    105142            case 'on-hold':
    106143            case 'pending':
    107             case 'processing':
    108144                $post_status = 'pending';
    109145                break;
  • subscription/trunk/includes/functions.php

    r3133657 r3141427  
    6868 * Get renewal process settings.
    6969 *
    70  * @return string
     70 * @return bool
    7171 */
    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     }
     72function subscrpt_is_auto_renew_enabled() {
     73    return 'auto' === get_option( 'subscrpt_renewal_process', 'auto' );
    7874}
    7975
     
    137133    }
    138134}
     135
     136if ( ! 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  
    8181== Changelog ==
    8282
     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
    8390= 1.2.1 =
    8491- **Fix**: pagination bug on `subscriptions` template.
  • subscription/trunk/subscription.php

    r3133657 r3141427  
    44Plugin URI: https://wordpress.org/plugins/subscription
    55Description: Allow your customers to order once and get their products and services every month/week.
    6 Version: 1.2.1
     6Version: 1.3
    77Author: SpringDevs
    88Author URI: https://springdevs.com/
     
    6060     * @var string
    6161     */
    62     const version = '1.2.1';
     62    const version = '1.3.0';
    6363
    6464    /**
     
    186186        }
    187187
    188         if ( $this->is_request( 'ajax' ) ) {
    189             // require_once SUBSCRPT_INCLUDES . '/class-ajax.php';
    190         }
     188        $this->container['illuminate'] = new SpringDevs\Subscription\Illuminate();
    191189    }
    192190
  • subscription/trunk/templates/myaccount/single.php

    r3133657 r3141427  
    88 * @var string $next_date
    99 * @var string|null $trial
     10 * @var string|null $trial_mode
    1011 * @var stdClass $status
    1112 * @var array $action_buttons
     
    3435        margin-bottom: 10px;
    3536    }
     37    .subscrpt_action_buttons {
     38        display: flex;
     39        flex-wrap: wrap;
     40        gap: 10px;
     41    }
    3642</style>
    3743<table class="woocommerce-table woocommerce-table--order-details shop_table order_details subscription_details">
     
    4551            <td><span class="subscrpt-<?php echo esc_html( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></span></td>
    4652        </tr>
     53        <?php if ( null != $trial && 'off' !== $trial ) : ?>
    4754        <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>
    5057        </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 ) ) : ?>
    5264            <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>
    6473            </tr>
    6574        <?php endif; ?>
     75        <?php if ( ! empty( $order->get_payment_method_title() ) ) : ?>
    6676        <tr>
    6777            <td><?php esc_html_e( 'Payment', 'sdevs_subscrpt' ); ?></td>
     
    7080            </td>
    7181        </tr>
     82        <?php endif; ?>
    7283        <?php if ( 0 < count( $action_buttons ) ) : ?>
    7384            <tr>
    7485                <td><?php echo esc_html_e( 'Actions', 'sdevs_subscrpt' ); ?></td>
    75                 <td>
     86                <td class="subscrpt_action_buttons">
    7687                    <?php foreach ( $action_buttons as $action_button ) : ?>
    7788                        <a href="<?php echo esc_attr( $action_button['url'] ); ?>" class="button
     
    123134    <tfoot>
    124135        <tr>
    125             <th scope="row"><?php _e( 'Subtotal', 'sdevs_subscrpt' ); ?>:</th>
     136            <th scope="row"><?php esc_html_e( 'Subtotal', 'sdevs_subscrpt' ); ?>:</th>
    126137            <td>
    127                 <span class="woocommerce-Price-amount amount"><?php echo wc_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>
    128139            </td>
    129140        </tr>
    130141        <tr>
    131             <th scope="row"><?php _e( 'Renew', 'sdevs_subscrpt' ); ?>:</th>
     142            <th scope="row"><?php esc_html_e( 'Renew', 'sdevs_subscrpt' ); ?>:</th>
    132143            <td>
    133144                <span class="woocommerce-Price-amount amount">
     
    140151
    141152<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>
    143154    <address>
    144155        <?php echo wp_kses_post( $order->get_formatted_billing_address() ); ?>
  • subscription/trunk/templates/myaccount/subscriptions.php

    r3133657 r3141427  
    3434                $order_item_id = get_post_meta( get_the_ID(), '_subscrpt_order_item_id', true );
    3535                $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;
    3638                $start_date    = get_post_meta( get_the_ID(), '_subscrpt_start_date', true );
    3739                $next_date     = get_post_meta( get_the_ID(), '_subscrpt_next_date', true );
     
    4547                ?>
    4648                <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>
    5254                    <?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>
    5456                    <?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">
    5759                        <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>
    5860                    </td>
     
    6163            endwhile;
    6264            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
    6375        endif;
    6476        ?>
  • subscription/trunk/vendor/autoload.php

    r3070491 r3141427  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInita869c88d1ec1e37aafbf64b8a247b087::getLoader();
     25return ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7::getLoader();
  • subscription/trunk/vendor/composer/autoload_real.php

    r3070491 r3141427  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInita869c88d1ec1e37aafbf64b8a247b087
     5class ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInita869c88d1ec1e37aafbf64b8a247b087', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    27         spl_autoload_unregister(array('ComposerAutoloaderInita869c88d1ec1e37aafbf64b8a247b087', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInitf36c272eb9d9672b5ad83d818f1e3ad7', 'loadClassLoader'));
    2828
    2929        require __DIR__ . '/autoload_static.php';
    30         call_user_func(\Composer\Autoload\ComposerStaticInita869c88d1ec1e37aafbf64b8a247b087::getInitializer($loader));
     30        call_user_func(\Composer\Autoload\ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::getInitializer($loader));
    3131
    3232        $loader->register(true);
    3333
    34         $filesToLoad = \Composer\Autoload\ComposerStaticInita869c88d1ec1e37aafbf64b8a247b087::$files;
     34        $filesToLoad = \Composer\Autoload\ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$files;
    3535        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3636            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • subscription/trunk/vendor/composer/autoload_static.php

    r3070491 r3141427  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInita869c88d1ec1e37aafbf64b8a247b087
     7class ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7
    88{
    99    public static $files = array (
     
    3232    {
    3333        return \Closure::bind(function () use ($loader) {
    34             $loader->prefixLengthsPsr4 = ComposerStaticInita869c88d1ec1e37aafbf64b8a247b087::$prefixLengthsPsr4;
    35             $loader->prefixDirsPsr4 = ComposerStaticInita869c88d1ec1e37aafbf64b8a247b087::$prefixDirsPsr4;
    36             $loader->classMap = ComposerStaticInita869c88d1ec1e37aafbf64b8a247b087::$classMap;
     34            $loader->prefixLengthsPsr4 = ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$prefixLengthsPsr4;
     35            $loader->prefixDirsPsr4 = ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$prefixDirsPsr4;
     36            $loader->classMap = ComposerStaticInitf36c272eb9d9672b5ad83d818f1e3ad7::$classMap;
    3737
    3838        }, null, ClassLoader::class);
  • subscription/trunk/vendor/composer/installed.php

    r3133657 r3141427  
    44        'pretty_version' => 'dev-next',
    55        'version' => 'dev-next',
    6         'reference' => 'da291e42231d59162fda05dacfa56a5747e8e0c8',
     6        'reference' => '7496a437c8b72c7e4f7653221e38f67fe809f0b8',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-next',
    1515            'version' => 'dev-next',
    16             'reference' => 'da291e42231d59162fda05dacfa56a5747e8e0c8',
     16            'reference' => '7496a437c8b72c7e4f7653221e38f67fe809f0b8',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.