@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | if ( $network_wide ) {
|
| 35 | 35 | $old_blog = $wpdb->blogid; |
| 36 | 36 | // Get all blog ids |
| 37 | - $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
|
| 37 | + $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
| 38 | 38 | foreach ( $blogids as $blog_id ) {
|
| 39 | 39 | switch_to_blog( $blog_id ); |
| 40 | 40 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | custom_fields TEXT NOT NULL, |
| 91 | 91 | UNIQUE KEY id (id) |
| 92 | 92 | ) $charset_collate;"; |
| 93 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
| 94 | - dbDelta($sql); |
|
| 93 | + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 94 | + dbDelta( $sql ); |
|
| 95 | 95 | |
| 96 | 96 | // create an option for the date that the user initially activated the plugin |
| 97 | 97 | // used to display a two week notice, asking for a review or to upgrade |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes |
| 19 | 19 | * @author YIKES Inc. <[email protected]> |
| 20 | 20 | */ |
| 21 | -class Yikes_Inc_Easy_Mailchimp_Extender_Activator {
|
|
| 21 | +class Yikes_Inc_Easy_Mailchimp_Extender_Activator { |
|
| 22 | 22 | /** |
| 23 | 23 | * Short Description. Activation hook. |
| 24 | 24 | * |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @since 6.0.0 |
| 28 | 28 | */ |
| 29 | - public static function activate( $network_wide ) {
|
|
| 29 | + public static function activate( $network_wide ) { |
|
| 30 | 30 | global $wpdb; |
| 31 | 31 | |
| 32 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
|
| 32 | + if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 33 | 33 | // check if it is a network activation - if so, run the activation function for each blog id |
| 34 | - if ( $network_wide ) {
|
|
| 34 | + if ( $network_wide ) { |
|
| 35 | 35 | $old_blog = $wpdb->blogid; |
| 36 | 36 | // Get all blog ids |
| 37 | 37 | $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
| 38 | - foreach ( $blogids as $blog_id ) {
|
|
| 38 | + foreach ( $blogids as $blog_id ) { |
|
| 39 | 39 | switch_to_blog( $blog_id ); |
| 40 | 40 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
| 41 | 41 | restore_current_blog(); |
@@ -44,7 +44,8 @@ discard block |
||
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
| 47 | - } else { /* end network activate */
|
|
| 47 | + } else { |
|
| 48 | +/* end network activate */ |
|
| 48 | 49 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
| 49 | 50 | } |
| 50 | 51 | } |
@@ -56,7 +57,7 @@ discard block |
||
| 56 | 57 | * |
| 57 | 58 | * @since 6.0.0 |
| 58 | 59 | */ |
| 59 | - static function _activate_yikes_easy_mailchimp( $wpdb ) {
|
|
| 60 | + static function _activate_yikes_easy_mailchimp( $wpdb ) { |
|
| 60 | 61 | |
| 61 | 62 | // single site |
| 62 | 63 | $custom_table_name = $wpdb->prefix . 'yikes_easy_mc_forms'; |
@@ -95,12 +96,12 @@ discard block |
||
| 95 | 96 | |
| 96 | 97 | // create an option for the date that the user initially activated the plugin |
| 97 | 98 | // used to display a two week notice, asking for a review or to upgrade |
| 98 | - if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) || get_option( 'yikes_easy_mailchimp_activation_date' ) == '' ) {
|
|
| 99 | + if ( ! get_option( 'yikes_easy_mailchimp_activation_date' ) || get_option( 'yikes_easy_mailchimp_activation_date' ) == '' ) { |
|
| 99 | 100 | update_option( 'yikes_easy_mailchimp_activation_date', strtotime( 'now' ) ); |
| 100 | 101 | } |
| 101 | 102 | |
| 102 | 103 | // Create an option for the forms. |
| 103 | - if ( class_exists( 'Yikes_Inc_Easy_MailChimp_Extender_Option_Forms' ) ) {
|
|
| 104 | + if ( class_exists( 'Yikes_Inc_Easy_MailChimp_Extender_Option_Forms' ) ) { |
|
| 104 | 105 | $option_class = new Yikes_Inc_Easy_MailChimp_Extender_Option_Forms(); |
| 105 | 106 | $option_class->create_option(); |
| 106 | 107 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes |
| 26 | 26 | * @author YIKES Inc. <[email protected]> |
| 27 | 27 | */ |
| 28 | -class Yikes_Inc_Easy_Mailchimp_Extender {
|
|
| 28 | +class Yikes_Inc_Easy_Mailchimp_Extender { |
|
| 29 | 29 | /** |
| 30 | 30 | * The loader that's responsible for maintaining and registering all hooks that power |
| 31 | 31 | * the plugin. |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @param Yikes_Inc_Easy_MailChimp_Extender_Form_Interface $form_interface |
| 72 | 72 | */ |
| 73 | - public function __construct( Yikes_Inc_Easy_MailChimp_Extender_Form_Interface $form_interface ) {
|
|
| 73 | + public function __construct( Yikes_Inc_Easy_MailChimp_Extender_Form_Interface $form_interface ) { |
|
| 74 | 74 | $this->version = YIKES_MC_VERSION; |
| 75 | 75 | $this->form_interface = $form_interface; |
| 76 | 76 | $this->load_dependencies(); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @since 1.0.0 |
| 94 | 94 | * @access private |
| 95 | 95 | */ |
| 96 | - private function load_dependencies() {
|
|
| 96 | + private function load_dependencies() { |
|
| 97 | 97 | /** |
| 98 | 98 | * The class responsible for orchestrating the actions and filters of the |
| 99 | 99 | * core plugin. |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @since 1.0.0 |
| 118 | 118 | * @access private |
| 119 | 119 | */ |
| 120 | - private function define_admin_hooks() {
|
|
| 120 | + private function define_admin_hooks() { |
|
| 121 | 121 | $plugin_admin = new Yikes_Inc_Easy_Mailchimp_Forms_Admin( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version(), $this->form_interface ); |
| 122 | 122 | $plugin_admin->hooks(); |
| 123 | 123 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @since 1.0.0 |
| 131 | 131 | * @access private |
| 132 | 132 | */ |
| 133 | - private function define_public_hooks() {
|
|
| 133 | + private function define_public_hooks() { |
|
| 134 | 134 | $plugin_public = new Yikes_Inc_Easy_Mailchimp_Extender_Public( $this->get_yikes_inc_easy_mailchimp_extender(), $this->get_version() ); |
| 135 | 135 | } |
| 136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @since 1.0.0 |
| 140 | 140 | */ |
| 141 | - public function run() {
|
|
| 141 | + public function run() { |
|
| 142 | 142 | $this->loader->run(); |
| 143 | 143 | } |
| 144 | 144 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @since 1.0.0 |
| 149 | 149 | * @return string The name of the plugin. |
| 150 | 150 | */ |
| 151 | - public function get_yikes_inc_easy_mailchimp_extender() {
|
|
| 151 | + public function get_yikes_inc_easy_mailchimp_extender() { |
|
| 152 | 152 | return $this->yikes_inc_easy_mailchimp_extender; |
| 153 | 153 | } |
| 154 | 154 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @since 1.0.0 |
| 158 | 158 | * @return Yikes_Inc_Easy_Mailchimp_Extender_Loader Orchestrates the hooks of the plugin. |
| 159 | 159 | */ |
| 160 | - public function get_loader() {
|
|
| 160 | + public function get_loader() { |
|
| 161 | 161 | return $this->loader; |
| 162 | 162 | } |
| 163 | 163 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @since 1.0.0 |
| 167 | 167 | * @return string The version number of the plugin. |
| 168 | 168 | */ |
| 169 | - public function get_version() {
|
|
| 169 | + public function get_version() { |
|
| 170 | 170 | return $this->version; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | if ( ! empty( $all_forms ) ) {
|
| 107 | 107 | // build an array to pass to our javascript |
| 108 | 108 | foreach ( $all_forms as $id => $form ) {
|
| 109 | - $lists[ $form['form_name'] ] = $id; |
|
| 109 | + $lists[ $form[ 'form_name' ] ] = $id; |
|
| 110 | 110 | } |
| 111 | 111 | } else {
|
| 112 | 112 | $lists[ __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-'; |
@@ -5,18 +5,18 @@ discard block |
||
| 5 | 5 | * @since 6.0.3 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -class YIKES_MailChimp_Visual_Composer_Extension {
|
|
| 8 | +class YIKES_MailChimp_Visual_Composer_Extension { |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Constructor |
| 12 | 12 | * |
| 13 | 13 | * @since 6.0.3 |
| 14 | 14 | */ |
| 15 | - function __construct() {
|
|
| 15 | + function __construct() { |
|
| 16 | 16 | |
| 17 | 17 | add_action( 'admin_init', array( $this, 'extend_visual_composer' ) ); |
| 18 | 18 | |
| 19 | - if ( function_exists( 'vc_add_shortcode_param' ) ) {
|
|
| 19 | + if ( function_exists( 'vc_add_shortcode_param' ) ) { |
|
| 20 | 20 | vc_add_shortcode_param( 'yikes_mailchimp_logo', array( $this, 'yikes_mailchimp_logo_vc_section' ) ); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @since 6.0.3 |
| 28 | 28 | */ |
| 29 | - public function extend_visual_composer() {
|
|
| 29 | + public function extend_visual_composer() { |
|
| 30 | 30 | |
| 31 | - if ( ! function_exists( 'vc_map' ) ) {
|
|
| 31 | + if ( ! function_exists( 'vc_map' ) ) { |
|
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @since 6.0.3 |
| 100 | 100 | */ |
| 101 | - public function yikes_mailchimp_logo_vc_section() {
|
|
| 101 | + public function yikes_mailchimp_logo_vc_section() { |
|
| 102 | 102 | return '<img style="width:250px;display:block;margin:0 auto;" src="' . YIKES_MC_URL . 'includes/images/Welcome_Page/mailchimp-logo.png" title="' . __( 'Easy Forms for MailChimp', 'yikes-inc-easy-mailchimp-extender' ) . '" />'; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @since 6.0.3 |
| 109 | 109 | */ |
| 110 | - public function yikes_mailchimp_retreive_user_created_forms() {
|
|
| 110 | + public function yikes_mailchimp_retreive_user_created_forms() { |
|
| 111 | 111 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 112 | 112 | $all_forms = $interface->get_all_forms(); |
| 113 | 113 | |
| 114 | 114 | $lists = array(); |
| 115 | - if ( ! empty( $all_forms ) ) {
|
|
| 115 | + if ( ! empty( $all_forms ) ) { |
|
| 116 | 116 | // build an array to pass to our javascript |
| 117 | - foreach ( $all_forms as $id => $form ) {
|
|
| 117 | + foreach ( $all_forms as $id => $form ) { |
|
| 118 | 118 | $lists[ $form['form_name'] ] = $id; |
| 119 | 119 | } |
| 120 | - } else {
|
|
| 120 | + } else { |
|
| 121 | 121 | $lists[ __( 'Please Import Some MailChimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-'; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @return type The collection of actions and filters registered with WordPress. |
| 87 | 87 | */ |
| 88 | 88 | private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
| 89 | - $hooks[] = array( |
|
| 89 | + $hooks[ ] = array( |
|
| 90 | 90 | 'hook' => $hook, |
| 91 | 91 | 'component' => $component, |
| 92 | 92 | 'callback' => $callback, |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function run() {
|
| 104 | 104 | foreach ( $this->filters as $hook ) {
|
| 105 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 105 | + add_filter( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
| 106 | 106 | } |
| 107 | 107 | foreach ( $this->actions as $hook ) {
|
| 108 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 108 | + add_action( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @subpackage Yikes_Inc_Easy_Mailchimp_Extender/includes |
| 20 | 20 | * @author YIKES Inc. <[email protected]> |
| 21 | 21 | */ |
| 22 | -class Yikes_Inc_Easy_Mailchimp_Extender_Loader {
|
|
| 22 | +class Yikes_Inc_Easy_Mailchimp_Extender_Loader { |
|
| 23 | 23 | /** |
| 24 | 24 | * The array of actions registered with WordPress. |
| 25 | 25 | * |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @since 6.0.0 |
| 43 | 43 | */ |
| 44 | - public function __construct() {
|
|
| 44 | + public function __construct() { |
|
| 45 | 45 | $this->actions = array(); |
| 46 | 46 | $this->filters = array(); |
| 47 | 47 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param int Optional $priority The priority at which the function should be fired. |
| 56 | 56 | * @param int Optional $accepted_args The number of arguments that should be passed to the $callback. |
| 57 | 57 | */ |
| 58 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
|
| 58 | + public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 59 | 59 | $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
| 60 | 60 | } |
| 61 | 61 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param int Optional $priority The priority at which the function should be fired. |
| 69 | 69 | * @param int Optional $accepted_args The number of arguments that should be passed to the $callback. |
| 70 | 70 | */ |
| 71 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
|
| 71 | + public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 72 | 72 | $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
| 73 | 73 | } |
| 74 | 74 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param int Optional $accepted_args The number of arguments that should be passed to the $callback. |
| 86 | 86 | * @return type The collection of actions and filters registered with WordPress. |
| 87 | 87 | */ |
| 88 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
|
| 88 | + private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
| 89 | 89 | $hooks[] = array( |
| 90 | 90 | 'hook' => $hook, |
| 91 | 91 | 'component' => $component, |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @since 6.0.0 |
| 102 | 102 | */ |
| 103 | - public function run() {
|
|
| 104 | - foreach ( $this->filters as $hook ) {
|
|
| 103 | + public function run() { |
|
| 104 | + foreach ( $this->filters as $hook ) { |
|
| 105 | 105 | add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
| 106 | 106 | } |
| 107 | - foreach ( $this->actions as $hook ) {
|
|
| 107 | + foreach ( $this->actions as $hook ) { |
|
| 108 | 108 | add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -1051,6 +1051,7 @@ discard block |
||
| 1051 | 1051 | * @param string | $slug | The type of message we're looking for |
| 1052 | 1052 | * @param string | $response_text| The default response message |
| 1053 | 1053 | * @param array | $data | An array of data that may be needed to construct the user's error message |
| 1054 | + * @param string $slug |
|
| 1054 | 1055 | * @return string| $response_text| The $response_text (after it's potentially been changed) |
| 1055 | 1056 | */ |
| 1056 | 1057 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
@@ -1198,6 +1199,7 @@ discard block |
||
| 1198 | 1199 | * |
| 1199 | 1200 | * @param string | $message | The response message |
| 1200 | 1201 | * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
| 1202 | + * @param boolean $is_success |
|
| 1201 | 1203 | * @return string| The $message wrapping in HTML |
| 1202 | 1204 | */ |
| 1203 | 1205 | public function wrap_form_submission_response( $message, $is_success ) { |
@@ -1242,6 +1244,7 @@ discard block |
||
| 1242 | 1244 | * @param string | $response | The response message to display to the user |
| 1243 | 1245 | * @param array | $additional_fields | An array of additional fields to return |
| 1244 | 1246 | * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
| 1247 | + * @param integer $hide |
|
| 1245 | 1248 | * |
| 1246 | 1249 | * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
| 1247 | 1250 | */ |
@@ -3,243 +3,243 @@ discard block |
||
| 3 | 3 | class Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler { |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
| 7 | - * |
|
| 8 | - * @since 6.3.0 |
|
| 9 | - * @access protected |
|
| 10 | - * @var bool | $is_ajax |
|
| 11 | - */ |
|
| 6 | + * A flag signifying whether we're dealing with an AJAX submission or standard form submission |
|
| 7 | + * |
|
| 8 | + * @since 6.3.0 |
|
| 9 | + * @access protected |
|
| 10 | + * @var bool | $is_ajax |
|
| 11 | + */ |
|
| 12 | 12 | protected $is_ajax; |
| 13 | 13 | |
| 14 | 14 | /**** Hardcoded Internal Variables ****/ |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * An array of form fields we don't process |
|
| 18 | - * |
|
| 19 | - * @since 6.3.0 |
|
| 20 | - * @access protected |
|
| 21 | - * @var array | $skipped_form_fields |
|
| 22 | - */ |
|
| 17 | + * An array of form fields we don't process |
|
| 18 | + * |
|
| 19 | + * @since 6.3.0 |
|
| 20 | + * @access protected |
|
| 21 | + * @var array | $skipped_form_fields |
|
| 22 | + */ |
|
| 23 | 23 | protected $skipped_form_fields; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * The default time in milliseconds to wait before redirecting a user |
|
| 27 | - * |
|
| 28 | - * @since 6.3.0 |
|
| 29 | - * @access protected |
|
| 30 | - * @var int | $default_redirect_time_ms |
|
| 31 | - */ |
|
| 26 | + * The default time in milliseconds to wait before redirecting a user |
|
| 27 | + * |
|
| 28 | + * @since 6.3.0 |
|
| 29 | + * @access protected |
|
| 30 | + * @var int | $default_redirect_time_ms |
|
| 31 | + */ |
|
| 32 | 32 | protected $default_redirect_time_ms; |
| 33 | 33 | |
| 34 | 34 | /**** Form Variables ****/ |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * The ID of the corresponding YIKES MailChimp form |
|
| 38 | - * |
|
| 39 | - * @since 6.3.0 |
|
| 40 | - * @access public |
|
| 41 | - * @var int | $form_id |
|
| 42 | - */ |
|
| 37 | + * The ID of the corresponding YIKES MailChimp form |
|
| 38 | + * |
|
| 39 | + * @since 6.3.0 |
|
| 40 | + * @access public |
|
| 41 | + * @var int | $form_id |
|
| 42 | + */ |
|
| 43 | 43 | public $form_id; |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * The ID of the corresponding MailChimp list |
|
| 47 | - * |
|
| 48 | - * @since 6.3.0 |
|
| 49 | - * @access public |
|
| 50 | - * @var int | $list_id |
|
| 51 | - */ |
|
| 46 | + * The ID of the corresponding MailChimp list |
|
| 47 | + * |
|
| 48 | + * @since 6.3.0 |
|
| 49 | + * @access public |
|
| 50 | + * @var int | $list_id |
|
| 51 | + */ |
|
| 52 | 52 | public $list_id; |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * The submitted email |
|
| 56 | - * |
|
| 57 | - * @since 6.3.0 |
|
| 58 | - * @access public |
|
| 59 | - * @var string | $email |
|
| 60 | - */ |
|
| 55 | + * The submitted email |
|
| 56 | + * |
|
| 57 | + * @since 6.3.0 |
|
| 58 | + * @access public |
|
| 59 | + * @var string | $email |
|
| 60 | + */ |
|
| 61 | 61 | public $email; |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * The array of error messages defined by the user and attached to this form |
|
| 65 | - * |
|
| 66 | - * @since 6.3.0 |
|
| 67 | - * @access public |
|
| 68 | - * @var array | $error_messages |
|
| 69 | - */ |
|
| 64 | + * The array of error messages defined by the user and attached to this form |
|
| 65 | + * |
|
| 66 | + * @since 6.3.0 |
|
| 67 | + * @access public |
|
| 68 | + * @var array | $error_messages |
|
| 69 | + */ |
|
| 70 | 70 | public $error_messages; |
| 71 | 71 | |
| 72 | 72 | /**** Default Error Messages ****/ |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * The error message for no form ID |
|
| 76 | - * |
|
| 77 | - * @since 6.3.0 |
|
| 78 | - * @access public |
|
| 79 | - * @var string | $handle_empty_form_id_message |
|
| 80 | - */ |
|
| 75 | + * The error message for no form ID |
|
| 76 | + * |
|
| 77 | + * @since 6.3.0 |
|
| 78 | + * @access public |
|
| 79 | + * @var string | $handle_empty_form_id_message |
|
| 80 | + */ |
|
| 81 | 81 | public $handle_empty_form_id_message; |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * The error message for no form found |
|
| 85 | - * |
|
| 86 | - * @since 6.3.0 |
|
| 87 | - * @access public |
|
| 88 | - * @var string | $handle_empty_form_message |
|
| 89 | - */ |
|
| 84 | + * The error message for no form found |
|
| 85 | + * |
|
| 86 | + * @since 6.3.0 |
|
| 87 | + * @access public |
|
| 88 | + * @var string | $handle_empty_form_message |
|
| 89 | + */ |
|
| 90 | 90 | public $handle_empty_form_message; |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * The error message for missing form fields |
|
| 94 | - * |
|
| 95 | - * @since 6.3.0 |
|
| 96 | - * @access public |
|
| 97 | - * @var string | $handle_empty_fields_generic_message |
|
| 98 | - */ |
|
| 93 | + * The error message for missing form fields |
|
| 94 | + * |
|
| 95 | + * @since 6.3.0 |
|
| 96 | + * @access public |
|
| 97 | + * @var string | $handle_empty_fields_generic_message |
|
| 98 | + */ |
|
| 99 | 99 | public $handle_empty_fields_generic_message; |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * The error message for missing $list_handler class |
|
| 103 | - * |
|
| 104 | - * @since 6.3.0 |
|
| 105 | - * @access public |
|
| 106 | - * @var string | $handle_empty_list_handler_message |
|
| 107 | - */ |
|
| 102 | + * The error message for missing $list_handler class |
|
| 103 | + * |
|
| 104 | + * @since 6.3.0 |
|
| 105 | + * @access public |
|
| 106 | + * @var string | $handle_empty_list_handler_message |
|
| 107 | + */ |
|
| 108 | 108 | public $handle_empty_list_handler_message; |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * The error message for no email |
|
| 112 | - * |
|
| 113 | - * @since 6.3.0 |
|
| 114 | - * @access public |
|
| 115 | - * @var string | $handle_empty_email_message |
|
| 116 | - */ |
|
| 111 | + * The error message for no email |
|
| 112 | + * |
|
| 113 | + * @since 6.3.0 |
|
| 114 | + * @access public |
|
| 115 | + * @var string | $handle_empty_email_message |
|
| 116 | + */ |
|
| 117 | 117 | public $handle_empty_email_message; |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * The error message for a filled in honeypot |
|
| 121 | - * |
|
| 122 | - * @since 6.3.0 |
|
| 123 | - * @access public |
|
| 124 | - * @var string | $handle_non_empty_honeypot_message |
|
| 125 | - */ |
|
| 120 | + * The error message for a filled in honeypot |
|
| 121 | + * |
|
| 122 | + * @since 6.3.0 |
|
| 123 | + * @access public |
|
| 124 | + * @var string | $handle_non_empty_honeypot_message |
|
| 125 | + */ |
|
| 126 | 126 | public $handle_non_empty_honeypot_message; |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | - * The error message for existing users trying to update when it's disallowed |
|
| 130 | - * |
|
| 131 | - * @since 6.3.0 |
|
| 132 | - * @access public |
|
| 133 | - * @var string | $handle_disallowed_existing_user_update_message |
|
| 134 | - */ |
|
| 129 | + * The error message for existing users trying to update when it's disallowed |
|
| 130 | + * |
|
| 131 | + * @since 6.3.0 |
|
| 132 | + * @access public |
|
| 133 | + * @var string | $handle_disallowed_existing_user_update_message |
|
| 134 | + */ |
|
| 135 | 135 | public $handle_disallowed_existing_user_update_message; |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * The first half of the error message for updating an existing user when it's done via a profile link |
|
| 139 | - * |
|
| 140 | - * @since 6.3.0 |
|
| 141 | - * @access public |
|
| 142 | - * @var string | $handle_updating_existing_user_message |
|
| 143 | - */ |
|
| 138 | + * The first half of the error message for updating an existing user when it's done via a profile link |
|
| 139 | + * |
|
| 140 | + * @since 6.3.0 |
|
| 141 | + * @access public |
|
| 142 | + * @var string | $handle_updating_existing_user_message |
|
| 143 | + */ |
|
| 144 | 144 | public $handle_updating_existing_user_message; |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
| 148 | - * |
|
| 149 | - * @since 6.3.0 |
|
| 150 | - * @access public |
|
| 151 | - * @var string | $handle_updating_existing_user_link_message |
|
| 152 | - */ |
|
| 147 | + * The second half of the error message (the link) for updating an existing user when it's done via a profile link |
|
| 148 | + * |
|
| 149 | + * @since 6.3.0 |
|
| 150 | + * @access public |
|
| 151 | + * @var string | $handle_updating_existing_user_link_message |
|
| 152 | + */ |
|
| 153 | 153 | public $handle_updating_existing_user_link_message; |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * A default, generic error message |
|
| 157 | - * |
|
| 158 | - * @since 6.3.0 |
|
| 159 | - * @access public |
|
| 160 | - * @var string | $default_error_response_message |
|
| 161 | - */ |
|
| 156 | + * A default, generic error message |
|
| 157 | + * |
|
| 158 | + * @since 6.3.0 |
|
| 159 | + * @access public |
|
| 160 | + * @var string | $default_error_response_message |
|
| 161 | + */ |
|
| 162 | 162 | public $default_error_response_message; |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | - * The error message for not filling out a required form field |
|
| 166 | - * |
|
| 167 | - * @since 6.3.0 |
|
| 168 | - * @access public |
|
| 169 | - * @var string | $handle_empty_required_field_message |
|
| 170 | - */ |
|
| 165 | + * The error message for not filling out a required form field |
|
| 166 | + * |
|
| 167 | + * @since 6.3.0 |
|
| 168 | + * @access public |
|
| 169 | + * @var string | $handle_empty_required_field_message |
|
| 170 | + */ |
|
| 171 | 171 | public $handle_empty_required_field_message; |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * The error message for not filling out a required interest group |
|
| 175 | - * |
|
| 176 | - * @since 6.3.0 |
|
| 177 | - * @access public |
|
| 178 | - * @var string | $handle_empty_required_interest_group_message |
|
| 179 | - */ |
|
| 174 | + * The error message for not filling out a required interest group |
|
| 175 | + * |
|
| 176 | + * @since 6.3.0 |
|
| 177 | + * @access public |
|
| 178 | + * @var string | $handle_empty_required_interest_group_message |
|
| 179 | + */ |
|
| 180 | 180 | public $handle_empty_required_interest_group_message; |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * The error message for nonce failures |
|
| 184 | - * |
|
| 185 | - * @since 6.3.0 |
|
| 186 | - * @access public |
|
| 187 | - * @var string | $handle_nonce_message |
|
| 188 | - */ |
|
| 183 | + * The error message for nonce failures |
|
| 184 | + * |
|
| 185 | + * @since 6.3.0 |
|
| 186 | + * @access public |
|
| 187 | + * @var string | $handle_nonce_message |
|
| 188 | + */ |
|
| 189 | 189 | public $handle_nonce_message; |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * The error message for a recaptcha that is not checked/filled out |
|
| 193 | - * |
|
| 194 | - * @since 6.3.0 |
|
| 195 | - * @access public |
|
| 196 | - * @var string | $handle_nonce_message |
|
| 197 | - */ |
|
| 192 | + * The error message for a recaptcha that is not checked/filled out |
|
| 193 | + * |
|
| 194 | + * @since 6.3.0 |
|
| 195 | + * @access public |
|
| 196 | + * @var string | $handle_nonce_message |
|
| 197 | + */ |
|
| 198 | 198 | public $handle_non_filled_recaptcha_message_message; |
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | - * The error message for recaptcha errors that we're not sure of |
|
| 202 | - * |
|
| 203 | - * @since 6.3.0 |
|
| 204 | - * @access public |
|
| 205 | - * @var string | $handle_nonce_message |
|
| 206 | - */ |
|
| 201 | + * The error message for recaptcha errors that we're not sure of |
|
| 202 | + * |
|
| 203 | + * @since 6.3.0 |
|
| 204 | + * @access public |
|
| 205 | + * @var string | $handle_nonce_message |
|
| 206 | + */ |
|
| 207 | 207 | public $generic_recaptcha_error_message; |
| 208 | 208 | |
| 209 | 209 | /**** Default Success Messages ****/ |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | - * The success message for single-optin forms |
|
| 213 | - * |
|
| 214 | - * @since 6.3.0 |
|
| 215 | - * @access public |
|
| 216 | - * @var string | $default_response_single_optin_success_message |
|
| 217 | - */ |
|
| 212 | + * The success message for single-optin forms |
|
| 213 | + * |
|
| 214 | + * @since 6.3.0 |
|
| 215 | + * @access public |
|
| 216 | + * @var string | $default_response_single_optin_success_message |
|
| 217 | + */ |
|
| 218 | 218 | public $default_response_single_optin_success_message; |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * The default success message for double-optin forms |
|
| 222 | - * |
|
| 223 | - * @since 6.3.0 |
|
| 224 | - * @access public |
|
| 225 | - * @var string | $default_response_double_optin_success_message |
|
| 226 | - */ |
|
| 221 | + * The default success message for double-optin forms |
|
| 222 | + * |
|
| 223 | + * @since 6.3.0 |
|
| 224 | + * @access public |
|
| 225 | + * @var string | $default_response_double_optin_success_message |
|
| 226 | + */ |
|
| 227 | 227 | public $default_response_double_optin_success_message; |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * The default success message for already subscribed users re-subscribing |
|
| 231 | - * |
|
| 232 | - * @since 6.3.0 |
|
| 233 | - * @access public |
|
| 234 | - * @var string | $existing_subscriber_profile_update_message |
|
| 235 | - */ |
|
| 230 | + * The default success message for already subscribed users re-subscribing |
|
| 231 | + * |
|
| 232 | + * @since 6.3.0 |
|
| 233 | + * @access public |
|
| 234 | + * @var string | $existing_subscriber_profile_update_message |
|
| 235 | + */ |
|
| 236 | 236 | public $existing_subscriber_profile_update_message; |
| 237 | 237 | |
| 238 | 238 | /** |
| 239 | - * The construct function - sets all of our hardcoded variables |
|
| 240 | - * |
|
| 241 | - * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
| 242 | - */ |
|
| 239 | + * The construct function - sets all of our hardcoded variables |
|
| 240 | + * |
|
| 241 | + * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission |
|
| 242 | + */ |
|
| 243 | 243 | public function __construct( $is_ajax ) { |
| 244 | 244 | |
| 245 | 245 | // Set up our variables |
@@ -278,45 +278,45 @@ discard block |
||
| 278 | 278 | /**** Setters for our Form Variables ****/ |
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | - * Set the form ID class property |
|
| 282 | - * |
|
| 283 | - * @since 6.3.0 |
|
| 284 | - * |
|
| 285 | - * @param int | $form_id | ID of the corresponding YIKES MailChimp form |
|
| 286 | - */ |
|
| 281 | + * Set the form ID class property |
|
| 282 | + * |
|
| 283 | + * @since 6.3.0 |
|
| 284 | + * |
|
| 285 | + * @param int | $form_id | ID of the corresponding YIKES MailChimp form |
|
| 286 | + */ |
|
| 287 | 287 | public function set_form_id( $form_id ) { |
| 288 | 288 | $this->form_id = $form_id; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | - * Set the list ID class property |
|
| 293 | - * |
|
| 294 | - * @since 6.3.0 |
|
| 295 | - * |
|
| 296 | - * @param int | $list_id | ID of the corresponding MailChimp list |
|
| 297 | - */ |
|
| 292 | + * Set the list ID class property |
|
| 293 | + * |
|
| 294 | + * @since 6.3.0 |
|
| 295 | + * |
|
| 296 | + * @param int | $list_id | ID of the corresponding MailChimp list |
|
| 297 | + */ |
|
| 298 | 298 | public function set_list_id( $list_id ) { |
| 299 | 299 | $this->list_id = $list_id; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
| 303 | - * Set the email class property |
|
| 304 | - * |
|
| 305 | - * @since 6.3.0 |
|
| 306 | - * |
|
| 307 | - * @param string | $sanitized_email | The sanitized email |
|
| 308 | - */ |
|
| 303 | + * Set the email class property |
|
| 304 | + * |
|
| 305 | + * @since 6.3.0 |
|
| 306 | + * |
|
| 307 | + * @param string | $sanitized_email | The sanitized email |
|
| 308 | + */ |
|
| 309 | 309 | public function set_email( $sanitized_email ) { |
| 310 | 310 | $this->email = $sanitized_email; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
| 314 | - * Set the $error_messages class property |
|
| 315 | - * |
|
| 316 | - * @since 6.3.0 |
|
| 317 | - * |
|
| 318 | - * @param array | $error_messages | The array of user-defined error messages for this form |
|
| 319 | - */ |
|
| 314 | + * Set the $error_messages class property |
|
| 315 | + * |
|
| 316 | + * @since 6.3.0 |
|
| 317 | + * |
|
| 318 | + * @param array | $error_messages | The array of user-defined error messages for this form |
|
| 319 | + */ |
|
| 320 | 320 | public function set_error_messages( $error_messages ) { |
| 321 | 321 | $this->error_messages = $error_messages; |
| 322 | 322 | } |
@@ -325,24 +325,24 @@ discard block |
||
| 325 | 325 | /**** Simple Return Functions ****/ |
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | - * Return a sanitized email |
|
| 329 | - * |
|
| 330 | - * @since 6.3.0 |
|
| 331 | - * |
|
| 332 | - * @param string | $email | The user's email |
|
| 333 | - * @return string| $email | The user's email, sanitized |
|
| 334 | - */ |
|
| 328 | + * Return a sanitized email |
|
| 329 | + * |
|
| 330 | + * @since 6.3.0 |
|
| 331 | + * |
|
| 332 | + * @param string | $email | The user's email |
|
| 333 | + * @return string| $email | The user's email, sanitized |
|
| 334 | + */ |
|
| 335 | 335 | public function get_sanitized_email( $email ) { |
| 336 | 336 | return sanitize_email( $email ); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | - * Return the class property $skipped_form_fields |
|
| 341 | - * |
|
| 342 | - * @since 6.3.0 |
|
| 343 | - * |
|
| 344 | - * @return array | $skipped_form_fields |
|
| 345 | - */ |
|
| 340 | + * Return the class property $skipped_form_fields |
|
| 341 | + * |
|
| 342 | + * @since 6.3.0 |
|
| 343 | + * |
|
| 344 | + * @return array | $skipped_form_fields |
|
| 345 | + */ |
|
| 346 | 346 | protected function get_skipped_merge_tags() { |
| 347 | 347 | return $this->skipped_form_fields; |
| 348 | 348 | } |
@@ -351,14 +351,14 @@ discard block |
||
| 351 | 351 | /**** Collection of functions handling the incoming form and interest group data ****/ |
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | - * Loop through form data to sanitize, format, filter, and return. |
|
| 355 | - * |
|
| 356 | - * @since 6.3.0 |
|
| 357 | - * |
|
| 358 | - * @param array | $data | The array of user-submitted form values |
|
| 359 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 360 | - * @return array| $merge_variables| The array of sanitized and formatted form values |
|
| 361 | - */ |
|
| 354 | + * Loop through form data to sanitize, format, filter, and return. |
|
| 355 | + * |
|
| 356 | + * @since 6.3.0 |
|
| 357 | + * |
|
| 358 | + * @param array | $data | The array of user-submitted form values |
|
| 359 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 360 | + * @return array| $merge_variables| The array of sanitized and formatted form values |
|
| 361 | + */ |
|
| 362 | 362 | public function get_submitted_merge_values( $data, $form_fields ) { |
| 363 | 363 | |
| 364 | 364 | // Array to return |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | - * yikes-mailchimp-filter-before-submission || yikes-mailchimp-filter-before-submission-{$form_id} |
|
| 395 | - * |
|
| 396 | - * Catch the merge variables before they get sent over to MailChimp |
|
| 397 | - * @since 6.0.0 |
|
| 398 | - * |
|
| 399 | - * @param array | $merge_variables | The user submitted form data |
|
| 400 | - */ |
|
| 394 | + * yikes-mailchimp-filter-before-submission || yikes-mailchimp-filter-before-submission-{$form_id} |
|
| 395 | + * |
|
| 396 | + * Catch the merge variables before they get sent over to MailChimp |
|
| 397 | + * @since 6.0.0 |
|
| 398 | + * |
|
| 399 | + * @param array | $merge_variables | The user submitted form data |
|
| 400 | + */ |
|
| 401 | 401 | $merge_variables = apply_filters( 'yikes-mailchimp-filter-before-submission', $merge_variables ); |
| 402 | 402 | $merge_variables = apply_filters( 'yikes-mailchimp-filter-before-submission-{$this->form_id}', $merge_variables ); |
| 403 | 403 | |
@@ -405,14 +405,14 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /** |
| 408 | - * Sanitize form values and return them |
|
| 409 | - * |
|
| 410 | - * @since 6.3.0 |
|
| 411 | - * |
|
| 412 | - * @param string | $key | The MERGE/Field-name for this value |
|
| 413 | - * @param mixed | $value | The form value - this could be an array or a string |
|
| 414 | - * @return mixed | $sanitized | The $value sanitized |
|
| 415 | - */ |
|
| 408 | + * Sanitize form values and return them |
|
| 409 | + * |
|
| 410 | + * @since 6.3.0 |
|
| 411 | + * |
|
| 412 | + * @param string | $key | The MERGE/Field-name for this value |
|
| 413 | + * @param mixed | $value | The form value - this could be an array or a string |
|
| 414 | + * @return mixed | $sanitized | The $value sanitized |
|
| 415 | + */ |
|
| 416 | 416 | protected function sanitize_form_values( $key, $value ) { |
| 417 | 417 | if ( is_scalar( $value ) ) { |
| 418 | 418 | $sanitized = sanitize_text_field( $value ); |
@@ -426,14 +426,14 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
| 429 | - * Check a date field's date format and pass it along to the appropriate function |
|
| 430 | - * |
|
| 431 | - * @since 6.3.0 |
|
| 432 | - * |
|
| 433 | - * @param string | $date | The unformatted date value |
|
| 434 | - * @param string | $date_format | The date format |
|
| 435 | - * @return string| $date | The date formatted according to the $date_format |
|
| 436 | - */ |
|
| 429 | + * Check a date field's date format and pass it along to the appropriate function |
|
| 430 | + * |
|
| 431 | + * @since 6.3.0 |
|
| 432 | + * |
|
| 433 | + * @param string | $date | The unformatted date value |
|
| 434 | + * @param string | $date_format | The date format |
|
| 435 | + * @return string| $date | The date formatted according to the $date_format |
|
| 436 | + */ |
|
| 437 | 437 | protected function handle_date_format_merge_values( $date, $date_format ) { |
| 438 | 438 | // Check if EU date format (for dates: 'DD/MM/YYYY', for birthdays: 'DD/MM') |
| 439 | 439 | if ( 'DD/MM/YYYY' === $date_format ) { |
@@ -446,13 +446,13 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | - * Format a date field whose date format is dd/mm/yyyy |
|
| 450 | - * |
|
| 451 | - * @since 6.3.0 |
|
| 452 | - * |
|
| 453 | - * @param string | $date | A date in the format dd/mm/yyyy |
|
| 454 | - * @return string| $date | A date in the format mm/dd/yyyy |
|
| 455 | - */ |
|
| 449 | + * Format a date field whose date format is dd/mm/yyyy |
|
| 450 | + * |
|
| 451 | + * @since 6.3.0 |
|
| 452 | + * |
|
| 453 | + * @param string | $date | A date in the format dd/mm/yyyy |
|
| 454 | + * @return string| $date | A date in the format mm/dd/yyyy |
|
| 455 | + */ |
|
| 456 | 456 | protected function handle_dd_mm_yyyy_date( $date ) { |
| 457 | 457 | |
| 458 | 458 | // MailChimp wants the dates as 'MM/DD/YYYY' regardless of user-specified format, so convert |
@@ -471,13 +471,13 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
| 474 | - * Format a birthday field whose date format is dd/mm |
|
| 475 | - * |
|
| 476 | - * @since 6.3.0 |
|
| 477 | - * |
|
| 478 | - * @param string | $birthday | A date in the format dd/mm |
|
| 479 | - * @return string| $birthday | A date in the format mm/dd |
|
| 480 | - */ |
|
| 474 | + * Format a birthday field whose date format is dd/mm |
|
| 475 | + * |
|
| 476 | + * @since 6.3.0 |
|
| 477 | + * |
|
| 478 | + * @param string | $birthday | A date in the format dd/mm |
|
| 479 | + * @return string| $birthday | A date in the format mm/dd |
|
| 480 | + */ |
|
| 481 | 481 | protected function handle_dd_mm_birthday( $birthday ) { |
| 482 | 482 | |
| 483 | 483 | // MailChimp wants the birthdays as 'MM/DD' regardless of user-specified format, so convert |
@@ -497,14 +497,14 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | |
| 499 | 499 | /** |
| 500 | - * Create an array of available interest groups based on the $replace_interests flag |
|
| 501 | - * |
|
| 502 | - * @since 6.3.0 |
|
| 503 | - * |
|
| 504 | - * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
| 505 | - * @param class | $list_class | Class for interacting with the current list |
|
| 506 | - * @return array | $groups | Array of interest groups |
|
| 507 | - */ |
|
| 500 | + * Create an array of available interest groups based on the $replace_interests flag |
|
| 501 | + * |
|
| 502 | + * @since 6.3.0 |
|
| 503 | + * |
|
| 504 | + * @param bool | $replace_interests| True if we're replacing interest groups, false if updating interest groups |
|
| 505 | + * @param class | $list_class | Class for interacting with the current list |
|
| 506 | + * @return array | $groups | Array of interest groups |
|
| 507 | + */ |
|
| 508 | 508 | public function get_default_interest_groups( $replace_interests, $list_class ) { |
| 509 | 509 | |
| 510 | 510 | // If $replace_interests flag is true then loop through interest groups and set them all to false to start. |
@@ -535,15 +535,15 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | |
| 537 | 537 | /** |
| 538 | - * Loop through the interest group form data to sanitize, format, filter, and return. |
|
| 539 | - * |
|
| 540 | - * @since 6.3.0 |
|
| 541 | - * |
|
| 542 | - * @param array | $data | The array of user-submitted form values |
|
| 543 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 544 | - * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
| 545 | - * @return array| $groups | The array of sanitized and formatted form values |
|
| 546 | - */ |
|
| 538 | + * Loop through the interest group form data to sanitize, format, filter, and return. |
|
| 539 | + * |
|
| 540 | + * @since 6.3.0 |
|
| 541 | + * |
|
| 542 | + * @param array | $data | The array of user-submitted form values |
|
| 543 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 544 | + * @param array | $groups | The array of interest groups created by `get_default_interest_groups()` |
|
| 545 | + * @return array| $groups | The array of sanitized and formatted form values |
|
| 546 | + */ |
|
| 547 | 547 | public function get_submitted_interest_groups( $data, $form_fields, $groups ) { |
| 548 | 548 | |
| 549 | 549 | // loop to push variables to our array |
@@ -568,13 +568,13 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | /** |
| 571 | - * yikes-mailchimp-filter-groups-before-submission |
|
| 572 | - * |
|
| 573 | - * Catch the interest groups before they get sent over to MailChimp |
|
| 574 | - * @param array | $groups | User submitted interest group data |
|
| 575 | - * @optional int| $form_id| the ID of the form to filter |
|
| 576 | - * @since 6.3.0 |
|
| 577 | - */ |
|
| 571 | + * yikes-mailchimp-filter-groups-before-submission |
|
| 572 | + * |
|
| 573 | + * Catch the interest groups before they get sent over to MailChimp |
|
| 574 | + * @param array | $groups | User submitted interest group data |
|
| 575 | + * @optional int| $form_id| the ID of the form to filter |
|
| 576 | + * @since 6.3.0 |
|
| 577 | + */ |
|
| 578 | 578 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission', $groups, $this->form_id ); |
| 579 | 579 | $groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission-{$this->form_id}', $groups, $this->form_id ); |
| 580 | 580 | |
@@ -585,17 +585,17 @@ discard block |
||
| 585 | 585 | /**** Functions to Handle Subscribe API Response ****/ |
| 586 | 586 | |
| 587 | 587 | /** |
| 588 | - * Handle the response to a successful subscribe request |
|
| 589 | - * |
|
| 590 | - * @since 6.3.0 |
|
| 591 | - * |
|
| 592 | - * @param array | $submission_settings | Array of the form's submission settings |
|
| 593 | - * @param array | $page_data | Array of the page data |
|
| 594 | - * @param array | $merge_variables | Array of the submitted form variables |
|
| 595 | - * @param array | $notifications | Literally don't know what this is yet. |
|
| 596 | - * @param array | $optin_settings | Array of the form's optin settings |
|
| 597 | - * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
| 598 | - */ |
|
| 588 | + * Handle the response to a successful subscribe request |
|
| 589 | + * |
|
| 590 | + * @since 6.3.0 |
|
| 591 | + * |
|
| 592 | + * @param array | $submission_settings | Array of the form's submission settings |
|
| 593 | + * @param array | $page_data | Array of the page data |
|
| 594 | + * @param array | $merge_variables | Array of the submitted form variables |
|
| 595 | + * @param array | $notifications | Literally don't know what this is yet. |
|
| 596 | + * @param array | $optin_settings | Array of the form's optin settings |
|
| 597 | + * @param bool | $new_subscriber | True if a new subscriber, false if an existing one |
|
| 598 | + */ |
|
| 599 | 599 | public function handle_submission_response_success( $submission_settings, $page_data, $merge_variables, $notifications, $optin_settings, $new_subscriber ) { |
| 600 | 600 | |
| 601 | 601 | // Check if we should redirect, and collect the redirect info in an array |
@@ -604,27 +604,27 @@ discard block |
||
| 604 | 604 | // Fire off our actions |
| 605 | 605 | |
| 606 | 606 | /** |
| 607 | - * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
| 608 | - * |
|
| 609 | - * Catch the merge variables after they've been sent over to MailChimp |
|
| 610 | - * @since 6.0.0 |
|
| 611 | - * |
|
| 612 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 613 | - */ |
|
| 607 | + * yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id} |
|
| 608 | + * |
|
| 609 | + * Catch the merge variables after they've been sent over to MailChimp |
|
| 610 | + * @since 6.0.0 |
|
| 611 | + * |
|
| 612 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 613 | + */ |
|
| 614 | 614 | do_action( 'yikes-mailchimp-after-submission', $merge_variables ); |
| 615 | 615 | do_action( "yikes-mailchimp-after-submission-{$this->form_id}", $merge_variables ); |
| 616 | 616 | |
| 617 | 617 | /** |
| 618 | - * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
| 619 | - * |
|
| 620 | - * Catch our notifications and other form data |
|
| 621 | - * |
|
| 622 | - * @param string | $email | The user's email |
|
| 623 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 624 | - * @param string | $form_id | The form ID |
|
| 625 | - * @param array | $notifications | Array of notification messages |
|
| 626 | - * |
|
| 627 | - */ |
|
| 618 | + * yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id} |
|
| 619 | + * |
|
| 620 | + * Catch our notifications and other form data |
|
| 621 | + * |
|
| 622 | + * @param string | $email | The user's email |
|
| 623 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 624 | + * @param string | $form_id | The form ID |
|
| 625 | + * @param array | $notifications | Array of notification messages |
|
| 626 | + * |
|
| 627 | + */ |
|
| 628 | 628 | do_action( 'yikes-mailchimp-form-submission', $this->email, $merge_variables, $this->form_id, $notifications ); |
| 629 | 629 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
| 630 | 630 | |
@@ -646,15 +646,15 @@ discard block |
||
| 646 | 646 | $default_response = ( $new_subscriber === false ) ? $this->check_for_user_defined_response_message( 'success-resubscribed', $this->existing_subscriber_profile_update_message ) : $default_response; |
| 647 | 647 | |
| 648 | 648 | /** |
| 649 | - * yikes-mailchimp-success-response |
|
| 650 | - * |
|
| 651 | - * Filter the success message displayed to the user |
|
| 652 | - * |
|
| 653 | - * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
| 654 | - * @param string | $form_id | The form ID |
|
| 655 | - * @param array | $merge_variables | The array of user submitted form data |
|
| 656 | - * |
|
| 657 | - */ |
|
| 649 | + * yikes-mailchimp-success-response |
|
| 650 | + * |
|
| 651 | + * Filter the success message displayed to the user |
|
| 652 | + * |
|
| 653 | + * @param string | $default_response | The response message that will be shown to the user if unchanged (see above for logic) |
|
| 654 | + * @param string | $form_id | The form ID |
|
| 655 | + * @param array | $merge_variables | The array of user submitted form data |
|
| 656 | + * |
|
| 657 | + */ |
|
| 658 | 658 | $response_message = apply_filters( 'yikes-mailchimp-success-response', $default_response, $this->form_id, $merge_variables ); |
| 659 | 659 | |
| 660 | 660 | // Construct our success array variables |
@@ -673,13 +673,13 @@ discard block |
||
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | - * Handle an unsuccessful/error subscribe request |
|
| 677 | - * |
|
| 678 | - * @since 6.3.0 |
|
| 679 | - * |
|
| 680 | - * @param object | $subscribe_response | The response from the API |
|
| 681 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 682 | - */ |
|
| 676 | + * Handle an unsuccessful/error subscribe request |
|
| 677 | + * |
|
| 678 | + * @since 6.3.0 |
|
| 679 | + * |
|
| 680 | + * @param object | $subscribe_response | The response from the API |
|
| 681 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 682 | + */ |
|
| 683 | 683 | public function handle_submission_response_error( $subscribe_response, $form_fields ) { |
| 684 | 684 | |
| 685 | 685 | // Get the error data |
@@ -716,14 +716,14 @@ discard block |
||
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | /** |
| 719 | - * Handle the redirect logic for successful submissions |
|
| 720 | - * |
|
| 721 | - * @since 6.3.0 |
|
| 722 | - * |
|
| 723 | - * @param array | $submission_settings | Array of the form's submission settings |
|
| 724 | - * @param array | $page_data | Array of the page data |
|
| 725 | - * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
| 726 | - */ |
|
| 719 | + * Handle the redirect logic for successful submissions |
|
| 720 | + * |
|
| 721 | + * @since 6.3.0 |
|
| 722 | + * |
|
| 723 | + * @param array | $submission_settings | Array of the form's submission settings |
|
| 724 | + * @param array | $page_data | Array of the page data |
|
| 725 | + * @return array| $redirect_array | Array with two values: Redirection flag, Redirect URL |
|
| 726 | + */ |
|
| 727 | 727 | protected function handle_submission_response_success_redirect( $submission_settings, $page_data ) { |
| 728 | 728 | |
| 729 | 729 | // Set up our return array with default values |
@@ -754,23 +754,23 @@ discard block |
||
| 754 | 754 | $redirect_url = ( 'custom_url' !== $redirect_page_setting ) ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
| 755 | 755 | |
| 756 | 756 | /** |
| 757 | - * yikes-mailchimp-redirect-url |
|
| 758 | - * |
|
| 759 | - * Catch the redirect URL before it's shown to the user |
|
| 760 | - * |
|
| 761 | - * @param string | $redirect_url | The URL that we will redirect to |
|
| 762 | - * @param string | $form_id | The ID of the current form being subscribed to |
|
| 763 | - * @param array | $page_data | An array of data related to the page the form is on |
|
| 764 | - */ |
|
| 757 | + * yikes-mailchimp-redirect-url |
|
| 758 | + * |
|
| 759 | + * Catch the redirect URL before it's shown to the user |
|
| 760 | + * |
|
| 761 | + * @param string | $redirect_url | The URL that we will redirect to |
|
| 762 | + * @param string | $form_id | The ID of the current form being subscribed to |
|
| 763 | + * @param array | $page_data | An array of data related to the page the form is on |
|
| 764 | + */ |
|
| 765 | 765 | $redirect_url = apply_filters( 'yikes-mailchimp-redirect-url', $redirect_url, $this->form_id, $page_data ); |
| 766 | 766 | |
| 767 | 767 | /** |
| 768 | - * yikes-mailchimp-redirect-timer |
|
| 769 | - * |
|
| 770 | - * Catch the redirect timer before it's sent to the JavaScript file |
|
| 771 | - * |
|
| 772 | - * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
| 773 | - */ |
|
| 768 | + * yikes-mailchimp-redirect-timer |
|
| 769 | + * |
|
| 770 | + * Catch the redirect timer before it's sent to the JavaScript file |
|
| 771 | + * |
|
| 772 | + * @param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting |
|
| 773 | + */ |
|
| 774 | 774 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $this->default_redirect_time_ms, $this->form_id ); |
| 775 | 775 | |
| 776 | 776 | $redirect_array['redirect_timer'] = $redirect_timer; |
@@ -787,13 +787,13 @@ discard block |
||
| 787 | 787 | // Note: All of these functions return `return $this->yikes_fail()`. Check function for more info. |
| 788 | 788 | |
| 789 | 789 | /** |
| 790 | - * Check if the submitted form data is missing any required fields |
|
| 791 | - * |
|
| 792 | - * @since 6.3.0 |
|
| 793 | - * |
|
| 794 | - * @param array | $data | The array of user-submitted form values |
|
| 795 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 796 | - */ |
|
| 790 | + * Check if the submitted form data is missing any required fields |
|
| 791 | + * |
|
| 792 | + * @since 6.3.0 |
|
| 793 | + * |
|
| 794 | + * @param array | $data | The array of user-submitted form values |
|
| 795 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 796 | + */ |
|
| 797 | 797 | public function check_for_required_form_fields( $data, $form_fields ) { |
| 798 | 798 | |
| 799 | 799 | // Set up our defaults |
@@ -818,15 +818,15 @@ discard block |
||
| 818 | 818 | foreach( $value as $field => $val ) { |
| 819 | 819 | |
| 820 | 820 | /** |
| 821 | - * 'yikes-mailchimp-ignore-required-array-field' |
|
| 822 | - * |
|
| 823 | - * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
| 824 | - * |
|
| 825 | - * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
| 826 | - * @param int | $form_id |
|
| 827 | - * |
|
| 828 | - * @return Array of fields to ignore. |
|
| 829 | - */ |
|
| 821 | + * 'yikes-mailchimp-ignore-required-array-field' |
|
| 822 | + * |
|
| 823 | + * Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array. |
|
| 824 | + * |
|
| 825 | + * @param array | Array of fields to ignore. Key of the array should be the field name. |
|
| 826 | + * @param int | $form_id |
|
| 827 | + * |
|
| 828 | + * @return Array of fields to ignore. |
|
| 829 | + */ |
|
| 830 | 830 | $ignored_fields = apply_filters( 'yikes-mailchimp-ignore-required-array-field', array( 'addr2' => true ), $this->form_id ); |
| 831 | 831 | |
| 832 | 832 | if ( empty( $val ) && ! isset( $ignored_fields[ $field ] ) ) { |
@@ -857,14 +857,14 @@ discard block |
||
| 857 | 857 | ); |
| 858 | 858 | |
| 859 | 859 | /** |
| 860 | - * yikes-mailchimp-required-form-field-missing |
|
| 861 | - * |
|
| 862 | - * Alter the response message shown to the user for missing required form fields |
|
| 863 | - * |
|
| 864 | - * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
| 865 | - * @param int | $form_id | The ID of the form |
|
| 866 | - * @param array | $missing_fields | Array of the missing required fields |
|
| 867 | - */ |
|
| 860 | + * yikes-mailchimp-required-form-field-missing |
|
| 861 | + * |
|
| 862 | + * Alter the response message shown to the user for missing required form fields |
|
| 863 | + * |
|
| 864 | + * @param string | $handle_empty_required_field_message | The default message displayed to the user |
|
| 865 | + * @param int | $form_id | The ID of the form |
|
| 866 | + * @param array | $missing_fields | Array of the missing required fields |
|
| 867 | + */ |
|
| 868 | 868 | $default_response = apply_filters( 'yikes-mailchimp-required-form-field-missing', $this->handle_empty_required_field_message, $this->form_id, $missing_fields ); |
| 869 | 869 | |
| 870 | 870 | // If we've found a missing field, return the array of field data |
@@ -873,13 +873,13 @@ discard block |
||
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | /** |
| 876 | - * Check if the submitted form interest group data is missing any required fields |
|
| 877 | - * |
|
| 878 | - * @since 6.3.0 |
|
| 879 | - * |
|
| 880 | - * @param array | $data | The array of user-submitted form values |
|
| 881 | - * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 882 | - */ |
|
| 876 | + * Check if the submitted form interest group data is missing any required fields |
|
| 877 | + * |
|
| 878 | + * @since 6.3.0 |
|
| 879 | + * |
|
| 880 | + * @param array | $data | The array of user-submitted form values |
|
| 881 | + * @param array | $form_fields | The array of form field definitions for this YIKES MailChimp form |
|
| 882 | + */ |
|
| 883 | 883 | public function check_for_required_interest_groups( $data, $form_fields ) { |
| 884 | 884 | |
| 885 | 885 | // Set up our defaults |
@@ -913,14 +913,14 @@ discard block |
||
| 913 | 913 | ); |
| 914 | 914 | |
| 915 | 915 | /** |
| 916 | - * yikes-mailchimp-required-interest-group-missing |
|
| 917 | - * |
|
| 918 | - * Alter the response message shown to the user for missing required form fields |
|
| 919 | - * |
|
| 920 | - * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
| 921 | - * @param int | $form_id | The ID of the form |
|
| 922 | - * @param array | $missing_fields | Array of the missing required fields |
|
| 923 | - */ |
|
| 916 | + * yikes-mailchimp-required-interest-group-missing |
|
| 917 | + * |
|
| 918 | + * Alter the response message shown to the user for missing required form fields |
|
| 919 | + * |
|
| 920 | + * @param string | $handle_empty_required_interest_group_message | The default message displayed to the user |
|
| 921 | + * @param int | $form_id | The ID of the form |
|
| 922 | + * @param array | $missing_fields | Array of the missing required fields |
|
| 923 | + */ |
|
| 924 | 924 | $default_response = apply_filters( 'yikes-mailchimp-required-interest-group-missing', $this->handle_empty_required_interest_group_message, $this->form_id, $missing_fields ); |
| 925 | 925 | |
| 926 | 926 | // If we find a required interest group with an empty value, send an error |
@@ -929,12 +929,12 @@ discard block |
||
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | /** |
| 932 | - * Handle the reCAPTCHA |
|
| 933 | - * |
|
| 934 | - * @since 6.3.0 |
|
| 935 | - * |
|
| 936 | - * @param string | $recaptcha_response | The form value of the recaptcha field |
|
| 937 | - */ |
|
| 932 | + * Handle the reCAPTCHA |
|
| 933 | + * |
|
| 934 | + * @since 6.3.0 |
|
| 935 | + * |
|
| 936 | + * @param string | $recaptcha_response | The form value of the recaptcha field |
|
| 937 | + */ |
|
| 938 | 938 | public function handle_recaptcha( $recaptcha_response ) { |
| 939 | 939 | |
| 940 | 940 | // Before we the hit the API, let's check that we actually got a response. |
@@ -942,11 +942,11 @@ discard block |
||
| 942 | 942 | if ( empty( $recaptcha_response ) ) { |
| 943 | 943 | |
| 944 | 944 | /** |
| 945 | - * yikes-mailchimp-recaptcha-required-error |
|
| 946 | - * |
|
| 947 | - * Catch the recaptcha errors before they're returned to the user |
|
| 948 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 949 | - */ |
|
| 945 | + * yikes-mailchimp-recaptcha-required-error |
|
| 946 | + * |
|
| 947 | + * Catch the recaptcha errors before they're returned to the user |
|
| 948 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 949 | + */ |
|
| 950 | 950 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', $this->handle_non_filled_recaptcha_message_message, $this->form_id ); |
| 951 | 951 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
| 952 | 952 | } |
@@ -979,40 +979,40 @@ discard block |
||
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | /** |
| 982 | - * yikes-mailchimp-recaptcha-required-error |
|
| 983 | - * |
|
| 984 | - * Catch the recaptcha errors before they're returned to the user |
|
| 985 | - * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 986 | - */ |
|
| 982 | + * yikes-mailchimp-recaptcha-required-error |
|
| 983 | + * |
|
| 984 | + * Catch the recaptcha errors before they're returned to the user |
|
| 985 | + * @param string | $recaptcha_errors | A string of recaptcha errors separated by a space |
|
| 986 | + */ |
|
| 987 | 987 | $response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $recaptcha_errors ), $this->form_id ); |
| 988 | 988 | return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true ); |
| 989 | 989 | } |
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | /** |
| 993 | - * Handle the nonce field |
|
| 994 | - * |
|
| 995 | - * @since 6.3.0 |
|
| 996 | - * |
|
| 997 | - * @param string | $nonce_value | The form value of the nonce |
|
| 998 | - * @param string | $nonce_name | The name of the nonce |
|
| 999 | - */ |
|
| 993 | + * Handle the nonce field |
|
| 994 | + * |
|
| 995 | + * @since 6.3.0 |
|
| 996 | + * |
|
| 997 | + * @param string | $nonce_value | The form value of the nonce |
|
| 998 | + * @param string | $nonce_name | The name of the nonce |
|
| 999 | + */ |
|
| 1000 | 1000 | public function handle_nonce( $nonce_value, $nonce_name ) { |
| 1001 | 1001 | |
| 1002 | 1002 | // First, check our option - this is set in the general settings page |
| 1003 | 1003 | if ( get_option( 'yikes-mailchimp-use-nonce' ) === '1' ) { |
| 1004 | 1004 | |
| 1005 | 1005 | /** |
| 1006 | - * yikes-mailchimp-use-nonce-verification |
|
| 1007 | - * |
|
| 1008 | - * Decide if we're going to check the nonce value. |
|
| 1009 | - * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
| 1010 | - * The default will always be to use the nonce. |
|
| 1011 | - * |
|
| 1012 | - * @param int | $form_id | The form id |
|
| 1013 | - * |
|
| 1014 | - * @return bool | True if we should check the nonce |
|
| 1015 | - */ |
|
| 1006 | + * yikes-mailchimp-use-nonce-verification |
|
| 1007 | + * |
|
| 1008 | + * Decide if we're going to check the nonce value. |
|
| 1009 | + * The reason we filter this is that some users are experiencing nonce issues repeatedly. |
|
| 1010 | + * The default will always be to use the nonce. |
|
| 1011 | + * |
|
| 1012 | + * @param int | $form_id | The form id |
|
| 1013 | + * |
|
| 1014 | + * @return bool | True if we should check the nonce |
|
| 1015 | + */ |
|
| 1016 | 1016 | $use_nonce = apply_filters( 'yikes-mailchimp-use-nonce-verification', true, $this->form_id ); |
| 1017 | 1017 | |
| 1018 | 1018 | // We let the filter override the option because the filter is on a per-form basis |
@@ -1025,24 +1025,24 @@ discard block |
||
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | 1027 | /** |
| 1028 | - * Handle a merge_variables error |
|
| 1029 | - * |
|
| 1030 | - * @since 6.3.0 |
|
| 1031 | - * |
|
| 1032 | - * @param int | $error | Int $error = 1 if an error |
|
| 1033 | - * @param string | $message | The message shown to the user |
|
| 1034 | - */ |
|
| 1028 | + * Handle a merge_variables error |
|
| 1029 | + * |
|
| 1030 | + * @since 6.3.0 |
|
| 1031 | + * |
|
| 1032 | + * @param int | $error | Int $error = 1 if an error |
|
| 1033 | + * @param string | $message | The message shown to the user |
|
| 1034 | + */ |
|
| 1035 | 1035 | public function handle_merge_variables_error( $error, $message ) { |
| 1036 | 1036 | return $this->yikes_fail( $hide = 0, $error, $message, array(), $return_response_non_ajax = true ); |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | /** |
| 1040 | - * Handle an empty email field and return the corresponding error message |
|
| 1041 | - * |
|
| 1042 | - * @since 6.3.0 |
|
| 1043 | - * |
|
| 1044 | - * @param string | $email |
|
| 1045 | - */ |
|
| 1040 | + * Handle an empty email field and return the corresponding error message |
|
| 1041 | + * |
|
| 1042 | + * @since 6.3.0 |
|
| 1043 | + * |
|
| 1044 | + * @param string | $email |
|
| 1045 | + */ |
|
| 1046 | 1046 | public function handle_empty_email( $email ) { |
| 1047 | 1047 | if ( empty( $email ) ) { |
| 1048 | 1048 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_email_message ); |
@@ -1050,12 +1050,12 @@ discard block |
||
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | /** |
| 1053 | - * Check if the form is empty and return the corresponding error message |
|
| 1054 | - * |
|
| 1055 | - * @since 6.3.0 |
|
| 1056 | - * |
|
| 1057 | - * @param array | $form_data |
|
| 1058 | - */ |
|
| 1053 | + * Check if the form is empty and return the corresponding error message |
|
| 1054 | + * |
|
| 1055 | + * @since 6.3.0 |
|
| 1056 | + * |
|
| 1057 | + * @param array | $form_data |
|
| 1058 | + */ |
|
| 1059 | 1059 | public function handle_empty_form( $form_data ) { |
| 1060 | 1060 | if ( empty( $form_data ) ) { |
| 1061 | 1061 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_message ); |
@@ -1063,12 +1063,12 @@ discard block |
||
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | /** |
| 1066 | - * Check if the honeypot is NOT empty and return the corresponding error message |
|
| 1067 | - * |
|
| 1068 | - * @since 6.3.0 |
|
| 1069 | - * |
|
| 1070 | - * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
| 1071 | - */ |
|
| 1066 | + * Check if the honeypot is NOT empty and return the corresponding error message |
|
| 1067 | + * |
|
| 1068 | + * @since 6.3.0 |
|
| 1069 | + * |
|
| 1070 | + * @param bool | $honey_pot_filled | True if the honeypot was filled out |
|
| 1071 | + */ |
|
| 1072 | 1072 | public function handle_non_empty_honeypot( $honey_pot_filled ) { |
| 1073 | 1073 | if ( $honey_pot_filled === true ) { |
| 1074 | 1074 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_non_empty_honeypot_message ); |
@@ -1076,12 +1076,12 @@ discard block |
||
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | /** |
| 1079 | - * Loop through fields looking for null and return the corresponding error message |
|
| 1080 | - * |
|
| 1081 | - * @since 6.3.0 |
|
| 1082 | - * |
|
| 1083 | - * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
| 1084 | - */ |
|
| 1079 | + * Loop through fields looking for null and return the corresponding error message |
|
| 1080 | + * |
|
| 1081 | + * @since 6.3.0 |
|
| 1082 | + * |
|
| 1083 | + * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
|
| 1084 | + */ |
|
| 1085 | 1085 | public function handle_empty_fields_generic( $fields_array ) { |
| 1086 | 1086 | foreach( $fields_array as $field ) { |
| 1087 | 1087 | if ( $field === null ) { |
@@ -1091,12 +1091,12 @@ discard block |
||
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | /** |
| 1094 | - * Check if the list handler is empty and return the corresponding error message |
|
| 1095 | - * |
|
| 1096 | - * @since 6.3.0 |
|
| 1097 | - * |
|
| 1098 | - * @param class | $list_handler | A class that handles list functions |
|
| 1099 | - */ |
|
| 1094 | + * Check if the list handler is empty and return the corresponding error message |
|
| 1095 | + * |
|
| 1096 | + * @since 6.3.0 |
|
| 1097 | + * |
|
| 1098 | + * @param class | $list_handler | A class that handles list functions |
|
| 1099 | + */ |
|
| 1100 | 1100 | public function handle_empty_list_handler( $list_handler ) { |
| 1101 | 1101 | if ( empty( $list_handler ) ) { |
| 1102 | 1102 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_list_handler_message ); |
@@ -1104,12 +1104,12 @@ discard block |
||
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | /** |
| 1107 | - * Check if the form id is empty and return the corresponding error message |
|
| 1108 | - * |
|
| 1109 | - * @since 6.3.0 |
|
| 1110 | - * |
|
| 1111 | - * @param int | $form_id | The form ID |
|
| 1112 | - */ |
|
| 1107 | + * Check if the form id is empty and return the corresponding error message |
|
| 1108 | + * |
|
| 1109 | + * @since 6.3.0 |
|
| 1110 | + * |
|
| 1111 | + * @param int | $form_id | The form ID |
|
| 1112 | + */ |
|
| 1113 | 1113 | public function handle_empty_form_id( $form_id ) { |
| 1114 | 1114 | if ( empty( $form_id ) ) { |
| 1115 | 1115 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_id_message ); |
@@ -1117,10 +1117,10 @@ discard block |
||
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | /** |
| 1120 | - * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
| 1121 | - * |
|
| 1122 | - * @since 6.3.0 |
|
| 1123 | - */ |
|
| 1120 | + * Construct and filter the error message related to user's re-subscribing when it's not allowed |
|
| 1121 | + * |
|
| 1122 | + * @since 6.3.0 |
|
| 1123 | + */ |
|
| 1124 | 1124 | public function handle_disallowed_existing_user_update() { |
| 1125 | 1125 | |
| 1126 | 1126 | // Get the default response |
@@ -1133,10 +1133,10 @@ discard block |
||
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | /** |
| 1136 | - * Construct and filter the error message related to the profile link to update user's profile |
|
| 1137 | - * |
|
| 1138 | - * @since 6.3.0 |
|
| 1139 | - */ |
|
| 1136 | + * Construct and filter the error message related to the profile link to update user's profile |
|
| 1137 | + * |
|
| 1138 | + * @since 6.3.0 |
|
| 1139 | + */ |
|
| 1140 | 1140 | public function handle_updating_existing_user() { |
| 1141 | 1141 | |
| 1142 | 1142 | // Get the first half of the message |
@@ -1161,15 +1161,15 @@ discard block |
||
| 1161 | 1161 | /**** Helper Functions ****/ |
| 1162 | 1162 | |
| 1163 | 1163 | /** |
| 1164 | - * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
| 1165 | - * |
|
| 1166 | - * @since 6.3.0 |
|
| 1167 | - * |
|
| 1168 | - * @param string | $slug | The type of message we're looking for |
|
| 1169 | - * @param string | $response_text| The default response message |
|
| 1170 | - * @param array | $data | An array of data that may be needed to construct the user's error message |
|
| 1171 | - * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
| 1172 | - */ |
|
| 1164 | + * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults. |
|
| 1165 | + * |
|
| 1166 | + * @since 6.3.0 |
|
| 1167 | + * |
|
| 1168 | + * @param string | $slug | The type of message we're looking for |
|
| 1169 | + * @param string | $response_text| The default response message |
|
| 1170 | + * @param array | $data | An array of data that may be needed to construct the user's error message |
|
| 1171 | + * @return string| $response_text| The $response_text (after it's potentially been changed) |
|
| 1172 | + */ |
|
| 1173 | 1173 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
| 1174 | 1174 | |
| 1175 | 1175 | switch( $slug ) { |
@@ -1183,13 +1183,13 @@ discard block |
||
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | /** |
| 1186 | - * yikes-easy-mailchimp-user-already-subscribed-text |
|
| 1187 | - * |
|
| 1188 | - * Catch the message for user's already subscrbed before we show it to the user |
|
| 1189 | - * @param string | $message | The response message |
|
| 1190 | - * @param int | $form_id | The form id |
|
| 1191 | - * @param string | $email | The user's email |
|
| 1192 | - */ |
|
| 1186 | + * yikes-easy-mailchimp-user-already-subscribed-text |
|
| 1187 | + * |
|
| 1188 | + * Catch the message for user's already subscrbed before we show it to the user |
|
| 1189 | + * @param string | $message | The response message |
|
| 1190 | + * @param int | $form_id | The form id |
|
| 1191 | + * @param string | $email | The user's email |
|
| 1192 | + */ |
|
| 1193 | 1193 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-text', $response_text, $this->form_id, $this->email ); |
| 1194 | 1194 | |
| 1195 | 1195 | return $response_text; |
@@ -1208,13 +1208,13 @@ discard block |
||
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /** |
| 1211 | - * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
| 1212 | - * |
|
| 1213 | - * Catch the message for user's already subscrbed link text before we show it to the user |
|
| 1214 | - * |
|
| 1215 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1216 | - * @param string | $form_id | The form ID |
|
| 1217 | - */ |
|
| 1211 | + * yikes-easy-mailchimp-user-already-subscribed-link-text |
|
| 1212 | + * |
|
| 1213 | + * Catch the message for user's already subscrbed link text before we show it to the user |
|
| 1214 | + * |
|
| 1215 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1216 | + * @param string | $form_id | The form ID |
|
| 1217 | + */ |
|
| 1218 | 1218 | $response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-link-text', $response_text, $this->form_id ); |
| 1219 | 1219 | |
| 1220 | 1220 | return $response_text; |
@@ -1228,14 +1228,14 @@ discard block |
||
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | 1230 | /** |
| 1231 | - * yikes-mailchimp-success-double-optin-response |
|
| 1232 | - * |
|
| 1233 | - * Filter the success message displayed to the user |
|
| 1234 | - * |
|
| 1235 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1236 | - * @param string | $form_id | The form ID |
|
| 1237 | - * |
|
| 1238 | - */ |
|
| 1231 | + * yikes-mailchimp-success-double-optin-response |
|
| 1232 | + * |
|
| 1233 | + * Filter the success message displayed to the user |
|
| 1234 | + * |
|
| 1235 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1236 | + * @param string | $form_id | The form ID |
|
| 1237 | + * |
|
| 1238 | + */ |
|
| 1239 | 1239 | $response_text = apply_filters( 'yikes-mailchimp-success-double-optin-response', $response_text, $this->form_id ); |
| 1240 | 1240 | |
| 1241 | 1241 | return $response_text; |
@@ -1248,14 +1248,14 @@ discard block |
||
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | /** |
| 1251 | - * yikes-mailchimp-success-single-optin-response |
|
| 1252 | - * |
|
| 1253 | - * Filter the success message displayed to the user |
|
| 1254 | - * |
|
| 1255 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1256 | - * @param string | $form_id | The form ID |
|
| 1257 | - * |
|
| 1258 | - */ |
|
| 1251 | + * yikes-mailchimp-success-single-optin-response |
|
| 1252 | + * |
|
| 1253 | + * Filter the success message displayed to the user |
|
| 1254 | + * |
|
| 1255 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1256 | + * @param string | $form_id | The form ID |
|
| 1257 | + * |
|
| 1258 | + */ |
|
| 1259 | 1259 | $response_text = apply_filters( 'yikes-mailchimp-success-single-optin-response', $response_text, $this->form_id ); |
| 1260 | 1260 | |
| 1261 | 1261 | return $response_text; |
@@ -1268,14 +1268,14 @@ discard block |
||
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | /** |
| 1271 | - * yikes-mailchimp-success-resubscribed-response |
|
| 1272 | - * |
|
| 1273 | - * Filter the success message displayed to the user |
|
| 1274 | - * |
|
| 1275 | - * @param string | $response_text | The response message that will be shown to the user |
|
| 1276 | - * @param string | $form_id | The form ID |
|
| 1277 | - * |
|
| 1278 | - */ |
|
| 1271 | + * yikes-mailchimp-success-resubscribed-response |
|
| 1272 | + * |
|
| 1273 | + * Filter the success message displayed to the user |
|
| 1274 | + * |
|
| 1275 | + * @param string | $response_text | The response message that will be shown to the user |
|
| 1276 | + * @param string | $form_id | The form ID |
|
| 1277 | + * |
|
| 1278 | + */ |
|
| 1279 | 1279 | $response_text = apply_filters( 'yikes-mailchimp-success-resubscribed-response', $response_text, $this->form_id ); |
| 1280 | 1280 | |
| 1281 | 1281 | return $response_text; |
@@ -1290,16 +1290,16 @@ discard block |
||
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | 1292 | /** |
| 1293 | - * yikes-mailchimp-general-error-response |
|
| 1294 | - * |
|
| 1295 | - * Filter the error message displayed to the user |
|
| 1296 | - * |
|
| 1297 | - * @param string | $original_response_text | The original response message returned from the API |
|
| 1298 | - * @param string | $user_defined_response_text | The response message defined by the user |
|
| 1299 | - * @param string | $form_id | The form ID |
|
| 1300 | - * |
|
| 1301 | - * @return string | $response_text | The message that will be shown to the user |
|
| 1302 | - */ |
|
| 1293 | + * yikes-mailchimp-general-error-response |
|
| 1294 | + * |
|
| 1295 | + * Filter the error message displayed to the user |
|
| 1296 | + * |
|
| 1297 | + * @param string | $original_response_text | The original response message returned from the API |
|
| 1298 | + * @param string | $user_defined_response_text | The response message defined by the user |
|
| 1299 | + * @param string | $form_id | The form ID |
|
| 1300 | + * |
|
| 1301 | + * @return string | $response_text | The message that will be shown to the user |
|
| 1302 | + */ |
|
| 1303 | 1303 | $response_text = apply_filters( 'yikes-mailchimp-general-error-response', $original_response_text, $user_defined_response_text, $this->form_id ); |
| 1304 | 1304 | |
| 1305 | 1305 | return $response_text; |
@@ -1313,14 +1313,14 @@ discard block |
||
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | /** |
| 1316 | - * Wrap the response message in HTML for Non-AJAX form submissions |
|
| 1317 | - * |
|
| 1318 | - * @since 6.3.0 |
|
| 1319 | - * |
|
| 1320 | - * @param string | $message | The response message |
|
| 1321 | - * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
| 1322 | - * @return string| The $message wrapping in HTML |
|
| 1323 | - */ |
|
| 1316 | + * Wrap the response message in HTML for Non-AJAX form submissions |
|
| 1317 | + * |
|
| 1318 | + * @since 6.3.0 |
|
| 1319 | + * |
|
| 1320 | + * @param string | $message | The response message |
|
| 1321 | + * @param bool | $is_success | Boolean signifying if we're returning a success message or an error message |
|
| 1322 | + * @return string| The $message wrapping in HTML |
|
| 1323 | + */ |
|
| 1324 | 1324 | public function wrap_form_submission_response( $message, $is_success ) { |
| 1325 | 1325 | |
| 1326 | 1326 | // If we're successful, we wrap the $message differently |
@@ -1334,14 +1334,14 @@ discard block |
||
| 1334 | 1334 | /**** Returning Success / Failure Functions ****/ |
| 1335 | 1335 | |
| 1336 | 1336 | /** |
| 1337 | - * Return success. Method of returning success based on the $is_ajax flag |
|
| 1338 | - * |
|
| 1339 | - * @since 6.3.0 |
|
| 1340 | - * |
|
| 1341 | - * @param array | $success_array | Array of success values to return |
|
| 1342 | - * |
|
| 1343 | - * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
| 1344 | - */ |
|
| 1337 | + * Return success. Method of returning success based on the $is_ajax flag |
|
| 1338 | + * |
|
| 1339 | + * @since 6.3.0 |
|
| 1340 | + * |
|
| 1341 | + * @param array | $success_array | Array of success values to return |
|
| 1342 | + * |
|
| 1343 | + * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`. |
|
| 1344 | + */ |
|
| 1345 | 1345 | protected function yikes_success( $success_array ) { |
| 1346 | 1346 | if ( $this->is_ajax === true ) { |
| 1347 | 1347 | wp_send_json_success( $success_array ); |
@@ -1354,18 +1354,18 @@ discard block |
||
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | 1356 | /** |
| 1357 | - * Return failure. Method of returning failure based on the $is_ajax flag |
|
| 1358 | - * |
|
| 1359 | - * @since 6.3.0 |
|
| 1360 | - * |
|
| 1361 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1362 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1363 | - * @param string | $response | The response message to display to the user |
|
| 1364 | - * @param array | $additional_fields | An array of additional fields to return |
|
| 1365 | - * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
| 1366 | - * |
|
| 1367 | - * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
| 1368 | - */ |
|
| 1357 | + * Return failure. Method of returning failure based on the $is_ajax flag |
|
| 1358 | + * |
|
| 1359 | + * @since 6.3.0 |
|
| 1360 | + * |
|
| 1361 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1362 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1363 | + * @param string | $response | The response message to display to the user |
|
| 1364 | + * @param array | $additional_fields | An array of additional fields to return |
|
| 1365 | + * @param bool | $return_response_non_ajax | Boolean deciding if we need to return a message |
|
| 1366 | + * |
|
| 1367 | + * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false. |
|
| 1368 | + */ |
|
| 1369 | 1369 | protected function yikes_fail( $hide, $error, $response, $additional_fields = array(), $return_response_non_ajax = false ) { |
| 1370 | 1370 | if ( $this->is_ajax === true ) { |
| 1371 | 1371 | $this->yikes_send_json_error( $hide, $error, $response, $additional_fields ); |
@@ -1378,17 +1378,17 @@ discard block |
||
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | /** |
| 1381 | - * Wrapper function for wp_send_json_error() |
|
| 1382 | - * |
|
| 1383 | - * @since 6.3.0 |
|
| 1384 | - * |
|
| 1385 | - * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1386 | - * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1387 | - * @param string | $translated_string | The response message to display to the user |
|
| 1388 | - * @param array | $additional_fields | An array of additional fields to return |
|
| 1389 | - * |
|
| 1390 | - * @return func | wp_send_json_error() |
|
| 1391 | - */ |
|
| 1381 | + * Wrapper function for wp_send_json_error() |
|
| 1382 | + * |
|
| 1383 | + * @since 6.3.0 |
|
| 1384 | + * |
|
| 1385 | + * @param int | $hide | Flag whether to hide the form (1 = hide, 0 = do not hide) |
|
| 1386 | + * @param int | $error | Flag whether this is an error (1 = error, 0 = no error) |
|
| 1387 | + * @param string | $translated_string | The response message to display to the user |
|
| 1388 | + * @param array | $additional_fields | An array of additional fields to return |
|
| 1389 | + * |
|
| 1390 | + * @return func | wp_send_json_error() |
|
| 1391 | + */ |
|
| 1392 | 1392 | protected function yikes_send_json_error( $hide, $error, $translated_string, $additional_fields = array() ) { |
| 1393 | 1393 | |
| 1394 | 1394 | // Default response array |
@@ -260,18 +260,18 @@ discard block |
||
| 260 | 260 | $this->handle_empty_email_message = __( 'Error: The email is invalid.', 'yikes-inc-easy-mailchimp-extender' ); |
| 261 | 261 | $this->handle_non_empty_honeypot_message = __( 'Error: It looks like the honeypot was filled out and the form was not properly submitted.', 'yikes-inc-easy-mailchimp-extender' ); |
| 262 | 262 | $this->handle_disallowed_existing_user_update_message = __( 'The email you entered is already a subscriber to this list.', 'yikes-inc-easy-mailchimp-extender' ); |
| 263 | - $this->default_error_response_message = __( 'Whoops! It looks like something went wrong. Please try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 263 | + $this->default_error_response_message = __( 'Whoops! It looks like something went wrong. Please try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 264 | 264 | $this->handle_updating_existing_user_message = __( 'You\'re already subscribed. ', 'yikes-inc-easy-mailchimp-extender' ); |
| 265 | 265 | $this->handle_updating_existing_user_link_message = __( 'To update your MailChimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ); |
| 266 | 266 | $this->handle_empty_required_field_message = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
| 267 | 267 | $this->handle_empty_required_interest_group_message = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' ); |
| 268 | - $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 268 | + $this->handle_nonce_message = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 269 | 269 | $this->handle_non_filled_recaptcha_message_message = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' ); |
| 270 | - $this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 270 | + $this->generic_recaptcha_error_message = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 271 | 271 | |
| 272 | 272 | // Define our success messages |
| 273 | - $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 274 | - $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 273 | + $this->default_response_single_optin_success_message = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 274 | + $this->default_response_double_optin_success_message = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 275 | 275 | $this->existing_subscriber_profile_update_message = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' ); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields) |
| 386 | - if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) { |
|
| 387 | - $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] ); |
|
| 386 | + if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) { |
|
| 387 | + $sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] ); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | $merge_variables[ $merge_tag ] = $sanitized; |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | if ( count( $pieces ) === 3 ) { |
| 465 | 465 | |
| 466 | 466 | // $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY |
| 467 | - $date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2]; |
|
| 467 | + $date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ]; |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | return $date; |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | if ( count( $pieces ) === 2 ) { |
| 490 | 490 | |
| 491 | 491 | // $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD |
| 492 | - $birthday = $pieces[1] . '/' . $pieces[0]; |
|
| 492 | + $birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ]; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | return $birthday; |
@@ -521,8 +521,8 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | // Loop through the interest groups and create a single array like {group_id} => false |
| 523 | 523 | foreach ( $interest_groupings as $group_data ) { |
| 524 | - foreach ( $group_data['items'] as $item ) { |
|
| 525 | - $groups[$item['id']] = false; |
|
| 524 | + foreach ( $group_data[ 'items' ] as $item ) { |
|
| 525 | + $groups[ $item[ 'id' ] ] = false; |
|
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | return $groups; |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications ); |
| 630 | 630 | |
| 631 | 631 | // Get the optin value |
| 632 | - $optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0; |
|
| 632 | + $optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0; |
|
| 633 | 633 | |
| 634 | 634 | if ( 1 === $optin ) { |
| 635 | 635 | |
@@ -659,13 +659,13 @@ discard block |
||
| 659 | 659 | |
| 660 | 660 | // Construct our success array variables |
| 661 | 661 | $return_success_array = array( |
| 662 | - 'hide' => $submission_settings['hide_form_post_signup'], |
|
| 662 | + 'hide' => $submission_settings[ 'hide_form_post_signup' ], |
|
| 663 | 663 | 'error' => 0, |
| 664 | 664 | 'response' => $response_message, |
| 665 | - 'redirection' => $redirect_array['redirection'], |
|
| 666 | - 'redirect' => $redirect_array['redirect'], |
|
| 667 | - 'new_window' => $redirect_array['new_window'], |
|
| 668 | - 'redirect_timer' => $redirect_array['redirect_timer'], |
|
| 665 | + 'redirection' => $redirect_array[ 'redirection' ], |
|
| 666 | + 'redirect' => $redirect_array[ 'redirect' ], |
|
| 667 | + 'new_window' => $redirect_array[ 'new_window' ], |
|
| 668 | + 'redirect_timer' => $redirect_array[ 'redirect_timer' ], |
|
| 669 | 669 | ); |
| 670 | 670 | |
| 671 | 671 | // Return success array |
@@ -687,12 +687,12 @@ discard block |
||
| 687 | 687 | $details = ''; |
| 688 | 688 | |
| 689 | 689 | // Loop through the error data and retrieve any fields and messages |
| 690 | - if ( isset( $error_data['data'] ) ) { |
|
| 691 | - foreach ( $error_data['data'] as $datum ) { |
|
| 692 | - if ( ! isset( $datum['field'], $datum['message'] ) ) { |
|
| 690 | + if ( isset( $error_data[ 'data' ] ) ) { |
|
| 691 | + foreach ( $error_data[ 'data' ] as $datum ) { |
|
| 692 | + if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) { |
|
| 693 | 693 | continue; |
| 694 | 694 | } |
| 695 | - $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] ); |
|
| 695 | + $details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] ); |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | |
@@ -735,20 +735,20 @@ discard block |
||
| 735 | 735 | ); |
| 736 | 736 | |
| 737 | 737 | // Let's confirm we have a value before trying to use it |
| 738 | - $redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false; |
|
| 738 | + $redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false; |
|
| 739 | 739 | |
| 740 | 740 | // Check the redirect flag |
| 741 | 741 | if ( '1' === $redirect_setting ) { |
| 742 | 742 | |
| 743 | 743 | // Supply return array with default value of 1 |
| 744 | - $redirect_array['redirection'] = 1; |
|
| 744 | + $redirect_array[ 'redirection' ] = 1; |
|
| 745 | 745 | |
| 746 | 746 | // Let's confirm we have redirect_page/custom_redirect_url/new_window values |
| 747 | - $redirect_page_setting = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false; |
|
| 748 | - $custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false; |
|
| 749 | - $redirect_new_window = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false; |
|
| 747 | + $redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false; |
|
| 748 | + $custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false; |
|
| 749 | + $redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false; |
|
| 750 | 750 | |
| 751 | - $redirect_array['new_window'] = $redirect_new_window; |
|
| 751 | + $redirect_array[ 'new_window' ] = $redirect_new_window; |
|
| 752 | 752 | |
| 753 | 753 | // Check if we're redirecting to a custom_url or just the redirect_page |
| 754 | 754 | $redirect_url = ( 'custom_url' !== $redirect_page_setting ) ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting; |
@@ -773,9 +773,9 @@ discard block |
||
| 773 | 773 | */ |
| 774 | 774 | $redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $this->default_redirect_time_ms, $this->form_id ); |
| 775 | 775 | |
| 776 | - $redirect_array['redirect_timer'] = $redirect_timer; |
|
| 776 | + $redirect_array[ 'redirect_timer' ] = $redirect_timer; |
|
| 777 | 777 | |
| 778 | - $redirect_array['redirect'] = $redirect_url; |
|
| 778 | + $redirect_array[ 'redirect' ] = $redirect_url; |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | return $redirect_array; |
@@ -801,21 +801,21 @@ discard block |
||
| 801 | 801 | $missing_fields = array(); |
| 802 | 802 | |
| 803 | 803 | // Loop through submitted form data |
| 804 | - foreach( $data as $merge_tag => $value ) { |
|
| 804 | + foreach ( $data as $merge_tag => $value ) { |
|
| 805 | 805 | |
| 806 | 806 | // Skip interest groups |
| 807 | - if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) { |
|
| 807 | + if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) { |
|
| 808 | 808 | continue; |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | // check if this field is required |
| 812 | - if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) { |
|
| 812 | + if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) { |
|
| 813 | 813 | |
| 814 | 814 | // Check if the field(s) are empty |
| 815 | 815 | if ( is_array( $value ) ) { |
| 816 | 816 | |
| 817 | 817 | // Loop through the data and check if any are empty |
| 818 | - foreach( $value as $field => $val ) { |
|
| 818 | + foreach ( $value as $field => $val ) { |
|
| 819 | 819 | |
| 820 | 820 | /** |
| 821 | 821 | * 'yikes-mailchimp-ignore-required-array-field' |
@@ -834,13 +834,13 @@ discard block |
||
| 834 | 834 | |
| 835 | 835 | // Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times |
| 836 | 836 | // (e.g. For arrays, like an address, where multiple address fields are empty) |
| 837 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
| 837 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | } else if ( empty( $value ) ) { |
| 842 | 842 | $field_is_missing = true; |
| 843 | - $missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ]; |
|
| 843 | + $missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ]; |
|
| 844 | 844 | } |
| 845 | 845 | } |
| 846 | 846 | } |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | foreach ( $form_fields as $merge_tag => $field_data ) { |
| 891 | 891 | |
| 892 | 892 | // If an interest group and it's required |
| 893 | - if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) { |
|
| 893 | + if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) { |
|
| 894 | 894 | |
| 895 | 895 | // Check if it was submitted (meaning, check if it's set in our $data array) |
| 896 | 896 | if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) { |
@@ -952,30 +952,30 @@ discard block |
||
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | // Construct the API URL |
| 955 | - $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] ); |
|
| 955 | + $url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] ); |
|
| 956 | 956 | $response = wp_remote_get( $url ); |
| 957 | - $response_body = json_decode( $response['body'], true ); |
|
| 957 | + $response_body = json_decode( $response[ 'body' ], true ); |
|
| 958 | 958 | |
| 959 | 959 | // Set up errors array |
| 960 | 960 | $recaptcha_errors = array(); |
| 961 | 961 | |
| 962 | 962 | // if we've hit an error, lets return the error! |
| 963 | - if ( true !== $response_body['success'] ) { |
|
| 963 | + if ( true !== $response_body[ 'success' ] ) { |
|
| 964 | 964 | |
| 965 | - if( isset( $response_body['error-codes'] ) ) { |
|
| 965 | + if ( isset( $response_body[ 'error-codes' ] ) ) { |
|
| 966 | 966 | |
| 967 | 967 | // Loop through response error codes |
| 968 | - foreach ( $response_body['error-codes'] as $error_code ) { |
|
| 968 | + foreach ( $response_body[ 'error-codes' ] as $error_code ) { |
|
| 969 | 969 | if ( 'missing-input-response' === $error_code ) { |
| 970 | 970 | $error_code = $this->handle_non_filled_recaptcha_message; |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | // Add our error_code to the errors array |
| 974 | - $recaptcha_errors[] = $error_code; |
|
| 974 | + $recaptcha_errors[ ] = $error_code; |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | } else { |
| 978 | - $recaptcha_errors[] = $this->generic_recaptcha_error_message; |
|
| 978 | + $recaptcha_errors[ ] = $this->generic_recaptcha_error_message; |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | /** |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | * @param array | $fields_array | An array of fields to loop through and make sure they're not null |
| 1084 | 1084 | */ |
| 1085 | 1085 | public function handle_empty_fields_generic( $fields_array ) { |
| 1086 | - foreach( $fields_array as $field ) { |
|
| 1086 | + foreach ( $fields_array as $field ) { |
|
| 1087 | 1087 | if ( $field === null ) { |
| 1088 | 1088 | return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message ); |
| 1089 | 1089 | } |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | |
| 1150 | 1150 | // Append our 'send-update-email' link and text |
| 1151 | 1151 | $response .= $link_start_tag; |
| 1152 | - $response .= $this->handle_updating_existing_user_link_message; |
|
| 1152 | + $response .= $this->handle_updating_existing_user_link_message; |
|
| 1153 | 1153 | $response .= $link_close_tag; |
| 1154 | 1154 | |
| 1155 | 1155 | // Check for a user-defined message |
@@ -1172,14 +1172,14 @@ discard block |
||
| 1172 | 1172 | */ |
| 1173 | 1173 | protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) { |
| 1174 | 1174 | |
| 1175 | - switch( $slug ) { |
|
| 1175 | + switch ( $slug ) { |
|
| 1176 | 1176 | case 'already-subscribed': |
| 1177 | 1177 | |
| 1178 | 1178 | // Check if this error message exists |
| 1179 | - if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) { |
|
| 1179 | + if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) { |
|
| 1180 | 1180 | |
| 1181 | 1181 | // Check if the substring (that we replace) '[email]' is located in the string and replace it |
| 1182 | - $response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] ); |
|
| 1182 | + $response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] ); |
|
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | /** |
@@ -1198,13 +1198,13 @@ discard block |
||
| 1198 | 1198 | case 'update-link': |
| 1199 | 1199 | |
| 1200 | 1200 | // Check if this error message exists |
| 1201 | - if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) { |
|
| 1201 | + if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) { |
|
| 1202 | 1202 | |
| 1203 | 1203 | // Check if the substring (that we replace) '[link]' is located in the string and replace it |
| 1204 | - $response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] ); |
|
| 1204 | + $response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] ); |
|
| 1205 | 1205 | |
| 1206 | 1206 | // Remove [/link] |
| 1207 | - $response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text ); |
|
| 1207 | + $response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text ); |
|
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /** |
@@ -1223,8 +1223,8 @@ discard block |
||
| 1223 | 1223 | case 'success': |
| 1224 | 1224 | |
| 1225 | 1225 | // 'success' is the user-defined success message for double opt-in |
| 1226 | - if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) { |
|
| 1227 | - $response_text = $this->error_messages['success']; |
|
| 1226 | + if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) { |
|
| 1227 | + $response_text = $this->error_messages[ 'success' ]; |
|
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | 1230 | /** |
@@ -1243,8 +1243,8 @@ discard block |
||
| 1243 | 1243 | |
| 1244 | 1244 | case 'success-single-optin': |
| 1245 | 1245 | |
| 1246 | - if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) { |
|
| 1247 | - $response_text = $this->error_messages['success-single-optin']; |
|
| 1246 | + if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) { |
|
| 1247 | + $response_text = $this->error_messages[ 'success-single-optin' ]; |
|
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | /** |
@@ -1263,8 +1263,8 @@ discard block |
||
| 1263 | 1263 | |
| 1264 | 1264 | case 'success-resubscribed': |
| 1265 | 1265 | |
| 1266 | - if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) { |
|
| 1267 | - $response_text = $this->error_messages['success-resubscribed']; |
|
| 1266 | + if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) { |
|
| 1267 | + $response_text = $this->error_messages[ 'success-resubscribed' ]; |
|
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | /** |
@@ -1285,8 +1285,8 @@ discard block |
||
| 1285 | 1285 | |
| 1286 | 1286 | $original_response_text = $response_text; |
| 1287 | 1287 | |
| 1288 | - if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) { |
|
| 1289 | - $user_defined_response_text = $this->error_messages['general-error']; |
|
| 1288 | + if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) { |
|
| 1289 | + $user_defined_response_text = $this->error_messages[ 'general-error' ]; |
|
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | 1292 | /** |
@@ -1348,7 +1348,7 @@ discard block |
||
| 1348 | 1348 | } else { |
| 1349 | 1349 | global $process_submission_response; |
| 1350 | 1350 | |
| 1351 | - $process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS? |
|
| 1351 | + $process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS? |
|
| 1352 | 1352 | $process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true ); |
| 1353 | 1353 | } |
| 1354 | 1354 | } |
@@ -1401,8 +1401,8 @@ discard block |
||
| 1401 | 1401 | // Add additional fields we've been supplied |
| 1402 | 1402 | if ( ! empty( $additional_fields ) ) { |
| 1403 | 1403 | |
| 1404 | - foreach( $additional_fields as $key => $value ) { |
|
| 1405 | - $response_array[$key] = $value; |
|
| 1404 | + foreach ( $additional_fields as $key => $value ) { |
|
| 1405 | + $response_array[ $key ] = $value; |
|
| 1406 | 1406 | } |
| 1407 | 1407 | } |
| 1408 | 1408 | |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | new YIKES_Inc_Easy_MailChimp_Public_Ajax(); |
| 57 | 57 | |
| 58 | 58 | // Include our error logging class |
| 59 | - add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 ); |
|
| 59 | + add_action( 'init', array( $this, 'load_error_logging_class' ), 1 ); |
|
| 60 | 60 | // load our checkbox classes |
| 61 | - add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 ); |
|
| 61 | + add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 ); |
|
| 62 | 62 | // custom front end filter |
| 63 | 63 | add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) ); |
| 64 | 64 | // Process non-ajax forms in the header |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | **/ |
| 94 | 94 | public function load_checkbox_integration_classes() { |
| 95 | 95 | // store our options |
| 96 | - $integrations = get_option( 'optin-checkbox-init' , array() ); |
|
| 97 | - if( ! empty( $integrations ) && is_array( $integrations ) ) { |
|
| 96 | + $integrations = get_option( 'optin-checkbox-init', array() ); |
|
| 97 | + if ( ! empty( $integrations ) && is_array( $integrations ) ) { |
|
| 98 | 98 | // load our mail integrations class |
| 99 | 99 | require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php'; |
| 100 | 100 | // loop over selected classes and load them up! |
| 101 | - foreach( $integrations as $integration => $value ) { |
|
| 102 | - if( isset( $value['value'] ) && $value['value'] == 'on' ) { |
|
| 101 | + foreach ( $integrations as $integration => $value ) { |
|
| 102 | + if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) { |
|
| 103 | 103 | // load our class extensions |
| 104 | - require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php'; |
|
| 104 | + require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php'; |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @since 6.0.0 |
| 116 | 116 | */ |
| 117 | 117 | public function load_error_logging_class() { |
| 118 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 118 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 119 | 119 | // if error logging is enabled we should include our error logging class |
| 120 | 120 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 121 | 121 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging; |
@@ -128,19 +128,19 @@ discard block |
||
| 128 | 128 | * @since 6.0.3.4 |
| 129 | 129 | */ |
| 130 | 130 | public function yikes_process_non_ajax_forms( $form_submitted ) { |
| 131 | - global $wpdb,$post; |
|
| 132 | - $form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id |
|
| 133 | - if( $form_id ) { |
|
| 131 | + global $wpdb, $post; |
|
| 132 | + $form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id |
|
| 133 | + if ( $form_id ) { |
|
| 134 | 134 | $form_settings = self::yikes_retrieve_form_settings( $form_id ); |
| 135 | - if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) { |
|
| 136 | - if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted |
|
| 135 | + if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) { |
|
| 136 | + if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted |
|
| 137 | 137 | |
| 138 | 138 | // Lets include our form processing file |
| 139 | 139 | include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' ); |
| 140 | - if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) { |
|
| 141 | - if( $form_submitted == 1 ) { |
|
| 140 | + if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) { |
|
| 141 | + if ( $form_submitted == 1 ) { |
|
| 142 | 142 | // decode our settings |
| 143 | - $redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url']; |
|
| 143 | + $redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ]; |
|
| 144 | 144 | wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) ); |
| 145 | 145 | exit; |
| 146 | 146 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public static function yikes_retrieve_form_settings( $form_id ) { |
| 170 | 170 | // if no form id, abort |
| 171 | - if( ! $form_id ) { |
|
| 171 | + if ( ! $form_id ) { |
|
| 172 | 172 | return array(); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | // trim trailing period |
| 200 | - if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) { |
|
| 201 | - $response_text = $form_settings['error_messages']['update-link']; |
|
| 200 | + if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) { |
|
| 201 | + $response_text = $form_settings[ 'error_messages' ][ 'update-link' ]; |
|
| 202 | 202 | // extract the link text |
| 203 | 203 | preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text ); |
| 204 | 204 | if ( $link_text && ! empty( $link_text ) ) { |
| 205 | 205 | // Extract the custom link text ([link]*[/link]) |
| 206 | - $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) ); |
|
| 206 | + $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) ); |
|
| 207 | 207 | // Replace the link text, with our custom link text |
| 208 | 208 | $response_text = str_replace( $link_text, $custom_link_text, $response_text ); |
| 209 | 209 | } |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // trim trailing period |
| 235 | - if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) { |
|
| 236 | - $response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] ); |
|
| 235 | + if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) { |
|
| 236 | + $response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] ); |
|
| 237 | 237 | } |
| 238 | 238 | // Return our new string |
| 239 | 239 | return $response_text; |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * Create our own custom the_content(); filter to prevent plugins and such from hooking in where not wanted |
|
| 74 | - * |
|
| 75 | - * @since 6.0.3 |
|
| 76 | - */ |
|
| 73 | + * Create our own custom the_content(); filter to prevent plugins and such from hooking in where not wanted |
|
| 74 | + * |
|
| 75 | + * @since 6.0.3 |
|
| 76 | + */ |
|
| 77 | 77 | public function yikes_custom_frontend_content_filter() { |
| 78 | 78 | add_filter( 'yikes-mailchimp-frontend-content', 'wptexturize' ); |
| 79 | 79 | add_filter( 'yikes-mailchimp-frontend-content', 'convert_smilies' ); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * load our checkbox classes |
| 91 | 91 | * |
| 92 | 92 | * @since 6.0.0 |
| 93 | - **/ |
|
| 93 | + **/ |
|
| 94 | 94 | public function load_checkbox_integration_classes() { |
| 95 | 95 | // store our options |
| 96 | 96 | $integrations = get_option( 'optin-checkbox-init' , array() ); |
@@ -133,7 +133,8 @@ |
||
| 133 | 133 | if( $form_id ) { |
| 134 | 134 | $form_settings = self::yikes_retrieve_form_settings( $form_id ); |
| 135 | 135 | if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) { |
| 136 | - if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted |
|
| 136 | + if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { |
|
| 137 | +// ensure we only process the form that was submitted |
|
| 137 | 138 | |
| 138 | 139 | // Lets include our form processing file |
| 139 | 140 | include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' ); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Prevent direct access to the file |
| 14 | -defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 14 | +defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
| 15 | 15 | |
| 16 | 16 | class Yikes_Easy_MC_CF7_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
| 17 | 17 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | // initialize |
| 27 | 27 | $this->init(); |
| 28 | 28 | add_action( 'wpcf7_mail_sent', array( $this, 'new_cf7_subscription' ) ); |
| 29 | - add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data') ); |
|
| 29 | + add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data' ) ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @return boolean |
| 36 | 36 | */ |
| 37 | 37 | public function init() { |
| 38 | - if( ! function_exists( 'wpcf7_add_form_tag' ) ) { |
|
| 38 | + if ( ! function_exists( 'wpcf7_add_form_tag' ) ) { |
|
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | wpcf7_add_form_tag( 'yikes_mailchimp_checkbox', array( $this, 'yikes_get_checkbox' ) ); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @return array |
| 52 | 52 | */ |
| 53 | 53 | public function alter_cf7_data( $data = array() ) { |
| 54 | - $data['yikes_mailchimp_checkbox'] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 54 | + $data[ 'yikes_mailchimp_checkbox' ] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 55 | 55 | return $data; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return false; |
| 65 | 65 | } |
| 66 | 66 | // get the integration options |
| 67 | - $integration_options = get_option( 'optin-checkbox-init' , '' ); |
|
| 67 | + $integration_options = get_option( 'optin-checkbox-init', '' ); |
|
| 68 | 68 | // get the contact form 7 submission instance |
| 69 | 69 | $submission = WPCF7_Submission::get_instance(); |
| 70 | 70 | // confirm the submission was received |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | // get the submission data |
| 73 | 73 | $posted_data = $submission->get_posted_data(); |
| 74 | 74 | // store the email -- this needs to be more dynamic (find string with containing string email?) |
| 75 | - $email = ( isset( $posted_data['your-email'] ) ) ? $posted_data['your-email'] : ''; |
|
| 75 | + $email = ( isset( $posted_data[ 'your-email' ] ) ) ? $posted_data[ 'your-email' ] : ''; |
|
| 76 | 76 | // Default the merge_values |
| 77 | 77 | $merge_values = array( 'email' => $email ); |
| 78 | 78 | // submit this subscriber |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Registers the CF7 shortcode |
|
| 33 | + * Registers the CF7 shortcode |
|
| 34 | 34 | * |
| 35 | - * @return boolean |
|
| 36 | - */ |
|
| 35 | + * @return boolean |
|
| 36 | + */ |
|
| 37 | 37 | public function init() { |
| 38 | 38 | if( ! function_exists( 'wpcf7_add_form_tag' ) ) { |
| 39 | 39 | return false; |
@@ -43,21 +43,21 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * Alter Contact Form 7 data. |
|
| 47 | - * |
|
| 48 | - * Adds yikes_mailchimp_checkbox to post data so users can use `yikes_mailchimp_checkbox` in their email templates |
|
| 49 | - * |
|
| 50 | - * @param array $data |
|
| 51 | - * @return array |
|
| 52 | - */ |
|
| 46 | + * Alter Contact Form 7 data. |
|
| 47 | + * |
|
| 48 | + * Adds yikes_mailchimp_checkbox to post data so users can use `yikes_mailchimp_checkbox` in their email templates |
|
| 49 | + * |
|
| 50 | + * @param array $data |
|
| 51 | + * @return array |
|
| 52 | + */ |
|
| 53 | 53 | public function alter_cf7_data( $data = array() ) { |
| 54 | 54 | $data['yikes_mailchimp_checkbox'] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' ); |
| 55 | 55 | return $data; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * Subscribe from Contact Form 7 Forms |
|
| 60 | - */ |
|
| 59 | + * Subscribe from Contact Form 7 Forms |
|
| 60 | + */ |
|
| 61 | 61 | public function new_cf7_subscription( $contact_form ) { |
| 62 | 62 | // was sign-up checkbox checked? |
| 63 | 63 | if ( $this->was_checkbox_checked( $this->type ) === false ) { |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | /* The template file for displaying our stats in the Admin dashboard widget */ |
| 3 | 3 | |
| 4 | 4 | if ( isset( $list_data ) ) { |
| 5 | - if ( isset( $list_data['id'] ) ) { |
|
| 5 | + if ( isset( $list_data[ 'id' ] ) ) { |
|
| 6 | 6 | |
| 7 | 7 | // When a user selects a list from the dropdown, capture the array value here |
| 8 | 8 | $list = $list_data; |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | // Get the list IDs, capture the first list ID |
| 14 | 14 | $first_list_id = ''; |
| 15 | 15 | $list_ids = array_keys( $list_data ); |
| 16 | - if ( is_array( $list_ids ) && isset( $list_ids[0] ) ) { |
|
| 17 | - $first_list_id = $list_ids[0]; |
|
| 16 | + if ( is_array( $list_ids ) && isset( $list_ids[ 0 ] ) ) { |
|
| 17 | + $first_list_id = $list_ids[ 0 ]; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // Set our $list value to the first list in the list_data array |
| 21 | - if ( isset( $list_data[ $first_list_id ] ) && is_array( $list_data[ $first_list_id ] ) && isset( $list_data[ $first_list_id ]['id'] ) ) { |
|
| 21 | + if ( isset( $list_data[ $first_list_id ] ) && is_array( $list_data[ $first_list_id ] ) && isset( $list_data[ $first_list_id ][ 'id' ] ) ) { |
|
| 22 | 22 | $list = $list_data[ $first_list_id ]; |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -31,36 +31,36 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | ?> |
| 33 | 33 | <section id="yikes-easy-mc-widget-stat-holder"> |
| 34 | - <h3><?php echo $list['name']; ?> <small><a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $list['id'] . '' ) ); ?>" title="<?php _e( 'view List' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'view list' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></h3> |
|
| 34 | + <h3><?php echo $list[ 'name' ]; ?> <small><a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $list[ 'id' ] . '' ) ); ?>" title="<?php _e( 'view List', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'view list', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></h3> |
|
| 35 | 35 | |
| 36 | 36 | <table class="yikes-easy-mc-stats-table"> |
| 37 | 37 | <thead class="yikes-easy-mc-hidden"> |
| 38 | 38 | <tr> |
| 39 | - <th><?php _e( 'Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 40 | - <th><?php _e( 'Unsubscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 41 | - <th><?php _e( 'New Since Send' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 42 | - <th><?php _e( 'Avg. Sub. Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 39 | + <th><?php _e( 'Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 40 | + <th><?php _e( 'Unsubscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 41 | + <th><?php _e( 'New Since Send', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 42 | + <th><?php _e( 'Avg. Sub. Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
| 43 | 43 | </tr> |
| 44 | 44 | </thead> |
| 45 | 45 | <tbody> |
| 46 | 46 | <tr class="yikes-easy-mc-table-stats-tr yikes-easy-mc-table-stats-tr-first"> |
| 47 | - <td title="<?php _e( 'Number of active subscribers.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 48 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['member_count']; ?></p> |
|
| 49 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 47 | + <td title="<?php _e( 'Number of active subscribers.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 48 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'member_count' ]; ?></p> |
|
| 49 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 50 | 50 | </td> |
| 51 | - <td title="<?php _e( 'Number of users who have unsusbscribed.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 52 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['unsubscribe_count']; ?></p> |
|
| 53 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'unsubscribed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 51 | + <td title="<?php _e( 'Number of users who have unsusbscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 52 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'unsubscribe_count' ]; ?></p> |
|
| 53 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'unsubscribed', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 54 | 54 | </td> |
| 55 | 55 | </tr> |
| 56 | 56 | <tr class="yikes-easy-mc-table-stats-tr yikes-easy-mc-table-stats-tr-second"> |
| 57 | - <td title="<?php _e( 'Number of new subscribers since the last campaign was sent.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 58 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['member_count_since_send']; ?></p> |
|
| 59 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'new since send' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 57 | + <td title="<?php _e( 'Number of new subscribers since the last campaign was sent.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 58 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'member_count_since_send' ]; ?></p> |
|
| 59 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'new since send', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 60 | 60 | </td> |
| 61 | - <td title="<?php _e( 'Average number of subscribers per month.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 62 | - <p class="yikes-easy-mc-dashboard-stat"><?php echo $list['stats']['avg_sub_rate']; ?></p> |
|
| 63 | - <p class="yikes-easy-mc-stat-list-label"><?php _e( 'avg. sub. rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 61 | + <td title="<?php _e( 'Average number of subscribers per month.', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 62 | + <p class="yikes-easy-mc-dashboard-stat"><?php echo $list[ 'stats' ][ 'avg_sub_rate' ]; ?></p> |
|
| 63 | + <p class="yikes-easy-mc-stat-list-label"><?php _e( 'avg. sub. rate', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 64 | 64 | </td> |
| 65 | 65 | </tr> |
| 66 | 66 | </tbody> |
@@ -118,8 +118,8 @@ |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | - * Save changes to a field's label |
|
| 122 | - */ |
|
| 121 | + * Save changes to a field's label |
|
| 122 | + */ |
|
| 123 | 123 | public function save_field_label_edits() { |
| 124 | 124 | |
| 125 | 125 | // Capture our $_POST variables |
@@ -7,8 +7,7 @@ |
||
| 7 | 7 | * @since 6.0.0 |
| 8 | 8 | * Author: Yikes Inc. | https://www.yikesinc.com |
| 9 | 9 | */ |
| 10 | - class YIKES_Inc_Easy_MailChimp_Process_Ajax |
|
| 11 | - { |
|
| 10 | + class YIKES_Inc_Easy_MailChimp_Process_Ajax { |
|
| 12 | 11 | |
| 13 | 12 | public function __construct() { |
| 14 | 13 | |
@@ -13,22 +13,22 @@ discard block |
||
| 13 | 13 | public function __construct() { |
| 14 | 14 | |
| 15 | 15 | // Ajax send merge variable to form builder |
| 16 | - add_action( 'wp_ajax_add_field_to_form', array( $this , 'send_field_to_form' ), 10 ); |
|
| 16 | + add_action( 'wp_ajax_add_field_to_form', array( $this, 'send_field_to_form' ), 10 ); |
|
| 17 | 17 | |
| 18 | 18 | // Ajax send interest group to form builder |
| 19 | - add_action( 'wp_ajax_add_interest_group_to_form', array( $this , 'send_interest_group_to_form' ), 10 ); |
|
| 19 | + add_action( 'wp_ajax_add_interest_group_to_form', array( $this, 'send_interest_group_to_form' ), 10 ); |
|
| 20 | 20 | |
| 21 | 21 | // Return new list data + activity (for dashboard widget ) |
| 22 | - add_action( 'wp_ajax_get_new_list_data', array( $this , 'get_new_list_data' ), 10 ); |
|
| 22 | + add_action( 'wp_ajax_get_new_list_data', array( $this, 'get_new_list_data' ), 10 ); |
|
| 23 | 23 | |
| 24 | 24 | // Return new list data + activity (for dashboard widget ) |
| 25 | - add_action( 'wp_ajax_check_list_for_interest_groups', array( $this , 'check_list_for_interest_groups' ), 10 ); |
|
| 25 | + add_action( 'wp_ajax_check_list_for_interest_groups', array( $this, 'check_list_for_interest_groups' ), 10 ); |
|
| 26 | 26 | |
| 27 | 27 | // Add a new notification to a form |
| 28 | - add_action( 'wp_ajax_add_notification_to_form', array( $this , 'add_notification_to_form' ), 10 , 1 ); |
|
| 28 | + add_action( 'wp_ajax_add_notification_to_form', array( $this, 'add_notification_to_form' ), 10, 1 ); |
|
| 29 | 29 | |
| 30 | 30 | // Save field label edits |
| 31 | - add_action( 'wp_ajax_save_field_label_edits', array( $this , 'save_field_label_edits' ), 10 , 1 ); |
|
| 31 | + add_action( 'wp_ajax_save_field_label_edits', array( $this, 'save_field_label_edits' ), 10, 1 ); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /* |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * - return a single container |
| 37 | 37 | */ |
| 38 | 38 | public function add_notification_to_form() { |
| 39 | - if( $_POST['notification_name'] ) { |
|
| 39 | + if ( $_POST[ 'notification_name' ] ) { |
|
| 40 | 40 | include_once( YIKES_MC_PATH . 'admin/partials/ajax/add_notification_to_form.php' ); |
| 41 | 41 | } |
| 42 | 42 | exit(); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | // when the user wants to switch which form data |
| 47 | 47 | // is displayed on the dashboard |
| 48 | 48 | public function get_new_list_data() { |
| 49 | - $list_id = $_POST['list_id']; |
|
| 49 | + $list_id = $_POST[ 'list_id' ]; |
|
| 50 | 50 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_list( $list_id ); |
| 51 | 51 | if ( is_wp_error( $list_data ) ) { |
| 52 | 52 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | /* note: this function is called statically from the integration settings page */ |
| 70 | 70 | public static function check_list_for_interest_groups( $list_id = '', $integration_type = '', $load = false ) { |
| 71 | 71 | if ( ! $list_id ) { |
| 72 | - $list_id = $_POST['list_id']; |
|
| 72 | + $list_id = $_POST[ 'list_id' ]; |
|
| 73 | 73 | } |
| 74 | 74 | if ( ! $integration_type ) { |
| 75 | - $integration_type = $_POST['integration']; |
|
| 75 | + $integration_type = $_POST[ 'integration' ]; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 82 | 82 | $error_logging->maybe_write_to_log( |
| 83 | 83 | $interest_groupings->get_error_code(), |
| 84 | - __( "Get Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ), |
|
| 84 | + __( "Get Interest Groups", 'yikes-inc-easy-mailchimp-extender' ), |
|
| 85 | 85 | "class.ajax.php" |
| 86 | 86 | ); |
| 87 | 87 | $interest_groupings = array(); |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | public function save_field_label_edits() { |
| 128 | 128 | |
| 129 | 129 | // Capture our $_POST variables |
| 130 | - $list_id = isset( $_POST['list_id'] ) ? $_POST['list_id'] : ''; |
|
| 131 | - $field_data = isset( $_POST['field_data'] ) ? $_POST['field_data'] : array(); |
|
| 132 | - $field_name = isset( $field_data['field_name'] ) ? $field_data['field_name'] : ''; |
|
| 133 | - $field_id = isset( $field_data['field_id'] ) ? $field_data['field_id'] : ''; |
|
| 130 | + $list_id = isset( $_POST[ 'list_id' ] ) ? $_POST[ 'list_id' ] : ''; |
|
| 131 | + $field_data = isset( $_POST[ 'field_data' ] ) ? $_POST[ 'field_data' ] : array(); |
|
| 132 | + $field_name = isset( $field_data[ 'field_name' ] ) ? $field_data[ 'field_name' ] : ''; |
|
| 133 | + $field_id = isset( $field_data[ 'field_id' ] ) ? $field_data[ 'field_id' ] : ''; |
|
| 134 | 134 | |
| 135 | 135 | // Make sure we have our required variables before continuing |
| 136 | 136 | if ( $list_id === '' || $field_name === '' || $field_id === '' ) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 150 | 150 | $error_logging->maybe_write_to_log( |
| 151 | 151 | $merge_field->get_error_code(), |
| 152 | - __( "Updating merge field" , 'yikes-inc-easy-mailchimp-extender' ), |
|
| 152 | + __( "Updating merge field", 'yikes-inc-easy-mailchimp-extender' ), |
|
| 153 | 153 | "class.ajax.php" |
| 154 | 154 | ); |
| 155 | 155 | wp_send_json_error( array( |