Cancelled
Push — master ( af90a2...865e4f )
by Paul
02:28
created
views/settings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 		<input type="hidden" id="enabled" name="<?= $id; ?>[enabled]" value="<?= wp_validate_boolean( $settings->enabled ) ? 0 : 1; ?>">
21 21
 		<input type="submit" name="submit" id="submit" class="button button-primary" value="<?= wp_validate_boolean( $settings->enabled ) ? __( 'Disable Logging', 'logger' ) : __( 'Enable Logging', 'logger' ); ?>">
22 22
 	</form>
23
-	<?php if( wp_validate_boolean( $settings->enabled )) : ?>
23
+	<?php if( wp_validate_boolean( $settings->enabled ) ) : ?>
24 24
 	<br>
25 25
 	<form method="post">
26 26
 		<textarea class="large-text code" rows="20" id="log-file" onclick="this.select()" readonly><?= $log; ?></textarea>
Please login to merge, or discard this patch.
logger.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 
18 18
 defined( 'WPINC' ) || die;
19 19
 
20
-if( !class_exists( 'GL_Plugin_Check' )) {
21
-	require_once __DIR__.'/activate.php';
20
+if( !class_exists( 'GL_Plugin_Check' ) ) {
21
+	require_once __DIR__ . '/activate.php';
22 22
 }
23
-require_once __DIR__.'/autoload.php';
24
-if( GL_Plugin_Check::shouldDeactivate( __FILE__ ))return;
23
+require_once __DIR__ . '/autoload.php';
24
+if( GL_Plugin_Check::shouldDeactivate( __FILE__ ) )return;
25 25
 GeminiLabs\Logger\Application::load()->init();
26 26
 
27 27
 /**
@@ -31,6 +31,6 @@  discard block
 block discarded – undo
31 31
 function gllog( $message = null ) {
32 32
 	$logger = GeminiLabs\Logger\Application::load()->log->logger();
33 33
 	return func_num_args() > 0
34
-		? $logger->debug( func_get_arg(0) )
34
+		? $logger->debug( func_get_arg( 0 ) )
35 35
 		: $logger;
36 36
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,14 +21,17 @@
 block discarded – undo
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) )
Please login to merge, or discard this patch.
plugin/Application.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public static function load()
23 23
 	{
24
-		if( empty( static::$instance )) {
24
+		if( empty( static::$instance ) ) {
25 25
 			static::$instance = new static;
26 26
 		}
27 27
 		return static::$instance;
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct()
34 34
 	{
35
-		$this->file = trailingslashit( dirname( __DIR__ )).static::ID.'.php';
36
-		$this->log = new Log( $this->path( 'development.log' ));
35
+		$this->file = trailingslashit( dirname( __DIR__ ) ) . static::ID . '.php';
36
+		$this->log = new Log( $this->path( 'development.log' ) );
37 37
 		$plugin = get_file_data( $this->file, [
38 38
 			'languages' => 'Domain Path',
39 39
 			'name' => 'Plugin Name',
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function init()
51 51
 	{
52
-		add_action( 'admin_init',     [$this, 'clearLog'] );
53
-		add_action( 'plugins_loaded', [$this, 'registerLanguages'] );
54
-		add_action( 'admin_menu',     [$this, 'registerMenu'] );
55
-		add_action( 'admin_menu',     [$this, 'registerSettings'] );
56
-		add_filter( 'all',            [$this, 'initLogger'] );
52
+		add_action( 'admin_init', [ $this, 'clearLog' ] );
53
+		add_action( 'plugins_loaded', [ $this, 'registerLanguages' ] );
54
+		add_action( 'admin_menu', [ $this, 'registerMenu' ] );
55
+		add_action( 'admin_menu', [ $this, 'registerSettings' ] );
56
+		add_filter( 'all', [ $this, 'initLogger' ] );
57 57
 	}
58 58
 
59 59
 	/**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function initLogger()
64 64
 	{
65
-		if( func_get_arg(0) != static::ID )return;
66
-		$type = func_get_arg(2)
67
-			? func_get_arg(2)
65
+		if( func_get_arg( 0 ) != static::ID )return;
66
+		$type = func_get_arg( 2 )
67
+			? func_get_arg( 2 )
68 68
 			: 'debug';
69
-		$this->log->log( $type, func_get_arg(1) );
69
+		$this->log->log( $type, func_get_arg( 1 ) );
70 70
 	}
71 71
 
72 72
 	/**
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function clearLog()
76 76
 	{
77
-		$request = filter_input( INPUT_POST, static::ID, FILTER_DEFAULT , FILTER_REQUIRE_ARRAY );
78
-		if( empty( $request['action'] ) || $request['action'] != 'clear-log' )return;
79
-		check_admin_referer( $request['action'] );
77
+		$request = filter_input( INPUT_POST, static::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
78
+		if( empty( $request[ 'action' ] ) || $request[ 'action' ] != 'clear-log' )return;
79
+		check_admin_referer( $request[ 'action' ] );
80 80
 		$this->log->clear();
81
-		add_action( 'admin_notices', [$this, 'renderNotice'] );
81
+		add_action( 'admin_notices', [ $this, 'renderNotice' ] );
82 82
 	}
83 83
 
84 84
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function path( $file = '' )
89 89
 	{
90
-		return realpath( plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' ));
90
+		return realpath( plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' ) );
91 91
 	}
92 92
 
93 93
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	public function registerLanguages()
97 97
 	{
98 98
 		load_plugin_textdomain( static::ID, '',
99
-			trailingslashit( plugin_basename( $this->path() ).'/'.$this->languages )
99
+			trailingslashit( plugin_basename( $this->path() ) . '/' . $this->languages )
100 100
 		);
101 101
 	}
102 102
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			__( 'Logger', 'logger' ),
113 113
 			'manage_options',
114 114
 			static::ID,
115
-			[$this, 'renderSettingsPage']
115
+			[ $this, 'renderSettingsPage' ]
116 116
 		);
117 117
 	}
118 118
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 * @param string $view
130 130
 	 * @return void|null
131 131
 	 */
132
-	public function render( $view, array $data = [] )
132
+	public function render( $view, array $data = [ ] )
133 133
 	{
134
-		if( !file_exists( $file = $this->path( 'views/'.$view.'.php' )))return;
134
+		if( !file_exists( $file = $this->path( 'views/' . $view . '.php' ) ) )return;
135 135
 		extract( $data );
136 136
 		include $file;
137 137
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		$this->render( 'notice', [
145 145
 			'notice' => __( 'The log was cleared.', 'logger' ),
146 146
 			'status' => 'success',
147
-		]);
147
+		] );
148 148
 	}
149 149
 
150 150
 	/**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'log' => $this->log,
159 159
 			'settings' => $this->getSettings(),
160 160
 			'title' => __( 'Logger', 'logger' ),
161
-		]);
161
+		] );
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	protected function getSettings()
168 168
 	{
169
-		$settings = get_option( static::ID, [] );
170
-		if( empty( $settings )) {
169
+		$settings = get_option( static::ID, [ ] );
170
+		if( empty( $settings ) ) {
171 171
 			update_option( static::ID, $settings = [
172 172
 				'enabled' => 0,
173
-			]);
173
+			] );
174 174
 		}
175
-		return (object)$settings;
175
+		return (object) $settings;
176 176
 	}
177 177
 }
Please login to merge, or discard this patch.