diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-22 20:25:47 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-09 10:56:24 +0100 |
commit | 53054b2bf6a919fd4ff9b44b6ad1986f21f488b6 (patch) | |
tree | 39cad52645ce00fbf863ff8e482d10dfcbe7f26c /application/helper | |
parent | e09bb93e18a333eff8e6a4156f5b58ba9c7d25cd (diff) | |
download | Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.gz Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.zst Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.zip |
Apply PHP Code Beautifier on source code for linter automatic fixes
Diffstat (limited to 'application/helper')
-rw-r--r-- | application/helper/ApplicationUtils.php | 47 | ||||
-rw-r--r-- | application/helper/FileUtils.php | 4 |
2 files changed, 28 insertions, 23 deletions
diff --git a/application/helper/ApplicationUtils.php b/application/helper/ApplicationUtils.php index 4b34e114..212dd8e2 100644 --- a/application/helper/ApplicationUtils.php +++ b/application/helper/ApplicationUtils.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
2 | namespace Shaarli\Helper; | 3 | namespace Shaarli\Helper; |
3 | 4 | ||
4 | use Exception; | 5 | use Exception; |
@@ -16,7 +17,7 @@ class ApplicationUtils | |||
16 | 17 | ||
17 | public static $GITHUB_URL = 'https://github.com/shaarli/Shaarli'; | 18 | public static $GITHUB_URL = 'https://github.com/shaarli/Shaarli'; |
18 | public static $GIT_RAW_URL = 'https://raw.githubusercontent.com/shaarli/Shaarli'; | 19 | public static $GIT_RAW_URL = 'https://raw.githubusercontent.com/shaarli/Shaarli'; |
19 | public static $GIT_BRANCHES = array('latest', 'stable'); | 20 | public static $GIT_BRANCHES = ['latest', 'stable']; |
20 | private static $VERSION_START_TAG = '<?php /* '; | 21 | private static $VERSION_START_TAG = '<?php /* '; |
21 | private static $VERSION_END_TAG = ' */ ?>'; | 22 | private static $VERSION_END_TAG = ' */ ?>'; |
22 | 23 | ||
@@ -64,8 +65,8 @@ class ApplicationUtils | |||
64 | } | 65 | } |
65 | 66 | ||
66 | return str_replace( | 67 | return str_replace( |
67 | array(self::$VERSION_START_TAG, self::$VERSION_END_TAG, PHP_EOL), | 68 | [self::$VERSION_START_TAG, self::$VERSION_END_TAG, PHP_EOL], |
68 | array('', '', ''), | 69 | ['', '', ''], |
69 | $data | 70 | $data |
70 | ); | 71 | ); |
71 | } | 72 | } |
@@ -184,13 +185,15 @@ class ApplicationUtils | |||
184 | $rainTplDir = rtrim($conf->get('resource.raintpl_tpl'), '/'); | 185 | $rainTplDir = rtrim($conf->get('resource.raintpl_tpl'), '/'); |
185 | 186 | ||
186 | // Check script and template directories are readable | 187 | // Check script and template directories are readable |
187 | foreach ([ | 188 | foreach ( |
188 | 'application', | 189 | [ |
189 | 'inc', | 190 | 'application', |
190 | 'plugins', | 191 | 'inc', |
191 | $rainTplDir, | 192 | 'plugins', |
192 | $rainTplDir . '/' . $conf->get('resource.theme'), | 193 | $rainTplDir, |
193 | ] as $path) { | 194 | $rainTplDir . '/' . $conf->get('resource.theme'), |
195 | ] as $path | ||
196 | ) { | ||
194 | if (!is_readable(realpath($path))) { | 197 | if (!is_readable(realpath($path))) { |
195 | $errors[] = '"' . $path . '" ' . t('directory is not readable'); | 198 | $errors[] = '"' . $path . '" ' . t('directory is not readable'); |
196 | } | 199 | } |
@@ -203,10 +206,10 @@ class ApplicationUtils | |||
203 | ]; | 206 | ]; |
204 | } else { | 207 | } else { |
205 | $folders = [ | 208 | $folders = [ |
206 | $conf->get('resource.thumbnails_cache'), | 209 | $conf->get('resource.thumbnails_cache'), |
207 | $conf->get('resource.data_dir'), | 210 | $conf->get('resource.data_dir'), |
208 | $conf->get('resource.page_cache'), | 211 | $conf->get('resource.page_cache'), |
209 | $conf->get('resource.raintpl_tmp'), | 212 | $conf->get('resource.raintpl_tmp'), |
210 | ]; | 213 | ]; |
211 | } | 214 | } |
212 | 215 | ||
@@ -224,13 +227,15 @@ class ApplicationUtils | |||
224 | } | 227 | } |
225 | 228 | ||
226 | // Check configuration files are readable and writable | 229 | // Check configuration files are readable and writable |
227 | foreach (array( | 230 | foreach ( |
228 | $conf->getConfigFileExt(), | 231 | [ |
229 | $conf->get('resource.datastore'), | 232 | $conf->getConfigFileExt(), |
230 | $conf->get('resource.ban_file'), | 233 | $conf->get('resource.datastore'), |
231 | $conf->get('resource.log'), | 234 | $conf->get('resource.ban_file'), |
232 | $conf->get('resource.update_check'), | 235 | $conf->get('resource.log'), |
233 | ) as $path) { | 236 | $conf->get('resource.update_check'), |
237 | ] as $path | ||
238 | ) { | ||
234 | if (!is_file(realpath($path))) { | 239 | if (!is_file(realpath($path))) { |
235 | # the file may not exist yet | 240 | # the file may not exist yet |
236 | continue; | 241 | continue; |
diff --git a/application/helper/FileUtils.php b/application/helper/FileUtils.php index 2eac0793..e8a2168c 100644 --- a/application/helper/FileUtils.php +++ b/application/helper/FileUtils.php | |||
@@ -105,7 +105,7 @@ class FileUtils | |||
105 | } | 105 | } |
106 | 106 | ||
107 | foreach (new \DirectoryIterator($path) as $file) { | 107 | foreach (new \DirectoryIterator($path) as $file) { |
108 | if($file->isDot()) { | 108 | if ($file->isDot()) { |
109 | continue; | 109 | continue; |
110 | } | 110 | } |
111 | 111 | ||
@@ -116,7 +116,7 @@ class FileUtils | |||
116 | 116 | ||
117 | if ($file->isFile()) { | 117 | if ($file->isFile()) { |
118 | unlink($file->getPathname()); | 118 | unlink($file->getPathname()); |
119 | } elseif($file->isDir()) { | 119 | } elseif ($file->isDir()) { |
120 | $skipped = static::clearFolder($file->getRealPath(), true, $exclude) || $skipped; | 120 | $skipped = static::clearFolder($file->getRealPath(), true, $exclude) || $skipped; |
121 | } | 121 | } |
122 | } | 122 | } |