@@ -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' ) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $options = $this->sanitizeGeneral( $input, $options ); |
26 | 26 | $options = $this->sanitizeSubmissions( $input, $options ); |
27 | 27 | $options = $this->sanitizeTranslations( $input, $options ); |
28 | - glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' )); |
|
28 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
29 | 29 | return $options; |
30 | 30 | } |
31 | 31 | return $input; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
41 | 41 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
42 | - ]); |
|
42 | + ] ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | if( $inputForm['support']['polylang'] == 'yes' ) { |
52 | 52 | if( !glsr( Polylang::class )->isActive() ) { |
53 | 53 | $options['settings']['general']['support']['polylang'] = 'no'; |
54 | - glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' )); |
|
54 | + glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) ); |
|
55 | 55 | } |
56 | 56 | else if( !glsr( Polylang::class )->isSupported() ) { |
57 | 57 | $options['settings']['general']['support']['polylang'] = 'no'; |
58 | - glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' )); |
|
58 | + glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) ); |
|
59 | 59 | } |
60 | 60 | } |
61 | - if( !isset( $inputForm['notifications'] )) { |
|
61 | + if( !isset($inputForm['notifications']) ) { |
|
62 | 62 | $options['settings']['general']['notifications'] = []; |
63 | 63 | } |
64 | 64 | if( trim( $inputForm['notification_message'] ) == '' ) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected function sanitizeSubmissions( array $input, array $options ) |
74 | 74 | { |
75 | 75 | $inputForm = $input['settings']['submissions']; |
76 | - if( !isset( $inputForm['required'] )) { |
|
76 | + if( !isset($inputForm['required']) ) { |
|
77 | 77 | $options['settings']['submissions']['required'] = []; |
78 | 78 | } |
79 | 79 | return $options; |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function sanitizeTranslations( array $input, array $options ) |
86 | 86 | { |
87 | - if( isset( $input['settings']['strings'] )) { |
|
88 | - $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] )); |
|
87 | + if( isset($input['settings']['strings']) ) { |
|
88 | + $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) ); |
|
89 | 89 | $allowedTags = ['a' => ['class' => [], 'href' => [], 'target' => []]]; |
90 | - array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) { |
|
91 | - if( isset( $string['s2'] )) { |
|
90 | + array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) { |
|
91 | + if( isset($string['s2']) ) { |
|
92 | 92 | $string['s2'] = wp_kses( $string['s2'], $allowedTags ); |
93 | 93 | } |
94 | - if( isset( $string['p2'] )) { |
|
94 | + if( isset($string['p2']) ) { |
|
95 | 95 | $string['p2'] = wp_kses( $string['p2'], $allowedTags ); |
96 | 96 | } |
97 | 97 | }); |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
18 | 18 | if( !$review ) { |
19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
21 | 21 | return; |
22 | 22 | } |
23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | if( $command->ajax_request )return; |
26 | - wp_safe_redirect( $this->getReferer( $command )); |
|
26 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function getReferer( Command $command ) |
34 | 34 | { |
35 | - $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
36 | - if( empty( $referer )) { |
|
35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
36 | + if( empty($referer) ) { |
|
37 | 37 | $referer = $command->referer; |
38 | 38 | } |
39 | - if( empty( $referer )) { |
|
39 | + if( empty($referer) ) { |
|
40 | 40 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
41 | 41 | $referer = home_url(); |
42 | 42 | } |
@@ -22,7 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | - if( $command->ajax_request )return; |
|
25 | + if( $command->ajax_request ) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | wp_safe_redirect( $this->getReferer( $command )); |
27 | 29 | exit; |
28 | 30 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $fields = []; |
30 | 30 | foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) { |
31 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
31 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
32 | 32 | } |
33 | 33 | return $fields; |
34 | 34 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | // Database/ReviewManager.php |
6 | 6 | add_action( 'site-reviews/review/created', function( $review ) { |
7 | - if( has_action( 'site-reviews/local/review/create' )) { |
|
7 | + if( has_action( 'site-reviews/local/review/create' ) ) { |
|
8 | 8 | glsr()->deprecated[] = 'The "site-reviews/local/review/create" hook has been deprecated. Please use the "site-reviews/create/review" hook instead.'; |
9 | 9 | do_action( 'site-reviews/local/review/create', (array)get_post( $review->ID ), (array)$review, $review->ID ); |
10 | 10 | } |
@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | |
13 | 13 | // Handlers/CreateReview.php |
14 | 14 | add_action( 'site-reviews/review/submitted', function( $review ) { |
15 | - if( has_action( 'site-reviews/local/review/submitted' )) { |
|
15 | + if( has_action( 'site-reviews/local/review/submitted' ) ) { |
|
16 | 16 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted" hook has been deprecated. Please use the "site-reviews/review/submitted" hook instead.'; |
17 | 17 | do_action( 'site-reviews/local/review/submitted', null, $review ); |
18 | 18 | } |
19 | - if( has_filter( 'site-reviews/local/review/submitted/message' )) { |
|
19 | + if( has_filter( 'site-reviews/local/review/submitted/message' ) ) { |
|
20 | 20 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted/message" hook has been deprecated.'; |
21 | 21 | } |
22 | 22 | }); |
23 | 23 | |
24 | 24 | // Database/ReviewManager.php |
25 | 25 | add_filter( 'site-reviews/create/review-values', function( $values, $command ) { |
26 | - if( has_filter( 'site-reviews/local/review' )) { |
|
26 | + if( has_filter( 'site-reviews/local/review' ) ) { |
|
27 | 27 | glsr()->deprecated[] = 'The "site-reviews/local/review" hook has been deprecated. Please use the "site-reviews/create/review-values" hook instead.'; |
28 | 28 | return apply_filters( 'site-reviews/local/review', $values, $command ); |
29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // Handlers/EnqueuePublicAssets.php |
34 | 34 | add_filter( 'site-reviews/enqueue/public/localize', function( $variables ) { |
35 | - if( has_filter( 'site-reviews/enqueue/localize' )) { |
|
35 | + if( has_filter( 'site-reviews/enqueue/localize' ) ) { |
|
36 | 36 | glsr()->deprecated[] = 'The "site-reviews/enqueue/localize" hook has been deprecated. Please use the "site-reviews/enqueue/public/localize" hook instead.'; |
37 | 37 | return apply_filters( 'site-reviews/enqueue/localize', $variables ); |
38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // Modules/Rating.php |
43 | 43 | add_filter( 'site-reviews/rating/average', function( $average ) { |
44 | - if( has_filter( 'site-reviews/average/rating' )) { |
|
44 | + if( has_filter( 'site-reviews/average/rating' ) ) { |
|
45 | 45 | glsr()->deprecated[] = 'The "site-reviews/average/rating" hook has been deprecated. Please use the "site-reviews/rating/average" hook instead.'; |
46 | 46 | } |
47 | 47 | return $average; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // Modules/Rating.php |
51 | 51 | add_filter( 'site-reviews/rating/ranking', function( $ranking ) { |
52 | - if( has_filter( 'site-reviews/bayesian/ranking' )) { |
|
52 | + if( has_filter( 'site-reviews/bayesian/ranking' ) ) { |
|
53 | 53 | glsr()->deprecated[] = 'The "site-reviews/bayesian/ranking" hook has been deprecated. Please use the "site-reviews/rating/ranking" hook instead.'; |
54 | 54 | } |
55 | 55 | return $ranking; |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | |
58 | 58 | // Modules/Html/Partials/SiteReviews.php |
59 | 59 | add_filter( 'site-reviews/review/build/after', function( $renderedFields ) { |
60 | - if( has_filter( 'site-reviews/rendered/field' )) { |
|
60 | + if( has_filter( 'site-reviews/rendered/field' ) ) { |
|
61 | 61 | glsr()->deprecated[] = 'The "site-reviews/rendered/field" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
62 | 62 | } |
63 | - if( has_filter( 'site-reviews/reviews/review/text' )) { |
|
63 | + if( has_filter( 'site-reviews/reviews/review/text' ) ) { |
|
64 | 64 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/text" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
65 | 65 | } |
66 | - if( has_filter( 'site-reviews/reviews/review/title' )) { |
|
66 | + if( has_filter( 'site-reviews/reviews/review/title' ) ) { |
|
67 | 67 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/title" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
68 | 68 | } |
69 | 69 | return $renderedFields; |
@@ -71,26 +71,26 @@ discard block |
||
71 | 71 | |
72 | 72 | // Modules/Html/Partials/SiteReviews.php |
73 | 73 | add_filter( 'site-reviews/review/build/before', function( $review ) { |
74 | - if( has_filter( 'site-reviews/rendered/review' )) { |
|
74 | + if( has_filter( 'site-reviews/rendered/review' ) ) { |
|
75 | 75 | glsr()->deprecated[] = 'The "site-reviews/rendered/review" hook has been deprecated. Please either use a custom "review.php" template (refer to the documentation), or use the "site-reviews/review/build/after" hook instead.'; |
76 | 76 | } |
77 | - if( has_filter( 'site-reviews/rendered/review/meta/order' )) { |
|
77 | + if( has_filter( 'site-reviews/rendered/review/meta/order' ) ) { |
|
78 | 78 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/meta/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
79 | 79 | } |
80 | - if( has_filter( 'site-reviews/rendered/review/order' )) { |
|
80 | + if( has_filter( 'site-reviews/rendered/review/order' ) ) { |
|
81 | 81 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
82 | 82 | } |
83 | - if( has_filter( 'site-reviews/rendered/review-form/login-register' )) { |
|
83 | + if( has_filter( 'site-reviews/rendered/review-form/login-register' ) ) { |
|
84 | 84 | glsr()->deprecated[] = 'The "site-reviews/rendered/review-form/login-register" hook has been deprecated. Please use a custom "login-register.php" template instead (refer to the documentation).'; |
85 | 85 | } |
86 | - if( has_filter( 'site-reviews/reviews/navigation_links' )) { |
|
86 | + if( has_filter( 'site-reviews/reviews/navigation_links' ) ) { |
|
87 | 87 | glsr()->deprecated[] = 'The "site-reviews/reviews/navigation_links" hook has been deprecated. Please use a custom "pagination.php" template instead (refer to the documentation).'; |
88 | 88 | } |
89 | 89 | return $review; |
90 | 90 | }); |
91 | 91 | |
92 | 92 | add_action( 'wp_footer', function() { |
93 | - $notices = array_keys( array_flip( glsr()->deprecated )); |
|
93 | + $notices = array_keys( array_flip( glsr()->deprecated ) ); |
|
94 | 94 | foreach( $notices as $notice ) { |
95 | 95 | glsr_log()->notice( $notice ); |
96 | 96 | } |