@@ -113,7 +113,7 @@ |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | - * Bind a singleton instance to the container |
|
116 | + * Bind a singleton instance to the container |
|
117 | 117 | * @param string $alias |
118 | 118 | * @param callable|string|null $binding |
119 | 119 | * @return void |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function load() |
39 | 39 | { |
40 | - if( empty( static::$instance )) { |
|
40 | + if( empty(static::$instance) ) { |
|
41 | 41 | static::$instance = new static; |
42 | 42 | } |
43 | 43 | return static::$instance; |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __get( $property ) |
51 | 51 | { |
52 | - if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES )) { |
|
52 | + if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES ) ) { |
|
53 | 53 | return $this->$property; |
54 | 54 | } |
55 | - $constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property )); |
|
56 | - if( defined( $constant )) { |
|
55 | + $constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property ) ); |
|
56 | + if( defined( $constant ) ) { |
|
57 | 57 | return constant( $constant ); |
58 | 58 | } |
59 | - return isset( $this->storage[$property] ) |
|
59 | + return isset($this->storage[$property]) |
|
60 | 60 | ? $this->storage[$property] |
61 | 61 | : null; |
62 | 62 | } |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function __set( $property, $value ) |
70 | 70 | { |
71 | - if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES )) { |
|
71 | + if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES ) ) { |
|
72 | 72 | $this->storage[$property] = $value; |
73 | 73 | } |
74 | - else if( !isset( $this->$property )) { |
|
74 | + else if( !isset($this->$property) ) { |
|
75 | 75 | $this->$property = $value; |
76 | 76 | } |
77 | 77 | else { |
78 | - throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property )); |
|
78 | + throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ) ); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function make( $abstract ) |
99 | 99 | { |
100 | - if( !isset( $this->services[$abstract] )) { |
|
100 | + if( !isset($this->services[$abstract]) ) { |
|
101 | 101 | $abstract = $this->addNamespace( $abstract ); |
102 | 102 | } |
103 | - if( isset( $this->services[$abstract] )) { |
|
103 | + if( isset($this->services[$abstract]) ) { |
|
104 | 104 | $abstract = $this->services[$abstract]; |
105 | 105 | } |
106 | - if( is_callable( $abstract )) { |
|
106 | + if( is_callable( $abstract ) ) { |
|
107 | 107 | return call_user_func_array( $abstract, [$this] ); |
108 | 108 | } |
109 | - if( is_object( $abstract )) { |
|
109 | + if( is_object( $abstract ) ) { |
|
110 | 110 | return $abstract; |
111 | 111 | } |
112 | 112 | return $this->resolve( $abstract ); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function singleton( $alias, $binding ) |
122 | 122 | { |
123 | - $this->bind( $alias, $this->make( $binding )); |
|
123 | + $this->bind( $alias, $this->make( $binding ) ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function addNamespace( $abstract ) |
132 | 132 | { |
133 | - if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { |
|
133 | + if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) { |
|
134 | 134 | $abstract = __NAMESPACE__.'\\'.$abstract; |
135 | 135 | } |
136 | 136 | return $abstract; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | throw new Exception( 'Target ['.$concrete.'] is not instantiable.' ); |
153 | 153 | } |
154 | 154 | $constructor = $reflector->getConstructor(); |
155 | - if( empty( $constructor )) { |
|
155 | + if( empty($constructor) ) { |
|
156 | 156 | return new $concrete; |
157 | 157 | } |
158 | 158 | return $reflector->newInstanceArgs( |
@@ -5,8 +5,8 @@ |
||
5 | 5 | use PasswordHash; |
6 | 6 | |
7 | 7 | /** |
8 | - * This class is derived from WP Session Manager (1.2.0) |
|
9 | - */ |
|
8 | + * This class is derived from WP Session Manager (1.2.0) |
|
9 | + */ |
|
10 | 10 | class Session |
11 | 11 | { |
12 | 12 | const SESSION_COOKIE = '_glsr_session'; |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | public function __construct() |
35 | 35 | { |
36 | - if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE )) { |
|
37 | - $cookie = explode( '||', stripslashes( $cookieId )); |
|
36 | + if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE ) ) { |
|
37 | + $cookie = explode( '||', stripslashes( $cookieId ) ); |
|
38 | 38 | $this->sessionId = preg_replace( '/[^A-Za-z0-9_]/', '', $cookie[0] ); |
39 | 39 | $this->expiryTimestamp = absint( $cookie[1] ); |
40 | 40 | $this->expiryTimestampReset = absint( $cookie[2] ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function deleteExpiredSessions( $limit = 1000 ) |
79 | 79 | { |
80 | 80 | global $wpdb; |
81 | - if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ))) { |
|
81 | + if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ) ) ) { |
|
82 | 82 | $wpdb->query( |
83 | 83 | "DELETE FROM {$wpdb->options} WHERE option_name IN ('{$expiredSessions}')" |
84 | 84 | ); |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | public function get( $key, $fallback = '', $unset = false ) |
95 | 95 | { |
96 | 96 | $key = sanitize_key( $key ); |
97 | - $value = isset( $this->sessionData[$key] ) |
|
97 | + $value = isset($this->sessionData[$key]) |
|
98 | 98 | ? maybe_unserialize( $this->sessionData[$key] ) |
99 | 99 | : $fallback; |
100 | - if( isset( $this->sessionData[$key] ) && $unset ) { |
|
101 | - unset( $this->sessionData[$key] ); |
|
100 | + if( isset($this->sessionData[$key]) && $unset ) { |
|
101 | + unset($this->sessionData[$key]); |
|
102 | 102 | $this->updateSession(); |
103 | 103 | } |
104 | 104 | return $value; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | protected function deleteSession() |
133 | 133 | { |
134 | 134 | delete_option( $this->getSessionId() ); |
135 | - delete_option( $this->getSessionId( 'expires' )); |
|
135 | + delete_option( $this->getSessionId( 'expires' ) ); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | protected function generateSessionId() |
142 | 142 | { |
143 | - return md5(( new PasswordHash( 8, false ))->get_random_bytes( 32 )); |
|
143 | + return md5( (new PasswordHash( 8, false ))->get_random_bytes( 32 ) ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | global $wpdb; |
153 | 153 | $expiredSessions = []; |
154 | 154 | $sessions = $wpdb->get_results( |
155 | - "SELECT option_name AS name, option_value AS expiration " . |
|
156 | - "FROM {$wpdb->options} " . |
|
157 | - "WHERE option_name LIKE '".static::SESSION_COOKIE."_expires_%' " . |
|
158 | - "ORDER BY option_value ASC " . |
|
155 | + "SELECT option_name AS name, option_value AS expiration ". |
|
156 | + "FROM {$wpdb->options} ". |
|
157 | + "WHERE option_name LIKE '".static::SESSION_COOKIE."_expires_%' ". |
|
158 | + "ORDER BY option_value ASC ". |
|
159 | 159 | "LIMIT 0, ".absint( $limit ) |
160 | 160 | ); |
161 | - if( !empty( $sessions )) { |
|
161 | + if( !empty($sessions) ) { |
|
162 | 162 | $now = time(); |
163 | 163 | foreach( $sessions as $session ) { |
164 | 164 | if( $now <= $session->expiration )continue; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | protected function getSessionId( $separator = '' ) |
177 | 177 | { |
178 | - return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] )); |
|
178 | + return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] ) ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | { |
207 | 207 | if( headers_sent() )return; |
208 | 208 | $cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset; |
209 | - $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ))); |
|
209 | + $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ) ) ); |
|
210 | 210 | setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath ); |
211 | 211 | } |
212 | 212 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | protected function updateSession() |
226 | 226 | { |
227 | - if( false === get_option( $this->getSessionId() )) { |
|
227 | + if( false === get_option( $this->getSessionId() ) ) { |
|
228 | 228 | $this->createSession(); |
229 | 229 | } |
230 | 230 | else { |
@@ -7,7 +7,7 @@ |
||
7 | 7 | class Cache |
8 | 8 | { |
9 | 9 | /** |
10 | - * @return array |
|
10 | + * @return array |
|
11 | 11 | */ |
12 | 12 | public function getCloudflareIps() |
13 | 13 | { |
@@ -17,11 +17,11 @@ |
||
17 | 17 | $ipAddresses = array_fill_keys( ['v4', 'v6'], [] ); |
18 | 18 | foreach( array_keys( $ipAddresses ) as $version ) { |
19 | 19 | $response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version ); |
20 | - if( is_wp_error( $response )) { |
|
20 | + if( is_wp_error( $response ) ) { |
|
21 | 21 | glsr_log()->error( $response->get_error_message() ); |
22 | 22 | continue; |
23 | 23 | } |
24 | - $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ))); |
|
24 | + $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) ); |
|
25 | 25 | } |
26 | 26 | wp_cache_set( Application::ID, $ipAddresses, '_cloudflare_ips' ); |
27 | 27 | } |
@@ -18,16 +18,16 @@ |
||
18 | 18 | |
19 | 19 | defined( 'WPINC' ) || die; |
20 | 20 | |
21 | -if( !class_exists( 'GL_Plugin_Check_v1' )) { |
|
21 | +if( !class_exists( 'GL_Plugin_Check_v1' ) ) { |
|
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | -if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' )))return; |
|
24 | +if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' ) ) )return; |
|
25 | 25 | |
26 | 26 | require_once __DIR__.'/autoload.php'; |
27 | 27 | require_once __DIR__.'/helpers.php'; |
28 | 28 | |
29 | 29 | $app = new GeminiLabs\SiteReviews\Application; |
30 | 30 | $app->make( 'Provider' )->register( $app ); |
31 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
32 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
31 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
32 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
33 | 33 | $app->init(); |
@@ -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 |
11 | 11 | : $app->make( $alias ); |
12 | 12 | } |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | * @return \WP_Screen|object |
17 | 17 | */ |
18 | 18 | function glsr_current_screen() { |
19 | - if( function_exists( 'get_current_screen' )) { |
|
19 | + if( function_exists( 'get_current_screen' ) ) { |
|
20 | 20 | $screen = get_current_screen(); |
21 | 21 | } |
22 | - return empty( $screen ) |
|
22 | + return empty($screen) |
|
23 | 23 | ? (object)array_fill_keys( ['base', 'id', 'post_type'], null ) |
24 | 24 | : $screen; |
25 | 25 | } |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | */ |
55 | 55 | function glsr_log() { |
56 | 56 | $args = func_get_args(); |
57 | - $context = isset( $args[1] ) |
|
57 | + $context = isset($args[1]) |
|
58 | 58 | ? $args[1] |
59 | 59 | : []; |
60 | 60 | $logger = glsr( 'Modules\Logger' ); |
61 | - return empty( $args ) |
|
61 | + return empty($args) |
|
62 | 62 | ? $logger |
63 | 63 | : $logger->log( 'debug', $args[0], $context ); |
64 | 64 | } |
@@ -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'; |
@@ -4,6 +4,6 @@ |
||
4 | 4 | <html> |
5 | 5 | <head> |
6 | 6 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
7 | - <title><?= wp_specialchars_decode( (string) get_option( 'blogname', '' ), ENT_QUOTES ); ?></title> |
|
7 | + <title><?= wp_specialchars_decode( (string)get_option( 'blogname', '' ), ENT_QUOTES ); ?></title> |
|
8 | 8 | </head> |
9 | 9 | <body> |
@@ -7,17 +7,17 @@ |
||
7 | 7 | <?php |
8 | 8 | |
9 | 9 | $html->renderNotices(); |
10 | - $html->renderPartial( 'tabs' , [ |
|
10 | + $html->renderPartial( 'tabs', [ |
|
11 | 11 | 'page' => $page, |
12 | 12 | 'tab' => $currentTab, |
13 | 13 | 'tabs' => $tabs, |
14 | - ]); |
|
15 | - $html->renderPartial( 'sections' , [ |
|
14 | + ] ); |
|
15 | + $html->renderPartial( 'sections', [ |
|
16 | 16 | 'page' => $page, |
17 | 17 | 'section' => $currentSection, |
18 | 18 | 'tab' => $currentTab, |
19 | 19 | 'tabs' => $tabs, |
20 | - ]); |
|
20 | + ] ); |
|
21 | 21 | $file = $currentSection ? $currentTab.'/'.$currentSection : $currentTab; |
22 | 22 | $file = trailingslashit( __DIR__ ).$page.'/'.$file.'.php'; |
23 | 23 | $file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data ); |
@@ -8,12 +8,12 @@ |
||
8 | 8 | 'link' => 'https://niftyplugins.com/addons/site-reviews-tripadvisor/', |
9 | 9 | 'name' => 'tripadvisor', |
10 | 10 | 'title' => 'Tripadvisor Reviews', |
11 | -]); |
|
11 | +] ); |
|
12 | 12 | glsr( 'Modules\Html' )->renderTemplate( 'addons/addon', [ |
13 | 13 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
14 | 14 | 'link' => 'https://niftyplugins.com/addons/site-reviews-yelp/', |
15 | 15 | 'name' => 'yelp', |
16 | 16 | 'title' => 'Yelp Reviews', |
17 | -]); |
|
17 | +] ); |
|
18 | 18 | ?> |
19 | 19 | </div> |