@@ -79,7 +79,9 @@ |
||
79 | 79 | */ |
80 | 80 | public function deactivate( $plugin ) |
81 | 81 | { |
82 | - if( static::isValid() )return; |
|
82 | + if( static::isValid() ) { |
|
83 | + return; |
|
84 | + } |
|
83 | 85 | $pluginSlug = plugin_basename( static::$file ); |
84 | 86 | if( $plugin == $pluginSlug ) { |
85 | 87 | $this->redirect(); //exit |
@@ -2,15 +2,20 @@ |
||
2 | 2 | |
3 | 3 | defined( 'WPINC' ) || die; |
4 | 4 | |
5 | -spl_autoload_register( function( $className ) { |
|
5 | +spl_autoload_register( function( $className ) |
|
6 | +{ |
|
6 | 7 | $namespaces = array( |
7 | 8 | 'GeminiLabs\\Logger\\' => __DIR__.'/plugin/', |
8 | 9 | ); |
9 | 10 | foreach( $namespaces as $prefix => $base_dir ) { |
10 | 11 | $len = strlen( $prefix ); |
11 | - if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
|
12 | + if( strncmp( $prefix, $className, $len ) !== 0 ) { |
|
13 | + continue; |
|
14 | + } |
|
12 | 15 | $file = $base_dir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
13 | - if( !file_exists( $file ))continue; |
|
16 | + if( !file_exists( $file )) { |
|
17 | + continue; |
|
18 | + } |
|
14 | 19 | require $file; |
15 | 20 | break; |
16 | 21 | } |
@@ -21,14 +21,17 @@ |
||
21 | 21 | require_once __DIR__.'/activate.php'; |
22 | 22 | } |
23 | 23 | require_once __DIR__.'/autoload.php'; |
24 | -if( GL_Plugin_Check::shouldDeactivate( __FILE__ ))return; |
|
24 | +if( GL_Plugin_Check::shouldDeactivate( __FILE__ )) { |
|
25 | + return; |
|
26 | +} |
|
25 | 27 | GeminiLabs\Logger\Application::load()->init(); |
26 | 28 | |
27 | 29 | /** |
28 | 30 | * @param mixed $message |
29 | 31 | * @return GeminiLabs\Logger\Log |
30 | 32 | */ |
31 | -function gllog( $message = null ) { |
|
33 | +function gllog( $message = null ) |
|
34 | +{ |
|
32 | 35 | $logger = GeminiLabs\Logger\Application::load()->log->logger(); |
33 | 36 | return func_num_args() > 0 |
34 | 37 | ? $logger->debug( func_get_arg(0) ) |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | 'name' => 'Plugin Name', |
40 | 40 | 'version' => 'Version', |
41 | 41 | ], 'plugin' ); |
42 | - array_walk( $plugin, function( $value, $key ) { |
|
42 | + array_walk( $plugin, function( $value, $key ) |
|
43 | + { |
|
43 | 44 | $this->$key = $value; |
44 | 45 | }); |
45 | 46 | } |
@@ -63,7 +64,9 @@ discard block |
||
63 | 64 | public function initLogger() |
64 | 65 | { |
65 | 66 | $args = func_get_args() + ['', null, 'debug']; |
66 | - if( $args[0] !== static::ID || is_null( $args[1] ))return; |
|
67 | + if( $args[0] !== static::ID || is_null( $args[1] )) { |
|
68 | + return; |
|
69 | + } |
|
67 | 70 | $this->log->log( $args[2], $args[1] ); |
68 | 71 | } |
69 | 72 | |
@@ -73,7 +76,9 @@ discard block |
||
73 | 76 | public function clearLog() |
74 | 77 | { |
75 | 78 | $request = filter_input( INPUT_POST, static::ID, FILTER_DEFAULT , FILTER_REQUIRE_ARRAY ); |
76 | - if( empty( $request['action'] ) || $request['action'] != 'clear-log' )return; |
|
79 | + if( empty( $request['action'] ) || $request['action'] != 'clear-log' ) { |
|
80 | + return; |
|
81 | + } |
|
77 | 82 | check_admin_referer( $request['action'] ); |
78 | 83 | $this->log->clear(); |
79 | 84 | add_action( 'admin_notices', [$this, 'renderNotice'] ); |
@@ -129,7 +134,9 @@ discard block |
||
129 | 134 | */ |
130 | 135 | public function render( $view, array $data = [] ) |
131 | 136 | { |
132 | - if( !file_exists( $file = $this->path( 'views/'.$view.'.php' )))return; |
|
137 | + if( !file_exists( $file = $this->path( 'views/'.$view.'.php' ))) { |
|
138 | + return; |
|
139 | + } |
|
133 | 140 | extract( $data ); |
134 | 141 | include $file; |
135 | 142 | } |