@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @var array |
| 75 | 75 | */ |
| 76 | - protected $localizations = []; |
|
| 76 | + protected $localizations = [ ]; |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Instantiate a ScriptAsset object. |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function __construct( |
| 92 | 92 | $handle, |
| 93 | 93 | $source, |
| 94 | - $dependencies = [], |
|
| 94 | + $dependencies = [ ], |
|
| 95 | 95 | $version = self::VERSION, |
| 96 | 96 | $in_footer = self::ENQUEUE_HEADER, |
| 97 | 97 | $external = false |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @return Closure |
| 128 | 128 | */ |
| 129 | 129 | protected function get_register_closure() { |
| 130 | - return function () { |
|
| 130 | + return function() { |
|
| 131 | 131 | if ( wp_script_is( $this->handle, 'registered' ) ) { |
| 132 | 132 | return; |
| 133 | 133 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @return Closure |
| 151 | 151 | */ |
| 152 | 152 | protected function get_enqueue_closure() { |
| 153 | - return function () { |
|
| 153 | + return function() { |
|
| 154 | 154 | if ( ! wp_script_is( $this->handle, 'registered' ) ) { |
| 155 | 155 | throw FailedToRegister::asset_not_registered( $this->handle ); |
| 156 | 156 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return Closure |
| 172 | 172 | */ |
| 173 | 173 | protected function get_dequeue_closure() { |
| 174 | - return function () { |
|
| 174 | + return function() { |
|
| 175 | 175 | wp_dequeue_script( $this->handle ); |
| 176 | 176 | }; |
| 177 | 177 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | |
| 19 | 19 | <div |
| 20 | 20 | class="g-recaptcha" |
| 21 | - data-sitekey="<?= esc_attr( $this->form->recaptcha['site_key'] ); ?>" |
|
| 22 | - data-theme="<?= esc_attr( $this->form->recaptcha['theme'] ); ?>" |
|
| 23 | - data-type="<?= esc_attr( $this->form->recaptcha['type'] ); ?>" |
|
| 24 | - data-size="<?= esc_attr( $this->form->recaptcha['size'] ); ?>" |
|
| 25 | - data-callback="<?= esc_attr( $this->form->recaptcha['success_callback'] ); ?>" |
|
| 26 | - data-expired-callback="<?= esc_attr( $this->form->recaptcha['expired_callback'] ); ?>" |
|
| 21 | + data-sitekey="<?= esc_attr( $this->form->recaptcha[ 'site_key' ] ); ?>" |
|
| 22 | + data-theme="<?= esc_attr( $this->form->recaptcha[ 'theme' ] ); ?>" |
|
| 23 | + data-type="<?= esc_attr( $this->form->recaptcha[ 'type' ] ); ?>" |
|
| 24 | + data-size="<?= esc_attr( $this->form->recaptcha[ 'size' ] ); ?>" |
|
| 25 | + data-callback="<?= esc_attr( $this->form->recaptcha[ 'success_callback' ] ); ?>" |
|
| 26 | + data-expired-callback="<?= esc_attr( $this->form->recaptcha[ 'expired_callback' ] ); ?>" |
|
| 27 | 27 | ></div> |
| 28 | 28 | \ No newline at end of file |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | return apply_filters( 'yikes-mailchimp-form-description', $custom_description, $this->form_id ); |
| 34 | 34 | } else { |
| 35 | - return apply_filters( 'yikes-mailchimp-form-description', $this->form_data['form_description'], $this->form_id ); |
|
| 35 | + return apply_filters( 'yikes-mailchimp-form-description', $this->form_data[ 'form_description' ], $this->form_id ); |
|
| 36 | 36 | } |
| 37 | 37 | } else { |
| 38 | 38 | return false; |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | protected function reduce_field_count() { |
| 43 | - $this->field_count = $this->field_count --; |
|
| 43 | + $this->field_count = $this->field_count--; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | protected function set_field_count() { |
| 47 | - return isset( $this->form_data['fields'] ) ? count( $this->form_data['fields'] ) : 0; |
|
| 47 | + return isset( $this->form_data[ 'fields' ] ) ? count( $this->form_data[ 'fields' ] ) : 0; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function form_classes( bool $is_submitted ) { |
| 51 | - $form_classes = $this->form_data['form_settings']['yikes-easy-mc-form-class-names']; |
|
| 51 | + $form_classes = $this->form_data[ 'form_settings' ][ 'yikes-easy-mc-form-class-names' ]; |
|
| 52 | 52 | $form_classes .= ' yikes-easy-mc-form yikes-easy-mc-form-' . $this->form_id; |
| 53 | 53 | |
| 54 | 54 | if ( isset( $this->form_inline ) && $this->form_inline != 0 ) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $form_classes = apply_filters( 'yikes-mailchimp-form-class', $form_classes, $this->form_id ); |
| 61 | 61 | |
| 62 | - if ( $is_submitted && $this->form_data['submission_settings']['hide_form_post_signup'] == 1 ) { |
|
| 62 | + if ( $is_submitted && $this->form_data[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { |
|
| 63 | 63 | $form_classes .= ' yikes-easy-mc-display-none'; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function edit_form_link() { |
| 74 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
| 74 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
| 75 | 75 | $edit_form_link = '<span class="edit-link">'; |
| 76 | - $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $this->form_id ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $this->form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 76 | + $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $this->form_id ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $this->form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
| 77 | 77 | $edit_form_link .= '</span>'; |
| 78 | - $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $this->form_id, ucwords( $this->form_data['form_name'] ) ); |
|
| 78 | + $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $this->form_id, ucwords( $this->form_data[ 'form_name' ] ) ); |
|
| 79 | 79 | } else { |
| 80 | 80 | $edit_form_link = ''; |
| 81 | 81 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ?> |
| 50 | 50 | |
| 51 | 51 | <form method="POST" |
| 52 | - id="<?= esc_attr( sanitize_title( $form_data['form_name'] ) ); ?>-<?= esc_attr( $form_id ); ?>" |
|
| 52 | + id="<?= esc_attr( sanitize_title( $form_data[ 'form_name' ] ) ); ?>-<?= esc_attr( $form_id ); ?>" |
|
| 53 | 53 | class="<?= esc_attr( $form_classes ); ?>" |
| 54 | 54 | data-attr-form-id="<?= esc_attr( $form_id ); ?>" |
| 55 | 55 | > |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * for non-admins |
| 86 | 86 | */ |
| 87 | 87 | if ( ! current_user_can( 'manage_options' ) ) { |
| 88 | - $impressions = $form_data['impressions'] + 1; |
|
| 88 | + $impressions = $form_data[ 'impressions' ] + 1; |
|
| 89 | 89 | |
| 90 | 90 | $form_data->update_form_field( $form_id, 'impressions', $impressions ); |
| 91 | 91 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @since %VERSION% |
| 87 | 87 | * @var array |
| 88 | 88 | */ |
| 89 | - private $submitted_data = []; |
|
| 89 | + private $submitted_data = [ ]; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * The validated data for this form. |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @since %VERSION% |
| 95 | 95 | * @var array |
| 96 | 96 | */ |
| 97 | - private $valid_data = []; |
|
| 97 | + private $valid_data = [ ]; |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Admin CSS Class |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $this->form_id = $form_id; |
| 119 | 119 | $this->form_data = $form_data; |
| 120 | 120 | $this->field_count = $this->set_field_count(); |
| 121 | - $this->form_inline = $form_data['form_settings']['yikes-easy-mc-inline-form']; |
|
| 121 | + $this->form_inline = $form_data[ 'form_settings' ][ 'yikes-easy-mc-inline-form' ]; |
|
| 122 | 122 | $this->recaptcha = ( new RecaptchaModel() )->setup( $attr ); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | private function admin_class() { |
| 131 | 131 | $is_admin = is_user_logged_in() && current_user_can( |
| 132 | - apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) |
|
| 132 | + apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) |
|
| 133 | 133 | ); |
| 134 | 134 | return $is_admin ? ' admin-logged-in' : ''; |
| 135 | 135 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @since %VERSION% |
| 162 | 162 | */ |
| 163 | 163 | private function create_fields() { |
| 164 | - $fields = []; |
|
| 164 | + $fields = [ ]; |
|
| 165 | 165 | |
| 166 | 166 | // // Manually add the hidden nonce and referrer fields. |
| 167 | 167 | // $fields[] = new Hidden( "yikes_easy_mc_new_subscriber", wp_create_nonce( 'yikes_easy_mc_form_submit' ), $this->form_id ); |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | // $fields[] = new Hidden( 'yikes-mailchimp-submitted-form', $this->form_id, $this->form_id ); |
| 178 | 178 | |
| 179 | 179 | // Add all of the active fields. |
| 180 | - foreach ( $this->form_data['fields'] as $field ) { |
|
| 181 | - if ( isset( $field['hide'] ) && (string) $field['hide'] === '1' ) { |
|
| 180 | + foreach ( $this->form_data[ 'fields' ] as $field ) { |
|
| 181 | + if ( isset( $field[ 'hide' ] ) && (string) $field[ 'hide' ] === '1' ) { |
|
| 182 | 182 | $this->reduce_field_count(); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @since %VERSION% |
| 195 | 195 | */ |
| 196 | - public function render( array $context = [] ) { |
|
| 196 | + public function render( array $context = [ ] ) { |
|
| 197 | 197 | foreach ( $this->fields as $field ) { |
| 198 | 198 | $field->render(); |
| 199 | 199 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @since %VERSION% |
| 228 | 228 | */ |
| 229 | 229 | public function validate_submission() { |
| 230 | - $valid = []; |
|
| 230 | + $valid = [ ]; |
|
| 231 | 231 | foreach ( $this->fields as $field ) { |
| 232 | 232 | try { |
| 233 | 233 | $submitted = array_key_exists( $field->get_id(), $this->submitted_data ) |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | private function get_field_type( $field ) { |
| 258 | 258 | |
| 259 | - $type = array_key_exists( $field['type'], Meta::FIELD_MAP ) ? Meta::FIELD_MAP[ $field['type'] ] : Types::TEXT; |
|
| 259 | + $type = array_key_exists( $field[ 'type' ], Meta::FIELD_MAP ) ? Meta::FIELD_MAP[ $field[ 'type' ] ] : Types::TEXT; |
|
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | 262 | * Filter the class used to instantiate the field. |
@@ -308,9 +308,9 @@ discard block |
||
| 308 | 308 | $classes = $this->get_field_classes( $field ); |
| 309 | 309 | $placeholder = $this->get_placeholder( $field ); |
| 310 | 310 | $description = $this->get_description( $field ); |
| 311 | - $merge = $field['merge']; |
|
| 311 | + $merge = $field[ 'merge' ]; |
|
| 312 | 312 | $hidden = $this->get_hidden( $field ); |
| 313 | - $required = isset( $field['require'] ) ? true : false; |
|
| 313 | + $required = isset( $field[ 'require' ] ) ? true : false; |
|
| 314 | 314 | return [ |
| 315 | 315 | new $type( |
| 316 | 316 | $classes, |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | - private $classes = []; |
|
| 34 | + private $classes = [ ]; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Field placeholder. |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | $this->placeholder = $placeholder; |
| 68 | 68 | $this->label = $label; |
| 69 | 69 | $this->value = $value; |
| 70 | - $this->description = $description['description']; |
|
| 71 | - $this->show_desc = $description['show_description']; |
|
| 72 | - $this->desc_above = $description['description_above']; |
|
| 70 | + $this->description = $description[ 'description' ]; |
|
| 71 | + $this->show_desc = $description[ 'show_description' ]; |
|
| 72 | + $this->desc_above = $description[ 'description_above' ]; |
|
| 73 | 73 | $this->merge = $merge; |
| 74 | 74 | $this->form_id = $form_id; |
| 75 | 75 | $this->hidden = $hidden; |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function field_classes() { |
| 96 | - return $this->classes['field_classes']; |
|
| 96 | + return $this->classes[ 'field_classes' ]; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function label_classes() { |
| 100 | 100 | if ( true === static::REQUIRED ) { |
| 101 | - $this->classes['label_classes'][] = 'yikes-mailchimp-field-required'; |
|
| 101 | + $this->classes[ 'label_classes' ][ ] = 'yikes-mailchimp-field-required'; |
|
| 102 | 102 | } |
| 103 | - return $this->classes['label_classes']; |
|
| 103 | + return $this->classes[ 'label_classes' ]; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | public function get_required() { |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | public function render() { |
| 131 | 131 | |
| 132 | 132 | ?> |
| 133 | - <label for="<?= esc_attr( $this->get_id() ); ?>" class="<?= esc_html( implode( ' ' , $this->label_classes() ) ); ?>" <?= esc_html( implode( ' ' , $this->label['props'] ) ); ?> > |
|
| 133 | + <label for="<?= esc_attr( $this->get_id() ); ?>" class="<?= esc_html( implode( ' ', $this->label_classes() ) ); ?>" <?= esc_html( implode( ' ', $this->label[ 'props' ] ) ); ?> > |
|
| 134 | 134 | |
| 135 | 135 | <!-- dictate label visibility --> |
| 136 | - <?php if ( ! isset( $this->label['hide-label'] ) ) { ?> |
|
| 136 | + <?php if ( ! isset( $this->label[ 'hide-label' ] ) ) { ?> |
|
| 137 | 137 | <span class="<?= esc_attr( $this->merge ) . '-label'; ?>"> |
| 138 | - <?= esc_html( apply_filters( 'yikes-mailchimp-'. $this->merge .'-label' , esc_attr( $this->label['value'] ), $this->form_id ) ); ?> |
|
| 138 | + <?= esc_html( apply_filters( 'yikes-mailchimp-' . $this->merge . '-label', esc_attr( $this->label[ 'value' ] ), $this->form_id ) ); ?> |
|
| 139 | 139 | </span> |
| 140 | 140 | <?php } |
| 141 | 141 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | endif; |
| 151 | 151 | ?> |
| 152 | 152 | <input type="<?= esc_attr( $this->get_type() ); ?>" |
| 153 | - class="<?= esc_attr( implode( ' ' , $this->field_classes() ) ); ?>" |
|
| 153 | + class="<?= esc_attr( implode( ' ', $this->field_classes() ) ); ?>" |
|
| 154 | 154 | name="<?= esc_attr( $this->get_name() ); ?>" |
| 155 | 155 | placeholder="<?= esc_attr( $this->get_placeholder() ); ?>" |
| 156 | 156 | id="<?= esc_attr( $this->get_id() ); ?>" |
@@ -11,62 +11,62 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | trait FieldBuilder { |
| 13 | 13 | protected function get_field_classes( $field ) { |
| 14 | - $field_classes = []; |
|
| 15 | - $label_classes = []; |
|
| 14 | + $field_classes = [ ]; |
|
| 15 | + $label_classes = [ ]; |
|
| 16 | 16 | |
| 17 | - $field_classes[] = 'yikes-easy-mc-' . $field['type']; |
|
| 18 | - $label_classes[] = $field['merge'] . '-label'; |
|
| 17 | + $field_classes[ ] = 'yikes-easy-mc-' . $field[ 'type' ]; |
|
| 18 | + $label_classes[ ] = $field[ 'merge' ] . '-label'; |
|
| 19 | 19 | |
| 20 | - if( $field['additional-classes'] != '' ) { |
|
| 20 | + if ( $field[ 'additional-classes' ] != '' ) { |
|
| 21 | 21 | |
| 22 | - $field_classes = explode( ' ' , $field['additional-classes'] ); |
|
| 22 | + $field_classes = explode( ' ', $field[ 'additional-classes' ] ); |
|
| 23 | 23 | |
| 24 | - if( in_array( 'field-left-half' , $field_classes ) ) { |
|
| 25 | - $$label_classes[] = 'field-left-half'; |
|
| 26 | - $key = array_search( 'field-left-half' , $field_classes ); |
|
| 27 | - unset( $field_classes[$key] ); |
|
| 24 | + if ( in_array( 'field-left-half', $field_classes ) ) { |
|
| 25 | + $$label_classes[ ] = 'field-left-half'; |
|
| 26 | + $key = array_search( 'field-left-half', $field_classes ); |
|
| 27 | + unset( $field_classes[ $key ] ); |
|
| 28 | 28 | } // input half right |
| 29 | - if( in_array( 'field-right-half' , $field_classes ) ) { |
|
| 30 | - $$label_classes[] = 'field-right-half'; |
|
| 31 | - $key = array_search( 'field-right-half' , $field_classes ); |
|
| 32 | - unset( $field_classes[$key] ); |
|
| 29 | + if ( in_array( 'field-right-half', $field_classes ) ) { |
|
| 30 | + $$label_classes[ ] = 'field-right-half'; |
|
| 31 | + $key = array_search( 'field-right-half', $field_classes ); |
|
| 32 | + unset( $field_classes[ $key ] ); |
|
| 33 | 33 | } // input thirds (1/3 width, floated left) |
| 34 | - if( in_array( 'field-third' , $field_classes ) ) { |
|
| 35 | - $$label_classes[] = 'field-third'; |
|
| 36 | - $key = array_search( 'field-third' , $field_classes ); |
|
| 37 | - unset( $field_classes[$key] ); |
|
| 34 | + if ( in_array( 'field-third', $field_classes ) ) { |
|
| 35 | + $$label_classes[ ] = 'field-third'; |
|
| 36 | + $key = array_search( 'field-third', $field_classes ); |
|
| 37 | + unset( $field_classes[ $key ] ); |
|
| 38 | 38 | } // 2 column radio |
| 39 | - if( in_array( 'option-2-col' , $field_classes ) ) { |
|
| 40 | - $$label_classes[] = 'option-2-col'; |
|
| 41 | - $key = array_search( 'option-2-col' , $field_classes ); |
|
| 42 | - unset( $field_classes[$key] ); |
|
| 39 | + if ( in_array( 'option-2-col', $field_classes ) ) { |
|
| 40 | + $$label_classes[ ] = 'option-2-col'; |
|
| 41 | + $key = array_search( 'option-2-col', $field_classes ); |
|
| 42 | + unset( $field_classes[ $key ] ); |
|
| 43 | 43 | } // 3 column radio |
| 44 | - if( in_array( 'option-3-col' , $field_classes ) ) { |
|
| 45 | - $$label_classes[] = 'option-3-col'; |
|
| 46 | - $key = array_search( 'option-3-col' , $field_classes ); |
|
| 47 | - unset( $field_classes[$key] ); |
|
| 44 | + if ( in_array( 'option-3-col', $field_classes ) ) { |
|
| 45 | + $$label_classes[ ] = 'option-3-col'; |
|
| 46 | + $key = array_search( 'option-3-col', $field_classes ); |
|
| 47 | + unset( $field_classes[ $key ] ); |
|
| 48 | 48 | } // 4 column radio |
| 49 | - if( in_array( 'option-4-col' , $field_classes ) ) { |
|
| 50 | - $$label_classes[] = 'option-4-col'; |
|
| 51 | - $key = array_search( 'option-4-col' , $field_classes ); |
|
| 52 | - unset( $field_classes[$key] ); |
|
| 49 | + if ( in_array( 'option-4-col', $field_classes ) ) { |
|
| 50 | + $$label_classes[ ] = 'option-4-col'; |
|
| 51 | + $key = array_search( 'option-4-col', $field_classes ); |
|
| 52 | + unset( $field_classes[ $key ] ); |
|
| 53 | 53 | } // inline radio & checkboxes etc |
| 54 | - if( in_array( 'option-inline' , $field_classes ) ) { |
|
| 55 | - $$label_classes[] = 'option-inline'; |
|
| 56 | - $key = array_search( 'option-inline' , $field_classes ); |
|
| 57 | - unset( $field_classes[$key] ); |
|
| 54 | + if ( in_array( 'option-inline', $field_classes ) ) { |
|
| 55 | + $$label_classes[ ] = 'option-inline'; |
|
| 56 | + $key = array_search( 'option-inline', $field_classes ); |
|
| 57 | + unset( $field_classes[ $key ] ); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // if the form is set to inline, add the inline class to our labels |
| 62 | - if( $this->form_inline ) { |
|
| 63 | - $label_classes[] = 'label-inline'; |
|
| 62 | + if ( $this->form_inline ) { |
|
| 63 | + $label_classes[ ] = 'label-inline'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if( isset( $field['hide-label'] ) ) { |
|
| 67 | - if( absint( $field['hide-label'] ) === 1 ) { |
|
| 66 | + if ( isset( $field[ 'hide-label' ] ) ) { |
|
| 67 | + if ( absint( $field[ 'hide-label' ] ) === 1 ) { |
|
| 68 | 68 | $this->increase_hidden_label_count(); |
| 69 | - $field_classes[] = 'field-no-label'; |
|
| 69 | + $field_classes[ ] = 'field-no-label'; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -81,37 +81,37 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | protected function get_label( $field ) { |
| 84 | - $label = []; |
|
| 85 | - if( $field['type'] == 'email' ) { |
|
| 86 | - $label['props']['visible'] = ''; |
|
| 84 | + $label = [ ]; |
|
| 85 | + if ( $field[ 'type' ] == 'email' ) { |
|
| 86 | + $label[ 'props' ][ 'visible' ] = ''; |
|
| 87 | 87 | } else { |
| 88 | - $label['props']['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
| 88 | + $label[ 'props' ][ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
| 89 | 89 | } |
| 90 | - if ( isset( $field['hide-label'] ) ) { |
|
| 91 | - $label['hide-label'] = true; |
|
| 90 | + if ( isset( $field[ 'hide-label' ] ) ) { |
|
| 91 | + $label[ 'hide-label' ] = true; |
|
| 92 | 92 | } |
| 93 | - if ( isset( $field['label'] ) ) { |
|
| 94 | - $label['value'] = $field['label']; |
|
| 93 | + if ( isset( $field[ 'label' ] ) ) { |
|
| 94 | + $label[ 'value' ] = $field[ 'label' ]; |
|
| 95 | 95 | } |
| 96 | 96 | return $label; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | protected function get_value( $field ) { |
| 100 | 100 | // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type) |
| 101 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
| 101 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
| 102 | 102 | $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value ); |
| 103 | - return apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $this->form_id ); |
|
| 103 | + return apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $this->form_id ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | protected function get_placeholder( $field ) { |
| 107 | - return isset( $field['placeholder'] ) ? $field['placeholder'] : ''; |
|
| 107 | + return isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | protected function get_hidden( $field ) { |
| 111 | 111 | $visible = false; |
| 112 | 112 | // if both hide label and hide field are checked, we gotta hide the field! |
| 113 | - if( isset( $field['hide' ] ) && $field['hide'] == 1 ) { |
|
| 114 | - if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) { |
|
| 113 | + if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) { |
|
| 114 | + if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) { |
|
| 115 | 115 | $visible = true; |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | protected function get_description( $field ) { |
| 122 | 122 | $description = ''; |
| 123 | - $show_description = isset( $field['description'] ) ? true : false; |
|
| 124 | - $description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false; |
|
| 123 | + $show_description = isset( $field[ 'description' ] ) ? true : false; |
|
| 124 | + $description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false; |
|
| 125 | 125 | if ( $show_description === true ) { |
| 126 | - $description = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $this->form_id ); |
|
| 126 | + $description = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $this->form_id ); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return [ |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | final class EasyFormsShortcode extends BaseShortcode { |
| 31 | 31 | |
| 32 | - const TAG = 'yikes-mailchimp'; |
|
| 32 | + const TAG = 'yikes-mailchimp'; |
|
| 33 | 33 | const VIEW_URI = 'views/easy-forms-shortcode'; |
| 34 | 34 | const SUBMITTED_URI = 'views/easy-forms-shortcode-completed'; |
| 35 | 35 | const TITLE_URI = 'views/easy-forms-shortcode-title'; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | parent::register(); |
| 86 | 86 | $this->enqueue_assets(); |
| 87 | 87 | add_filter( 'safe_style_css', function( $styles ) { |
| 88 | - $styles[] = 'display'; |
|
| 88 | + $styles[ ] = 'display'; |
|
| 89 | 89 | return $styles; |
| 90 | 90 | } ); |
| 91 | 91 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @throws InvalidPostID When the post ID is not valid. |
| 105 | 105 | */ |
| 106 | 106 | protected function get_context( array $attr ) { |
| 107 | - $form_id = $attr['form'] ? $attr['form'] : '1'; |
|
| 107 | + $form_id = $attr[ 'form' ] ? $attr[ 'form' ] : '1'; |
|
| 108 | 108 | $form_data = ( new EasyFormsModel() )->find( $form_id ); |
| 109 | 109 | |
| 110 | 110 | $this->is_submitted = $this->is_submitting_form(); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | // Set up the form object. |
| 113 | 113 | $form = $this->get_optin_form( $form_id, $form_data, $attr ); |
| 114 | 114 | |
| 115 | - $title = $form->form_title( $attr['title'], $attr['custom_title'], $form_data['form_name'] ); |
|
| 115 | + $title = $form->form_title( $attr[ 'title' ], $attr[ 'custom_title' ], $form_data[ 'form_name' ] ); |
|
| 116 | 116 | |
| 117 | 117 | if ( false !== $title ) { |
| 118 | 118 | add_action( 'easy_forms_do_form_title', function( $view ) { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } ); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $description = $form->form_description( $attr['description'], $attr['custom_description'] ); |
|
| 123 | + $description = $form->form_description( $attr[ 'description' ], $attr[ 'custom_description' ] ); |
|
| 124 | 124 | |
| 125 | 125 | if ( false !== $description ) { |
| 126 | 126 | add_action( 'easy_forms_do_form_description', function( $view ) { |
@@ -134,9 +134,9 @@ discard block |
||
| 134 | 134 | 'form_classes' => $form->form_classes( $this->is_submitted ), |
| 135 | 135 | 'edit_form_link' => $form->edit_form_link(), |
| 136 | 136 | 'submit_button_classes' => $form->submit_button_classes(), |
| 137 | - 'submit_button_text' => $form->submit_button_text( $attr['submit'] ), |
|
| 138 | - 'ajax' => $attr['ajax'], |
|
| 139 | - 'form_settings' => $form_data['form_settings'], |
|
| 137 | + 'submit_button_text' => $form->submit_button_text( $attr[ 'submit' ] ), |
|
| 138 | + 'ajax' => $attr[ 'ajax' ], |
|
| 139 | + 'form_settings' => $form_data[ 'form_settings' ], |
|
| 140 | 140 | 'form_data' => $form_data, |
| 141 | 141 | 'form' => $form, |
| 142 | 142 | 'form_id' => $form_id, |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return string Rendered HTML. |
| 208 | 208 | */ |
| 209 | - public function render( array $context = [] ) { |
|
| 209 | + public function render( array $context = [ ] ) { |
|
| 210 | 210 | try { |
| 211 | 211 | $this->enqueue_assets(); |
| 212 | 212 | $view = new FormEscapedView( new NoOverrideLocationView( $this->get_view_uri() ) ); |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | $form_data = array( |
| 3 | - 'field_name' => $_POST['field_name'], |
|
| 4 | - 'merge_tag' => $_POST['merge_tag'], |
|
| 5 | - 'field_type' => $_POST['field_type'], |
|
| 6 | - 'list_id' => $_POST['list_id'], |
|
| 3 | + 'field_name' => $_POST[ 'field_name' ], |
|
| 4 | + 'merge_tag' => $_POST[ 'merge_tag' ], |
|
| 5 | + 'field_type' => $_POST[ 'field_type' ], |
|
| 6 | + 'list_id' => $_POST[ 'list_id' ], |
|
| 7 | 7 | ); |
| 8 | 8 | |
| 9 | 9 | // Grab our list handler. |
| 10 | 10 | $list_handler = yikes_get_mc_api_manager()->get_list_handler(); |
| 11 | 11 | |
| 12 | -$available_merge_variables = $list_handler->get_merge_fields( $form_data['list_id'] ); |
|
| 12 | +$available_merge_variables = $list_handler->get_merge_fields( $form_data[ 'list_id' ] ); |
|
| 13 | 13 | if ( is_wp_error( $available_merge_variables ) ) { |
| 14 | 14 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 15 | 15 | $error_logging->maybe_write_to_log( |
@@ -28,17 +28,17 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // find and return the location of this merge field in the array |
| 31 | -$index = $this->findMCListIndex( $form_data['merge_tag'], $available_merge_variables['merge_fields'], 'tag' ); |
|
| 31 | +$index = $this->findMCListIndex( $form_data[ 'merge_tag' ], $available_merge_variables[ 'merge_fields' ], 'tag' ); |
|
| 32 | 32 | |
| 33 | 33 | // store it and use it to pre-populate field data (only on initial add to form) |
| 34 | -$merge_field_data = $available_merge_variables['merge_fields'][ $index ]; |
|
| 34 | +$merge_field_data = $available_merge_variables[ 'merge_fields' ][ $index ]; |
|
| 35 | 35 | ?> |
| 36 | -<section class="draggable" id="<?php echo $form_data['field_name']; ?>"> |
|
| 36 | +<section class="draggable" id="<?php echo $form_data[ 'field_name' ]; ?>"> |
|
| 37 | 37 | <!-- top --> |
| 38 | 38 | <a href="#" class="expansion-section-title settings-sidebar"> |
| 39 | - <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field' , 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
| 40 | - <?php echo stripslashes( $form_data['field_name'] ); ?> |
|
| 41 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data['field_type']; ?></small></span> |
|
| 39 | + <span class="dashicons dashicons-plus yikes-mc-expansion-toggle" title="<?php _e( 'Expand Field', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span> |
|
| 40 | + <?php echo stripslashes( $form_data[ 'field_name' ] ); ?> |
|
| 41 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data[ 'field_type' ]; ?></small></span> |
|
| 42 | 42 | </a> |
| 43 | 43 | <!-- expansion section --> |
| 44 | 44 | <div class="yikes-mc-settings-expansion-section"> |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | <!-- Single or Double Opt-in --> |
| 47 | 47 | <p class="type-container form-field-container"><!-- necessary to prevent skipping on slideToggle(); --> |
| 48 | 48 | <!-- store the label --> |
| 49 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][label]" value="<?php echo htmlspecialchars( $form_data['field_name'] ); ?>" /> |
|
| 50 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][type]" value="<?php echo $form_data['field_type']; ?>" /> |
|
| 51 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][merge]" value="<?php echo $merge_field_data['tag']; ?>" /> |
|
| 52 | - <input type="hidden" class="field-<?php echo $merge_field_data['tag']; ?>-position position-input" name="field[<?php echo $merge_field_data['tag']; ?>][position]" value="" /> |
|
| 49 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][label]" value="<?php echo htmlspecialchars( $form_data[ 'field_name' ] ); ?>" /> |
|
| 50 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][type]" value="<?php echo $form_data[ 'field_type' ]; ?>" /> |
|
| 51 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][merge]" value="<?php echo $merge_field_data[ 'tag' ]; ?>" /> |
|
| 52 | + <input type="hidden" class="field-<?php echo $merge_field_data[ 'tag' ]; ?>-position position-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][position]" value="" /> |
|
| 53 | 53 | |
| 54 | - <?php if ( $form_data['field_type'] == 'radio' || $form_data['field_type'] == 'dropdown' ) { ?> |
|
| 55 | - <?php $choices = ( isset( $merge_field_data['options']['choices'] ) ) ? esc_attr( json_encode( $merge_field_data['options']['choices'] ) ) : ''; ?> |
|
| 56 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
| 54 | + <?php if ( $form_data[ 'field_type' ] == 'radio' || $form_data[ 'field_type' ] == 'dropdown' ) { ?> |
|
| 55 | + <?php $choices = ( isset( $merge_field_data[ 'options' ][ 'choices' ] ) ) ? esc_attr( json_encode( $merge_field_data[ 'options' ][ 'choices' ] ) ) : ''; ?> |
|
| 56 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][choices]" value='<?php echo $choices; ?>' /> |
|
| 57 | 57 | <?php } ?> |
| 58 | 58 | |
| 59 | 59 | <table class="form-table form-field-container"> |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | <tr valign="top"> |
| 63 | 63 | <td scope="row"> |
| 64 | 64 | <label for="merge-tag"> |
| 65 | - <?php _e( 'Merge Tag' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 65 | + <?php _e( 'Merge Tag', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 66 | 66 | </label> |
| 67 | 67 | </td> |
| 68 | 68 | <td> |
| 69 | - <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data['tag']; ?>"> |
|
| 69 | + <input class="widefat merge-tag-text" type="text" readonly value="<?php echo $merge_field_data[ 'tag' ]; ?>"> |
|
| 70 | 70 | </td> |
| 71 | 71 | </tr> |
| 72 | 72 | |
| 73 | - <?php switch( $form_data['field_type'] ) { |
|
| 73 | + <?php switch ( $form_data[ 'field_type' ] ) { |
|
| 74 | 74 | |
| 75 | 75 | default: |
| 76 | 76 | break; |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | <tr valign="top"> |
| 89 | 89 | <td scope="row"> |
| 90 | 90 | <label for="placeholder"> |
| 91 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 91 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 92 | 92 | </label> |
| 93 | 93 | </td> |
| 94 | 94 | <td> |
| 95 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][placeholder]" value="<?php echo isset( $merge_field_data['placeholder'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['placeholder'] ) ): '' ; ?>" /> |
|
| 96 | - <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 95 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][placeholder]" value="<?php echo isset( $merge_field_data[ 'placeholder' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'placeholder' ] ) ) : ''; ?>" /> |
|
| 96 | + <p class="description"><small><?php _e( "Assign a placeholder value to this field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 97 | 97 | </td> |
| 98 | 98 | </tr> |
| 99 | 99 | |
@@ -102,27 +102,27 @@ discard block |
||
| 102 | 102 | * Loop over field types and store necessary formats |
| 103 | 103 | * ( date, birthday - dateformat ; phone - phoneformat ) |
| 104 | 104 | */ |
| 105 | - switch( $form_data['field_type'] ) { |
|
| 105 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 106 | 106 | |
| 107 | 107 | /* Store the date format, for properly rendering dates on the front end */ |
| 108 | 108 | case 'date': |
| 109 | - $date_format = isset( $merge_field_data['options']['dateformat'] ) ? $merge_field_data['options']['dateformat'] : 'MM/DD/YYYY'; |
|
| 109 | + $date_format = isset( $merge_field_data[ 'options' ][ 'dateformat' ] ) ? $merge_field_data[ 'options' ][ 'dateformat' ] : 'MM/DD/YYYY'; |
|
| 110 | 110 | ?> |
| 111 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 111 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 112 | 112 | <?php |
| 113 | 113 | break; |
| 114 | 114 | |
| 115 | 115 | case 'birthday': |
| 116 | - $date_format = isset( $merge_field_data['options']['dateformat'] ) ? $merge_field_data['options']['dateformat'] : 'MM/DD'; |
|
| 116 | + $date_format = isset( $merge_field_data[ 'options' ][ 'dateformat' ] ) ? $merge_field_data[ 'options' ][ 'dateformat' ] : 'MM/DD'; |
|
| 117 | 117 | ?> |
| 118 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 118 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][date_format]" value="<?php echo strtolower( $date_format ); ?>" /> |
|
| 119 | 119 | <?php |
| 120 | 120 | break; |
| 121 | 121 | |
| 122 | 122 | /* Store the phone format, for properly regex pattern */ |
| 123 | 123 | case 'phone': |
| 124 | 124 | ?> |
| 125 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][phone_format]" value="<?php echo $merge_field_data['options']['phone_format']; ?>" /> |
|
| 125 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][phone_format]" value="<?php echo $merge_field_data[ 'options' ][ 'phone_format' ]; ?>" /> |
|
| 126 | 126 | <?php |
| 127 | 127 | break; |
| 128 | 128 | } |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | ?> |
| 134 | 134 | <tr valign="top"> |
| 135 | 135 | <td scope="row"> |
| 136 | - <label for="placeholder_<?php echo esc_attr( $field['merge'] ); ?>"> |
|
| 137 | - <?php _e( 'Placeholder' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 136 | + <label for="placeholder_<?php echo esc_attr( $field[ 'merge' ] ); ?>"> |
|
| 137 | + <?php _e( 'Placeholder', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 138 | 138 | </label> |
| 139 | 139 | </td> |
| 140 | 140 | <td> |
| 141 | - <input type="checkbox" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][placeholder]" value="1" /> |
|
| 142 | - <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' );?></small></span> |
|
| 141 | + <input type="checkbox" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][placeholder]" value="1" /> |
|
| 142 | + <span class="description"><small><?php _e( "Use placeholders for this field (these will be automatically filled in with field names).", 'yikes-inc-easy-mailchimp-extender' ); ?></small></span> |
|
| 143 | 143 | </td> |
| 144 | 144 | </tr> |
| 145 | 145 | <?php |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ?> |
| 150 | 150 | |
| 151 | 151 | <!-- Default Value --> |
| 152 | - <?php switch( $form_data['field_type'] ) { |
|
| 152 | + <?php switch ( $form_data[ 'field_type' ] ) { |
|
| 153 | 153 | |
| 154 | 154 | default: |
| 155 | 155 | case 'text': |
@@ -157,17 +157,17 @@ discard block |
||
| 157 | 157 | <tr valign="top"> |
| 158 | 158 | <td scope="row"> |
| 159 | 159 | <label for="placeholder"> |
| 160 | - <?php _e( 'Default Value' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 160 | + <?php _e( 'Default Value', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 161 | 161 | </label> |
| 162 | 162 | </td> |
| 163 | 163 | <td> |
| 164 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][default]" <?php if( $form_data['field_type'] != 'url' ) { ?> value="<?php echo isset( $merge_field_data['default_value'] ) ? stripslashes( wp_strip_all_tags( $merge_field_data['default_value'] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data['default_value'] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data['default_value'] ) ) ) : ''; } ?>" /> |
|
| 165 | - <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 164 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default]" <?php if ( $form_data[ 'field_type' ] != 'url' ) { ?> value="<?php echo isset( $merge_field_data[ 'default_value' ] ) ? stripslashes( wp_strip_all_tags( $merge_field_data[ 'default_value' ] ) ) : ''; ?>" <?php } else { ?> value="<?php echo isset( $merge_field_data[ 'default_value' ] ) ? stripslashes( wp_strip_all_tags( esc_url_raw( $merge_field_data[ 'default_value' ] ) ) ) : ''; } ?>" /> |
|
| 165 | + <p class="description"><small><?php _e( "Assign a default value to populate this field with on initial page load.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 166 | 166 | <?php |
| 167 | - switch ( $form_data['field_type'] ) { |
|
| 167 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 168 | 168 | case 'text': |
| 169 | 169 | ?> |
| 170 | - <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" class="thickbox" onclick="storeGlobalClicked( jQuery( this ) );"><?php _e( 'View Pre-Defined Tags' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
| 170 | + <p><small class="pre-defined-tag-link"><a href="#TB_inline?width=600&height=550&inlineId=pre-defined-tag-container" class="thickbox" onclick="storeGlobalClicked( jQuery( this ) );"><?php _e( 'View Pre-Defined Tags', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
| 171 | 171 | <?php |
| 172 | 172 | break; |
| 173 | 173 | } ?> |
@@ -181,28 +181,28 @@ discard block |
||
| 181 | 181 | <tr valign="top"> |
| 182 | 182 | <td scope="row"> |
| 183 | 183 | <label for="placeholder"> |
| 184 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 184 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 185 | 185 | </label> |
| 186 | 186 | </td> |
| 187 | 187 | <td> |
| 188 | - <?php $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : 'no-default'; ?> |
|
| 189 | - <label for="<?php echo $merge_field_data['tag'] . '-no-default'; ?>"> |
|
| 190 | - <input id="<?php echo $merge_field_data['tag'] . '-no-default'; ?>" |
|
| 188 | + <?php $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 189 | + <label for="<?php echo $merge_field_data[ 'tag' ] . '-no-default'; ?>"> |
|
| 190 | + <input id="<?php echo $merge_field_data[ 'tag' ] . '-no-default'; ?>" |
|
| 191 | 191 | type="radio" |
| 192 | - name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" |
|
| 192 | + name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]" |
|
| 193 | 193 | value="no-default" <?php checked( $pre_selected, 'no-default' ); ?> |
| 194 | 194 | > |
| 195 | 195 | No Default |
| 196 | 196 | </label> |
| 197 | 197 | <?php |
| 198 | 198 | $x = 0; |
| 199 | - foreach ( $merge_field_data['options']['choices'] as $choice => $value ) { ?> |
|
| 199 | + foreach ( $merge_field_data[ 'options' ][ 'choices' ] as $choice => $value ) { ?> |
|
| 200 | 200 | <label> |
| 201 | - <input type="radio" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $pre_selected, $choice ); ?>><?php echo $value; ?> |
|
| 201 | + <input type="radio" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]" value="<?php echo $x; ?>" <?php checked( $pre_selected, $choice ); ?>><?php echo $value; ?> |
|
| 202 | 202 | </label> |
| 203 | 203 | <?php $x++; |
| 204 | 204 | } ?> |
| 205 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 205 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 206 | 206 | </td> |
| 207 | 207 | </tr> |
| 208 | 208 | |
@@ -214,18 +214,18 @@ discard block |
||
| 214 | 214 | <tr valign="top"> |
| 215 | 215 | <td scope="row"> |
| 216 | 216 | <label for="placeholder"> |
| 217 | - <?php _e( 'Default DROPDOWN Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 217 | + <?php _e( 'Default DROPDOWN Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 218 | 218 | </label> |
| 219 | 219 | </td> |
| 220 | 220 | <td> |
| 221 | - <select type="default" name="field[<?php echo $merge_field_data['tag']; ?>][default_choice]"> |
|
| 222 | - <?php $pre_selected = ! empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : 'no-default'; ?> |
|
| 221 | + <select type="default" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][default_choice]"> |
|
| 222 | + <?php $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : 'no-default'; ?> |
|
| 223 | 223 | <option value="no-default" <?php selected( $pre_selected, $choice ); ?>>No Default</option> |
| 224 | - <?php foreach ( $merge_field_data['options']['choices'] as $choice => $value ) { ?> |
|
| 224 | + <?php foreach ( $merge_field_data[ 'options' ][ 'choices' ] as $choice => $value ) { ?> |
|
| 225 | 225 | <option value="<?php echo $choice; ?>" <?php selected( $pre_selected, $choice ); ?>><?php echo stripslashes( $value ); ?></option> |
| 226 | 226 | <?php } ?> |
| 227 | 227 | </select> |
| 228 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 228 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 229 | 229 | </td> |
| 230 | 230 | </tr> |
| 231 | 231 | |
@@ -238,77 +238,77 @@ discard block |
||
| 238 | 238 | <tr valign="top"> |
| 239 | 239 | <td scope="row"> |
| 240 | 240 | <label for="placeholder"> |
| 241 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 241 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 242 | 242 | </label> |
| 243 | 243 | </td> |
| 244 | 244 | <td> |
| 245 | - <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description]"></textarea> |
|
| 246 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 245 | + <textarea class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description]"></textarea> |
|
| 246 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 247 | 247 | </td> |
| 248 | 248 | </tr> |
| 249 | 249 | <!-- Description Above Field --> |
| 250 | 250 | <tr valign="top" class="yikes-checkbox-container"> |
| 251 | 251 | <td scope="row"> |
| 252 | - <label for="description_above_<?php echo esc_attr( $merge_field_data['tag'] ); ?>"> |
|
| 253 | - <?php _e( 'Description Above Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 252 | + <label for="description_above_<?php echo esc_attr( $merge_field_data[ 'tag' ] ); ?>"> |
|
| 253 | + <?php _e( 'Description Above Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 254 | 254 | </label> |
| 255 | 255 | </td> |
| 256 | 256 | <td> |
| 257 | - <input type="checkbox" id="description_above_<?php echo esc_attr( $merge_field_data['tag'] ); ?>" class="widefat field-description-input" name="field[<?php echo $merge_field_data['tag']; ?>][description_above]" value="1" /> |
|
| 258 | - <p class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 257 | + <input type="checkbox" id="description_above_<?php echo esc_attr( $merge_field_data[ 'tag' ] ); ?>" class="widefat field-description-input" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][description_above]" value="1" /> |
|
| 258 | + <p class="description"><small><?php _e( "By default the description will appear undearneath the field. Check this box if you'd like the description to appear above the field.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 259 | 259 | </td> |
| 260 | 260 | </tr> |
| 261 | 261 | <!-- Additional Classes --> |
| 262 | 262 | <tr valign="top"> |
| 263 | 263 | <td scope="row"> |
| 264 | 264 | <label for="placeholder"> |
| 265 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 265 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 266 | 266 | </label> |
| 267 | 267 | </td> |
| 268 | 268 | <td> |
| 269 | - <input type="text" class="widefat" name="field[<?php echo $merge_field_data['tag']; ?>][additional-classes]" value="<?php echo isset( $form_data['classes'] ) ? stripslashes( wp_strip_all_tags( $form_data['classes'] ) ) : '' ; ?>" /> |
|
| 270 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
| 269 | + <input type="text" class="widefat" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][additional-classes]" value="<?php echo isset( $form_data[ 'classes' ] ) ? stripslashes( wp_strip_all_tags( $form_data[ 'classes' ] ) ) : ''; ?>" /> |
|
| 270 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
| 271 | 271 | </td> |
| 272 | 272 | </tr> |
| 273 | 273 | <!-- Required Toggle --> |
| 274 | 274 | <tr valign="top" class="yikes-checkbox-container"> |
| 275 | 275 | <td scope="row"> |
| 276 | 276 | <label for="field-required"> |
| 277 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 277 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 278 | 278 | </label> |
| 279 | 279 | </td> |
| 280 | 280 | <td> |
| 281 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][require]" <?php checked( $merge_field_data['required'], 1 ); ?> <?php if( $merge_field_data['tag'] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 282 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 281 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][require]" <?php checked( $merge_field_data[ 'required' ], 1 ); ?> <?php if ( $merge_field_data[ 'tag' ] == 'EMAIL' ) { ?> disabled="disabled" checked="checked" title="<?php echo __( 'Email is a required field.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 282 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 283 | 283 | </td> |
| 284 | 284 | </tr> |
| 285 | 285 | <!-- Visible Toggle --> |
| 286 | 286 | <tr valign="top" class="yikes-checkbox-container"> |
| 287 | 287 | <td scope="row"> |
| 288 | 288 | <label for="hide-field"> |
| 289 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 289 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 290 | 290 | </label> |
| 291 | 291 | </td> |
| 292 | 292 | <td> |
| 293 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data['tag']; ?>][hide]" <?php checked( $merge_field_data['public'], '' ); ?> <?php if( $merge_field_data['tag'] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.' , 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 294 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 293 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide]" <?php checked( $merge_field_data[ 'public' ], '' ); ?> <?php if ( $merge_field_data[ 'tag' ] == 'EMAIL' ) { ?> disabled="disabled" title="<?php echo __( 'Cannot toggle email field visibility.', 'yikes-inc-easy-mailchimp-extender' ); } ?>"> |
|
| 294 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 295 | 295 | </td> |
| 296 | 296 | </tr> |
| 297 | 297 | <!-- Toggle Field Label Visibility --> |
| 298 | 298 | <tr valign="top" class="yikes-checkbox-container"> |
| 299 | 299 | <td scope="row"> |
| 300 | 300 | <label for="placeholder"> |
| 301 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 301 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 302 | 302 | </label> |
| 303 | 303 | </td> |
| 304 | 304 | <td> |
| 305 | - <input type="checkbox" name="field[<?php echo $merge_field_data['tag']; ?>][hide-label]" value="1" /> |
|
| 306 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
| 305 | + <input type="checkbox" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][hide-label]" value="1" /> |
|
| 306 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
| 307 | 307 | </td> |
| 308 | 308 | </tr> |
| 309 | 309 | <!-- Display Phone/Date Formats back to the user --> |
| 310 | 310 | <?php |
| 311 | - switch( $form_data['field_type'] ) { |
|
| 311 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 312 | 312 | |
| 313 | 313 | /* Store the phone format, for properly regex pattern */ |
| 314 | 314 | case 'phone': |
@@ -319,23 +319,23 @@ discard block |
||
| 319 | 319 | <td scope="row"> |
| 320 | 320 | <label for="placeholder"> |
| 321 | 321 | <?php |
| 322 | - switch( $form_data['field_type'] ) { |
|
| 322 | + switch ( $form_data[ 'field_type' ] ) { |
|
| 323 | 323 | default: |
| 324 | 324 | case 'birthday': |
| 325 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 326 | - $format = $merge_field_data['options']['date_format']; |
|
| 325 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 326 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
| 327 | 327 | $format_name = 'date_format'; |
| 328 | 328 | break; |
| 329 | 329 | |
| 330 | 330 | case 'date': |
| 331 | - $type = __( 'Date Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 332 | - $format = $merge_field_data['options']['date_format']; |
|
| 331 | + $type = __( 'Date Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 332 | + $format = $merge_field_data[ 'options' ][ 'date_format' ]; |
|
| 333 | 333 | $format_name = 'date_format'; |
| 334 | 334 | break; |
| 335 | 335 | |
| 336 | 336 | case 'phone': |
| 337 | - $type = __( 'Phone Format' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 338 | - $format = ( ( $merge_field_data['options']['phone_format'] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data['options']['phone_format'] ); |
|
| 337 | + $type = __( 'Phone Format', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 338 | + $format = ( ( $merge_field_data[ 'options' ][ 'phone_format' ] == 'none' ) ? __( 'International', 'yikes-inc-easy-mailchimp-extender' ) : $merge_field_data[ 'options' ][ 'phone_format' ] ); |
|
| 339 | 339 | $format_name = 'phone_format'; |
| 340 | 340 | break; |
| 341 | 341 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | </td> |
| 346 | 346 | <td> |
| 347 | 347 | <strong><?php echo $format; ?></strong> |
| 348 | - <input type="hidden" name="field[<?php echo $merge_field_data['tag']; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 348 | + <input type="hidden" name="field[<?php echo $merge_field_data[ 'tag' ]; ?>][<?php echo $format_name; ?>]" value="<?php echo $format; ?>" /> |
|
| 349 | 349 | <p class="description"><small> |
| 350 | 350 | <?php printf( __( 'To change the %s please head over to <a href="%s" title="Mailchimp" target="_blank">Mailchimp</a>. If you alter the format, you should re-import this field.', 'yikes-inc-easy-mailchimp-extender' ), strtolower( $type ), esc_url( 'http://www.mailchimp.com' ) ); ?> |
| 351 | 351 | </small></p> |
@@ -366,8 +366,8 @@ discard block |
||
| 366 | 366 | </td> |
| 367 | 367 | <td> |
| 368 | 368 | <span class="toggle-container"> |
| 369 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 370 | - <a href="#" class="remove-field" alt="<?php echo $merge_field_data['tag']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 369 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
| 370 | + <a href="#" class="remove-field" alt="<?php echo $merge_field_data[ 'tag' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 371 | 371 | </span> |
| 372 | 372 | </td> |
| 373 | 373 | </tr> |