@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function enqueueAssets() |
| 28 | 28 | { |
| 29 | - if( apply_filters( 'site-reviews/assets/css', true )) { |
|
| 29 | + if( apply_filters( 'site-reviews/assets/css', true ) ) { |
|
| 30 | 30 | wp_enqueue_style( |
| 31 | 31 | Application::ID, |
| 32 | 32 | $this->getStylesheet(), |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | glsr()->version |
| 35 | 35 | ); |
| 36 | 36 | } |
| 37 | - if( apply_filters( 'site-reviews/assets/js', true )) { |
|
| 37 | + if( apply_filters( 'site-reviews/assets/js', true ) ) { |
|
| 38 | 38 | $dependencies = apply_filters( 'site-reviews/assets/polyfill', true ) |
| 39 | 39 | ? [Application::ID.'/polyfill'] |
| 40 | 40 | : []; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function enqueuePolyfillService() |
| 56 | 56 | { |
| 57 | - if( !apply_filters( 'site-reviews/assets/polyfill', true ))return; |
|
| 57 | + if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return; |
|
| 58 | 58 | wp_enqueue_script( |
| 59 | 59 | Application::ID.'/polyfill', |
| 60 | 60 | 'https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.closest,Element.prototype.dataset,Event&flags=gated', |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
| 72 | 72 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
| 73 | - wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
|
| 73 | + wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [ |
|
| 74 | 74 | 'hl' => $language, |
| 75 | 75 | 'onload' => 'glsr_render_recaptcha', |
| 76 | 76 | 'render' => 'explicit', |
| 77 | - ], 'https://www.google.com/recaptcha/api.js' )); |
|
| 78 | - $inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' )); |
|
| 77 | + ], 'https://www.google.com/recaptcha/api.js' ) ); |
|
| 78 | + $inlineScript = file_get_contents( glsr()->path( 'assets/scripts/recaptcha.js' ) ); |
|
| 79 | 79 | wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' ); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | public function inlineStyles() |
| 86 | 86 | { |
| 87 | 87 | $inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' ); |
| 88 | - if( !apply_filters( 'site-reviews/assets/css', true ))return; |
|
| 89 | - if( !file_exists( $inlineStylesheetPath )) { |
|
| 88 | + if( !apply_filters( 'site-reviews/assets/css', true ) )return; |
|
| 89 | + if( !file_exists( $inlineStylesheetPath ) ) { |
|
| 90 | 90 | glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath ); |
| 91 | 91 | return; |
| 92 | 92 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | protected function getFixedSelectorsForPagination() |
| 122 | 122 | { |
| 123 | - $selectors = ['#wpadminbar','.site-navigation-fixed']; |
|
| 123 | + $selectors = ['#wpadminbar', '.site-navigation-fixed']; |
|
| 124 | 124 | return apply_filters( 'site-reviews/localize/pagination/selectors', $selectors ); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | protected function getStylesheet() |
| 131 | 131 | { |
| 132 | 132 | $currentStyle = glsr( Style::class )->style; |
| 133 | - return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' )) |
|
| 133 | + return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) ) |
|
| 134 | 134 | ? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' ) |
| 135 | 135 | : glsr()->url( 'assets/styles/'.Application::ID.'.css' ); |
| 136 | 136 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | 'input_error_class' => 'glsr-is-invalid', |
| 149 | 149 | 'input_success_class' => 'glsr-is-valid', |
| 150 | 150 | ]; |
| 151 | - $config = array_merge( $defaults, array_filter( glsr( Style::class )->validation )); |
|
| 151 | + $config = array_merge( $defaults, array_filter( glsr( Style::class )->validation ) ); |
|
| 152 | 152 | glsr_log( $config ); |
| 153 | 153 | return apply_filters( 'site-reviews/localize/validation/config', $config ); |
| 154 | 154 | } |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | 'templates/form/submit-button', |
| 43 | 43 | 'templates/reviews-form', |
| 44 | 44 | ]; |
| 45 | - if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) { |
|
| 45 | + if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) { |
|
| 46 | 46 | return $view; |
| 47 | 47 | } |
| 48 | 48 | $views = $this->generatePossibleViews( $view ); |
| 49 | 49 | foreach( $views as $possibleView ) { |
| 50 | - if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' )))continue; |
|
| 50 | + if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' ) ) )continue; |
|
| 51 | 51 | return $possibleView; |
| 52 | 52 | } |
| 53 | 53 | return $view; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | glsr()->config( 'styles/'.$this->style ) |
| 76 | 76 | ); |
| 77 | 77 | foreach( array_keys( $config ) as $key ) { |
| 78 | - $this->$key = wp_parse_args( $config[$key], array_fill_keys( $keys[$key], '' )); |
|
| 78 | + $this->$key = wp_parse_args( $config[$key], array_fill_keys( $keys[$key], '' ) ); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function modifyField( Builder $instance ) |
| 86 | 86 | { |
| 87 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
| 87 | + if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return; |
|
| 88 | 88 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | protected function customize( Builder $instance ) |
| 95 | 95 | { |
| 96 | - $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' )); |
|
| 96 | + $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) ); |
|
| 97 | 97 | $key = $instance->tag.'_'.$args['type']; |
| 98 | - $classes = !isset( $this->fields[$key] ) |
|
| 98 | + $classes = !isset($this->fields[$key]) |
|
| 99 | 99 | ? $this->fields[$instance->tag] |
| 100 | 100 | : $this->fields[$key]; |
| 101 | 101 | $instance->args['class'] = trim( $args['class'].' '.$classes ); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $args = wp_parse_args( $instance->args, [ |
| 130 | 130 | 'is_public' => false, |
| 131 | 131 | 'is_raw' => false, |
| 132 | - ]); |
|
| 132 | + ] ); |
|
| 133 | 133 | if( is_admin() || !$args['is_public'] || $args['is_raw'] ) { |
| 134 | 134 | return false; |
| 135 | 135 | } |
@@ -47,7 +47,9 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | $views = $this->generatePossibleViews( $view ); |
| 49 | 49 | foreach( $views as $possibleView ) { |
| 50 | - if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' )))continue; |
|
| 50 | + if( !file_exists( glsr()->path( 'views/'.$possibleView.'.php' ))) { |
|
| 51 | + continue; |
|
| 52 | + } |
|
| 51 | 53 | return $possibleView; |
| 52 | 54 | } |
| 53 | 55 | return $view; |
@@ -84,7 +86,9 @@ discard block |
||
| 84 | 86 | */ |
| 85 | 87 | public function modifyField( Builder $instance ) |
| 86 | 88 | { |
| 87 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
| 89 | + if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) { |
|
| 90 | + return; |
|
| 91 | + } |
|
| 88 | 92 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
| 89 | 93 | } |
| 90 | 94 | |