@@ -161,7 +161,9 @@ discard block |
||
161 | 161 | if( !empty( $sessions )) { |
162 | 162 | $now = time(); |
163 | 163 | foreach( $sessions as $session ) { |
164 | - if( $now <= $session->expiration )continue; |
|
164 | + if( $now <= $session->expiration ) { |
|
165 | + continue; |
|
166 | + } |
|
165 | 167 | $expiredSessions[] = $session->name; |
166 | 168 | $expiredSessions[] = str_replace( '_expires_', '_', $session->name ); |
167 | 169 | } |
@@ -204,7 +206,9 @@ discard block |
||
204 | 206 | */ |
205 | 207 | protected function setCookie() |
206 | 208 | { |
207 | - if( headers_sent() )return; |
|
209 | + if( headers_sent() ) { |
|
210 | + return; |
|
211 | + } |
|
208 | 212 | $cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset; |
209 | 213 | $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ))); |
210 | 214 | setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath ); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | |
35 | 35 | public function __construct() |
36 | 36 | { |
37 | - if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE )) { |
|
38 | - $cookie = explode( '||', stripslashes( $cookieId )); |
|
37 | + if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE ) ) { |
|
38 | + $cookie = explode( '||', stripslashes( $cookieId ) ); |
|
39 | 39 | $this->sessionId = preg_replace( '/[^A-Za-z0-9_]/', '', $cookie[0] ); |
40 | 40 | $this->expiryTimestamp = absint( $cookie[1] ); |
41 | 41 | $this->expiryTimestampReset = absint( $cookie[2] ); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function deleteExpiredSessions( $limit = 1000 ) |
77 | 77 | { |
78 | - if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ))) { |
|
78 | + if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ) ) ) { |
|
79 | 79 | glsr( SqlQueries::class )->deleteExpiredSessions( $expiredSessions ); |
80 | 80 | } |
81 | 81 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | public function get( $key, $fallback = '', $unset = false ) |
90 | 90 | { |
91 | 91 | $key = sanitize_key( $key ); |
92 | - $value = isset( $this->sessionData[$key] ) |
|
92 | + $value = isset($this->sessionData[$key]) |
|
93 | 93 | ? maybe_unserialize( $this->sessionData[$key] ) |
94 | 94 | : $fallback; |
95 | - if( isset( $this->sessionData[$key] ) && $unset ) { |
|
96 | - unset( $this->sessionData[$key] ); |
|
95 | + if( isset($this->sessionData[$key]) && $unset ) { |
|
96 | + unset($this->sessionData[$key]); |
|
97 | 97 | $this->updateSession(); |
98 | 98 | } |
99 | 99 | return $value; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | protected function deleteSession() |
128 | 128 | { |
129 | 129 | delete_option( $this->getSessionId() ); |
130 | - delete_option( $this->getSessionId( 'expires' )); |
|
130 | + delete_option( $this->getSessionId( 'expires' ) ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function generateSessionId() |
137 | 137 | { |
138 | - return md5(( new PasswordHash( 8, false ))->get_random_bytes( 32 )); |
|
138 | + return md5( (new PasswordHash( 8, false ))->get_random_bytes( 32 ) ); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | protected function getExpiredSessions( $limit ) |
146 | 146 | { |
147 | 147 | $expiredSessions = []; |
148 | - $sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit )); |
|
149 | - if( !empty( $sessions )) { |
|
148 | + $sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit ) ); |
|
149 | + if( !empty($sessions) ) { |
|
150 | 150 | $now = time(); |
151 | 151 | foreach( $sessions as $session ) { |
152 | 152 | if( $now <= $session->expiration )continue; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function getSessionId( $separator = '' ) |
165 | 165 | { |
166 | - return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] )); |
|
166 | + return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] ) ); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | { |
195 | 195 | if( headers_sent() )return; |
196 | 196 | $cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset; |
197 | - $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ))); |
|
197 | + $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ) ) ); |
|
198 | 198 | setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath ); |
199 | 199 | } |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function updateSession() |
214 | 214 | { |
215 | - if( false === get_option( $this->getSessionId() )) { |
|
215 | + if( false === get_option( $this->getSessionId() ) ) { |
|
216 | 216 | return $this->createSession(); |
217 | 217 | } |
218 | 218 | update_option( $this->getSessionId(), $this->sessionData, false ); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | natsort( $routines ); |
17 | 17 | array_walk( $routines, function( $routine ) { |
18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
19 | + if( version_compare( glsr()->version, $version, '>=' ) )return; |
|
20 | 20 | call_user_func( [$this, $routine] ); |
21 | 21 | }); |
22 | 22 | $this->updateVersion(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function updateVersion() |
29 | 29 | { |
30 | 30 | $currentVersion = glsr( OptionManager::class )->get( 'version' ); |
31 | - if( version_compare( $currentVersion, glsr()->version, '<' )) { |
|
31 | + if( version_compare( $currentVersion, glsr()->version, '<' ) ) { |
|
32 | 32 | glsr( OptionManager::class )->set( 'version', glsr()->version ); |
33 | 33 | } |
34 | 34 | if( $currentVersion != glsr()->version ) { |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | natsort( $routines ); |
17 | 17 | array_walk( $routines, function( $routine ) { |
18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
19 | + if( version_compare( glsr()->version, $version, '>=' )) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | call_user_func( [$this, $routine] ); |
21 | 23 | }); |
22 | 24 | $this->updateVersion(); |
@@ -37,5 +39,6 @@ discard block |
||
37 | 39 | } |
38 | 40 | |
39 | 41 | protected function upgrade_3_0_0() |
40 | - {} |
|
42 | + { |
|
43 | +} |
|
41 | 44 | } |
@@ -22,7 +22,8 @@ |
||
22 | 22 | protected $public; |
23 | 23 | protected $translator; |
24 | 24 | |
25 | - public function __construct( Application $app ) { |
|
25 | + public function __construct( Application $app ) |
|
26 | + { |
|
26 | 27 | $this->app = $app; |
27 | 28 | $this->admin = $app->make( AdminController::class ); |
28 | 29 | $this->basename = plugin_basename( $app->file ); |
@@ -38,27 +38,27 @@ |
||
38 | 38 | */ |
39 | 39 | public function run() |
40 | 40 | { |
41 | - add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
42 | - add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
43 | - add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
44 | - add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
45 | - add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
46 | - add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
|
47 | - add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
|
48 | - add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
49 | - add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
50 | - add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
51 | - add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | - add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | - add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | - add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
41 | + add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
42 | + add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
43 | + add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
44 | + add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
45 | + add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
46 | + add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
|
47 | + add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
|
48 | + add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
49 | + add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
50 | + add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
51 | + add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | + add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | + add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | + add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
55 | 55 | add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] ); |
56 | - add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | - add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | - add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | - add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | - add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | - add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | - add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
56 | + add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | + add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | + add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | + add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | + add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | + add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | + add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
63 | 63 | } |
64 | 64 | } |
@@ -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 ); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | 'name' => 'tripadvisor', |
13 | 13 | 'title' => 'Tripadvisor Reviews', |
14 | 14 | ], |
15 | - ]); |
|
15 | + ] ); |
|
16 | 16 | $template->render( 'partials/addons/addon', [ |
17 | 17 | 'context' => [ |
18 | 18 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'name' => 'yelp', |
21 | 21 | 'title' => 'Yelp Reviews', |
22 | 22 | ], |
23 | - ]); |
|
23 | + ] ); |
|
24 | 24 | ?> |
25 | 25 | </div> |
26 | 26 | </div> |
@@ -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 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | protected function normalize( array $settings ) |
58 | 58 | { |
59 | 59 | array_walk( $settings, function( &$setting ) { |
60 | - if( isset( $setting['default'] ))return; |
|
60 | + if( isset($setting['default']) )return; |
|
61 | 61 | $setting['default'] = ''; |
62 | 62 | }); |
63 | 63 | return $settings; |