@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | public function __construct() |
19 | 19 | { |
20 | - $this->options = get_option( Settings::id(), [] ); |
|
20 | + $this->options = get_option( Settings::id(), [ ] ); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | { |
29 | 29 | $args = array_pad( $args, 2, null ); |
30 | 30 | $group = $this->$group; |
31 | - if( is_object( $group )) { |
|
31 | + if( is_object( $group ) ) { |
|
32 | 32 | return $group; |
33 | 33 | } |
34 | - return $this->get( $group, $args[0], $args[1] ); |
|
34 | + return $this->get( $group, $args[ 0 ], $args[ 1 ] ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | if( $group == 'all' ) { |
44 | 44 | return (object) $this->options; |
45 | 45 | } |
46 | - if( empty( $group )) { |
|
46 | + if( empty( $group ) ) { |
|
47 | 47 | $group = $this->getDefaultGroup(); |
48 | 48 | } |
49 | - return isset( $this->options[$group] ) |
|
50 | - ? $this->options[$group] |
|
49 | + return isset( $this->options[ $group ] ) |
|
50 | + ? $this->options[ $group ] |
|
51 | 51 | : null; |
52 | 52 | } |
53 | 53 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | if( func_num_args() < 1 ) { |
63 | 63 | return $this->all; |
64 | 64 | } |
65 | - if( is_string( $group )) { |
|
65 | + if( is_string( $group ) ) { |
|
66 | 66 | $group = $this->$group; |
67 | 67 | } |
68 | - if( !is_array( $group )) { |
|
68 | + if( !is_array( $group ) ) { |
|
69 | 69 | return $fallback; |
70 | 70 | } |
71 | - if( is_null( $key )) { |
|
71 | + if( is_null( $key ) ) { |
|
72 | 72 | return $group; |
73 | 73 | } |
74 | 74 | return $this->getValue( $group, $key, $fallback ); |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function getValue( array $group, $key, $fallback ) |
91 | 91 | { |
92 | - if( !array_key_exists( $key, $group )) { |
|
92 | + if( !array_key_exists( $key, $group ) ) { |
|
93 | 93 | return $fallback; |
94 | 94 | } |
95 | - return empty( $group[$key] ) && !is_null( $fallback ) |
|
95 | + return empty( $group[ $key ] ) && !is_null( $fallback ) |
|
96 | 96 | ? $fallback |
97 | - : $group[$key]; |
|
97 | + : $group[ $key ]; |
|
98 | 98 | } |
99 | 99 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | public function __construct() |
18 | 18 | { |
19 | - $this->options = get_option( Archive::id(), [] ); |
|
19 | + $this->options = get_option( Archive::id(), [ ] ); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -4,7 +4,7 @@ |
||
4 | 4 | <a href="<?= $thickbox_url; ?>" id="set-post-thumbnail" class="thickbox"><?= $thumbnail; ?></a> |
5 | 5 | </p> |
6 | 6 | |
7 | -<?php if( get_post( $image_id )) : ?> |
|
7 | +<?php if( get_post( $image_id ) ) : ?> |
|
8 | 8 | |
9 | 9 | <p class="hide-if-no-js howto" id="set-post-thumbnail-desc"><?= $edit_image; ?></p> |
10 | 10 | <p class="hide-if-no-js"> |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function buildClassName( $name, $path = '' ) |
15 | 15 | { |
16 | - $className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ))); |
|
16 | + $className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ) ) ); |
|
17 | 17 | $className = implode( '', $className ); |
18 | 18 | return !empty( $path ) |
19 | - ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className )) |
|
19 | + ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ) ) |
|
20 | 20 | : $className; |
21 | 21 | } |
22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function buildMethodName( $name, $prefix = 'get' ) |
29 | 29 | { |
30 | - return lcfirst( $this->buildClassName( $prefix . '-' . $name )); |
|
30 | + return lcfirst( $this->buildClassName( $prefix . '-' . $name ) ); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function getCurrentScreen() |
64 | 64 | { |
65 | 65 | global $current_screen, $pagenow; |
66 | - if( isset( $current_screen )) { |
|
66 | + if( isset( $current_screen ) ) { |
|
67 | 67 | $current_screen->pagenow = $pagenow; |
68 | 68 | return $current_screen; |
69 | 69 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function startsWith( $needle, $haystack ) |
83 | 83 | { |
84 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
84 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -86,6 +86,7 @@ |
||
86 | 86 | abstract public function filter( $name, ...$args ); |
87 | 87 | |
88 | 88 | /** |
89 | + * @param boolean $bool |
|
89 | 90 | * @return bool |
90 | 91 | * @filter rwmb_show |
91 | 92 | */ |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | protected function generateInstructions() |
24 | 24 | { |
25 | 25 | $instructions = array_reduce( $this->getInstructions(), function( $html, $metabox ) { |
26 | - $fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) { |
|
27 | - return $this->validate( $field['condition'] ) |
|
28 | - ? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL |
|
26 | + $fields = array_reduce( $metabox[ 'fields' ], function( $html, $field ) use( $metabox ) { |
|
27 | + return $this->validate( $field[ 'condition' ] ) |
|
28 | + ? $html . $this->filter( 'instruction', "PostMeta::get('{$field[ 'slug' ]}');", $field, $metabox ) . PHP_EOL |
|
29 | 29 | : $html; |
30 | 30 | }); |
31 | 31 | return $html . sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
32 | - $metabox['title'], |
|
32 | + $metabox[ 'title' ], |
|
33 | 33 | $fields |
34 | 34 | ); |
35 | 35 | }); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | protected function getInstructions() |
43 | 43 | { |
44 | 44 | return array_filter( $this->metaboxes, function( $metabox ) { |
45 | - return $this->validate( $metabox['condition'] ) |
|
45 | + return $this->validate( $metabox[ 'condition' ] ) |
|
46 | 46 | && $this->hasPostType( $metabox ); |
47 | 47 | }); |
48 | 48 | } |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | return [ |
57 | 57 | 'infodiv' => [ |
58 | 58 | 'context' => 'side', |
59 | - 'fields' => [[ |
|
59 | + 'fields' => [ [ |
|
60 | 60 | 'slug' => '', |
61 | 61 | 'std' => $this->generateInstructions(), |
62 | 62 | 'type' => 'custom_html', |
63 | - ]], |
|
63 | + ] ], |
|
64 | 64 | 'post_types' => $this->getPostTypes(), |
65 | 65 | 'priority' => 'low', |
66 | 66 | 'title' => __( 'How to use in your theme', 'pollux' ), |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) { |
77 | 77 | return $this->show( false, $metabox ); |
78 | - })) > 0 ); |
|
78 | + }) ) > 0 ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -22,8 +22,10 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected function generateInstructions() |
24 | 24 | { |
25 | - $instructions = array_reduce( $this->getInstructions(), function( $html, $metabox ) { |
|
26 | - $fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) { |
|
25 | + $instructions = array_reduce( $this->getInstructions(), function( $html, $metabox ) |
|
26 | + { |
|
27 | + $fields = array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) |
|
28 | + { |
|
27 | 29 | return $this->validate( $field['condition'] ) |
28 | 30 | ? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL |
29 | 31 | : $html; |
@@ -41,7 +43,8 @@ discard block |
||
41 | 43 | */ |
42 | 44 | protected function getInstructions() |
43 | 45 | { |
44 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
46 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
47 | + { |
|
45 | 48 | return $this->validate( $metabox['condition'] ) |
46 | 49 | && $this->hasPostType( $metabox ); |
47 | 50 | }); |
@@ -52,7 +55,9 @@ discard block |
||
52 | 55 | */ |
53 | 56 | protected function initInstructions() |
54 | 57 | { |
55 | - if( !$this->showInstructions() )return; |
|
58 | + if( !$this->showInstructions() ) { |
|
59 | + return; |
|
60 | + } |
|
56 | 61 | return [ |
57 | 62 | 'infodiv' => [ |
58 | 63 | 'context' => 'side', |
@@ -73,7 +78,8 @@ discard block |
||
73 | 78 | */ |
74 | 79 | protected function showInstructions() |
75 | 80 | { |
76 | - return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) { |
|
81 | + return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) |
|
82 | + { |
|
77 | 83 | return $this->show( false, $metabox ); |
78 | 84 | })) > 0 ); |
79 | 85 | } |