Passed
Push — develop ( ca8eef...8e4caa )
by Paul
03:11
created
helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if( !function_exists( 'pollux_app' )) {
3
+if( !function_exists( 'pollux_app' ) ) {
4 4
 	function pollux_app() {
5 5
 		return GeminiLabs\Pollux\Application::getInstance();
6 6
 	}
Please login to merge, or discard this patch.
thirdparty.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
  * Compatibility with Give WP plugin
5 5
  */
6 6
 add_filter( 'give_load_admin_scripts', function( $is_admin_page, $hook ) {
7
-	$needle = sprintf( '_page_%s', filter_input( INPUT_GET, 'page' ));
8
-	return substr( $hook, - strlen( $needle )) !== $needle
7
+	$needle = sprintf( '_page_%s', filter_input( INPUT_GET, 'page' ) );
8
+	return substr( $hook, - strlen( $needle ) ) !== $needle
9 9
 		? $is_admin_page
10 10
 		: true;
11 11
 }, 10, 2 );
Please login to merge, or discard this patch.
activate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 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
 	/**
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 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
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			filter_input( INPUT_GET, 'plugin_status' ),
138 138
 			filter_input( INPUT_GET, 'paged' ),
139 139
 			filter_input( INPUT_GET, 's' )
140
-		)));
140
+		) ) );
141 141
 		exit;
142 142
 	}
143 143
 }
Please login to merge, or discard this patch.
src/MetaBox/PostMetaManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function get( $metaKey, array $args = [] )
20 20
 	{
21
-		if( empty( $metaKey ))return;
21
+		if( empty($metaKey) )return;
22 22
 
23 23
 		$args = $this->normalize( $args );
24 24
 		$metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
25 25
 		$metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] );
26 26
 
27
-		if( is_string( $metaValue )) {
27
+		if( is_string( $metaValue ) ) {
28 28
 			$metaValue = trim( $metaValue );
29 29
 		}
30
-		return empty( $metaValue )
30
+		return empty($metaValue)
31 31
 			? $args['fallback']
32 32
 			: $metaValue;
33 33
 	}
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	protected function buildMetaKey( $metaKey, $prefix )
41 41
 	{
42
-		return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ))
42
+		return (substr( $metaKey, 0, 1 ) == '_' && !empty($prefix))
43 43
 			? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey )
44
-			: $prefix . $metaKey;
44
+			: $prefix.$metaKey;
45 45
 	}
46 46
 
47 47
 	/**
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
 			'single'   => true,
56 56
 			'prefix'   => Application::prefix(),
57 57
 		];
58
-		return shortcode_atts( $defaults, array_change_key_case( $args ));
58
+		return shortcode_atts( $defaults, array_change_key_case( $args ) );
59 59
 	}
60 60
 }
Please login to merge, or discard this patch.
src/MetaBox/SiteMetaManager.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$args = array_pad( $args, 2, null );
32 32
 		$group = $this->$group;
33
-		if( is_object( $group )) {
33
+		if( is_object( $group ) ) {
34 34
 			return $group;
35 35
 		}
36 36
 		return $this->get( $group, $args[0], $args[1] );
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 	public function __get( $group )
44 44
 	{
45 45
 		if( $group == 'all' ) {
46
-			return (object) $this->options;
46
+			return (object)$this->options;
47 47
 		}
48
-		if( empty( $group )) {
48
+		if( empty($group) ) {
49 49
 			$group = $this->getDefaultGroup();
50 50
 		}
51
-		if( is_array( $group )) {
51
+		if( is_array( $group ) ) {
52 52
 			$group = reset( $group );
53 53
 		}
54
-		return isset( $this->options[$group] )
54
+		return isset($this->options[$group])
55 55
 			? $this->options[$group]
56 56
 			: null;
57 57
 	}
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 		if( func_num_args() < 1 ) {
68 68
 			return $this->all;
69 69
 		}
70
-		if( is_string( $group )) {
70
+		if( is_string( $group ) ) {
71 71
 			$group = $this->$group;
72 72
 		}
73
-		if( !is_array( $group )) {
73
+		if( !is_array( $group ) ) {
74 74
 			return $fallback;
75 75
 		}
76
-		if( is_null( $key )) {
76
+		if( is_null( $key ) ) {
77 77
 			return $group;
78 78
 		}
79 79
 		return $this->getValue( $group, $key, $fallback );
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	protected function getValue( array $group, $key, $fallback )
96 96
 	{
97
-		if( !array_key_exists( $key, $group )) {
97
+		if( !array_key_exists( $key, $group ) ) {
98 98
 			return $fallback;
99 99
 		}
100
-		return empty( $group[$key] ) && !is_null( $fallback )
100
+		return empty($group[$key]) && !is_null( $fallback )
101 101
 			? $fallback
102 102
 			: $group[$key];
103 103
 	}
Please login to merge, or discard this patch.
src/MetaBox/Instruction.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		$instructions = array_reduce( $this->getInstructionGroups(), function( $html, $metabox ) {
24 24
 			$fields = $this->getInstructionFields( $metabox );
25
-			if( empty( $fields )) {
25
+			if( empty($fields) ) {
26 26
 				return $html;
27 27
 			}
28
-			return $html . sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>',
28
+			return $html.sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>',
29 29
 				$metabox['title'],
30 30
 				$fields
31 31
 			);
32 32
 		});
33
-		return $this->filter( 'before/instructions', '' ) . $instructions . $this->filter( 'after/instructions', '' );
33
+		return $this->filter( 'before/instructions', '' ).$instructions.$this->filter( 'after/instructions', '' );
34 34
 	}
35 35
 
36 36
 	/**
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	protected function getInstructionFields( $metabox )
40 40
 	{
41 41
 		$skipFields = ['custom_html', 'divider', 'heading', 'taxonomy'];
42
-		return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox, $skipFields ) {
42
+		return array_reduce( $metabox['fields'], function( $html, $field ) use($metabox, $skipFields) {
43 43
 			return $this->validate( $field['condition'] ) && !in_array( $field['type'], $skipFields )
44
-				? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL
44
+				? $html.$this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ).PHP_EOL
45 45
 				: $html;
46 46
 		});
47 47
 	}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) {
87 87
 			return $this->show( false, $metabox );
88
-		})) > 0 );
88
+		}) ) > 0 );
89 89
 	}
90 90
 
91 91
 	/**
Please login to merge, or discard this patch.
src/Notice.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		$method = strtolower( $name );
31 31
 		$status = substr( $method, 3 );
32
-		if( 'add' == substr( $method, 0, 3 ) && in_array( $status, ['error', 'info', 'success', 'warning'] )) {
33
-			return call_user_func_array( [$this, 'addNotice'], array_merge( [$status], $args ));
32
+		if( 'add' == substr( $method, 0, 3 ) && in_array( $status, ['error', 'info', 'success', 'warning'] ) ) {
33
+			return call_user_func_array( [$this, 'addNotice'], array_merge( [$status], $args ) );
34 34
 		}
35
-		throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ));
35
+		throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ) );
36 36
 	}
37 37
 
38 38
 	public function __get( $property )
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		if( $property == 'all' ) {
41 41
 			return $this->app->notices;
42 42
 		}
43
-		throw new Exception( sprintf( 'Not a valid property: %s', $property ));
43
+		throw new Exception( sprintf( 'Not a valid property: %s', $property ) );
44 44
 	}
45 45
 
46 46
 	/**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function activateButton( array $plugin )
50 50
 	{
51
-		$actionUrl = self_admin_url( sprintf( 'options-general.php?page=%s&action=activate&plugin=%s', $this->app->id, $plugin['plugin'] ));
51
+		$actionUrl = self_admin_url( sprintf( 'options-general.php?page=%s&action=activate&plugin=%s', $this->app->id, $plugin['plugin'] ) );
52 52
 		return $this->button( sprintf( '%s %s', __( 'Activate', 'pollux' ), $plugin['name'] ), [
53 53
 			'data-name' => $plugin['name'],
54 54
 			'data-plugin' => $plugin['plugin'],
55 55
 			'data-slug' => $plugin['slug'],
56
-			'href' => wp_nonce_url( $actionUrl, sprintf( 'activate-plugin_%s', $plugin['plugin'] )),
57
-		]);
56
+			'href' => wp_nonce_url( $actionUrl, sprintf( 'activate-plugin_%s', $plugin['plugin'] ) ),
57
+		] );
58 58
 	}
59 59
 
60 60
 	/**
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 		$atts = wp_parse_args( $atts, [
67 67
 			'class' => '',
68 68
 			'href' => '',
69
-		]);
70
-		$atts['class'] = trim( $atts['class'] . ' button button-small' );
71
-		$attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use( $atts ) {
72
-			return $carry . sprintf( ' %s="%s"', $key, $atts[$key] );
69
+		] );
70
+		$atts['class'] = trim( $atts['class'].' button button-small' );
71
+		$attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use($atts) {
72
+			return $carry.sprintf( ' %s="%s"', $key, $atts[$key] );
73 73
 		});
74 74
 		return sprintf( '<a%s>%s</a>', $attributes, $title );
75 75
 	}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		if( $unset ) {
83 83
 			$index = array_search( $notice, $this->app->notices );
84 84
 			if( $index !== false ) {
85
-				unset( $this->app->notices[$index] );
85
+				unset($this->app->notices[$index]);
86 86
 			}
87 87
 		}
88 88
 		return $this->buildNotice( $notice );
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function installButton( array $plugin )
95 95
 	{
96
-		$actionUrl = self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', $plugin['slug'] ));
96
+		$actionUrl = self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', $plugin['slug'] ) );
97 97
 		return $this->button( sprintf( '%s %s', __( 'Install', 'pollux' ), $plugin['name'] ), [
98 98
 			'data-name' => $plugin['name'],
99 99
 			'data-plugin' => $plugin['plugin'],
100 100
 			'data-slug' => $plugin['slug'],
101
-			'href' => wp_nonce_url( $actionUrl, sprintf( 'install-plugin_%s', $plugin['slug'] )),
102
-		]);
101
+			'href' => wp_nonce_url( $actionUrl, sprintf( 'install-plugin_%s', $plugin['slug'] ) ),
102
+		] );
103 103
 	}
104 104
 
105 105
 	/**
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function updateButton( array $plugin )
109 109
 	{
110
-		$actionUrl = self_admin_url( sprintf( 'update.php?action=upgrade-plugin&plugin=%s', $plugin['plugin'] ));
110
+		$actionUrl = self_admin_url( sprintf( 'update.php?action=upgrade-plugin&plugin=%s', $plugin['plugin'] ) );
111 111
 		return $this->button( sprintf( '%s %s', __( 'Update', 'pollux' ), $plugin['name'] ), [
112 112
 			'data-name' => $plugin['name'],
113 113
 			'data-plugin' => $plugin['plugin'],
114 114
 			'data-slug' => $plugin['slug'],
115
-			'href' => wp_nonce_url( $actionUrl, sprintf( 'upgrade-plugin_%s', $plugin['plugin'] )),
116
-		]);
115
+			'href' => wp_nonce_url( $actionUrl, sprintf( 'upgrade-plugin_%s', $plugin['plugin'] ) ),
116
+		] );
117 117
 	}
118 118
 
119 119
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	{
136 136
 		$this->app->notices[] = [
137 137
 			'dismissible' => $dismissible,
138
-			'message' => $this->buildMessage( array_filter( (array) $messages )),
138
+			'message' => $this->buildMessage( array_filter( (array)$messages ) ),
139 139
 			'type' => $type,
140 140
 		];
141 141
 		$this->app->notices = array_unique( $this->app->notices, SORT_REGULAR );
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	protected function buildMessage( array $messages )
148 148
 	{
149 149
 		foreach( $messages as $key => &$message ) {
150
-			if( !is_wp_error( $message ))continue;
150
+			if( !is_wp_error( $message ) )continue;
151 151
 			$message = $message->get_error_message();
152 152
 		}
153
-		return wpautop( implode( PHP_EOL . PHP_EOL, $messages ));
153
+		return wpautop( implode( PHP_EOL.PHP_EOL, $messages ) );
154 154
 	}
155 155
 
156 156
 	/**
Please login to merge, or discard this patch.
src/AliasLoader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function getInstance( array $aliases = [] )
42 42
 	{
43
-		if( is_null( static::$instance )) {
44
-			return static::$instance = new static( $aliases );
43
+		if( is_null( static::$instance ) ) {
44
+			return static::$instance = new static($aliases);
45 45
 		}
46 46
 
47 47
 		$aliases = array_merge( static::$instance->aliases, $aliases );
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function load( $alias )
62 62
 	{
63
-		if( isset( $this->aliases[$alias] )) {
63
+		if( isset($this->aliases[$alias]) ) {
64 64
 			return class_alias( $this->aliases[$alias], $alias );
65 65
 		}
66 66
 	}
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public function __construct()
33 33
 	{
34
-		$this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' );
35
-		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ));
34
+		$this->file = realpath( dirname( dirname( __FILE__ ) ).'/pollux.php' );
35
+		$this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) );
36 36
 
37 37
 		$data = get_file_data( $this->file, array(
38 38
 			'id' => 'Text Domain',
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 		add_action( 'plugins_loaded', function() {
59 59
 			$this->bootstrap();
60 60
 		});
61
-		add_action( 'admin_enqueue_scripts',           array( $controller, 'registerAssets' ));
62
-		add_action( 'admin_init',                      array( $controller, 'removeDashboardWidgets' ));
63
-		add_action( 'wp_before_admin_bar_render',      array( $controller, 'removeWordPressMenu' ));
64
-		add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' ));
65
-		add_filter( 'admin_footer_text',               array( $controller, 'filterWordPressFooter' ));
61
+		add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) );
62
+		add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) );
63
+		add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) );
64
+		add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' ) );
65
+		add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) );
66 66
 
67 67
 		// Disallow indexing of the site on non-production environments
68 68
 		if( !$this->environment( 'production' ) && !is_admin() ) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	public function environment( $checkFor = '' )
78 78
 	{
79 79
 		$environment = defined( 'WP_ENV' ) ? WP_ENV : 'production';
80
-		if( !empty( $checkFor )) {
80
+		if( !empty($checkFor) ) {
81 81
 			return $environment == $checkFor;
82 82
 		}
83 83
 		return $environment;
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
 		$theme = wp_get_theme();
93 93
 		$filename = apply_filters( 'pollux/file', $filename );
94 94
 		$locations = apply_filters( 'pollux/file/locations', [
95
-			trailingslashit( trailingslashit( $theme->theme_root ) . $theme->stylesheet ),
96
-			trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ),
95
+			trailingslashit( trailingslashit( $theme->theme_root ).$theme->stylesheet ),
96
+			trailingslashit( trailingslashit( $theme->theme_root ).$theme->template ),
97 97
 			trailingslashit( WP_CONTENT_DIR ),
98 98
 			trailingslashit( ABSPATH ),
99
-			trailingslashit( dirname( ABSPATH )),
100
-			trailingslashit( dirname( dirname( ABSPATH ))),
101
-		]);
102
-		foreach( (array) $locations as $location ) {
103
-			if( !file_exists( $location . $filename ))continue;
104
-			return $location . $filename;
99
+			trailingslashit( dirname( ABSPATH ) ),
100
+			trailingslashit( dirname( dirname( ABSPATH ) ) ),
101
+		] );
102
+		foreach( (array)$locations as $location ) {
103
+			if( !file_exists( $location.$filename ) )continue;
104
+			return $location.$filename;
105 105
 		}
106 106
 		return null;
107 107
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function path( $file = '' )
128 128
 	{
129
-		return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' );
129
+		return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' );
130 130
 	}
131 131
 
132 132
 	/**
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	public function render( $view, array $data = [] )
137 137
 	{
138 138
 		$file = apply_filters( 'pollux/views/file',
139
-			$this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))),
139
+			$this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ),
140 140
 			$view,
141 141
 			$data
142 142
 		);
143
-		if( !file_exists( $file ))return;
143
+		if( !file_exists( $file ) )return;
144 144
 		extract( $data );
145 145
 		include $file;
146 146
 	}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function url( $path = '' )
153 153
 	{
154
-		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ));
154
+		return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
155 155
 	}
156 156
 
157 157
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function loadHooks()
186 186
 	{
187
-		if( $file = $this->getFile( 'pollux-hooks.php' )) {
187
+		if( $file = $this->getFile( 'pollux-hooks.php' ) ) {
188 188
 			include_once $file;
189 189
 		}
190 190
 	}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	protected function loadTextdomain()
196 196
 	{
197
-		load_plugin_textdomain( $this->id, false, plugin_basename( $this->path() ) . '/languages/' );
197
+		load_plugin_textdomain( $this->id, false, plugin_basename( $this->path() ).'/languages/' );
198 198
 	}
199 199
 
200 200
 	/**
@@ -206,6 +206,6 @@  discard block
 block discarded – undo
206 206
 			'ArchiveMeta' => 'GeminiLabs\Pollux\Facades\ArchiveMeta',
207 207
 			'PostMeta' => 'GeminiLabs\Pollux\Facades\PostMeta',
208 208
 			'SiteMeta' => 'GeminiLabs\Pollux\Facades\SiteMeta',
209
-		)))->register();
209
+		) ) )->register();
210 210
 	}
211 211
 }
Please login to merge, or discard this patch.