@@ -10,7 +10,7 @@ |
||
10 | 10 | const EXPIRY_TIME = WEEK_IN_SECONDS; |
11 | 11 | |
12 | 12 | /** |
13 | - * @return array |
|
13 | + * @return array |
|
14 | 14 | */ |
15 | 15 | public function getCloudflareIps() |
16 | 16 | { |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | $ipAddresses = array_fill_keys( ['v4', 'v6'], [] ); |
20 | 20 | foreach( array_keys( $ipAddresses ) as $version ) { |
21 | 21 | $response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version ); |
22 | - if( is_wp_error( $response )) { |
|
22 | + if( is_wp_error( $response ) ) { |
|
23 | 23 | glsr_log()->error( $response->get_error_message() ); |
24 | 24 | continue; |
25 | 25 | } |
26 | - $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ))); |
|
26 | + $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) ); |
|
27 | 27 | } |
28 | 28 | set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME ); |
29 | 29 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if( $test === false ) { |
58 | 58 | $response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' ); |
59 | 59 | $test = !is_wp_error( $response ) |
60 | - && in_array( $response['response']['code'], range( 200, 299 )) |
|
60 | + && in_array( $response['response']['code'], range( 200, 299 ) ) |
|
61 | 61 | ? 'Works' |
62 | 62 | : 'Does not work'; |
63 | 63 | set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME ); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | <p>{{ data.s1 }}</p> |
4 | 4 | <p>{{ data.p1 }}</p> |
5 | 5 | <p class="row-actions"> |
6 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
6 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
7 | 7 | </p> |
8 | 8 | <button type="button" class="toggle-row"> |
9 | 9 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <td class="glsr-string-td1 column-primary"> |
3 | 3 | <p>{{ data.s1 }}</p> |
4 | 4 | <p class="row-actions"> |
5 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
5 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
6 | 6 | </p> |
7 | 7 | <button type="button" class="toggle-row"> |
8 | 8 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php defined( 'WPINC' ) || die; |
2 | 2 | |
3 | -include trailingslashit(__DIR__).'header.php'; |
|
4 | -include trailingslashit(__DIR__).'body.php'; |
|
5 | -include trailingslashit(__DIR__).'footer.php'; |
|
3 | +include trailingslashit( __DIR__ ).'header.php'; |
|
4 | +include trailingslashit( __DIR__ ).'body.php'; |
|
5 | +include trailingslashit( __DIR__ ).'footer.php'; |
@@ -53,7 +53,9 @@ |
||
53 | 53 | protected function normalize( array $settings ) |
54 | 54 | { |
55 | 55 | array_walk( $settings, function( &$setting ) { |
56 | - if( isset( $setting['default'] ))return; |
|
56 | + if( isset( $setting['default'] )) { |
|
57 | + return; |
|
58 | + } |
|
57 | 59 | $setting['default'] = ''; |
58 | 60 | }); |
59 | 61 | return $settings; |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | public function defaults() |
14 | 14 | { |
15 | 15 | $settings = $this->settings(); |
16 | - $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' )); |
|
16 | + $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) ); |
|
17 | 17 | return wp_parse_args( $defaults, [ |
18 | 18 | 'version' => '', |
19 | 19 | 'version_upgraded_from' => '', |
20 | - ]); |
|
20 | + ] ); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function settings() |
48 | 48 | { |
49 | - $settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' )); |
|
49 | + $settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ) ); |
|
50 | 50 | return $this->normalize( $settings ); |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | protected function normalize( array $settings ) |
57 | 57 | { |
58 | 58 | array_walk( $settings, function( &$setting ) { |
59 | - if( isset( $setting['default'] ))return; |
|
59 | + if( isset($setting['default']) )return; |
|
60 | 60 | $setting['default'] = ''; |
61 | 61 | }); |
62 | 62 | return $settings; |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | $options = $this->all(); |
43 | 43 | $pointer = &$options; |
44 | 44 | foreach( $keys as $key ) { |
45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
45 | + if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) { |
|
46 | + continue; |
|
47 | + } |
|
46 | 48 | $pointer = &$pointer[$key]; |
47 | 49 | } |
48 | 50 | unset( $pointer[$last] ); |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | glsr( DefaultsManager::class )->defaults() |
78 | 80 | ); |
79 | 81 | array_walk( $options, function( &$value ) { |
80 | - if( !is_string( $value ))return; |
|
82 | + if( !is_string( $value )) { |
|
83 | + return; |
|
84 | + } |
|
81 | 85 | $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
82 | 86 | }); |
83 | 87 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function all() |
30 | 30 | { |
31 | - if( empty( $this->options )) { |
|
31 | + if( empty($this->options) ) { |
|
32 | 32 | $this->reset(); |
33 | 33 | } |
34 | 34 | return $this->options; |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $options = $this->all(); |
46 | 46 | $pointer = &$options; |
47 | 47 | foreach( $keys as $key ) { |
48 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
48 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
49 | 49 | $pointer = &$pointer[$key]; |
50 | 50 | } |
51 | - unset( $pointer[$last] ); |
|
51 | + unset($pointer[$last]); |
|
52 | 52 | return $this->set( $options ); |
53 | 53 | } |
54 | 54 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | glsr( DefaultsManager::class )->defaults() |
81 | 81 | ); |
82 | 82 | array_walk( $options, function( &$value ) { |
83 | - if( !is_string( $value ))return; |
|
84 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
83 | + if( !is_string( $value ) )return; |
|
84 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
85 | 85 | }); |
86 | 86 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function isRecaptchaEnabled() |
93 | 93 | { |
94 | 94 | $integration = $this->get( 'settings.submissions.recaptcha.integration' ); |
95 | - return $integration == 'all' || ( $integration == 'guest' && !is_user_logged_in() ); |
|
95 | + return $integration == 'all' || ($integration == 'guest' && !is_user_logged_in()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function reset() |
102 | 102 | { |
103 | 103 | $options = get_option( static::databaseKey(), [] ); |
104 | - if( !is_array( $options ) || empty( $options )) { |
|
104 | + if( !is_array( $options ) || empty($options) ) { |
|
105 | 105 | delete_option( static::databaseKey() ); |
106 | 106 | $options = wp_parse_args( glsr()->defaults, ['settings' => []] ); |
107 | 107 | } |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function set( $pathOrOptions, $value = '' ) |
117 | 117 | { |
118 | - if( is_string( $pathOrOptions )) { |
|
118 | + if( is_string( $pathOrOptions ) ) { |
|
119 | 119 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
120 | 120 | } |
121 | - if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) { |
|
121 | + if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) { |
|
122 | 122 | $this->reset(); |
123 | 123 | } |
124 | 124 | return $result; |
@@ -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 | } |
@@ -51,9 +51,9 @@ |
||
51 | 51 | protected function normalize( array $data ) |
52 | 52 | { |
53 | 53 | $arrayKeys = ['context', 'globals']; |
54 | - $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
|
54 | + $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) ); |
|
55 | 55 | foreach( $arrayKeys as $key ) { |
56 | - if( is_array( $data[$key] ))continue; |
|
56 | + if( is_array( $data[$key] ) )continue; |
|
57 | 57 | $data[$key] = []; |
58 | 58 | } |
59 | 59 | return $data; |
@@ -53,7 +53,9 @@ |
||
53 | 53 | $arrayKeys = ['context', 'globals']; |
54 | 54 | $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
55 | 55 | foreach( $arrayKeys as $key ) { |
56 | - if( is_array( $data[$key] ))continue; |
|
56 | + if( is_array( $data[$key] )) { |
|
57 | + continue; |
|
58 | + } |
|
57 | 59 | $data[$key] = []; |
58 | 60 | } |
59 | 61 | return $data; |
@@ -19,13 +19,17 @@ discard block |
||
19 | 19 | public function build( array $args = [] ) |
20 | 20 | { |
21 | 21 | $this->args = $this->normalize( $args ); |
22 | - if( $this->args['total'] < 2 )return; |
|
22 | + if( $this->args['total'] < 2 ) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | $links = $this->buildLinksForDeprecatedThemes(); |
24 | 26 | if( empty( $links )) { |
25 | 27 | $links = $this->buildLinks(); |
26 | 28 | } |
27 | 29 | $links = apply_filters( 'site-reviews/reviews/navigation_links', $links, $this->args ); |
28 | - if( empty( $links ))return; |
|
30 | + if( empty( $links )) { |
|
31 | + return; |
|
32 | + } |
|
29 | 33 | return $this->buildTemplate( $links ); |
30 | 34 | } |
31 | 35 | |
@@ -55,7 +59,9 @@ discard block |
||
55 | 59 | protected function buildLinksForDeprecatedThemes() |
56 | 60 | { |
57 | 61 | $theme = wp_get_theme()->get( 'TextDomain' ); |
58 | - if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] ))return; |
|
62 | + if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] )) { |
|
63 | + return; |
|
64 | + } |
|
59 | 65 | $links = ''; |
60 | 66 | if( $this->args['paged'] > 1 ) { |
61 | 67 | $links.= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | $this->args = $this->normalize( $args ); |
23 | 23 | if( $this->args['total'] < 2 )return; |
24 | 24 | $links = $this->buildLinksForDeprecatedThemes(); |
25 | - if( empty( $links )) { |
|
25 | + if( empty($links) ) { |
|
26 | 26 | $links = $this->buildLinks(); |
27 | 27 | } |
28 | 28 | $links = apply_filters( 'site-reviews/reviews/navigation_links', $links, $this->args ); |
29 | - if( empty( $links ))return; |
|
29 | + if( empty($links) )return; |
|
30 | 30 | return $this->buildTemplate( $links ); |
31 | 31 | } |
32 | 32 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | 'total' => $this->args['total'], |
46 | 46 | ]; |
47 | 47 | if( is_front_page() ) { |
48 | - unset( $paginateArgs['format'] ); |
|
48 | + unset($paginateArgs['format']); |
|
49 | 49 | } |
50 | 50 | return paginate_links( $paginateArgs ); |
51 | 51 | } |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | protected function buildLinksForDeprecatedThemes() |
57 | 57 | { |
58 | 58 | $theme = wp_get_theme()->get( 'TextDomain' ); |
59 | - if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] ))return; |
|
59 | + if( !in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve', 'twentythirteen'] ) )return; |
|
60 | 60 | $links = ''; |
61 | 61 | if( $this->args['paged'] > 1 ) { |
62 | - $links.= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
|
62 | + $links .= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
|
63 | 63 | $this->buildUrlForDeprecatedThemes(-1), |
64 | 64 | __( 'Previous', 'site-reviews' ) |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | if( $this->args['paged'] < $this->args['total'] ) { |
68 | - $links.= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">→</span></a></div>', |
|
69 | - $this->buildUrlForDeprecatedThemes(1), |
|
68 | + $links .= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">→</span></a></div>', |
|
69 | + $this->buildUrlForDeprecatedThemes( 1 ), |
|
70 | 70 | __( 'Next', 'site-reviews' ) |
71 | 71 | ); |
72 | 72 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $screenReaderTemplate = '<h2 class="screen-reader-text">%2$s</h2>'; |
85 | 85 | $screenReaderText = __( 'Site Reviews navigation', 'site-reviews' ); |
86 | 86 | $innerTemplate = $screenReaderTemplate.'<div class="nav-links">%3$s</div>'; |
87 | - if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] )) { |
|
87 | + if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] ) ) { |
|
88 | 88 | $innerTemplate = '%3$s'; |
89 | 89 | } |
90 | 90 | else if( $theme == 'twentyfourteen' ) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $template = sprintf( $template, $class, $screenReaderText, $links ); |
97 | 97 | return glsr( Builder::class )->div( $template.'<div class="glsr-loader"></div>', [ |
98 | 98 | 'class' => 'glsr-navigation', |
99 | - ]); |
|
99 | + ] ); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -119,6 +119,6 @@ discard block |
||
119 | 119 | return wp_parse_args( $args, [ |
120 | 120 | 'paged' => glsr( QueryBuilder::class )->getPaged(), |
121 | 121 | 'total' => 1, |
122 | - ]); |
|
122 | + ] ); |
|
123 | 123 | } |
124 | 124 | } |