Completed
Push — develop ( 509eab...41e75c )
by Paul
04:07
created
src/AliasLoader.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
 	}
32 32
 
33 33
 	private function __clone()
34
-	{}
34
+	{
35
+}
35 36
 
36 37
 	/**
37 38
 	 * Get or create the singleton alias loader instance.
Please login to merge, or discard this 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/MetaBox/PostMetaManager.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function get( $metaKey, array $args = [] )
14 14
 	{
15
-		if( empty( $metaKey ))return;
15
+		if( empty( $metaKey )) {
16
+			return;
17
+		}
16 18
 
17 19
 		$args = $this->normalize( $args );
18 20
 		$metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] );
Please login to merge, or discard this 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.
helpers.php 2 patches
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.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if( !function_exists( 'pollux_app' )) {
4
-	function pollux_app() {
4
+	function pollux_app()
5
+	{
5 6
 		return GeminiLabs\Pollux\Application::getInstance();
6 7
 	}
7 8
 }
Please login to merge, or discard this patch.
src/Config/Config.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function init()
39 39
 	{
40
-		if( $this->app->config->disable_config )return;
40
+		if( $this->app->config->disable_config ) {
41
+			return;
42
+		}
41 43
 
42 44
 		add_action( 'admin_menu',     [$this, 'registerPage'] );
43 45
 		add_action( 'admin_menu',     [$this, 'registerSetting'] );
@@ -107,7 +109,9 @@  discard block
 block discarded – undo
107 109
 	{
108 110
 		if( filter_input( INPUT_GET, 'page' ) !== $this->app->id
109 111
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
110
-		)return;
112
+		) {
113
+			return;
114
+		}
111 115
 		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), static::id() )) {
112 116
 			delete_option( static::id() );
113 117
 			$this->app->make( ConfigManager::class )->compile( true );
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public static function id()
26 26
 	{
27
-		return Application::PREFIX . static::ID;
27
+		return Application::PREFIX.static::ID;
28 28
 	}
29 29
 
30 30
 	public function __construct( Application $app )
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	{
40 40
 		if( $this->app->config->disable_config )return;
41 41
 
42
-		add_action( 'admin_menu',     [$this, 'registerPage'] );
43
-		add_action( 'admin_menu',     [$this, 'registerSetting'] );
42
+		add_action( 'admin_menu', [$this, 'registerPage'] );
43
+		add_action( 'admin_menu', [$this, 'registerSetting'] );
44 44
 		add_action( 'current_screen', [$this, 'resetPage'] );
45 45
 	}
46 46
 
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 			'config' => $this->app->make( ConfigManager::class ),
95 95
 			'heading' => __( 'Pollux Settings', 'pollux' ),
96 96
 			'id' => static::id(),
97
-			'reset_url' => esc_url( add_query_arg( $query, admin_url( 'options-general.php' ))),
97
+			'reset_url' => esc_url( add_query_arg( $query, admin_url( 'options-general.php' ) ) ),
98 98
 			'has_meta_box' => $this->app->gatekeeper->hasDependency( 'meta-box/meta-box.php' ),
99
-		]);
99
+		] );
100 100
 	}
101 101
 
102 102
 	/**
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 		if( filter_input( INPUT_GET, 'page' ) !== $this->app->id
109 109
 			|| filter_input( INPUT_GET, 'action' ) !== 'reset'
110 110
 		)return;
111
-		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), static::id() )) {
111
+		if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), static::id() ) ) {
112 112
 			delete_option( static::id() );
113 113
 			$this->app->make( ConfigManager::class )->compile( true );
114 114
 			add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' );
115 115
 		}
116 116
 		else {
117
-			add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ));
117
+			add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ) );
118 118
 		}
119 119
 		set_transient( 'settings_errors', get_settings_errors(), 30 );
120
-		wp_safe_redirect( add_query_arg( 'settings-updated', 'true',  wp_get_referer() ));
120
+		wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() ) );
121 121
 		exit;
122 122
 	}
123 123
 }
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.
src/Controller.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function filterWordPressFooter( $text )
42 42
 	{
43
-		if( $this->app->config->remove_wordpress_footer )return;
43
+		if( $this->app->config->remove_wordpress_footer ) {
44
+			return;
45
+		}
44 46
 		return $text;
45 47
 	}
46 48
 
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 	 */
80 82
 	public function removeDashboardWidgets()
81 83
 	{
82
-		if( !$this->app->config->remove_dashboard_widgets )return;
84
+		if( !$this->app->config->remove_dashboard_widgets ) {
85
+			return;
86
+		}
83 87
 		$widgets = apply_filters( 'pollux/dashoard/widgets', [
84 88
 			'dashboard_primary',
85 89
 			'dashboard_quick_press',
@@ -95,7 +99,9 @@  discard block
 block discarded – undo
95 99
 	 */
96 100
 	public function removeWordPressMenu()
97 101
 	{
98
-		if( !$this->app->config->remove_wordpress_menu )return;
102
+		if( !$this->app->config->remove_wordpress_menu ) {
103
+			return;
104
+		}
99 105
 		global $wp_admin_bar;
100 106
 		$wp_admin_bar->remove_menu( 'wp-logo' );
101 107
 	}
@@ -122,7 +128,9 @@  discard block
 block discarded – undo
122 128
 	 */
123 129
 	protected function registerCodemirrorAssets( WP_Screen $screen )
124 130
 	{
125
-		if( $screen->id != 'settings_page_pollux' || $screen->pagenow != 'options-general.php' )return;
131
+		if( $screen->id != 'settings_page_pollux' || $screen->pagenow != 'options-general.php' ) {
132
+			return;
133
+		}
126 134
 		wp_enqueue_style( 'pollux/codemirror.css',
127 135
 			$this->app->url( 'assets/codemirror.css' ),
128 136
 			[],
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function filterPluginLinks( array $links )
29 29
 	{
30
-		$settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ));
30
+		$settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ) );
31 31
 		$links[] = $this->app->config->disable_config
32
-			? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ))
33
-			: sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ));
32
+			? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ) )
33
+			: sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ) );
34 34
 		return $links;
