🔞 ADULT: Changeset/ - Uncensored 2025

Changeset 2123418


Ignore:
Timestamp:
07/15/2019 08:06:25 PM (6 years ago)
Author:
travisnorthcutt
Message:

Version 1.2.0

Location:
convertkit-for-woocommerce/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • convertkit-for-woocommerce/trunk/components/integration/functions/integration.php

    r2052888 r2123418  
    2828            $tags    = ckwc_convertkit_api_get_tags();
    2929
     30            /**
     31             * Alphabetize
     32             */
     33            usort( $courses, function( $a, $b ) {
     34                return strcmp( $a['name'], $b['name'] );
     35            });
     36            usort( $forms, function( $a, $b ) {
     37                return strcmp( $a['name'], $b['name'] );
     38            });
     39            usort( $tags, function( $a, $b ) {
     40                return strcmp( $a['name'], $b['name'] );
     41            });
     42
    3043            if ( ! is_wp_error( $courses ) && ! is_wp_error( $forms ) && ! is_wp_error( $tags ) ) {
    3144                $options = array(
    3245                    array(
    3346                        'key'     => 'course',
    34                         'name'    => __( 'Courses' ),
     47                        'name'    => __( 'Courses', 'woocommerce-convertkit' ),
    3548                        'options' => array_combine(
    3649                            wp_list_pluck( $courses, 'id' ),
     
    4053                    array(
    4154                        'key'     => 'form',
    42                         'name'    => __( 'Forms' ),
     55                        'name'    => __( 'Forms', 'woocommerce-convertkit' ),
    4356                        'options' => array_combine(
    4457                            wp_list_pluck( $forms, 'id' ),
     
    4861                    array(
    4962                        'key'     => 'tag',
    50                         'name'    => __( 'Tags' ),
     63                        'name'    => __( 'Tags', 'woocommerce-convertkit' ),
    5164                        'options' => array_combine(
    5265                            wp_list_pluck( $tags, 'id' ),
     
    6376    }
    6477}
     78
     79function ckwc_force_get_subscription_options() {
     80        $courses = ckwc_convertkit_api_get_courses();
     81        $forms   = ckwc_convertkit_api_get_forms();
     82        $tags    = ckwc_convertkit_api_get_tags();
     83
     84        /**
     85         * Alphabetize
     86         */
     87        usort( $courses, function( $a, $b ) {
     88            return strcmp( $a['name'], $b['name'] );
     89        });
     90        usort( $forms, function( $a, $b ) {
     91            return strcmp( $a['name'], $b['name'] );
     92        });
     93        usort( $tags, function( $a, $b ) {
     94            return strcmp( $a['name'], $b['name'] );
     95        });
     96
     97        if ( ! is_wp_error( $courses ) && ! is_wp_error( $forms ) && ! is_wp_error( $tags ) ) {
     98            $options = array(
     99                array(
     100                    'key'     => 'course',
     101                    'name'    => __( 'Courses', 'woocommerce-convertkit' ),
     102                    'options' => array_combine(
     103                        wp_list_pluck( $courses, 'id' ),
     104                        wp_list_pluck( $courses, 'name' )
     105                    ),
     106                ),
     107                array(
     108                    'key'     => 'form',
     109                    'name'    => __( 'Forms', 'woocommerce-convertkit' ),
     110                    'options' => array_combine(
     111                        wp_list_pluck( $forms, 'id' ),
     112                        wp_list_pluck( $forms, 'name' )
     113                    ),
     114                ),
     115                array(
     116                    'key'     => 'tag',
     117                    'name'    => __( 'Tags', 'woocommerce-convertkit' ),
     118                    'options' => array_combine(
     119                        wp_list_pluck( $tags, 'id' ),
     120                        wp_list_pluck( $tags, 'name' )
     121                    ),
     122                ),
     123            );
     124
     125            ckwc_update_stored_subscription_options( $options );
     126        }
     127
     128    return $options;
     129}
     130
     131function ckwc_update_stored_subscription_options( $options = null ) {
     132    set_transient( 'ckwc_subscription_options', $options, 5 * MINUTE_IN_SECONDS );
     133
     134}
  • convertkit-for-woocommerce/trunk/components/integration/integration.php

    r2052888 r2123418  
    7070    public function __construct() {
    7171        $this->id                 = 'ckwc';
    72         $this->method_title       = __( 'ConvertKit' );
    73         $this->method_description = __( 'Enter your ConvertKit settings below to control how WooCommerce integrates with your ConvertKit account.' );
     72        $this->method_title       = __( 'ConvertKit', 'woocommerce-convertkit' );
     73        $this->method_description = __( 'Enter your ConvertKit settings below to control how WooCommerce integrates with your ConvertKit account.', 'woocommerce-convertkit' );
    7474
    7575        // Initialize form fields
     
    105105            add_action( 'add_meta_boxes_product', array( $this, 'add_meta_boxes' ) );
    106106            add_action( 'save_post_product', array( $this, 'save_product' ) );
     107
     108
     109            add_action( 'wp_ajax_ckwc_refresh_subscription_options', array( $this, 'refresh_subscription_options' ) );
    107110        }
    108111
     
    128131     */
    129132    public function add_meta_boxes( $post ) {
    130         add_meta_box( 'ckwc', __( 'Convert Kit Integration' ), array( $this, 'display_meta_box' ), null, 'side', 'default' );
     133        add_meta_box( 'ckwc', __( 'ConvertKit Integration', 'woocommerce-convertkit' ), array( $this, 'display_meta_box' ), null, 'side', 'default' );
    131134    }
    132135
     
    158161        $this->form_fields = array(
    159162            'enabled' => array(
    160                 'title'       => __( 'Enable/Disable' ),
     163                'title'       => __( 'Enable/Disable', 'woocommerce-convertkit' ),
    161164                'type'        => 'checkbox',
    162                 'label'       => __( 'Enable ConvertKit integration' ),
     165                'label'       => __( 'Enable ConvertKit integration', 'woocommerce-convertkit' ),
    163166                'default'     => 'no',
    164167            ),
    165168
    166169            'event' => array(
    167                 'title'       => __( 'Subscribe Event' ),
     170                'title'       => __( 'Subscribe Event', 'woocommerce-convertkit' ),
    168171                'type'        => 'select',
    169172                'default'     => 'pending',
    170                 'description' => __( 'When should customers be subscribed?' ),
     173                'description' => __( 'When should customers be subscribed?', 'woocommerce-convertkit' ),
    171174                'desc_tip'    => false,
    172175                'options'     => array(
    173                     'pending'    => __( 'Order Created' ),
    174                     'processing' => __( 'Order Processing' ),
    175                     'completed'  => __( 'Order Completed' ),
     176                    'pending'    => __( 'Order Created', 'woocommerce-convertkit' ),
     177                    'processing' => __( 'Order Processing', 'woocommerce-convertkit' ),
     178                    'completed'  => __( 'Order Completed', 'woocommerce-convertkit' ),
    176179                ),
    177180            ),
    178181
    179182            'display_opt_in' => array(
    180                 'title'       => __( 'Display Opt-In Checkbox' ),
    181                 'label'       => __( 'Display an Opt-In checkbox on checkout' ),
     183                'title'       => __( 'Display Opt-In Checkbox', 'woocommerce-convertkit' ),
     184                'label'       => __( 'Display an Opt-In checkbox on checkout', 'woocommerce-convertkit' ),
    182185                'type'        => 'checkbox',
    183186                'default'     => 'no',
    184                 'description' => __( 'If enabled, customers will only be subscribed if the "Opt-In" checkbox presented on checkout is checked.' ),
     187                'description' => __( 'If enabled, customers will only be subscribed if the "Opt-In" checkbox presented on checkout is checked.', 'woocommerce-convertkit' ),
    185188                'desc_tip'    => false,
    186189            ),
    187190
    188191            'opt_in_label' => array(
    189                 'title'       => __( 'Opt-In Checkbox Label' ),
     192                'title'       => __( 'Opt-In Checkbox Label', 'woocommerce-convertkit' ),
    190193                'type'        => 'text',
    191                 'default'     => __( 'I want to subscribe to the newsletter' ),
    192                 'description' => __( 'Optional (only used if the above field is checked): Customize the label next to the opt-in checkbox.' ),
     194                'default'     => __( 'I want to subscribe to the newsletter', 'woocommerce-convertkit' ),
     195                'description' => __( 'Optional (only used if the above field is checked): Customize the label next to the opt-in checkbox.', 'woocommerce-convertkit' ),
    193196                'desc_tip'    => false,
    194197