@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | { |
29 | 29 | $configFile = $this->getFile(); |
30 | 30 | $configYaml = $this->getYaml(); |
31 | - if( $this->shouldGenerate( $configYaml )) { |
|
31 | + if( $this->shouldGenerate( $configYaml ) ) { |
|
32 | 32 | file_put_contents( $configFile, sprintf( '<?php // DO NOT MODIFY THIS FILE DIRECTLY!%sreturn %s;', |
33 | 33 | PHP_EOL, |
34 | 34 | $this->parseYaml( $configYaml ) |
35 | - )); |
|
35 | + ) ); |
|
36 | 36 | } |
37 | 37 | return include $configFile; |
38 | 38 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | public function getFile( $filename = 'pollux-config.php' ) |
44 | 44 | { |
45 | 45 | $filename = apply_filters( 'pollux/config/dist/file', $filename ); |
46 | - $storagePath = trailingslashit( apply_filters( 'pollux/config/dist/location', WP_CONTENT_DIR )); |
|
47 | - if( !is_dir( $storagePath )) { |
|
46 | + $storagePath = trailingslashit( apply_filters( 'pollux/config/dist/location', WP_CONTENT_DIR ) ); |
|
47 | + if( !is_dir( $storagePath ) ) { |
|
48 | 48 | mkdir( $storagePath, 0775 ); |
49 | 49 | } |
50 | 50 | return sprintf( '%s/%s', $storagePath, $filename ); |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ), |
63 | 63 | trailingslashit( WP_CONTENT_DIR ), |
64 | 64 | trailingslashit( ABSPATH ), |
65 | - trailingslashit( dirname( ABSPATH )), |
|
66 | - ]); |
|
65 | + trailingslashit( dirname( ABSPATH ) ), |
|
66 | + ] ); |
|
67 | 67 | foreach( (array) $configLocations as $location ) { |
68 | - if( !file_exists( $location . $configYaml ))continue; |
|
68 | + if( !file_exists( $location . $configYaml ) )continue; |
|
69 | 69 | return $location . $configYaml; |
70 | 70 | } |
71 | 71 | return $this->app->path( 'defaults.yml' ); |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | public function parseYaml( $yamlFile ) |
79 | 79 | { |
80 | 80 | $config = wp_parse_args( |
81 | - Yaml::parse( file_get_contents( $yamlFile )), |
|
82 | - Yaml::parse( file_get_contents( $this->app->path( 'defaults.yml' ))) |
|
81 | + Yaml::parse( file_get_contents( $yamlFile ) ), |
|
82 | + Yaml::parse( file_get_contents( $this->app->path( 'defaults.yml' ) ) ) |
|
83 | 83 | ); |
84 | - return $this->parseRawStrings( var_export( $config, true )); |
|
84 | + return $this->parseRawStrings( var_export( $config, true ) ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | protected function shouldGenerate( $configYaml ) |
104 | 104 | { |
105 | 105 | $configFile = $this->getFile(); |
106 | - if( !file_exists( $configFile )) { |
|
106 | + if( !file_exists( $configFile ) ) { |
|
107 | 107 | return true; |
108 | 108 | } |
109 | 109 | return filemtime( $configYaml ) >= filemtime( $configFile ); |