@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | class Yikes_Inc_Easy_Mailchimp_Extender_Helper { |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * Helper functions to help out with extensions (still fleshing out) |
|
| 11 | - * @since 6.0 |
|
| 12 | - * @ Parameters (array of data) |
|
| 13 | - * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
| 14 | - * - Link Text - Visible text for this link ie: 'Custom Section' |
|
| 15 | - * - Dashicon - class of the icon you would like to use for this link |
|
| 16 | - **/ |
|
| 10 | + * Helper functions to help out with extensions (still fleshing out) |
|
| 11 | + * @since 6.0 |
|
| 12 | + * @ Parameters (array of data) |
|
| 13 | + * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
| 14 | + * - Link Text - Visible text for this link ie: 'Custom Section' |
|
| 15 | + * - Dashicon - class of the icon you would like to use for this link |
|
| 16 | + **/ |
|
| 17 | 17 | public static function add_edit_form_section_link( $link_array=array() ) { |
| 18 | 18 | if( !empty( $link_array ) ) { |
| 19 | 19 | $link_data = wp_parse_args( array() , $link_array ); |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Helper functions to help out with extensions (still fleshing out) |
|
| 40 | - * @since 6.0 |
|
| 41 | - * @ Parameters: |
|
| 42 | - * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
| 43 | - * - Class - class file to call function from? |
|
| 44 | - * - Main Callback - call back for main section |
|
| 45 | - * - Main Section Title - main section title |
|
| 46 | - * - Sidebar Callback - callback for the sidebar section |
|
| 47 | - * - Sidebar Title - title of the sidebar section |
|
| 48 | - * - Class - class to reference funtions out of (optiona, if left blank functions should be defined in functions.php (or outside of a class)) |
|
| 49 | - **/ |
|
| 39 | + * Helper functions to help out with extensions (still fleshing out) |
|
| 40 | + * @since 6.0 |
|
| 41 | + * @ Parameters: |
|
| 42 | + * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
| 43 | + * - Class - class file to call function from? |
|
| 44 | + * - Main Callback - call back for main section |
|
| 45 | + * - Main Section Title - main section title |
|
| 46 | + * - Sidebar Callback - callback for the sidebar section |
|
| 47 | + * - Sidebar Title - title of the sidebar section |
|
| 48 | + * - Class - class to reference funtions out of (optiona, if left blank functions should be defined in functions.php (or outside of a class)) |
|
| 49 | + **/ |
|
| 50 | 50 | public static function add_edit_form_section( $section_array=array() ) { |
| 51 | 51 | if( !empty( $section_array ) ) { |
| 52 | 52 | $section_data = wp_parse_args( array() , $section_array ); |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * Check if the custom section is single or two columns (with sidebar) |
|
| 63 | - * @since 6.0 |
|
| 64 | - * @Parameters: |
|
| 65 | - * - Section Data - the array of data associated with the custom field you've set up |
|
| 66 | - */ |
|
| 62 | + * Check if the custom section is single or two columns (with sidebar) |
|
| 63 | + * @since 6.0 |
|
| 64 | + * @Parameters: |
|
| 65 | + * - Section Data - the array of data associated with the custom field you've set up |
|
| 66 | + */ |
|
| 67 | 67 | public static function is_custom_section_two_column( $custom_section_data ) { |
| 68 | 68 | // print_r( $custom_section_data ); |
| 69 | 69 | $value = ( isset( $custom_section_data['sidebar_title'] ) && isset( $custom_section_data['sidebar_fields'] ) && !empty( $custom_section_data['sidebar_fields'] ) ) ? true : false; |
@@ -302,9 +302,9 @@ |
||
| 302 | 302 | ?></ul><?php |
| 303 | 303 | } |
| 304 | 304 | /** |
| 305 | - * Custom action hook for our add-ons to hook into |
|
| 306 | - * @since 6.0.3.8 |
|
| 307 | - */ |
|
| 305 | + * Custom action hook for our add-ons to hook into |
|
| 306 | + * @since 6.0.3.8 |
|
| 307 | + */ |
|
| 308 | 308 | do_action( 'yikes-mailchimp-list-form-fields-metabox' ); |
| 309 | 309 | ?> |
| 310 | 310 | |
@@ -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 |
@@ -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() ); |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | $precheck = isset( $checkbox_options[ $this->type ]['precheck'] ) && 'true' === $checkbox_options[ $this->type ]['precheck'] ? '1' : '0'; |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * Filter where the checkbox goes. |
|
| 76 | - * |
|
| 77 | - * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ |
|
| 78 | - * |
|
| 79 | - * @param string | Which set of fields the checkbox should go into |
|
| 80 | - */ |
|
| 75 | + * Filter where the checkbox goes. |
|
| 76 | + * |
|
| 77 | + * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ |
|
| 78 | + * |
|
| 79 | + * @param string | Which set of fields the checkbox should go into |
|
| 80 | + */ |
|
| 81 | 81 | $field_placement = apply_filters( 'yikes-mailchimp-wooco-integration-checkbox-placement', 'billing' ); |
| 82 | 82 | |
| 83 | 83 | $yikes_checkbox = array( |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * Filter the checkbox data. |
|
| 93 | - * |
|
| 94 | - * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ |
|
| 95 | - * |
|
| 96 | - * @param array $yikes_checkbox The checkbox's fields. |
|
| 97 | - * @return array $yikes_checkbox The checkbox's fields. |
|
| 98 | - */ |
|
| 92 | + * Filter the checkbox data. |
|
| 93 | + * |
|
| 94 | + * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ |
|
| 95 | + * |
|
| 96 | + * @param array $yikes_checkbox The checkbox's fields. |
|
| 97 | + * @return array $yikes_checkbox The checkbox's fields. |
|
| 98 | + */ |
|
| 99 | 99 | $yikes_checkbox = apply_filters( 'yikes_mailchimp_wooco_integration_checkbox_field', $yikes_checkbox, $checkbox_options[ $this->type ] ); |
| 100 | 100 | |
| 101 | 101 | $fields[ $field_placement ][ 'yikes_mailchimp_checkbox_' . $this->type ] = $yikes_checkbox; |
@@ -181,19 +181,19 @@ |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | - * Update a merge field for a particular list |
|
| 185 | - * |
|
| 186 | - * @author Kevin Utz |
|
| 187 | - * |
|
| 188 | - * @since 6.3.3 |
|
| 189 | - * |
|
| 190 | - * @param string | $list_id | The ID of the Mailchimp list |
|
| 191 | - * @param string | $field_id | The ID of the merge field |
|
| 192 | - * @param array | $field_data | An array of field data constituting the body of our API request |
|
| 193 | - * @param bool | $clear_transient | Flag whether we should delete the transients associated with this list |
|
| 194 | - * |
|
| 195 | - * @return array | WP_Error |
|
| 196 | - */ |
|
| 184 | + * Update a merge field for a particular list |
|
| 185 | + * |
|
| 186 | + * @author Kevin Utz |
|
| 187 | + * |
|
| 188 | + * @since 6.3.3 |
|
| 189 | + * |
|
| 190 | + * @param string | $list_id | The ID of the Mailchimp list |
|
| 191 | + * @param string | $field_id | The ID of the merge field |
|
| 192 | + * @param array | $field_data | An array of field data constituting the body of our API request |
|
| 193 | + * @param bool | $clear_transient | Flag whether we should delete the transients associated with this list |
|
| 194 | + * |
|
| 195 | + * @return array | WP_Error |
|
| 196 | + */ |
|
| 197 | 197 | public function update_merge_field( $list_id, $field_id, $field_data, $clear_transient = true ) { |
| 198 | 198 | $path = "{$this->base_path}/{$list_id}/merge-fields/{$field_id}"; |
| 199 | 199 | $field = $this->patch_to_api( $path, $field_data ); |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | - * If login is required, abort |
|
| 140 | - * @since 6.0.3.8 |
|
| 141 | - */ |
|
| 139 | + * If login is required, abort |
|
| 140 | + * @since 6.0.3.8 |
|
| 141 | + */ |
|
| 142 | 142 | if( $form_login_required ) { |
| 143 | 143 | if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
| 144 | 144 | ob_start(); |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * Check if schedule is set for this form |
|
| 157 | - * @since 6.0.3.8 |
|
| 158 | - */ |
|
| 156 | + * Check if schedule is set for this form |
|
| 157 | + * @since 6.0.3.8 |
|
| 158 | + */ |
|
| 159 | 159 | if( $form_schedule_state ) { |
| 160 | 160 | // store current date |
| 161 | 161 | $current_date = strtotime( current_time( 'm/d/Y g:iA' ) ); |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | - * Check for form inline parameter |
|
| 194 | - */ |
|
| 193 | + * Check for form inline parameter |
|
| 194 | + */ |
|
| 195 | 195 | $form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension |
| 196 | 196 | // recheck from our form options |
| 197 | 197 | if ( ! $form_inline ) { |
@@ -290,21 +290,21 @@ discard block |
||
| 290 | 290 | /**** Set up any filter'able content (that needs to be filtered before the rest of the logic kicks off) ****/ |
| 291 | 291 | |
| 292 | 292 | /** |
| 293 | - * yikes-mailchimp-countries-with-zip |
|
| 294 | - * |
|
| 295 | - * Filter which countries show the zip field |
|
| 296 | - * |
|
| 297 | - * @param array | An array of country codes that the zip field will appear for - default: US, GB, CA |
|
| 298 | - * Note: please return the array with the country code as the KEY! This allows for optimal searching. |
|
| 299 | - * @param int | $form_id |
|
| 300 | - */ |
|
| 293 | + * yikes-mailchimp-countries-with-zip |
|
| 294 | + * |
|
| 295 | + * Filter which countries show the zip field |
|
| 296 | + * |
|
| 297 | + * @param array | An array of country codes that the zip field will appear for - default: US, GB, CA |
|
| 298 | + * Note: please return the array with the country code as the KEY! This allows for optimal searching. |
|
| 299 | + * @param int | $form_id |
|
| 300 | + */ |
|
| 301 | 301 | $countries_with_zip_code_field = apply_filters( 'yikes-mailchimp-countries-with-zip', |
| 302 | 302 | array( 'US' => 'US', 'GB' => 'GB', 'CA' => 'CA', |
| 303 | - 'IE' => 'IE', 'CN' => 'CN', 'IN' => 'IN', |
|
| 304 | - 'AU' => 'AU', 'BR' => 'BR', 'MX' => 'MX', |
|
| 305 | - 'IT' => 'IT', 'NZ' => 'NZ', 'JP' => 'JP', |
|
| 306 | - 'FR' => 'FR', 'GR' => 'GR', 'DE' => 'DE', |
|
| 307 | - 'NL' => 'NL', 'PT' => 'PT', 'ES' => 'ES' |
|
| 303 | + 'IE' => 'IE', 'CN' => 'CN', 'IN' => 'IN', |
|
| 304 | + 'AU' => 'AU', 'BR' => 'BR', 'MX' => 'MX', |
|
| 305 | + 'IT' => 'IT', 'NZ' => 'NZ', 'JP' => 'JP', |
|
| 306 | + 'FR' => 'FR', 'GR' => 'GR', 'DE' => 'DE', |
|
| 307 | + 'NL' => 'NL', 'PT' => 'PT', 'ES' => 'ES' |
|
| 308 | 308 | ), $form_id |
| 309 | 309 | ); |
| 310 | 310 | |
@@ -540,14 +540,14 @@ discard block |
||
| 540 | 540 | $description .= '</p>'; |
| 541 | 541 | |
| 542 | 542 | /** |
| 543 | - * 'yikes-mailchimp-' . $field['merge'] . '-description-html' (e.g. yikes-mailchimp-FNAME-description-html) |
|
| 544 | - * |
|
| 545 | - * Filter the description HTML block |
|
| 546 | - * |
|
| 547 | - * @param string | $description | The full HTML description block |
|
| 548 | - * @param string | $field['description'] | The field's description text |
|
| 549 | - * @param int | $form_id |
|
| 550 | - */ |
|
| 543 | + * 'yikes-mailchimp-' . $field['merge'] . '-description-html' (e.g. yikes-mailchimp-FNAME-description-html) |
|
| 544 | + * |
|
| 545 | + * Filter the description HTML block |
|
| 546 | + * |
|
| 547 | + * @param string | $description | The full HTML description block |
|
| 548 | + * @param string | $field['description'] | The field's description text |
|
| 549 | + * @param int | $form_id |
|
| 550 | + */ |
|
| 551 | 551 | $description = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
| 552 | 552 | } |
| 553 | 553 | |
@@ -675,13 +675,13 @@ discard block |
||
| 675 | 675 | $required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' ); |
| 676 | 676 | |
| 677 | 677 | /** |
| 678 | - * Filter to control the default country (the option pre-selected in the country dropdown). |
|
| 679 | - * |
|
| 680 | - * 'yikes-mailchimp-default-country-value' |
|
| 681 | - * |
|
| 682 | - * @param string | $country_slug | The slug of the desired default country. Default: 'US' |
|
| 683 | - * @param int | $form_id | ID of the form |
|
| 684 | - */ |
|
| 678 | + * Filter to control the default country (the option pre-selected in the country dropdown). |
|
| 679 | + * |
|
| 680 | + * 'yikes-mailchimp-default-country-value' |
|
| 681 | + * |
|
| 682 | + * @param string | $country_slug | The slug of the desired default country. Default: 'US' |
|
| 683 | + * @param int | $form_id | ID of the form |
|
| 684 | + */ |
|
| 685 | 685 | $default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US', $form_id ); |
| 686 | 686 | |
| 687 | 687 | // <!-- Description Above --> |
@@ -758,15 +758,15 @@ discard block |
||
| 758 | 758 | <?php |
| 759 | 759 | $state_and_province_list = file_get_contents( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-and-province-dropdown.php' ); |
| 760 | 760 | /** |
| 761 | - * 'yikes-mailchimp-state-province-list' |
|
| 762 | - * |
|
| 763 | - * Filter the HTML options for the states dropdown |
|
| 764 | - * |
|
| 765 | - * @param string | $state_and_province_list | HTML string of state/province options |
|
| 766 | - * @param int | $form_id | The form ID |
|
| 767 | - * |
|
| 768 | - * @return string | $state_and_province_list | Filtered HTML string of state/province options |
|
| 769 | - */ |
|
| 761 | + * 'yikes-mailchimp-state-province-list' |
|
| 762 | + * |
|
| 763 | + * Filter the HTML options for the states dropdown |
|
| 764 | + * |
|
| 765 | + * @param string | $state_and_province_list | HTML string of state/province options |
|
| 766 | + * @param int | $form_id | The form ID |
|
| 767 | + * |
|
| 768 | + * @return string | $state_and_province_list | Filtered HTML string of state/province options |
|
| 769 | + */ |
|
| 770 | 770 | echo apply_filters( 'yikes-mailchimp-state-province-list', $state_and_province_list, $form_id ); |
| 771 | 771 | |
| 772 | 772 | ?> |
@@ -799,17 +799,17 @@ discard block |
||
| 799 | 799 | } else { |
| 800 | 800 | |
| 801 | 801 | /** |
| 802 | - * A filter to set the default zip code value. |
|
| 803 | - * |
|
| 804 | - * U.S. users may want to default their subscribers. |
|
| 805 | - * However, this filter is more for non-U.S. users, where the zip field is hidden. |
|
| 806 | - * Mailchimp requires a zip code (for all submissions/countries), so this filter allows users users to set a default value. |
|
| 807 | - * |
|
| 808 | - * 'yikes-mailchimp-default-zip-code' |
|
| 809 | - * |
|
| 810 | - * @param string | $zip | A value to pre-populate the zip code with. |
|
| 811 | - * @param int | $form_id | ID of the form |
|
| 812 | - */ |
|
| 802 | + * A filter to set the default zip code value. |
|
| 803 | + * |
|
| 804 | + * U.S. users may want to default their subscribers. |
|
| 805 | + * However, this filter is more for non-U.S. users, where the zip field is hidden. |
|
| 806 | + * Mailchimp requires a zip code (for all submissions/countries), so this filter allows users users to set a default value. |
|
| 807 | + * |
|
| 808 | + * 'yikes-mailchimp-default-zip-code' |
|
| 809 | + * |
|
| 810 | + * @param string | $zip | A value to pre-populate the zip code with. |
|
| 811 | + * @param int | $form_id | ID of the form |
|
| 812 | + */ |
|
| 813 | 813 | $zip_value = apply_filters( 'yikes-mailchimp-default-zip-code', '', $form_id ); |
| 814 | 814 | } |
| 815 | 815 | ?> |
@@ -1046,14 +1046,14 @@ discard block |
||
| 1046 | 1046 | $description .= '</p>'; |
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | - * 'yikes-mailchimp-' . $field['group_id'] . '-description-html' (e.g. yikes-mailchimp-0ab8f8c84b-description-html) |
|
| 1050 | - * |
|
| 1051 | - * Filter the description HTML block |
|
| 1052 | - * |
|
| 1053 | - * @param string | $description | The full HTML description block |
|
| 1054 | - * @param string | $field['description'] | The field's description text |
|
| 1055 | - * @param int | $form_id |
|
| 1056 | - */ |
|
| 1049 | + * 'yikes-mailchimp-' . $field['group_id'] . '-description-html' (e.g. yikes-mailchimp-0ab8f8c84b-description-html) |
|
| 1050 | + * |
|
| 1051 | + * Filter the description HTML block |
|
| 1052 | + * |
|
| 1053 | + * @param string | $description | The full HTML description block |
|
| 1054 | + * @param string | $field['description'] | The field's description text |
|
| 1055 | + * @param int | $form_id |
|
| 1056 | + */ |
|
| 1057 | 1057 | $description = apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id ); |
| 1058 | 1058 | } |
| 1059 | 1059 | |
@@ -29,25 +29,25 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public static function from_site_key() { |
| 31 | 31 | $message = sprintf( |
| 32 | - __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>' |
|
| 32 | + __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>' |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | return new static( $message ); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Create a new instance of the exception for a field class name that is |
|
| 40 | - * not recognized. |
|
| 41 | - * |
|
| 42 | - * @since %VERSION% |
|
| 43 | - * |
|
| 44 | - * @param string $field Class name of the service that was not recognized. |
|
| 45 | - * |
|
| 46 | - * @return static |
|
| 47 | - */ |
|
| 38 | + /** |
|
| 39 | + * Create a new instance of the exception for a field class name that is |
|
| 40 | + * not recognized. |
|
| 41 | + * |
|
| 42 | + * @since %VERSION% |
|
| 43 | + * |
|
| 44 | + * @param string $field Class name of the service that was not recognized. |
|
| 45 | + * |
|
| 46 | + * @return static |
|
| 47 | + */ |
|
| 48 | 48 | public static function from_secret_key() { |
| 49 | 49 | $message = sprintf( |
| 50 | - __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>' |
|
| 50 | + __( 'Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!' , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>' |
|
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | 53 | return new static( $message ); |
@@ -23,42 +23,42 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | final class Recaptcha implements Service, AssetsAware { |
| 25 | 25 | |
| 26 | - use AssetsAwareness; |
|
| 26 | + use AssetsAwareness; |
|
| 27 | 27 | |
| 28 | - const VIEW_URI = 'views/recaptcha-box'; |
|
| 29 | - const JS_HANDLE = 'google-recaptcha-js'; |
|
| 30 | - const JS_URI = 'https://www.google.com/recaptcha/api.js'; |
|
| 31 | - const JS_DEPENDENCIES = [ 'jquery', 'form-submission-helpers' ]; |
|
| 32 | - const JS_VERSION = '1.0.0'; |
|
| 28 | + const VIEW_URI = 'views/recaptcha-box'; |
|
| 29 | + const JS_HANDLE = 'google-recaptcha-js'; |
|
| 30 | + const JS_URI = 'https://www.google.com/recaptcha/api.js'; |
|
| 31 | + const JS_DEPENDENCIES = [ 'jquery', 'form-submission-helpers' ]; |
|
| 32 | + const JS_VERSION = '1.0.0'; |
|
| 33 | 33 | |
| 34 | - public function register() { |
|
| 35 | - $this->register_assets(); |
|
| 34 | + public function register() { |
|
| 35 | + $this->register_assets(); |
|
| 36 | 36 | |
| 37 | - add_action( 'easy_forms_do_recaptcha_box', function( $view ) { |
|
| 38 | - $this->enqueue_assets(); |
|
| 39 | - echo $view->render_partial( static::VIEW_URI ); // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 40 | - } ); |
|
| 41 | - } |
|
| 37 | + add_action( 'easy_forms_do_recaptcha_box', function( $view ) { |
|
| 38 | + $this->enqueue_assets(); |
|
| 39 | + echo $view->render_partial( static::VIEW_URI ); // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 40 | + } ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Get the context to pass onto the view. |
|
| 45 | - * |
|
| 46 | - * Override to provide data to the view. |
|
| 47 | - * |
|
| 48 | - * @since %VERSION% |
|
| 49 | - * |
|
| 50 | - * @return array Context to pass onto view. |
|
| 51 | - */ |
|
| 43 | + /** |
|
| 44 | + * Get the context to pass onto the view. |
|
| 45 | + * |
|
| 46 | + * Override to provide data to the view. |
|
| 47 | + * |
|
| 48 | + * @since %VERSION% |
|
| 49 | + * |
|
| 50 | + * @return array Context to pass onto view. |
|
| 51 | + */ |
|
| 52 | 52 | protected function get_context() { |
| 53 | 53 | return $this->recaptcha['recaptcha_options']; |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - private function get_script_params() { |
|
| 57 | - $recaptcha_options = ( new RecaptchaModel() )->setup(); |
|
| 58 | - return $recaptcha_options['script_params']; |
|
| 59 | - } |
|
| 56 | + private function get_script_params() { |
|
| 57 | + $recaptcha_options = ( new RecaptchaModel() )->setup(); |
|
| 58 | + return $recaptcha_options['script_params']; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function __get( $name ) { |
|
| 61 | + public function __get( $name ) { |
|
| 62 | 62 | switch ( $name ) { |
| 63 | 63 | case 'script_params': |
| 64 | 64 | return $this->get_script_params(); |
@@ -66,23 +66,23 @@ discard block |
||
| 66 | 66 | default: |
| 67 | 67 | return null; |
| 68 | 68 | } |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Load asset objects for use. |
|
| 73 | - * |
|
| 74 | - * @since %SINCE% |
|
| 75 | - */ |
|
| 71 | + /** |
|
| 72 | + * Load asset objects for use. |
|
| 73 | + * |
|
| 74 | + * @since %SINCE% |
|
| 75 | + */ |
|
| 76 | 76 | protected function load_assets() { |
| 77 | 77 | $this->assets= [ |
| 78 | 78 | new ScriptAsset( |
| 79 | - self::JS_HANDLE, |
|
| 80 | - self::JS_URI . $this->script_params, |
|
| 81 | - self::JS_DEPENDENCIES, |
|
| 82 | - self::JS_VERSION, |
|
| 83 | - ScriptAsset::ENQUEUE_HEADER, |
|
| 84 | - true |
|
| 85 | - ), |
|
| 79 | + self::JS_HANDLE, |
|
| 80 | + self::JS_URI . $this->script_params, |
|
| 81 | + self::JS_DEPENDENCIES, |
|
| 82 | + self::JS_VERSION, |
|
| 83 | + ScriptAsset::ENQUEUE_HEADER, |
|
| 84 | + true |
|
| 85 | + ), |
|
| 86 | 86 | ]; |
| 87 | - } |
|
| 87 | + } |
|
| 88 | 88 | } |
| 89 | 89 | \ No newline at end of file |