@@ -55,7 +55,7 @@ |
||
| 55 | 55 | * @return string Rendered HTML. |
| 56 | 56 | * @throws FailedToLoadView If the View URI could not be loaded. |
| 57 | 57 | */ |
| 58 | - public function render( array $context = [] ) { |
|
| 58 | + public function render( array $context = [ ] ) { |
|
| 59 | 59 | return wp_kses_post( $this->view->render( $context ) ); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * @return string Rendered HTML. |
| 34 | 34 | * @throws FailedToLoadView If the View URI could not be loaded. |
| 35 | 35 | */ |
| 36 | - public function render( array $context = [] ); |
|
| 36 | + public function render( array $context = [ ] ); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Render a partial view. |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function register() { |
| 41 | 41 | $this->register_assets(); |
| 42 | 42 | |
| 43 | - add_action( 'init', function () { |
|
| 43 | + add_action( 'init', function() { |
|
| 44 | 44 | add_shortcode( $this->get_tag(), [ $this, 'process_shortcode' ] ); |
| 45 | 45 | } ); |
| 46 | 46 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return string Rendered HTML. |
| 72 | 72 | */ |
| 73 | - public function render( array $context = [] ) { |
|
| 73 | + public function render( array $context = [ ] ) { |
|
| 74 | 74 | try { |
| 75 | 75 | $this->enqueue_assets(); |
| 76 | 76 | $view = new PostEscapedView( new TemplatedView( $this->get_view_uri() ) ); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return array Context to pass onto view. |
| 111 | 111 | */ |
| 112 | 112 | protected function get_context( array $atts ) { |
| 113 | - return []; |
|
| 113 | + return [ ]; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @var array |
| 96 | 96 | */ |
| 97 | - private $allowed_tags = []; |
|
| 97 | + private $allowed_tags = [ ]; |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Instantiate a FormEscapedView object. |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @return string Rendered HTML. |
| 142 | 142 | * @throws FailedToLoadView If the View URI could not be loaded. |
| 143 | 143 | */ |
| 144 | - public function render( array $context = [] ) { |
|
| 144 | + public function render( array $context = [ ] ) { |
|
| 145 | 145 | return wp_kses( $this->view->render( $context ), $this->allowed_tags ); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @return bool Whether the form was successfully updated. |
| 49 | 49 | */ |
| 50 | 50 | public function update_form( $form_id, $data ) { |
| 51 | - $data['id'] = $form_id; |
|
| 51 | + $data[ 'id' ] = $form_id; |
|
| 52 | 52 | $all_forms = $this->get_all_forms(); |
| 53 | 53 | |
| 54 | 54 | if ( ! isset( $all_forms[ $form_id ] ) ) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $all_ids = $this->get_form_ids(); |
| 80 | 80 | $last_id = end( $all_ids ); |
| 81 | 81 | $new_id = false === $last_id ? 1 : $last_id + 1; |
| 82 | - $form_data['id'] = $new_id; |
|
| 82 | + $form_data[ 'id' ] = $new_id; |
|
| 83 | 83 | |
| 84 | 84 | // Ensure our data is consistently sorted |
| 85 | 85 | ksort( $form_data ); |
@@ -29,7 +29,7 @@ discard block |
||
| 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 ); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 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 ); |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | * @return array Context to pass onto view. |
| 51 | 51 | */ |
| 52 | 52 | protected function get_context() { |
| 53 | - return $this->recaptcha['recaptcha_options']; |
|
| 53 | + return $this->recaptcha[ 'recaptcha_options' ]; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | private function get_script_params() { |
| 57 | 57 | $recaptcha_options = ( new RecaptchaModel() )->setup(); |
| 58 | - return $recaptcha_options['script_params']; |
|
| 58 | + return $recaptcha_options[ 'script_params' ]; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function __get( $name ) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @since %SINCE% |
| 75 | 75 | */ |
| 76 | 76 | protected function load_assets() { |
| 77 | - $this->assets= [ |
|
| 77 | + $this->assets = [ |
|
| 78 | 78 | new ScriptAsset( |
| 79 | 79 | self::JS_HANDLE, |
| 80 | 80 | self::JS_URI . $this->script_params, |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function register_log() :void { |
| 16 | 16 | if ( ! get_option( self::LOG_NAME ) ) { |
| 17 | - add_option( self::LOG_NAME, [] ); |
|
| 17 | + add_option( self::LOG_NAME, [ ] ); |
|
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function get_log() { |
| 22 | - return get_option( self::LOG_NAME, [] ); |
|
| 22 | + return get_option( self::LOG_NAME, [ ] ); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function pretty_log() { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | const SITE_KEY = 'yikes-mc-recaptcha-site-key'; |
| 15 | 15 | const SECRET_KEY = 'yikes-mc-recaptcha-secret-key'; |
| 16 | 16 | |
| 17 | - public function setup( $recaptcha_options = [] ) { |
|
| 17 | + public function setup( $recaptcha_options = [ ] ) { |
|
| 18 | 18 | if ( ! $this->has_recaptcha() ) { |
| 19 | 19 | return false; |
| 20 | 20 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | private function get_site_key() { |
| 32 | - $site_key = get_option( 'yikes-mc-recaptcha-secret-key' , '' ); |
|
| 32 | + $site_key = get_option( 'yikes-mc-recaptcha-secret-key', '' ); |
|
| 33 | 33 | if ( ! $site_key ) { |
| 34 | 34 | throw InvalidRecaptcha::from_site_key(); |
| 35 | 35 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | private function get_secret_key() { |
| 40 | - $secret_key = get_option( 'yikes-mc-recaptcha-secret-key' , '' ); |
|
| 40 | + $secret_key = get_option( 'yikes-mc-recaptcha-secret-key', '' ); |
|
| 41 | 41 | if ( ! $secret_key ) { |
| 42 | 42 | throw InvalidRecaptcha::from_secret_key(); |
| 43 | 43 | } |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | $locale_split = explode( '_', $locale ); |
| 51 | 51 | |
| 52 | 52 | // Setup reCAPTCHA parameters. |
| 53 | - $lang = ! empty( $locale_split ) ? $locale_split[0] : $locale; |
|
| 54 | - $lang = ! empty( $defaults['recaptcha_lang'] ) ? $defaults['recaptcha_lang'] : $lang; |
|
| 55 | - $type = ! empty( $defaults['recaptcha_type'] ) ? strtolower( $defaults['recaptcha_type'] ) : 'image'; // setup recaptcha type |
|
| 56 | - $theme = ! empty( $defaults['recaptcha_theme'] ) ? strtolower( $defaults['recaptcha_theme'] ) : 'light'; // setup recaptcha theme |
|
| 57 | - $size = ! empty( $defaults['recaptcha_size'] ) ? strtolower( $defaults['recaptcha_size'] ) : 'normal'; // setup recaptcha size |
|
| 58 | - $data_cb = ! empty( $defaults['recaptcha_data_callback'] ) ? $defaults['recaptcha_data_callback'] : false; // setup recaptcha size |
|
| 59 | - $expired_cb = ! empty( $defaults['recaptcha_expired_callback'] ) ? $defaults['recaptcha_expired_callback'] : false; // setup recaptcha size |
|
| 53 | + $lang = ! empty( $locale_split ) ? $locale_split[ 0 ] : $locale; |
|
| 54 | + $lang = ! empty( $defaults[ 'recaptcha_lang' ] ) ? $defaults[ 'recaptcha_lang' ] : $lang; |
|
| 55 | + $type = ! empty( $defaults[ 'recaptcha_type' ] ) ? strtolower( $defaults[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type |
|
| 56 | + $theme = ! empty( $defaults[ 'recaptcha_theme' ] ) ? strtolower( $defaults[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme |
|
| 57 | + $size = ! empty( $defaults[ 'recaptcha_size' ] ) ? strtolower( $defaults[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size |
|
| 58 | + $data_cb = ! empty( $defaults[ 'recaptcha_data_callback' ] ) ? $defaults[ 'recaptcha_data_callback' ] : false; // setup recaptcha size |
|
| 59 | + $expired_cb = ! empty( $defaults[ 'recaptcha_expired_callback' ] ) ? $defaults[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size |
|
| 60 | 60 | |
| 61 | 61 | $script_params = '?hl=' . $lang . '&onload=renderReCaptchaCallback&render=explicit'; |
| 62 | 62 | |