@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function callbackRegisterSettings( $input ) |
| 19 | 19 | { |
| 20 | - if( !is_array( $input )) { |
|
| 20 | + if( !is_array( $input ) ) { |
|
| 21 | 21 | $input = ['settings' => []]; |
| 22 | 22 | } |
| 23 | 23 | if( key( $input ) == 'settings' ) { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $options = $this->sanitizeSubmissions( $input, $options ); |
| 27 | 27 | $options = $this->sanitizeTranslations( $input, $options ); |
| 28 | 28 | if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) { |
| 29 | - glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' )); |
|
| 29 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
| 30 | 30 | } |
| 31 | 31 | return $options; |
| 32 | 32 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
| 43 | 43 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
| 44 | - ]); |
|
| 44 | + ] ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if( trim( $inputForm['notification_message'] ) == '' ) { |
| 57 | 57 | $options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message']; |
| 58 | 58 | } |
| 59 | - $options['settings']['general']['notifications'] = isset( $inputForm['notifications'] ) |
|
| 59 | + $options['settings']['general']['notifications'] = isset($inputForm['notifications']) |
|
| 60 | 60 | ? $inputForm['notifications'] |
| 61 | 61 | : []; |
| 62 | 62 | return $options; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | protected function sanitizeSubmissions( array $input, array $options ) |
| 69 | 69 | { |
| 70 | 70 | $inputForm = $input['settings']['submissions']; |
| 71 | - $options['settings']['submissions']['required'] = isset( $inputForm['required'] ) |
|
| 71 | + $options['settings']['submissions']['required'] = isset($inputForm['required']) |
|
| 72 | 72 | ? $inputForm['required'] |
| 73 | 73 | : []; |
| 74 | 74 | return $options; |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | protected function sanitizeTranslations( array $input, array $options ) |
| 81 | 81 | { |
| 82 | - if( isset( $input['settings']['strings'] )) { |
|
| 83 | - $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] )); |
|
| 82 | + if( isset($input['settings']['strings']) ) { |
|
| 83 | + $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) ); |
|
| 84 | 84 | $allowedTags = ['a' => ['class' => [], 'href' => [], 'target' => []]]; |
| 85 | - array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) { |
|
| 86 | - if( isset( $string['s2'] )) { |
|
| 85 | + array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) { |
|
| 86 | + if( isset($string['s2']) ) { |
|
| 87 | 87 | $string['s2'] = wp_kses( $string['s2'], $allowedTags ); |
| 88 | 88 | } |
| 89 | - if( isset( $string['p2'] )) { |
|
| 89 | + if( isset($string['p2']) ) { |
|
| 90 | 90 | $string['p2'] = wp_kses( $string['p2'], $allowedTags ); |
| 91 | 91 | } |
| 92 | 92 | }); |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | protected function isPolylangActiveAndSupported() |
| 101 | 101 | { |
| 102 | 102 | if( !glsr( Polylang::class )->isActive() ) { |
| 103 | - glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' )); |
|
| 103 | + glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) ); |
|
| 104 | 104 | return false; |
| 105 | 105 | } |
| 106 | 106 | else if( !glsr( Polylang::class )->isSupported() ) { |
| 107 | - glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' )); |
|
| 107 | + glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) ); |
|
| 108 | 108 | return false; |
| 109 | 109 | } |
| 110 | 110 | return true; |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | 'templates/form/submit-button', |
| 51 | 51 | 'templates/reviews-form', |
| 52 | 52 | ]; |
| 53 | - if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) { |
|
| 53 | + if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) { |
|
| 54 | 54 | return $view; |
| 55 | 55 | } |
| 56 | 56 | $views = $this->generatePossibleViews( $view ); |
| 57 | 57 | foreach( $views as $possibleView ) { |
| 58 | - if( !file_exists( glsr()->file( $possibleView )))continue; |
|
| 58 | + if( !file_exists( glsr()->file( $possibleView ) ) )continue; |
|
| 59 | 59 | return glsr( Helper::class )->removePrefix( 'views/', $possibleView ); |
| 60 | 60 | } |
| 61 | 61 | return $view; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function modifyField( Builder $instance ) |
| 90 | 90 | { |
| 91 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
| 91 | + if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return; |
|
| 92 | 92 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | protected function customize( Builder $instance ) |
| 107 | 107 | { |
| 108 | - $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' )); |
|
| 108 | + $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) ); |
|
| 109 | 109 | $key = $instance->tag.'_'.$args['type']; |
| 110 | - $classes = !isset( $this->fields[$key] ) |
|
| 110 | + $classes = !isset($this->fields[$key]) |
|
| 111 | 111 | ? $this->fields[$instance->tag] |
| 112 | 112 | : $this->fields[$key]; |
| 113 | 113 | $instance->args['class'] = trim( $args['class'].' '.$classes ); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $args = wp_parse_args( $instance->args, [ |
| 142 | 142 | 'is_public' => false, |
| 143 | 143 | 'is_raw' => false, |
| 144 | - ]); |
|
| 144 | + ] ); |
|
| 145 | 145 | if( is_admin() || !$args['is_public'] || $args['is_raw'] ) { |
| 146 | 146 | return false; |
| 147 | 147 | } |
@@ -55,7 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | $views = $this->generatePossibleViews( $view ); |
| 57 | 57 | foreach( $views as $possibleView ) { |
| 58 | - if( !file_exists( glsr()->file( $possibleView )))continue; |
|
| 58 | + if( !file_exists( glsr()->file( $possibleView ))) { |
|
| 59 | + continue; |
|
| 60 | + } |
|
| 59 | 61 | return glsr( Helper::class )->removePrefix( 'views/', $possibleView ); |
| 60 | 62 | } |
| 61 | 63 | return $view; |
@@ -88,7 +90,9 @@ discard block |
||
| 88 | 90 | */ |
| 89 | 91 | public function modifyField( Builder $instance ) |
| 90 | 92 | { |
| 91 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
| 93 | + if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) { |
|
| 94 | + return; |
|
| 95 | + } |
|
| 92 | 96 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
| 93 | 97 | } |
| 94 | 98 | |