@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | */ |
17 | 17 | protected static $instance; |
18 | 18 | |
19 | - /** |
|
20 | - * The container's bound services. |
|
21 | - * |
|
22 | - * @var array |
|
23 | - */ |
|
19 | + /** |
|
20 | + * The container's bound services. |
|
21 | + * |
|
22 | + * @var array |
|
23 | + */ |
|
24 | 24 | protected $services = []; |
25 | 25 | |
26 | - /** |
|
27 | - * The container's bucket items |
|
28 | - * |
|
29 | - * @var array |
|
30 | - */ |
|
26 | + /** |
|
27 | + * The container's bucket items |
|
28 | + * |
|
29 | + * @var array |
|
30 | + */ |
|
31 | 31 | protected $bucket = []; |
32 | 32 | |
33 | 33 | /** |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | - * Register a Provider. |
|
127 | - * |
|
128 | - * @return void |
|
129 | - */ |
|
126 | + * Register a Provider. |
|
127 | + * |
|
128 | + * @return void |
|
129 | + */ |
|
130 | 130 | public function register( $provider ) |
131 | 131 | { |
132 | 132 | $provider->register( $this ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function getInstance() |
39 | 39 | { |
40 | - if( is_null( static::$instance )) { |
|
40 | + if( is_null( static::$instance ) ) { |
|
41 | 41 | static::$instance = new static; |
42 | 42 | } |
43 | 43 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function make( $abstract ) |
70 | 70 | { |
71 | - $service = isset( $this->services[$abstract] ) |
|
71 | + $service = isset($this->services[$abstract]) |
|
72 | 72 | ? $this->services[$abstract] |
73 | 73 | : $this->addNamespace( $abstract ); |
74 | 74 | |
75 | - if( is_callable( $service )) { |
|
75 | + if( is_callable( $service ) ) { |
|
76 | 76 | return call_user_func_array( $service, [$this] ); |
77 | 77 | } |
78 | - if( is_object( $service )) { |
|
78 | + if( is_object( $service ) ) { |
|
79 | 79 | return $service; |
80 | 80 | } |
81 | 81 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function singleton( $abstract, $concrete ) |
94 | 94 | { |
95 | - $this->bind( $abstract, $this->make( $concrete )); |
|
95 | + $this->bind( $abstract, $this->make( $concrete ) ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function __get( $item ) |
106 | 106 | { |
107 | - return isset( $this->bucket[$item] ) |
|
107 | + return isset($this->bucket[$item]) |
|
108 | 108 | ? $this->bucket[$item] |
109 | 109 | : null; |
110 | 110 | } |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | */ |
142 | 142 | protected function addNamespace( $abstract ) |
143 | 143 | { |
144 | - if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { |
|
145 | - $abstract = __NAMESPACE__ . "\\$abstract"; |
|
144 | + if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) { |
|
145 | + $abstract = __NAMESPACE__."\\$abstract"; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $abstract; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | return $this->notInstantiable( $concrete ); |
184 | 184 | } |
185 | 185 | |
186 | - if( is_null(( $constructor = $reflector->getConstructor() ))) { |
|
186 | + if( is_null( ($constructor = $reflector->getConstructor()) ) ) { |
|
187 | 187 | return new $concrete; |
188 | 188 | } |
189 | 189 |
@@ -1,6 +1,6 @@ |
||
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 | } |
@@ -4,8 +4,8 @@ |
||
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 ); |
@@ -30,7 +30,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -38,8 +38,8 @@ |
||
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 | } |
@@ -18,16 +18,16 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -30,7 +30,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -22,15 +22,15 @@ discard block |
||
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 |
||
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 |
||
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 | /** |