@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | protected function generateInstructions() |
| 22 | 22 | { |
| 23 | - $instructions = array_reduce( $this->getInstructionGroups(), function( $html, $metabox ) { |
|
| 23 | + $instructions = array_reduce( $this->getInstructionGroups(), function( $html, $metabox ) |
|
| 24 | + { |
|
| 24 | 25 | $fields = $this->getInstructionFields( $metabox ); |
| 25 | 26 | if( empty( $fields )) { |
| 26 | 27 | return $html; |
@@ -39,7 +40,8 @@ discard block |
||
| 39 | 40 | protected function getInstructionFields( $metabox ) |
| 40 | 41 | { |
| 41 | 42 | $skipFields = ['custom_html', 'divider', 'heading', 'taxonomy']; |
| 42 | - return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox, $skipFields ) { |
|
| 43 | + return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox, $skipFields ) |
|
| 44 | + { |
|
| 43 | 45 | return $this->validate( $field['condition'] ) && !in_array( $field['type'], $skipFields ) |
| 44 | 46 | ? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL |
| 45 | 47 | : $html; |
@@ -51,7 +53,8 @@ discard block |
||
| 51 | 53 | */ |
| 52 | 54 | protected function getInstructionGroups() |
| 53 | 55 | { |
| 54 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
| 56 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
| 57 | + { |
|
| 55 | 58 | return $this->validate( $metabox['condition'] ) |
| 56 | 59 | && $this->hasPostType( $metabox ); |
| 57 | 60 | }); |
@@ -62,7 +65,9 @@ discard block |
||
| 62 | 65 | */ |
| 63 | 66 | protected function initInstructions() |
| 64 | 67 | { |
| 65 | - if( !$this->showInstructions() )return; |
|
| 68 | + if( !$this->showInstructions() ) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 66 | 71 | return [ |
| 67 | 72 | 'infodiv' => [ |
| 68 | 73 | 'context' => 'side', |
@@ -83,7 +88,8 @@ discard block |
||
| 83 | 88 | */ |
| 84 | 89 | protected function showInstructions() |
| 85 | 90 | { |
| 86 | - return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) { |
|
| 91 | + return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) |
|
| 92 | + { |
|
| 87 | 93 | return $this->show( false, $metabox ); |
| 88 | 94 | })) > 0 ); |
| 89 | 95 | } |
@@ -99,7 +99,9 @@ |
||
| 99 | 99 | trailingslashit( dirname( dirname( ABSPATH ))), |
| 100 | 100 | ]); |
| 101 | 101 | foreach( (array) $locations as $location ) { |
| 102 | - if( !file_exists( $location . $filename ))continue; |
|
| 102 | + if( !file_exists( $location . $filename )) { |
|
| 103 | + continue; |
|
| 104 | + } |
|
| 103 | 105 | return $location . $filename; |
| 104 | 106 | } |
| 105 | 107 | return null; |
@@ -108,7 +108,8 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function normalizeArray( array $array ) |
| 110 | 110 | { |
| 111 | - array_walk( $array, function( &$value, $key ) { |
|
| 111 | + array_walk( $array, function( &$value, $key ) |
|
| 112 | + { |
|
| 112 | 113 | if( !is_numeric( $value ) && is_string( $value )) { |
| 113 | 114 | $value = $this->parseYaml( $value, $key ); |
| 114 | 115 | if( $this->parseError == $key ) { |
@@ -124,7 +125,8 @@ discard block |
||
| 124 | 125 | */ |
| 125 | 126 | public function normalizeYamlValues( array $array ) |
| 126 | 127 | { |
| 127 | - return array_map( function( $value ) { |
|
| 128 | + return array_map( function( $value ) |
|
| 129 | + { |
|
| 128 | 130 | return is_array( $value ) |
| 129 | 131 | ? $this->convertArrayToYaml( $value ) |
| 130 | 132 | : $value; |
@@ -181,7 +183,8 @@ discard block |
||
| 181 | 183 | } |
| 182 | 184 | $pattern = '/(\')((' . implode( '|', $strings ) . ')\(?.+\))(\')/'; |
| 183 | 185 | return stripslashes( |
| 184 | - preg_replace_callback( $pattern, function( $matches ) { |
|
| 186 | + preg_replace_callback( $pattern, function( $matches ) |
|
| 187 | + { |
|
| 185 | 188 | return str_replace( "''", "'", $matches[2] ); |
| 186 | 189 | }, $configString ) |
| 187 | 190 | ); |