Changeset 2123418
- Timestamp:
- 07/15/2019 08:06:25 PM (6 years ago)
- Location:
- convertkit-for-woocommerce/trunk
- Files:
-
- 7 edited
-
components/integration/functions/integration.php (modified) (4 diffs)
-
components/integration/integration.php (modified) (11 diffs)
-
components/integration/resources/integration.js (modified) (1 diff)
-
components/integration/views/meta-box.php (modified) (3 diffs)
-
functions/convertkit.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
woocommerce-convertkit.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
convertkit-for-woocommerce/trunk/components/integration/functions/integration.php
r2052888 r2123418 28 28 $tags = ckwc_convertkit_api_get_tags(); 29 29 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 30 43 if ( ! is_wp_error( $courses ) && ! is_wp_error( $forms ) && ! is_wp_error( $tags ) ) { 31 44 $options = array( 32 45 array( 33 46 'key' => 'course', 34 'name' => __( 'Courses' ),47 'name' => __( 'Courses', 'woocommerce-convertkit' ), 35 48 'options' => array_combine( 36 49 wp_list_pluck( $courses, 'id' ), … … 40 53 array( 41 54 'key' => 'form', 42 'name' => __( 'Forms' ),55 'name' => __( 'Forms', 'woocommerce-convertkit' ), 43 56 'options' => array_combine( 44 57 wp_list_pluck( $forms, 'id' ), … … 48 61 array( 49 62 'key' => 'tag', 50 'name' => __( 'Tags' ),63 'name' => __( 'Tags', 'woocommerce-convertkit' ), 51 64 'options' => array_combine( 52 65 wp_list_pluck( $tags, 'id' ), … … 63 76 } 64 77 } 78 79 function 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 131 function 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 70 70 public function __construct() { 71 71 $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' ); 74 74 75 75 // Initialize form fields … … 105 105 add_action( 'add_meta_boxes_product', array( $this, 'add_meta_boxes' ) ); 106 106 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' ) ); 107 110 } 108 111 … … 128 131 */ 129 132 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' ); 131 134 } 132 135 … … 158 161 $this->form_fields = array( 159 162 'enabled' => array( 160 'title' => __( 'Enable/Disable' ),163 'title' => __( 'Enable/Disable', 'woocommerce-convertkit' ), 161 164 'type' => 'checkbox', 162 'label' => __( 'Enable ConvertKit integration' ),165 'label' => __( 'Enable ConvertKit integration', 'woocommerce-convertkit' ), 163 166 'default' => 'no', 164 167 ), 165 168 166 169 'event' => array( 167 'title' => __( 'Subscribe Event' ),170 'title' => __( 'Subscribe Event', 'woocommerce-convertkit' ), 168 171 'type' => 'select', 169 172 'default' => 'pending', 170 'description' => __( 'When should customers be subscribed?' ),173 'description' => __( 'When should customers be subscribed?', 'woocommerce-convertkit' ), 171 174 'desc_tip' => false, 172 175 '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' ), 176 179 ), 177 180 ), 178 181 179 182 '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' ), 182 185 'type' => 'checkbox', 183 186 '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' ), 185 188 'desc_tip' => false, 186 189 ), 187 190 188 191 'opt_in_label' => array( 189 'title' => __( 'Opt-In Checkbox Label' ),192 'title' => __( 'Opt-In Checkbox Label', 'woocommerce-convertkit' ), 190 193 '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' ), 193 196 'desc_tip' => false, 194 197