@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p class="glsr-field {{ class }}"> |
4 | 4 | {{ label }} |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p class="glsr-field {{ class }}"> |
4 | 4 | {{ label }} |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <table class="form-table"> |
4 | 4 | <tbody> |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <table class="form-table"> |
4 | 4 | <tbody> |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <table class="form-table"> |
4 | 4 | <tbody> |
@@ -8,137 +8,137 @@ |
||
8 | 8 | */ |
9 | 9 | class GL_Plugin_Check_v3 |
10 | 10 | { |
11 | - const MIN_PHP_VERSION = '5.6.0'; |
|
12 | - const MIN_WORDPRESS_VERSION = '4.7.0'; |
|
11 | + const MIN_PHP_VERSION = '5.6.0'; |
|
12 | + const MIN_WORDPRESS_VERSION = '4.7.0'; |
|
13 | 13 | |
14 | - /** |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $file; |
|
14 | + /** |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $file; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @var array |
|
21 | - */ |
|
22 | - protected $versions; |
|
19 | + /** |
|
20 | + * @var array |
|
21 | + */ |
|
22 | + protected $versions; |
|
23 | 23 | |
24 | - /** |
|
25 | - * @param string $file |
|
26 | - */ |
|
27 | - public function __construct($file, array $versions = array()) |
|
28 | - { |
|
29 | - $this->file = realpath($file); |
|
30 | - $this->versions = wp_parse_args($versions, array( |
|
31 | - 'php' => static::MIN_PHP_VERSION, |
|
32 | - 'wordpress' => static::MIN_WORDPRESS_VERSION, |
|
33 | - )); |
|
34 | - } |
|
24 | + /** |
|
25 | + * @param string $file |
|
26 | + */ |
|
27 | + public function __construct($file, array $versions = array()) |
|
28 | + { |
|
29 | + $this->file = realpath($file); |
|
30 | + $this->versions = wp_parse_args($versions, array( |
|
31 | + 'php' => static::MIN_PHP_VERSION, |
|
32 | + 'wordpress' => static::MIN_WORDPRESS_VERSION, |
|
33 | + )); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @return bool |
|
38 | - */ |
|
39 | - public function canProceed() |
|
40 | - { |
|
41 | - if ($this->isValid()) { |
|
42 | - return true; |
|
43 | - } |
|
44 | - add_action('activated_plugin', array($this, 'deactivate')); |
|
45 | - add_action('admin_notices', array($this, 'deactivate')); |
|
46 | - return false; |
|
47 | - } |
|
36 | + /** |
|
37 | + * @return bool |
|
38 | + */ |
|
39 | + public function canProceed() |
|
40 | + { |
|
41 | + if ($this->isValid()) { |
|
42 | + return true; |
|
43 | + } |
|
44 | + add_action('activated_plugin', array($this, 'deactivate')); |
|
45 | + add_action('admin_notices', array($this, 'deactivate')); |
|
46 | + return false; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return bool |
|
51 | - */ |
|
52 | - public function isPhpValid() |
|
53 | - { |
|
54 | - return !version_compare(PHP_VERSION, $this->versions['php'], '<'); |
|
55 | - } |
|
49 | + /** |
|
50 | + * @return bool |
|
51 | + */ |
|
52 | + public function isPhpValid() |
|
53 | + { |
|
54 | + return !version_compare(PHP_VERSION, $this->versions['php'], '<'); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return bool |
|
59 | - */ |
|
60 | - public function isValid() |
|
61 | - { |
|
62 | - return $this->isPhpValid() && $this->isWpValid(); |
|
63 | - } |
|
57 | + /** |
|
58 | + * @return bool |
|
59 | + */ |
|
60 | + public function isValid() |
|
61 | + { |
|
62 | + return $this->isPhpValid() && $this->isWpValid(); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return bool |
|
67 | - */ |
|
68 | - public function isWpValid() |
|
69 | - { |
|
70 | - global $wp_version; |
|
71 | - return !version_compare($wp_version, $this->versions['wordpress'], '<'); |
|
72 | - } |
|
65 | + /** |
|
66 | + * @return bool |
|
67 | + */ |
|
68 | + public function isWpValid() |
|
69 | + { |
|
70 | + global $wp_version; |
|
71 | + return !version_compare($wp_version, $this->versions['wordpress'], '<'); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @param string $plugin |
|
76 | - * @return void |
|
77 | - */ |
|
78 | - public function deactivate($plugin) |
|
79 | - { |
|
80 | - if ($this->isValid()) { |
|
81 | - return; |
|
82 | - } |
|
83 | - $pluginSlug = plugin_basename($this->file); |
|
84 | - if ($plugin == $pluginSlug) { |
|
85 | - $this->redirect(); //exit |
|
86 | - } |
|
87 | - $pluginData = get_file_data($this->file, array('name' => 'Plugin Name'), 'plugin'); |
|
88 | - deactivate_plugins($pluginSlug); |
|
89 | - $this->printNotice($pluginData['name']); |
|
90 | - } |
|
74 | + /** |
|
75 | + * @param string $plugin |
|
76 | + * @return void |
|
77 | + */ |
|
78 | + public function deactivate($plugin) |
|
79 | + { |
|
80 | + if ($this->isValid()) { |
|
81 | + return; |
|
82 | + } |
|
83 | + $pluginSlug = plugin_basename($this->file); |
|
84 | + if ($plugin == $pluginSlug) { |
|
85 | + $this->redirect(); //exit |
|
86 | + } |
|
87 | + $pluginData = get_file_data($this->file, array('name' => 'Plugin Name'), 'plugin'); |
|
88 | + deactivate_plugins($pluginSlug); |
|
89 | + $this->printNotice($pluginData['name']); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * @return array |
|
94 | - */ |
|
95 | - protected function getMessages() |
|
96 | - { |
|
97 | - return array( |
|
98 | - __('The %s plugin was deactivated.', 'site-reviews'), |
|
99 | - __('This plugin requires %s or greater in order to work properly.', 'site-reviews'), |
|
100 | - __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews'), |
|
101 | - __('PHP version', 'site-reviews'), |
|
102 | - __('WordPress version', 'site-reviews'), |
|
103 | - __('Update WordPress', 'site-reviews'), |
|
104 | - __('You can use the %s plugin to restore %s to the previous version.', 'site-reviews'), |
|
105 | - ); |
|
106 | - } |
|
92 | + /** |
|
93 | + * @return array |
|
94 | + */ |
|
95 | + protected function getMessages() |
|
96 | + { |
|
97 | + return array( |
|
98 | + __('The %s plugin was deactivated.', 'site-reviews'), |
|
99 | + __('This plugin requires %s or greater in order to work properly.', 'site-reviews'), |
|
100 | + __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews'), |
|
101 | + __('PHP version', 'site-reviews'), |
|
102 | + __('WordPress version', 'site-reviews'), |
|
103 | + __('Update WordPress', 'site-reviews'), |
|
104 | + __('You can use the %s plugin to restore %s to the previous version.', 'site-reviews'), |
|
105 | + ); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * @param string $pluginName |
|
110 | - * @return void |
|
111 | - */ |
|
112 | - protected function printNotice($pluginName) |
|
113 | - { |
|
114 | - $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
|
115 | - $messages = $this->getMessages(); |
|
116 | - $rollbackMessage = sprintf('<strong>'.$messages[6].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName); |
|
117 | - if (!$this->isPhpValid()) { |
|
118 | - printf($noticeTemplate, |
|
119 | - sprintf($messages[0], $pluginName), |
|
120 | - sprintf($messages[1], $messages[3].' '.$this->versions['php']), |
|
121 | - sprintf($messages[2], PHP_VERSION).'</p><p>'.$rollbackMessage |
|
122 | - ); |
|
123 | - } elseif (!$this->isWpValid()) { |
|
124 | - printf($noticeTemplate, |
|
125 | - sprintf($messages[0], $pluginName), |
|
126 | - sprintf($messages[1], $messages[4].' '.$this->versions['wordpress']), |
|
127 | - $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages[5]) |
|
128 | - ); |
|
129 | - } |
|
130 | - } |
|
108 | + /** |
|
109 | + * @param string $pluginName |
|
110 | + * @return void |
|
111 | + */ |
|
112 | + protected function printNotice($pluginName) |
|
113 | + { |
|
114 | + $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
|
115 | + $messages = $this->getMessages(); |
|
116 | + $rollbackMessage = sprintf('<strong>'.$messages[6].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName); |
|
117 | + if (!$this->isPhpValid()) { |
|
118 | + printf($noticeTemplate, |
|
119 | + sprintf($messages[0], $pluginName), |
|
120 | + sprintf($messages[1], $messages[3].' '.$this->versions['php']), |
|
121 | + sprintf($messages[2], PHP_VERSION).'</p><p>'.$rollbackMessage |
|
122 | + ); |
|
123 | + } elseif (!$this->isWpValid()) { |
|
124 | + printf($noticeTemplate, |
|
125 | + sprintf($messages[0], $pluginName), |
|
126 | + sprintf($messages[1], $messages[4].' '.$this->versions['wordpress']), |
|
127 | + $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages[5]) |
|
128 | + ); |
|
129 | + } |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * @return void |
|
134 | - */ |
|
135 | - protected function redirect() |
|
136 | - { |
|
137 | - wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
138 | - filter_input(INPUT_GET, 'plugin_status'), |
|
139 | - filter_input(INPUT_GET, 'paged'), |
|
140 | - filter_input(INPUT_GET, 's') |
|
141 | - ))); |
|
142 | - exit; |
|
143 | - } |
|
132 | + /** |
|
133 | + * @return void |
|
134 | + */ |
|
135 | + protected function redirect() |
|
136 | + { |
|
137 | + wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
138 | + filter_input(INPUT_GET, 'plugin_status'), |
|
139 | + filter_input(INPUT_GET, 'paged'), |
|
140 | + filter_input(INPUT_GET, 's') |
|
141 | + ))); |
|
142 | + exit; |
|
143 | + } |
|
144 | 144 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -defined('WPINC') || die; |
|
3 | +defined( 'WPINC' ) || die; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Check for minimum system requirments on plugin activation. |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @param string $file |
26 | 26 | */ |
27 | - public function __construct($file, array $versions = array()) |
|
27 | + public function __construct( $file, array $versions = array() ) |
|
28 | 28 | { |
29 | - $this->file = realpath($file); |
|
30 | - $this->versions = wp_parse_args($versions, array( |
|
29 | + $this->file = realpath( $file ); |
|
30 | + $this->versions = wp_parse_args( $versions, array( |
|
31 | 31 | 'php' => static::MIN_PHP_VERSION, |
32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
33 | - )); |
|
33 | + ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function canProceed() |
40 | 40 | { |
41 | - if ($this->isValid()) { |
|
41 | + if( $this->isValid() ) { |
|
42 | 42 | return true; |
43 | 43 | } |
44 | - add_action('activated_plugin', array($this, 'deactivate')); |
|
45 | - add_action('admin_notices', array($this, 'deactivate')); |
|
44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function isPhpValid() |
53 | 53 | { |
54 | - return !version_compare(PHP_VERSION, $this->versions['php'], '<'); |
|
54 | + return !version_compare( PHP_VERSION, $this->versions['php'], '<' ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -68,25 +68,25 @@ discard block |
||
68 | 68 | public function isWpValid() |
69 | 69 | { |
70 | 70 | global $wp_version; |
71 | - return !version_compare($wp_version, $this->versions['wordpress'], '<'); |
|
71 | + return !version_compare( $wp_version, $this->versions['wordpress'], '<' ); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @param string $plugin |
76 | 76 | * @return void |
77 | 77 | */ |
78 | - public function deactivate($plugin) |
|
78 | + public function deactivate( $plugin ) |
|
79 | 79 | { |
80 | - if ($this->isValid()) { |
|
80 | + if( $this->isValid() ) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | - $pluginSlug = plugin_basename($this->file); |
|
84 | - if ($plugin == $pluginSlug) { |
|
83 | + $pluginSlug = plugin_basename( $this->file ); |
|
84 | + if( $plugin == $pluginSlug ) { |
|
85 | 85 | $this->redirect(); //exit |
86 | 86 | } |
87 | - $pluginData = get_file_data($this->file, array('name' => 'Plugin Name'), 'plugin'); |
|
88 | - deactivate_plugins($pluginSlug); |
|
89 | - $this->printNotice($pluginData['name']); |
|
87 | + $pluginData = get_file_data( $this->file, array( 'name' => 'Plugin Name' ), 'plugin' ); |
|
88 | + deactivate_plugins( $pluginSlug ); |
|
89 | + $this->printNotice( $pluginData['name'] ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | protected function getMessages() |
96 | 96 | { |
97 | 97 | return array( |
98 | - __('The %s plugin was deactivated.', 'site-reviews'), |
|
99 | - __('This plugin requires %s or greater in order to work properly.', 'site-reviews'), |
|
100 | - __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews'), |
|
101 | - __('PHP version', 'site-reviews'), |
|
102 | - __('WordPress version', 'site-reviews'), |
|
103 | - __('Update WordPress', 'site-reviews'), |
|
104 | - __('You can use the %s plugin to restore %s to the previous version.', 'site-reviews'), |
|
98 | + __( 'The %s plugin was deactivated.', 'site-reviews' ), |
|
99 | + __( 'This plugin requires %s or greater in order to work properly.', 'site-reviews' ), |
|
100 | + __( 'Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews' ), |
|
101 | + __( 'PHP version', 'site-reviews' ), |
|
102 | + __( 'WordPress version', 'site-reviews' ), |
|
103 | + __( 'Update WordPress', 'site-reviews' ), |
|
104 | + __( 'You can use the %s plugin to restore %s to the previous version.', 'site-reviews' ), |
|
105 | 105 | ); |
106 | 106 | } |
107 | 107 | |
@@ -109,22 +109,22 @@ discard block |
||
109 | 109 | * @param string $pluginName |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - protected function printNotice($pluginName) |
|
112 | + protected function printNotice( $pluginName ) |
|
113 | 113 | { |
114 | 114 | $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
115 | 115 | $messages = $this->getMessages(); |
116 | - $rollbackMessage = sprintf('<strong>'.$messages[6].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName); |
|
117 | - if (!$this->isPhpValid()) { |
|
118 | - printf($noticeTemplate, |
|
119 | - sprintf($messages[0], $pluginName), |
|
120 | - sprintf($messages[1], $messages[3].' '.$this->versions['php']), |
|
121 | - sprintf($messages[2], PHP_VERSION).'</p><p>'.$rollbackMessage |
|
116 | + $rollbackMessage = sprintf( '<strong>'.$messages[6].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName ); |
|
117 | + if( !$this->isPhpValid() ) { |
|
118 | + printf( $noticeTemplate, |
|
119 | + sprintf( $messages[0], $pluginName ), |
|
120 | + sprintf( $messages[1], $messages[3].' '.$this->versions['php'] ), |
|
121 | + sprintf( $messages[2], PHP_VERSION ).'</p><p>'.$rollbackMessage |
|
122 | 122 | ); |
123 | - } elseif (!$this->isWpValid()) { |
|
124 | - printf($noticeTemplate, |
|
125 | - sprintf($messages[0], $pluginName), |
|
126 | - sprintf($messages[1], $messages[4].' '.$this->versions['wordpress']), |
|
127 | - $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages[5]) |
|
123 | + } elseif( !$this->isWpValid() ) { |
|
124 | + printf( $noticeTemplate, |
|
125 | + sprintf( $messages[0], $pluginName ), |
|
126 | + sprintf( $messages[1], $messages[4].' '.$this->versions['wordpress'] ), |
|
127 | + $rollbackMessage.'</p><p>'.sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] ) |
|
128 | 128 | ); |
129 | 129 | } |
130 | 130 | } |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function redirect() |
136 | 136 | { |
137 | - wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
138 | - filter_input(INPUT_GET, 'plugin_status'), |
|
139 | - filter_input(INPUT_GET, 'paged'), |
|
140 | - filter_input(INPUT_GET, 's') |
|
141 | - ))); |
|
137 | + wp_safe_redirect( self_admin_url( sprintf( 'plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
138 | + filter_input( INPUT_GET, 'plugin_status' ), |
|
139 | + filter_input( INPUT_GET, 'paged' ), |
|
140 | + filter_input( INPUT_GET, 's' ) |
|
141 | + ) ) ); |
|
142 | 142 | exit; |
143 | 143 | } |
144 | 144 | } |
@@ -120,7 +120,8 @@ |
||
120 | 120 | sprintf($messages[1], $messages[3].' '.$this->versions['php']), |
121 | 121 | sprintf($messages[2], PHP_VERSION).'</p><p>'.$rollbackMessage |
122 | 122 | ); |
123 | - } elseif (!$this->isWpValid()) { |
|
123 | + } |
|
124 | + elseif (!$this->isWpValid()) { |
|
124 | 125 | printf($noticeTemplate, |
125 | 126 | sprintf($messages[0], $pluginName), |
126 | 127 | sprintf($messages[1], $messages[4].' '.$this->versions['wordpress']), |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="glsr-form-wrap"> |
4 | 4 | <form class="{{ class }}" id="{{ id }}" method="post" enctype="multipart/form-data"> |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="glsr-form-message {{ class }}"> |
4 | 4 | {{ message }} |
@@ -5,23 +5,23 @@ |
||
5 | 5 | require_once ABSPATH.WPINC.'/class-phpass.php'; |
6 | 6 | |
7 | 7 | spl_autoload_register(function ($className) { |
8 | - $namespaces = [ |
|
9 | - 'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/', |
|
10 | - 'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/', |
|
11 | - 'GeminiLabs\\Sepia\\PoParser\\' => __DIR__.'/vendors/sepia/po-parser/', |
|
12 | - 'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/', |
|
13 | - 'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/', |
|
14 | - ]; |
|
15 | - foreach ($namespaces as $prefix => $baseDir) { |
|
16 | - $len = strlen($prefix); |
|
17 | - if (0 !== strncmp($prefix, $className, $len)) { |
|
18 | - continue; |
|
19 | - } |
|
20 | - $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php'; |
|
21 | - if (!file_exists($file)) { |
|
22 | - continue; |
|
23 | - } |
|
24 | - require $file; |
|
25 | - break; |
|
26 | - } |
|
8 | + $namespaces = [ |
|
9 | + 'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/', |
|
10 | + 'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/', |
|
11 | + 'GeminiLabs\\Sepia\\PoParser\\' => __DIR__.'/vendors/sepia/po-parser/', |
|
12 | + 'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/', |
|
13 | + 'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/', |
|
14 | + ]; |
|
15 | + foreach ($namespaces as $prefix => $baseDir) { |
|
16 | + $len = strlen($prefix); |
|
17 | + if (0 !== strncmp($prefix, $className, $len)) { |
|
18 | + continue; |
|
19 | + } |
|
20 | + $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php'; |
|
21 | + if (!file_exists($file)) { |
|
22 | + continue; |
|
23 | + } |
|
24 | + require $file; |
|
25 | + break; |
|
26 | + } |
|
27 | 27 | }); |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -defined('WPINC') || die; |
|
3 | +defined( 'WPINC' ) || die; |
|
4 | 4 | |
5 | 5 | require_once ABSPATH.WPINC.'/class-phpass.php'; |
6 | 6 | |
7 | -spl_autoload_register(function ($className) { |
|
7 | +spl_autoload_register( function( $className ) { |
|
8 | 8 | $namespaces = [ |
9 | 9 | 'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/', |
10 | 10 | 'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/', |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | 'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/', |
13 | 13 | 'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/', |
14 | 14 | ]; |
15 | - foreach ($namespaces as $prefix => $baseDir) { |
|
16 | - $len = strlen($prefix); |
|
17 | - if (0 !== strncmp($prefix, $className, $len)) { |
|
15 | + foreach( $namespaces as $prefix => $baseDir ) { |
|
16 | + $len = strlen( $prefix ); |
|
17 | + if( 0 !== strncmp( $prefix, $className, $len ) ) { |
|
18 | 18 | continue; |
19 | 19 | } |
20 | - $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php'; |
|
21 | - if (!file_exists($file)) { |
|
20 | + $file = $baseDir.str_replace( '\\', '/', substr( $className, $len ) ).'.php'; |
|
21 | + if( !file_exists( $file ) ) { |
|
22 | 22 | continue; |
23 | 23 | } |
24 | 24 | require $file; |