@@ -107,7 +107,9 @@ discard block |
||
| 107 | 107 | trailingslashit( dirname( dirname( ABSPATH ))), |
| 108 | 108 | ]); |
| 109 | 109 | foreach( (array) $configLocations as $location ) { |
| 110 | - if( !file_exists( $location . $configYaml ))continue; |
|
| 110 | + if( !file_exists( $location . $configYaml )) { |
|
| 111 | + continue; |
|
| 112 | + } |
|
| 111 | 113 | return $location . $configYaml; |
| 112 | 114 | } |
| 113 | 115 | return $this->app->path( 'defaults.yml' ); |
@@ -118,7 +120,8 @@ discard block |
||
| 118 | 120 | */ |
| 119 | 121 | public function normalizeArray( array $array ) |
| 120 | 122 | { |
| 121 | - array_walk( $array, function( &$value, $key ) { |
|
| 123 | + array_walk( $array, function( &$value, $key ) |
|
| 124 | + { |
|
| 122 | 125 | if( !is_numeric( $value ) && is_string( $value )) { |
| 123 | 126 | $value = $this->parseYaml( $value, $key ); |
| 124 | 127 | if( $this->parseError == $key ) { |
@@ -134,7 +137,8 @@ discard block |
||
| 134 | 137 | */ |
| 135 | 138 | public function normalizeYamlValues( array $array ) |
| 136 | 139 | { |
| 137 | - return array_map( function( $value ) { |
|
| 140 | + return array_map( function( $value ) |
|
| 141 | + { |
|
| 138 | 142 | return is_array( $value ) |
| 139 | 143 | ? $this->convertArrayToYaml( $value ) |
| 140 | 144 | : $value; |
@@ -191,7 +195,8 @@ discard block |
||
| 191 | 195 | } |
| 192 | 196 | $pattern = '/(\')((' . implode( '|', $strings ) . ')\(?.+\))(\')/'; |
| 193 | 197 | return stripslashes( |
| 194 | - preg_replace_callback( $pattern, function( $matches ) { |
|
| 198 | + preg_replace_callback( $pattern, function( $matches ) |
|
| 199 | + { |
|
| 195 | 200 | return str_replace( "''", "'", $matches[2] ); |
| 196 | 201 | }, $configString ) |
| 197 | 202 | ); |
@@ -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']; |
| 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 | } |