@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function handle( Command $command ) |
14 | 14 | { |
15 | - $postId = wp_update_post([ |
|
15 | + $postId = wp_update_post( [ |
|
16 | 16 | 'ID' => $command->id, |
17 | 17 | 'post_status' => $command->status, |
18 | - ]); |
|
19 | - if( is_wp_error( $postId )) { |
|
18 | + ] ); |
|
19 | + if( is_wp_error( $postId ) ) { |
|
20 | 20 | glsr_log()->error( $postId->get_error_message() ); |
21 | 21 | return []; |
22 | 22 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')', |
38 | 38 | 'class' => 'row-title', |
39 | 39 | 'href' => get_edit_post_link( $postId ), |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | protected function getPostState( $postId ) |
48 | 48 | { |
49 | 49 | ob_start(); |
50 | - _post_states( get_post( $postId )); |
|
50 | + _post_states( get_post( $postId ) ); |
|
51 | 51 | return ob_get_clean(); |
52 | 52 | } |
53 | 53 | } |
@@ -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 | }); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | function glsr( $alias = null ) { |
8 | 8 | $app = \GeminiLabs\SiteReviews\Application::load(); |
9 | - return !empty( $alias ) |
|
9 | + return !empty($alias) |
|
10 | 10 | ? $app->make( $alias ) |
11 | 11 | : $app; |
12 | 12 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @return false|\GeminiLabs\SiteReviews\Review |
16 | 16 | */ |
17 | 17 | function glsr_create_review( array $reviewValues = [] ) { |
18 | - if( empty( $reviewValues )) { |
|
18 | + if( empty($reviewValues) ) { |
|
19 | 19 | return false; |
20 | 20 | } |
21 | 21 | $review = new \GeminiLabs\SiteReviews\Commands\CreateReview( $reviewValues ); |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * @return \WP_Screen|object |
27 | 27 | */ |
28 | 28 | function glsr_current_screen() { |
29 | - if( function_exists( 'get_current_screen' )) { |
|
29 | + if( function_exists( 'get_current_screen' ) ) { |
|
30 | 30 | $screen = get_current_screen(); |
31 | 31 | } |
32 | - return empty( $screen ) |
|
32 | + return empty($screen) |
|
33 | 33 | ? (object)array_fill_keys( ['base', 'id', 'post_type'], null ) |
34 | 34 | : $screen; |
35 | 35 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | */ |
93 | 93 | function glsr_log() { |
94 | 94 | $args = func_get_args(); |
95 | - $context = isset( $args[1] ) |
|
95 | + $context = isset($args[1]) |
|
96 | 96 | ? $args[1] |
97 | 97 | : []; |
98 | 98 | $console = glsr( 'Modules\Console' ); |
99 | - return !empty( $args ) |
|
99 | + return !empty($args) |
|
100 | 100 | ? $console->log( 'debug', $args[0], $context ) |
101 | 101 | : $console; |
102 | 102 | } |
@@ -4,7 +4,8 @@ discard block |
||
4 | 4 | /** |
5 | 5 | * @return mixed |
6 | 6 | */ |
7 | -function glsr( $alias = null ) { |
|
7 | +function glsr( $alias = null ) |
|
8 | +{ |
|
8 | 9 | $app = \GeminiLabs\SiteReviews\Application::load(); |
9 | 10 | return !empty( $alias ) |
10 | 11 | ? $app->make( $alias ) |
@@ -14,7 +15,8 @@ discard block |
||
14 | 15 | /** |
15 | 16 | * @return false|\GeminiLabs\SiteReviews\Review |
16 | 17 | */ |
17 | -function glsr_create_review( array $reviewValues = [] ) { |
|
18 | +function glsr_create_review( array $reviewValues = [] ) |
|
19 | +{ |
|
18 | 20 | if( empty( $reviewValues )) { |
19 | 21 | return false; |
20 | 22 | } |
@@ -25,7 +27,8 @@ discard block |
||
25 | 27 | /** |
26 | 28 | * @return \WP_Screen|object |
27 | 29 | */ |
28 | -function glsr_current_screen() { |
|
30 | +function glsr_current_screen() |
|
31 | +{ |
|
29 | 32 | if( function_exists( 'get_current_screen' )) { |
30 | 33 | $screen = get_current_screen(); |
31 | 34 | } |
@@ -38,7 +41,8 @@ discard block |
||
38 | 41 | * @param mixed ...$vars |
39 | 42 | * @return void |
40 | 43 | */ |
41 | -function glsr_debug( ...$vars ) { |
|
44 | +function glsr_debug( ...$vars ) |
|
45 | +{ |
|
42 | 46 | if( count( $vars ) == 1 ) { |
43 | 47 | $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' ); |
44 | 48 | printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value ); |
@@ -57,14 +61,16 @@ discard block |
||
57 | 61 | * @param mixed $fallback |
58 | 62 | * @return string|array |
59 | 63 | */ |
60 | -function glsr_get_option( $path = '', $fallback = '' ) { |
|
64 | +function glsr_get_option( $path = '', $fallback = '' ) |
|
65 | +{ |
|
61 | 66 | return glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback ); |
62 | 67 | } |
63 | 68 | |
64 | 69 | /** |
65 | 70 | * @return array |
66 | 71 | */ |
67 | -function glsr_get_options() { |
|
72 | +function glsr_get_options() |
|
73 | +{ |
|
68 | 74 | return glsr( 'Database\OptionManager' )->get( 'settings' ); |
69 | 75 | } |
70 | 76 | |
@@ -72,7 +78,8 @@ discard block |
||
72 | 78 | * @param int $post_id |
73 | 79 | * @return void|\GeminiLabs\SiteReviews\Review |
74 | 80 | */ |
75 | -function glsr_get_review( $post_id ) { |
|
81 | +function glsr_get_review( $post_id ) |
|
82 | +{ |
|
76 | 83 | $post = get_post( $post_id ); |
77 | 84 | if( $post instanceof WP_Post ) { |
78 | 85 | return glsr( 'Database\ReviewManager' )->single( $post ); |
@@ -83,14 +90,16 @@ discard block |
||
83 | 90 | * @return array |
84 | 91 | * @todo document change of $reviews->reviews to $reviews->results |
85 | 92 | */ |
86 | -function glsr_get_reviews( array $args = array() ) { |
|
93 | +function glsr_get_reviews( array $args = array() ) |
|
94 | +{ |
|
87 | 95 | return glsr( 'Database\ReviewManager' )->get( $args ); |
88 | 96 | } |
89 | 97 | |
90 | 98 | /** |
91 | 99 | * @return \GeminiLabs\SiteReviews\Modules\Console |
92 | 100 | */ |
93 | -function glsr_log() { |
|
101 | +function glsr_log() |
|
102 | +{ |
|
94 | 103 | $args = func_get_args(); |
95 | 104 | $context = isset( $args[1] ) |
96 | 105 | ? $args[1] |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $className = str_replace( '.php', '', $file ); |
25 | 25 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
26 | 26 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
27 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return; |
|
28 | 28 | glsr( 'Modules\\Upgrader\\'.$className ); |
29 | 29 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
30 | 30 | }); |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function setReviewCounts() |
47 | 47 | { |
48 | - if( !empty( glsr( OptionManager::class )->get( 'last_review_count' )))return; |
|
48 | + if( !empty(glsr( OptionManager::class )->get( 'last_review_count' )) )return; |
|
49 | 49 | add_action( 'admin_init', function() { |
50 | 50 | glsr( AdminController::class )->routerCountReviews( false ); |
51 | - glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' )); |
|
51 | + glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' ) ); |
|
52 | 52 | }); |
53 | 53 | } |
54 | 54 |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | $filenames = []; |
17 | 17 | $iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' ); |
18 | 18 | foreach( $iterator as $fileinfo ) { |
19 | - if( !$fileinfo->isFile() )continue; |
|
19 | + if( !$fileinfo->isFile() ) { |
|
20 | + continue; |
|
21 | + } |
|
20 | 22 | $filenames[] = $fileinfo->getFilename(); |
21 | 23 | } |
22 | 24 | natsort( $filenames ); |
@@ -24,7 +26,9 @@ discard block |
||
24 | 26 | $className = str_replace( '.php', '', $file ); |
25 | 27 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
26 | 28 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
29 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' )) { |
|
30 | + return; |
|
31 | + } |
|
28 | 32 | glsr( 'Modules\\Upgrader\\'.$className ); |
29 | 33 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
30 | 34 | }); |
@@ -45,7 +49,9 @@ discard block |
||
45 | 49 | */ |
46 | 50 | public function setReviewCounts() |
47 | 51 | { |
48 | - if( !empty( glsr( OptionManager::class )->get( 'last_review_count' )))return; |
|
52 | + if( !empty( glsr( OptionManager::class )->get( 'last_review_count' ))) { |
|
53 | + return; |
|
54 | + } |
|
49 | 55 | add_action( 'admin_init', function() { |
50 | 56 | glsr( AdminController::class )->routerCountReviews( false ); |
51 | 57 | glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' )); |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | { |
26 | 26 | sort( $termIds ); |
27 | 27 | sort( $oldTermIds ); |
28 | - if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return; |
|
29 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
28 | + if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ) )return; |
|
29 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
30 | 30 | $ignoredTerms = array_intersect( $oldTermIds, $termIds ); |
31 | - if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) { |
|
31 | + if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms ) ) { |
|
32 | 32 | glsr( CountsManager::class )->decreaseTermCounts( $review ); |
33 | 33 | } |
34 | - if( $review->term_ids = array_diff( $termIds, $ignoredTerms )) { |
|
34 | + if( $review->term_ids = array_diff( $termIds, $ignoredTerms ) ) { |
|
35 | 35 | glsr( CountsManager::class )->increaseTermCounts( $review ); |
36 | 36 | } |
37 | 37 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function onBeforeDelete( $postId ) |
54 | 54 | { |
55 | - if( !$this->isReviewPostId( $postId ))return; |
|
56 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
55 | + if( !$this->isReviewPostId( $postId ) )return; |
|
56 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
57 | 57 | glsr( CountsManager::class )->decrease( $review ); |
58 | 58 | } |
59 | 59 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if( !$this->isReviewPostId( $postId ) |
71 | 71 | || !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] ) |
72 | 72 | )return; |
73 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
73 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
74 | 74 | if( $review->$metaKey == $metaValue )return; |
75 | 75 | $method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' ); |
76 | 76 | call_user_func( [$this, $method], $review, $metaValue ); |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post ) |
119 | 119 | { |
120 | - if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return; |
|
121 | - $review = glsr( ReviewManager::class )->single( get_post( $post->ID )); |
|
120 | + if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ) )return; |
|
121 | + $review = glsr( ReviewManager::class )->single( get_post( $post->ID ) ); |
|
122 | 122 | if( $post->post_status == 'publish' ) { |
123 | 123 | glsr( CountsManager::class )->increase( $review ); |
124 | 124 | } |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | { |
26 | 26 | sort( $termIds ); |
27 | 27 | sort( $oldTermIds ); |
28 | - if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return; |
|
28 | + if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId )) { |
|
29 | + return; |
|
30 | + } |
|
29 | 31 | $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
30 | 32 | $ignoredTerms = array_intersect( $oldTermIds, $termIds ); |
31 | 33 | if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) { |
@@ -52,7 +54,9 @@ discard block |
||
52 | 54 | */ |
53 | 55 | public function onBeforeDelete( $postId ) |
54 | 56 | { |
55 | - if( !$this->isReviewPostId( $postId ))return; |
|
57 | + if( !$this->isReviewPostId( $postId )) { |
|
58 | + return; |
|
59 | + } |
|
56 | 60 | $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
57 | 61 | glsr( CountsManager::class )->decrease( $review ); |
58 | 62 | } |
@@ -69,9 +73,13 @@ discard block |
||
69 | 73 | { |
70 | 74 | if( !$this->isReviewPostId( $postId ) |
71 | 75 | || !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] ) |
72 | - )return; |
|
76 | + ) { |
|
77 | + return; |
|
78 | + } |
|
73 | 79 | $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
74 | - if( $review->$metaKey == $metaValue )return; |
|
80 | + if( $review->$metaKey == $metaValue ) { |
|
81 | + return; |
|
82 | + } |
|
75 | 83 | $method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' ); |
76 | 84 | call_user_func( [$this, $method], $review, $metaValue ); |
77 | 85 | } |
@@ -117,7 +125,9 @@ discard block |
||
117 | 125 | */ |
118 | 126 | public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post ) |
119 | 127 | { |
120 | - if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return; |
|
128 | + if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] )) { |
|
129 | + return; |
|
130 | + } |
|
121 | 131 | $review = glsr( ReviewManager::class )->single( get_post( $post->ID )); |
122 | 132 | if( $post->post_status == 'publish' ) { |
123 | 133 | glsr( CountsManager::class )->increase( $review ); |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | { |
23 | 23 | global $menu, $typenow; |
24 | 24 | foreach( $menu as $key => $value ) { |
25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
25 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
26 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
27 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
28 | 28 | 'class' => 'pending-count', |
29 | - ]); |
|
29 | + ] ); |
|
30 | 30 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
31 | 31 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
32 | - ]); |
|
32 | + ] ); |
|
33 | 33 | $menu[$key][0] .= ' '.$awaitingModeration; |
34 | 34 | if( $typenow === Application::POST_TYPE ) { |
35 | - $menu[$key][4].= ' current'; |
|
35 | + $menu[$key][4] .= ' current'; |
|
36 | 36 | } |
37 | 37 | break; |
38 | 38 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
50 | 50 | 'addons' => __( 'Addons', 'site-reviews' ), |
51 | 51 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
52 | - ]); |
|
52 | + ] ); |
|
53 | 53 | foreach( $pages as $slug => $title ) { |
54 | 54 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
55 | 55 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
56 | - if( !is_callable( $callback ))continue; |
|
56 | + if( !is_callable( $callback ) )continue; |
|
57 | 57 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->constant( 'CAPABILITY' ), $slug, $callback ); |
58 | 58 | } |
59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $this->renderPage( 'addons', [ |
69 | 69 | 'template' => glsr( Template::class ), |
70 | - ]); |
|
70 | + ] ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
86 | 86 | 'addons' => __( 'Addons', 'site-reviews' ), |
87 | - ]); |
|
87 | + ] ); |
|
88 | 88 | $addons = apply_filters( 'site-reviews/addon/documentation', [] ); |
89 | 89 | ksort( $addons ); |
90 | - if( empty( $addons )) { |
|
91 | - unset( $tabs['addons'] ); |
|
90 | + if( empty($addons) ) { |
|
91 | + unset($tabs['addons']); |
|
92 | 92 | } |
93 | 93 | $this->renderPage( 'documentation', [ |
94 | 94 | 'addons' => $addons, |
95 | 95 | 'tabs' => $tabs, |
96 | - ]); |
|
96 | + ] ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | 'translations' => __( 'Translations', 'site-reviews' ), |
112 | 112 | 'addons' => __( 'Addons', 'site-reviews' ), |
113 | 113 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
114 | - ]); |
|
115 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
116 | - unset( $tabs['addons'] ); |
|
114 | + ] ); |
|
115 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
116 | + unset($tabs['addons']); |
|
117 | 117 | } |
118 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
119 | - unset( $tabs['licenses'] ); |
|
118 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
119 | + unset($tabs['licenses']); |
|
120 | 120 | } |
121 | 121 | $this->renderPage( 'settings', [ |
122 | 122 | 'notices' => $this->getNotices(), |
123 | 123 | 'settings' => glsr( Settings::class ), |
124 | 124 | 'tabs' => $tabs, |
125 | - ]); |
|
125 | + ] ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -137,24 +137,24 @@ discard block |
||
137 | 137 | 'sync' => __( 'Sync Reviews', 'site-reviews' ), |
138 | 138 | 'console' => __( 'Console', 'site-reviews' ), |
139 | 139 | 'system-info' => __( 'System Info', 'site-reviews' ), |
140 | - ]); |
|
141 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
142 | - unset( $tabs['sync'] ); |
|
140 | + ] ); |
|
141 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
142 | + unset($tabs['sync']); |
|
143 | 143 | } |
144 | 144 | $this->renderPage( 'tools', [ |
145 | 145 | 'data' => [ |
146 | 146 | 'context' => [ |
147 | 147 | 'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ), |
148 | - 'console' => strval( glsr( Console::class )), |
|
148 | + 'console' => strval( glsr( Console::class ) ), |
|
149 | 149 | 'id' => Application::ID, |
150 | - 'system' => strval( glsr( System::class )), |
|
150 | + 'system' => strval( glsr( System::class ) ), |
|
151 | 151 | ], |
152 | 152 | 'services' => apply_filters( 'site-reviews/addon/sync/services', [] ), |
153 | 153 | ], |
154 | 154 | 'notices' => $this->getNotices(), |
155 | 155 | 'tabs' => $tabs, |
156 | 156 | 'template' => glsr( Template::class ), |
157 | - ]); |
|
157 | + ] ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | { |
176 | 176 | return glsr( Builder::class )->div( glsr( Notice::class )->get(), [ |
177 | 177 | 'id' => 'glsr-notices', |
178 | - ]); |
|
178 | + ] ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -54,57 +54,57 @@ |
||
54 | 54 | */ |
55 | 55 | public function run() |
56 | 56 | { |
57 | - add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
58 | - add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] ); |
|
59 | - add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
60 | - add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
61 | - add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
62 | - add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
63 | - add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
64 | - add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
65 | - add_action( 'init', [$this->blocks, 'registerAssets'], 9 ); |
|
66 | - add_action( 'init', [$this->blocks, 'registerBlocks'] ); |
|
67 | - add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
68 | - add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'], 10, 2 ); |
|
69 | - add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
70 | - add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
71 | - add_action( 'current_screen', [$this->editor, 'removePostTypeSupport'] ); |
|
72 | - add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
73 | - add_action( 'admin_head', [$this->editor, 'renderReviewFields'] ); |
|
74 | - add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
75 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
76 | - add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
77 | - add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
78 | - add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
79 | - add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
80 | - add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
81 | - add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
82 | - add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
83 | - add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
84 | - add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
85 | - add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
86 | - add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
87 | - add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
88 | - add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
89 | - add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
90 | - add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
91 | - add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] ); |
|
92 | - add_action( 'wp_footer', [$this->public, 'renderSchema'] ); |
|
93 | - add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 ); |
|
94 | - add_action( 'site-reviews/review/created', [$this->review, 'onAfterCreate'] ); |
|
95 | - add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] ); |
|
96 | - add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 ); |
|
97 | - add_action( 'transition_post_status', [$this->review, 'onChangeStatus'], 10, 3 ); |
|
98 | - add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
99 | - add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
57 | + add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
58 | + add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] ); |
|
59 | + add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
60 | + add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
61 | + add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
62 | + add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
63 | + add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
64 | + add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
65 | + add_action( 'init', [$this->blocks, 'registerAssets'], 9 ); |
|
66 | + add_action( 'init', [$this->blocks, 'registerBlocks'] ); |
|
67 | + add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
68 | + add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'], 10, 2 ); |
|
69 | + add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
70 | + add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
71 | + add_action( 'current_screen', [$this->editor, 'removePostTypeSupport'] ); |
|
72 | + add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
73 | + add_action( 'admin_head', [$this->editor, 'renderReviewFields'] ); |
|
74 | + add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
75 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
76 | + add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
77 | + add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
78 | + add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
79 | + add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
80 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
81 | + add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
82 | + add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
83 | + add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
84 | + add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
85 | + add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
86 | + add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
87 | + add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
88 | + add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
89 | + add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
90 | + add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
91 | + add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] ); |
|
92 | + add_action( 'wp_footer', [$this->public, 'renderSchema'] ); |
|
93 | + add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 ); |
|
94 | + add_action( 'site-reviews/review/created', [$this->review, 'onAfterCreate'] ); |
|
95 | + add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] ); |
|
96 | + add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 ); |
|
97 | + add_action( 'transition_post_status', [$this->review, 'onChangeStatus'], 10, 3 ); |
|
98 | + add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
99 | + add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
100 | 100 | add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
101 | - add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
102 | - add_action( 'site-reviews/schedule/session/purge', [$this->session, 'deleteExpiredSessions'] ); |
|
103 | - add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
104 | - add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] ); |
|
105 | - add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] ); |
|
106 | - add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] ); |
|
107 | - add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] ); |
|
108 | - add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 ); |
|
101 | + add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
102 | + add_action( 'site-reviews/schedule/session/purge', [$this->session, 'deleteExpiredSessions'] ); |
|
103 | + add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
104 | + add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] ); |
|
105 | + add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] ); |
|
106 | + add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] ); |
|
107 | + add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] ); |
|
108 | + add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 ); |
|
109 | 109 | } |
110 | 110 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'setting' => 'Plugin Settings', |
41 | 41 | 'reviews' => 'Review Counts', |
42 | 42 | ]; |
43 | - $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) { |
|
43 | + $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) { |
|
44 | 44 | $methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' ); |
45 | 45 | if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) { |
46 | 46 | return $carry.$this->implode( |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | { |
61 | 61 | $plugins = get_plugins(); |
62 | 62 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
63 | - $inactive = array_diff_key( $plugins, array_flip( $activePlugins )); |
|
64 | - return $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
63 | + $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) ); |
|
64 | + return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function getInactivePluginDetails() |
96 | 96 | { |
97 | 97 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
98 | - return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ))); |
|
98 | + return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | { |
106 | 106 | $plugins = array_merge( |
107 | 107 | get_mu_plugins(), |
108 | - get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
|
108 | + get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) ) |
|
109 | 109 | ); |
110 | - if( empty( $plugins ))return; |
|
110 | + if( empty($plugins) )return; |
|
111 | 111 | return $this->normalizePluginList( $plugins ); |
112 | 112 | } |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getMultisitePluginDetails() |
118 | 118 | { |
119 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
119 | + if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return; |
|
120 | 120 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
121 | 121 | } |
122 | 122 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | 'Max Input Vars' => ini_get( 'max_input_vars' ), |
144 | 144 | 'Memory Limit' => ini_get( 'memory_limit' ), |
145 | 145 | 'Post Max Size' => ini_get( 'post_max_size' ), |
146 | - 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )), |
|
147 | - 'Session Name' => esc_html( ini_get( 'session.name' )), |
|
148 | - 'Session Save Path' => esc_html( ini_get( 'session.save_path' )), |
|
149 | - 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ), |
|
150 | - 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ), |
|
146 | + 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ), |
|
147 | + 'Session Name' => esc_html( ini_get( 'session.name' ) ), |
|
148 | + 'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ), |
|
149 | + 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ), |
|
150 | + 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ), |
|
151 | 151 | 'Upload Max Filesize' => ini_get( 'upload_max_filesize' ), |
152 | 152 | ]; |
153 | 153 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | { |
160 | 160 | $counts = glsr( CountsManager::class )->getCounts(); |
161 | 161 | $counts = glsr( Helper::class )->flattenArray( $counts ); |
162 | - array_walk( $counts, function( &$ratings ) use( $counts ) { |
|
163 | - if( !is_array( $ratings )) { |
|
162 | + array_walk( $counts, function( &$ratings ) use($counts) { |
|
163 | + if( !is_array( $ratings ) ) { |
|
164 | 164 | glsr_log() |
165 | 165 | ->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' ) |
166 | 166 | ->debug( $ratings ) |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | ksort( $settings ); |
200 | 200 | $details = []; |
201 | 201 | foreach( $settings as $key => $value ) { |
202 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
203 | - $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
|
202 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue; |
|
203 | + $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' ); |
|
204 | 204 | $details[$key] = $value; |
205 | 205 | } |
206 | 206 | return $details; |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | 'WPE_APIKEY' => 'WP Engine', |
273 | 273 | ]; |
274 | 274 | foreach( $checks as $key => $value ) { |
275 | - if( !$this->isWebhostCheckValid( $key ))continue; |
|
275 | + if( !$this->isWebhostCheckValid( $key ) )continue; |
|
276 | 276 | return $value; |
277 | 277 | } |
278 | - return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] )); |
|
278 | + return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) ); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | { |
297 | 297 | $plugins = get_plugins(); |
298 | 298 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
299 | - $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ))); |
|
300 | - $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
299 | + $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) ); |
|
300 | + $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
301 | 301 | return $active + $inactive; |
302 | 302 | } |
303 | 303 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | protected function implode( $title, array $details ) |
309 | 309 | { |
310 | 310 | $strings = ['['.$title.']']; |
311 | - $padding = max( array_map( 'strlen', array_keys( $details )) ); |
|
311 | + $padding = max( array_map( 'strlen', array_keys( $details ) ) ); |
|
312 | 312 | $padding = max( [$padding, static::PAD] ); |
313 | 313 | foreach( $details as $key => $value ) { |
314 | 314 | $strings[] = is_string( $key ) |
@@ -351,9 +351,9 @@ discard block |
||
351 | 351 | $keys = [ |
352 | 352 | 'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret', |
353 | 353 | ]; |
354 | - array_walk( $settings, function( &$value, $setting ) use( $keys ) { |
|
354 | + array_walk( $settings, function( &$value, $setting ) use($keys) { |
|
355 | 355 | foreach( $keys as $key ) { |
356 | - if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue; |
|
356 | + if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty($value) )continue; |
|
357 | 357 | $value = str_repeat( '•', 13 ); |
358 | 358 | return; |
359 | 359 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function enqueueAssets() |
25 | 25 | { |
26 | - $command = new EnqueueAdminAssets([ |
|
26 | + $command = new EnqueueAdminAssets( [ |
|
27 | 27 | 'pointers' => [[ |
28 | 28 | 'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ), |
29 | 29 | 'id' => 'glsr-pointer-pinned', |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'target' => '#misc-pub-pinned', |
36 | 36 | 'title' => __( 'Pin Your Reviews', 'site-reviews' ), |
37 | 37 | ]], |
38 | - ]); |
|
38 | + ] ); |
|
39 | 39 | $this->execute( $command ); |
40 | 40 | } |
41 | 41 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [ |
49 | 49 | 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ), |
50 | - ]); |
|
50 | + ] ); |
|
51 | 51 | return $links; |
52 | 52 | } |
53 | 53 | |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | public function filterDashboardGlanceItems( array $items ) |
59 | 59 | { |
60 | 60 | $postCount = wp_count_posts( Application::POST_TYPE ); |
61 | - if( empty( $postCount->publish )) { |
|
61 | + if( empty($postCount->publish) ) { |
|
62 | 62 | return $items; |
63 | 63 | } |
64 | 64 | $text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' ); |
65 | - $text = sprintf( $text, number_format_i18n( $postCount->publish )); |
|
65 | + $text = sprintf( $text, number_format_i18n( $postCount->publish ) ); |
|
66 | 66 | $items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts ) |
67 | 67 | ? glsr( Builder::class )->a( $text, [ |
68 | 68 | 'class' => 'glsr-review-count', |
69 | 69 | 'href' => 'edit.php?post_type='.Application::POST_TYPE, |
70 | - ]) |
|
70 | + ] ) |
|
71 | 71 | : glsr( Builder::class )->span( $text, [ |
72 | 72 | 'class' => 'glsr-review-count', |
73 | - ]); |
|
73 | + ] ); |
|
74 | 74 | return $items; |
75 | 75 | } |
76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function filterTinymcePlugins( array $plugins ) |
82 | 82 | { |
83 | - if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) { |
|
83 | + if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) { |
|
84 | 84 | $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' ); |
85 | 85 | } |
86 | 86 | return $plugins; |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function registerTinymcePopups() |
94 | 94 | { |
95 | - $command = new RegisterTinymcePopups([ |
|
95 | + $command = new RegisterTinymcePopups( [ |
|
96 | 96 | 'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ), |
97 | 97 | 'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ), |
98 | 98 | 'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ), |
99 | - ]); |
|
99 | + ] ); |
|
100 | 100 | $this->execute( $command ); |
101 | 101 | } |
102 | 102 | |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | public function renderTinymceButton( $editorId ) |
109 | 109 | { |
110 | 110 | $allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'] ); |
111 | - if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return; |
|
111 | + if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ) )return; |
|
112 | 112 | $shortcodes = []; |
113 | 113 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
114 | 114 | $shortcodes[$shortcode] = $values; |
115 | 115 | } |
116 | - if( empty( $shortcodes ))return; |
|
116 | + if( empty($shortcodes) )return; |
|
117 | 117 | glsr()->render( 'partials/editor/tinymce', [ |
118 | 118 | 'shortcodes' => $shortcodes, |
119 | - ]); |
|
119 | + ] ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | public function routerClearConsole() |
126 | 126 | { |
127 | 127 | glsr( Console::class )->clear(); |
128 | - glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' )); |
|
128 | + glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) ); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function routerFetchConsole() |
135 | 135 | { |
136 | - glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' )); |
|
136 | + glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,22 +143,22 @@ discard block |
||
143 | 143 | public function routerCountReviews( $showNotice = true ) |
144 | 144 | { |
145 | 145 | $countManager = glsr( CountsManager::class ); |
146 | - $terms = get_terms([ |
|
146 | + $terms = get_terms( [ |
|
147 | 147 | 'hide_empty' => true, |
148 | 148 | 'taxonomy' => Application::TAXONOMY, |
149 | - ]); |
|
149 | + ] ); |
|
150 | 150 | foreach( $terms as $term ) { |
151 | - $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id )); |
|
151 | + $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ) ); |
|
152 | 152 | } |
153 | 153 | $postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' ); |
154 | 154 | foreach( $postIds as $postId ) { |
155 | - $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId )); |
|
155 | + $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) ); |
|
156 | 156 | } |
157 | 157 | $countManager->setCounts( $countManager->buildCounts() ); |
158 | 158 | if( $showNotice ) { |
159 | - glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' )); |
|
159 | + glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) ); |
|
160 | 160 | } |
161 | - glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' )); |
|
161 | + glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ) ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -192,17 +192,17 @@ discard block |
||
192 | 192 | { |
193 | 193 | $file = $_FILES['import-file']; |
194 | 194 | if( $file['error'] !== UPLOAD_ERR_OK ) { |
195 | - return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] )); |
|
195 | + return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) ); |
|
196 | 196 | } |
197 | - if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) { |
|
198 | - return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' )); |
|
197 | + if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) { |
|
198 | + return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) ); |
|
199 | 199 | } |
200 | 200 | $settings = json_decode( file_get_contents( $file['tmp_name'] ), true ); |
201 | - if( empty( $settings )) { |
|
202 | - return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' )); |
|
201 | + if( empty($settings) ) { |
|
202 | + return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) ); |
|
203 | 203 | } |
204 | - glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings )); |
|
205 | - glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' )); |
|
204 | + glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) ); |
|
205 | + glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) ); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ), |
221 | 221 | UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ), |
222 | 222 | ]; |
223 | - return !isset( $errors[$errorCode] ) |
|
223 | + return !isset($errors[$errorCode]) |
|
224 | 224 | ? __( 'Unknown upload error.', 'site-reviews' ) |
225 | 225 | : $errors[$errorCode]; |
226 | 226 | } |
@@ -108,12 +108,16 @@ |
||
108 | 108 | public function renderTinymceButton( $editorId ) |
109 | 109 | { |
110 | 110 | $allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'] ); |
111 | - if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return; |
|
111 | + if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors )) { |
|
112 | + return; |
|
113 | + } |
|
112 | 114 | $shortcodes = []; |
113 | 115 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
114 | 116 | $shortcodes[$shortcode] = $values; |
115 | 117 | } |
116 | - if( empty( $shortcodes ))return; |
|
118 | + if( empty( $shortcodes )) { |
|
119 | + return; |
|
120 | + } |
|
117 | 121 | glsr()->render( 'partials/editor/tinymce', [ |
118 | 122 | 'shortcodes' => $shortcodes, |
119 | 123 | ]); |