35 35
 	}
36 36
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function registerAssets()
52 52
 	{
53
-		$screen = ( new Helper )->getCurrentScreen();
53
+		$screen = (new Helper)->getCurrentScreen();
54 54
 
55 55
 		$this->registerArchiveAssets( $screen );
56 56
 		$this->registerCodemirrorAssets( $screen );
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$widgets = apply_filters( 'pollux/dashoard/widgets', [
84 84
 			'dashboard_primary',
85 85
 			'dashboard_quick_press',
86
-		]);
86
+		] );
87 87
 		foreach( $widgets as $widget ) {
88 88
 			remove_meta_box( $widget, 'dashboard', 'normal' );
89 89
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function registerArchiveAssets( WP_Screen $screen )
107 107
 	{
108
-		if(( new Helper )->endsWith( '_archive', $screen->id ) && $screen->pagenow == 'edit.php' ) {
108
+		if( (new Helper)->endsWith( '_archive', $screen->id ) && $screen->pagenow == 'edit.php' ) {
109 109
 			wp_enqueue_script( 'common' );
110 110
 			wp_enqueue_script( 'editor-expand' );
111 111
 			wp_enqueue_script( 'post' );
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	protected function registerSettingsAssets( WP_Screen $screen )
154 154
 	{
155
-		if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() )) {
155
+		if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() ) ) {
156 156
 			wp_enqueue_script( 'common' );
157 157
 			wp_enqueue_script( 'postbox' );
158 158
 			wp_enqueue_script( 'wp-lists' );
Please login to merge, or discard this patch.
activate.php 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,9 @@
 block discarded – undo
77 77
 	 */
78 78
 	public function deactivate( $plugin )
79 79
 	{
80
-		if( $this->isValid() )return;
80
+		if( $this->isValid() ) {
81
+			return;
82
+		}
81 83
 		$pluginSlug = plugin_basename( $this->file );
82 84
 		if( $plugin == $pluginSlug ) {
83 85
 			$this->redirect(); //exit
Please login to merge, or discard this patch.
src/Component.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
 	{
39 39
 		$data = wp_parse_args( $data, $defaults );
40 40
 		foreach( $defaults as $key => $value ) {
41
-			$method = ( new Helper )->buildMethodName( $key, 'normalize' );
42
-			if( method_exists( $this, $method )) {
41
+			$method = (new Helper)->buildMethodName( $key, 'normalize' );
42
+			if( method_exists( $this, $method ) ) {
43 43
 				$data[$key] = $this->$method( $data[$key], $data, $id );
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
src/MetaBox/Condition.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function validate( array $conditions )
30 30
 	{
31 31
 		array_walk( $conditions, function( &$value, $key ) {
32
-			$method = ( new Helper )->buildMethodName( $key, 'validate' );
32
+			$method = (new Helper)->buildMethodName( $key, 'validate' );
33 33
 			$value = method_exists( $this, $method )
34 34
 				? $this->$method( $value )
35 35
 				: $this->validateUnknown( $key, $value );
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	protected function normalizeCondition( $conditions )
45 45
 	{
46
-		if( !is_array( $conditions )) {
46
+		if( !is_array( $conditions ) ) {
47 47
 			$conditions = [];
48 48
 		}
49
-		if( count( array_filter( array_keys( $conditions ), 'is_string' )) == 0 ) {
49
+		if( count( array_filter( array_keys( $conditions ), 'is_string' ) ) == 0 ) {
50 50
 			foreach( $conditions as $key ) {
51 51
 				$conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1;
52 52
 			}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		}
57 57
 		return array_intersect_key(
58 58
 			$conditions,
59
-			array_flip( $this->filter( 'conditions', static::conditions() ))
59
+			array_flip( $this->filter( 'conditions', static::conditions() ) )
60 60
 		);
61 61
 	}
62 62
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	protected function validateIsFrontPage( $value )
104 104
 	{
105
-		return $value == ( $this->getPostId() == get_option( 'page_on_front' ));
105
+		return $value == ($this->getPostId() == get_option( 'page_on_front' ));
106 106
 	}
107 107
 
108 108
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function validateIsHome( $value )
113 113
 	{
114
-		return $value == ( $this->getPostId() == get_option( 'page_for_posts' ));
114
+		return $value == ($this->getPostId() == get_option( 'page_for_posts' ));
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function validateIsPageTemplate( $value )
122 122
 	{
123
-		return ( new Helper )->endsWith(
123
+		return (new Helper)->endsWith(
124 124
 			$value,
125
-			basename( get_page_template_slug( $this->getPostId() ))
125
+			basename( get_page_template_slug( $this->getPostId() ) )
126 126
 		);
127 127
 	}
128 128
 
Please login to merge, or discard this patch.