@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function all() |
| 30 | 30 | { |
| 31 | - if( empty( $this->options )) { |
|
| 31 | + if( empty($this->options) ) { |
|
| 32 | 32 | $this->reset(); |
| 33 | 33 | } |
| 34 | 34 | return $this->options; |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | $options = $this->all(); |
| 46 | 46 | $pointer = &$options; |
| 47 | 47 | foreach( $keys as $key ) { |
| 48 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
| 48 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
| 49 | 49 | $pointer = &$pointer[$key]; |
| 50 | 50 | } |
| 51 | - unset( $pointer[$last] ); |
|
| 51 | + unset($pointer[$last]); |
|
| 52 | 52 | return $this->set( $options ); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | glsr( DefaultsManager::class )->defaults() |
| 81 | 81 | ); |
| 82 | 82 | array_walk( $options, function( &$value ) { |
| 83 | - if( !is_string( $value ))return; |
|
| 84 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
| 83 | + if( !is_string( $value ) )return; |
|
| 84 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
| 85 | 85 | }); |
| 86 | 86 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
| 87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public function reset() |
| 93 | 93 | { |
| 94 | 94 | $options = get_option( static::databaseKey(), [] ); |
| 95 | - if( !is_array( $options ) || empty( $options )) { |
|
| 95 | + if( !is_array( $options ) || empty($options) ) { |
|
| 96 | 96 | delete_option( static::databaseKey() ); |
| 97 | 97 | $options = wp_parse_args( glsr()->defaults, ['settings' => []] ); |
| 98 | 98 | } |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function set( $pathOrOptions, $value = '' ) |
| 108 | 108 | { |
| 109 | - if( is_string( $pathOrOptions )) { |
|
| 109 | + if( is_string( $pathOrOptions ) ) { |
|
| 110 | 110 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
| 111 | 111 | } |
| 112 | - if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) { |
|
| 112 | + if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) { |
|
| 113 | 113 | $this->reset(); |
| 114 | 114 | } |
| 115 | 115 | return $result; |