diff --git a/flextype/Cache.php b/flextype/Cache.php index 9664a24a..b1ff2b48 100755 --- a/flextype/Cache.php +++ b/flextype/Cache.php @@ -137,28 +137,28 @@ class Cache // that come with PHP so no additional setup is required in order to use it. case 'apc': $driver = new DoctrineCache\ApcCache(); - break; + break; // The ApcuCache driver uses the apcu_fetch, apcu_exists, etc. functions // that come with PHP so no additional setup is required in order to use it. case 'apcu': $driver = new DoctrineCache\ApcuCache(); - break; + break; // The ArrayCache driver stores the cache data in PHPs memory and is not persisted anywhere. // This can be useful for caching things in memory for a single process when you don't need the cache to be persistent across processes. case 'array': $driver = new DoctrineCache\ArrayCache(); - break; + break; // The WinCacheCache driver uses the wincache_ucache_get, wincache_ucache_exists, etc. functions // that come with the wincache extension // http://php.net/manual/en/book.wincache.php case 'wincache': $driver = new DoctrineCache\WinCacheCache(); - break; + break; // The XcacheCache driver uses functions that come with the xcache extension // https://xcache.lighttpd.net case 'xcache': $driver = new DoctrineCache\XcacheCache(); - break; + break; // The MemcacheCache drivers stores the cache data in Memcache. case 'memcache': $memcache = new \Memcache(); @@ -326,7 +326,7 @@ class Cache return; } - $interval = $future - Cache::$now; + $interval = $future-Cache::$now; if ($interval > 0 && $interval < Cache::getLifetime()) { Cache::$lifetime = $interval; diff --git a/flextype/Entries.php b/flextype/Entries.php index 4db50948..9bc8d174 100755 --- a/flextype/Entries.php +++ b/flextype/Entries.php @@ -158,7 +158,7 @@ class Entries if ($url === '') { $file_path = PATH['entries'] . '/' . Registry::get('settings.entries.main') . '/entry.html'; } else { - $file_path = PATH['entries'] . '/' . $url . '/entry.html'; + $file_path = PATH['entries'] . '/' . $url . '/entry.html'; } // If entry exist @@ -399,7 +399,7 @@ class Entries */ private static function displayCurrentEntry() : void { - Http::setRequestHeaders('Content-Type: text/html; charset='.Registry::get('settings.charset')); + Http::setRequestHeaders('Content-Type: text/html; charset=' . Registry::get('settings.charset')); Themes::view(empty(Entries::$entry['template']) ? 'templates/default' : 'templates/' . Entries::$entry['template']) ->assign('entry', Entries::$entry, true) ->display(); diff --git a/flextype/Flextype.php b/flextype/Flextype.php index 563524c0..eb98cccf 100755 --- a/flextype/Flextype.php +++ b/flextype/Flextype.php @@ -149,7 +149,7 @@ class Flextype // Set settings files path $default_settings_file_path = PATH['config']['default'] . '/settings.yaml'; - $site_settings_file_path = PATH['config']['site'] . '/settings.yaml'; + $site_settings_file_path = PATH['config']['site'] . '/settings.yaml'; // Set settings if Flextype settings and Site settings config files exist if (Filesystem::has($default_settings_file_path) && Filesystem::has($site_settings_file_path)) { diff --git a/flextype/Images.php b/flextype/Images.php index 8f361d9b..d87f2de5 100644 --- a/flextype/Images.php +++ b/flextype/Images.php @@ -153,8 +153,8 @@ class Images */ public static function getImage(string $path, array $params, array $attributes = []) : string { - if (file_exists(PATH['entries'] . '/' . $path)) { - return ''; + if (file_exists(PATH['entries'] . '/' . $path)) { + return ''; } else { return "File {$path} does not exist."; } diff --git a/flextype/Menus.php b/flextype/Menus.php index 51e876fb..da161b8d 100644 --- a/flextype/Menus.php +++ b/flextype/Menus.php @@ -32,7 +32,7 @@ class Menus if (Filesystem::has($menu_path)) { return YamlParser::decode(Filesystem::read($menu_path)); } else { - throw new \RuntimeException("Menu {$menu_name} does not exist."); - } + throw new \RuntimeException("Menu {$menu_name} does not exist."); + } } } diff --git a/flextype/Plugins.php b/flextype/Plugins.php index 103552b8..85e304d2 100755 --- a/flextype/Plugins.php +++ b/flextype/Plugins.php @@ -33,163 +33,163 @@ class Plugins * @var array */ private static $locales = [ - 'af' => [ 'name' => 'Afrikaans', 'nativeName' => 'Afrikaans' ], - 'af_ZA' => [ 'name' => 'Afrikaans', 'nativeName' => 'Afrikaans' ], - 'ak' => [ 'name' => 'Akan', 'nativeName' => 'Akan' ], // unverified native name - 'ast' => [ 'name' => 'Asturian', 'nativeName' => 'Asturianu' ], - 'ar' => [ 'name' => 'Arabic', 'nativeName' => 'عربي', 'orientation' => 'rtl'], - 'ar_SA' => [ 'name' => 'Arabic', 'nativeName' => 'عربي', 'orientation' => 'rtl'], - 'as' => [ 'name' => 'Assamese', 'nativeName' => 'অসমীয়া' ], - 'be' => [ 'name' => 'Belarusian', 'nativeName' => 'Беларуская' ], - 'bg' => [ 'name' => 'Bulgarian', 'nativeName' => 'Български' ], - 'bn' => [ 'name' => 'Bengali', 'nativeName' => 'বাংলা' ], - 'bn_BD' => [ 'name' => 'Bengali (Bangladesh)', 'nativeName' => 'বাংলা (বাংলাদেশ)' ], - 'bn_IN' => [ 'name' => 'Bengali (India)', 'nativeName' => 'বাংলা (ভারত)' ], - 'br' => [ 'name' => 'Breton', 'nativeName' => 'Brezhoneg' ], - 'bs' => [ 'name' => 'Bosnian', 'nativeName' => 'Bosanski' ], - 'ca' => [ 'name' => 'Catalan', 'nativeName' => 'Català' ], - 'ca_ES' => [ 'name' => 'Catalan', 'nativeName' => 'Català' ], - 'ca_valencia'=> [ 'name' => 'Catalan (Valencian)', 'nativeName' => 'Català (valencià)' ], // not iso-639-1. a=l10n-drivers - 'cs' => [ 'name' => 'Czech', 'nativeName' => 'Čeština' ], - 'cs_CZ' => [ 'name' => 'Czech', 'nativeName' => 'Čeština' ], - 'cy' => [ 'name' => 'Welsh', 'nativeName' => 'Cymraeg' ], - 'da' => [ 'name' => 'Danish', 'nativeName' => 'Dansk' ], - 'da_DK' => [ 'name' => 'Danish', 'nativeName' => 'Dansk' ], - 'de' => [ 'name' => 'German', 'nativeName' => 'Deutsch' ], - 'de_AT' => [ 'name' => 'German (Austria)', 'nativeName' => 'Deutsch (Österreich)' ], - 'de_CH' => [ 'name' => 'German (Switzerland)', 'nativeName' => 'Deutsch (Schweiz)' ], - 'de_DE' => [ 'name' => 'German (Germany)', 'nativeName' => 'Deutsch (Deutschland)' ], - 'dsb' => [ 'name' => 'Lower Sorbian', 'nativeName' => 'Dolnoserbšćina' ], // iso-639-2 - 'el' => [ 'name' => 'Greek', 'nativeName' => 'Ελληνικά' ], - 'el_GR' => [ 'name' => 'Greek', 'nativeName' => 'Ελληνικά' ], - 'en' => [ 'name' => 'English', 'nativeName' => 'English' ], - 'en_AU' => [ 'name' => 'English (Australian)', 'nativeName' => 'English (Australian)' ], - 'en_CA' => [ 'name' => 'English (Canadian)', 'nativeName' => 'English (Canadian)' ], - 'en_GB' => [ 'name' => 'English (British)', 'nativeName' => 'English (British)' ], - 'en_NZ' => [ 'name' => 'English (New Zealand)', 'nativeName' => 'English (New Zealand)' ], - 'en_US' => [ 'name' => 'English (US)', 'nativeName' => 'English (US)' ], - 'en_ZA' => [ 'name' => 'English (South African)', 'nativeName' => 'English (South African)' ], - 'eo' => [ 'name' => 'Esperanto', 'nativeName' => 'Esperanto' ], - 'es' => [ 'name' => 'Spanish', 'nativeName' => 'Español' ], - 'es_AR' => [ 'name' => 'Spanish (Argentina)', 'nativeName' => 'Español (de Argentina)' ], - 'es_CL' => [ 'name' => 'Spanish (Chile)', 'nativeName' => 'Español (de Chile)' ], - 'es_ES' => [ 'name' => 'Spanish (Spain)', 'nativeName' => 'Español (de España)' ], - 'es_MX' => [ 'name' => 'Spanish (Mexico)', 'nativeName' => 'Español (de México)' ], - 'et' => [ 'name' => 'Estonian', 'nativeName' => 'Eesti keel' ], - 'eu' => [ 'name' => 'Basque', 'nativeName' => 'Euskara' ], - 'fa' => [ 'name' => 'Persian', 'nativeName' => 'فارسی' , 'orientation' => 'rtl' ], - 'fi' => [ 'name' => 'Finnish', 'nativeName' => 'Suomi' ], - 'fi_FI' => [ 'name' => 'Finnish', 'nativeName' => 'Suomi' ], - 'fj_FJ' => [ 'name' => 'Fijian', 'nativeName' => 'Vosa vaka_Viti' ], - 'fr' => [ 'name' => 'French', 'nativeName' => 'Français' ], - 'fr_CA' => [ 'name' => 'French (Canada)', 'nativeName' => 'Français (Canada)' ], - 'fr_FR' => [ 'name' => 'French (France)', 'nativeName' => 'Français (France)' ], - 'fur' => [ 'name' => 'Friulian', 'nativeName' => 'Furlan' ], - 'fur_IT' => [ 'name' => 'Friulian', 'nativeName' => 'Furlan' ], - 'fy' => [ 'name' => 'Frisian', 'nativeName' => 'Frysk' ], - 'fy_NL' => [ 'name' => 'Frisian', 'nativeName' => 'Frysk' ], - 'ga' => [ 'name' => 'Irish', 'nativeName' => 'Gaeilge' ], - 'ga_IE' => [ 'name' => 'Irish (Ireland)', 'nativeName' => 'Gaeilge (Éire)' ], - 'gd' => [ 'name' => 'Gaelic (Scotland)', 'nativeName' => 'Gàidhlig' ], - 'gl' => [ 'name' => 'Galician', 'nativeName' => 'Galego' ], - 'gu' => [ 'name' => 'Gujarati', 'nativeName' => 'ગુજરાતી' ], - 'gu_IN' => [ 'name' => 'Gujarati', 'nativeName' => 'ગુજરાતી' ], - 'he' => [ 'name' => 'Hebrew', 'nativeName' => 'עברית', 'orientation' => 'rtl' ], - 'he_IL' => [ 'name' => 'Hebrew', 'nativeName' => 'עברית', 'orientation' => 'rtl' ], - 'hi' => [ 'name' => 'Hindi', 'nativeName' => 'हिन्दी' ], - 'hi_IN' => [ 'name' => 'Hindi (India)', 'nativeName' => 'हिन्दी (भारत)' ], - 'hr' => [ 'name' => 'Croatian', 'nativeName' => 'Hrvatski' ], - 'hr_HR' => [ 'name' => 'Croatian', 'nativeName' => 'Hrvatski' ], - 'hsb' => [ 'name' => 'Upper Sorbian', 'nativeName' => 'Hornjoserbsce' ], - 'hu' => [ 'name' => 'Hungarian', 'nativeName' => 'Magyar' ], - 'hu_HU' => [ 'name' => 'Hungarian', 'nativeName' => 'Magyar' ], - 'hy' => [ 'name' => 'Armenian', 'nativeName' => 'Հայերեն' ], - 'hy_AM' => [ 'name' => 'Armenian', 'nativeName' => 'Հայերեն' ], - 'id' => [ 'name' => 'Indonesian', 'nativeName' => 'Bahasa Indonesia' ], - 'is' => [ 'name' => 'Icelandic', 'nativeName' => 'íslenska' ], - 'it' => [ 'name' => 'Italian', 'nativeName' => 'Italiano' ], - 'it_IT' => [ 'name' => 'Italian', 'nativeName' => 'Italiano' ], - 'ja' => [ 'name' => 'Japanese', 'nativeName' => '日本語' ], - 'ja_JP' => [ 'name' => 'Japanese', 'nativeName' => '日本語' ], // not iso-639-1 - 'ka' => [ 'name' => 'Georgian', 'nativeName' => 'ქართული' ], - 'kk' => [ 'name' => 'Kazakh', 'nativeName' => 'Қазақ' ], - 'kn' => [ 'name' => 'Kannada', 'nativeName' => 'ಕನ್ನಡ' ], - 'ko' => [ 'name' => 'Korean', 'nativeName' => '한국어' ], - 'ko_KR' => [ 'name' => 'Korean', 'nativeName' => '한국어' ], - 'ku' => [ 'name' => 'Kurdish', 'nativeName' => 'Kurdî' ], - 'la' => [ 'name' => 'Latin', 'nativeName' => 'Latina' ], - 'lb' => [ 'name' => 'Luxembourgish', 'nativeName' => 'Lëtzebuergesch' ], - 'lg' => [ 'name' => 'Luganda', 'nativeName' => 'Luganda' ], - 'lt' => [ 'name' => 'Lithuanian', 'nativeName' => 'Lietuvių kalba' ], - 'lv' => [ 'name' => 'Latvian', 'nativeName' => 'Latviešu' ], - 'mai' => [ 'name' => 'Maithili', 'nativeName' => 'मैथिली মৈথিলী' ], - 'mg' => [ 'name' => 'Malagasy', 'nativeName' => 'Malagasy' ], - 'mi' => [ 'name' => 'Maori (Aotearoa)', 'nativeName' => 'Māori (Aotearoa)' ], - 'mk' => [ 'name' => 'Macedonian', 'nativeName' => 'Македонски' ], - 'ml' => [ 'name' => 'Malayalam', 'nativeName' => 'മലയാളം' ], - 'mn' => [ 'name' => 'Mongolian', 'nativeName' => 'Монгол' ], - 'mr' => [ 'name' => 'Marathi', 'nativeName' => 'मराठी' ], - 'no' => [ 'name' => 'Norwegian', 'nativeName' => 'Norsk' ], - 'no_NO' => [ 'name' => 'Norwegian', 'nativeName' => 'Norsk' ], - 'nb' => [ 'name' => 'Norwegian', 'nativeName' => 'Norsk' ], - 'nb_NO' => [ 'name' => 'Norwegian (Bokmål)', 'nativeName' => 'Norsk bokmål' ], - 'ne_NP' => [ 'name' => 'Nepali', 'nativeName' => 'नेपाली' ], - 'nn_NO' => [ 'name' => 'Norwegian (Nynorsk)', 'nativeName' => 'Norsk nynorsk' ], - 'nl' => [ 'name' => 'Dutch', 'nativeName' => 'Nederlands' ], - 'nl_NL' => [ 'name' => 'Dutch', 'nativeName' => 'Nederlands' ], - 'nr' => [ 'name' => 'Ndebele, South', 'nativeName' => 'IsiNdebele' ], - 'nso' => [ 'name' => 'Northern Sotho', 'nativeName' => 'Sepedi' ], - 'oc' => [ 'name' => 'Occitan (Lengadocian)', 'nativeName' => 'Occitan (lengadocian)' ], - 'or' => [ 'name' => 'Oriya', 'nativeName' => 'ଓଡ଼ିଆ' ], - 'pa' => [ 'name' => 'Punjabi', 'nativeName' => 'ਪੰਜਾਬੀ' ], - 'pa_IN' => [ 'name' => 'Punjabi', 'nativeName' => 'ਪੰਜਾਬੀ' ], - 'pl' => [ 'name' => 'Polish', 'nativeName' => 'Polski' ], - 'pl_PL' => [ 'name' => 'Polish', 'nativeName' => 'Polski' ], - 'pt' => [ 'name' => 'Portuguese', 'nativeName' => 'Português' ], - 'pt_BR' => [ 'name' => 'Portuguese (Brazilian)', 'nativeName' => 'Português (do Brasil)' ], - 'pt_PT' => [ 'name' => 'Portuguese (Portugal)', 'nativeName' => 'Português (Europeu)' ], - 'ro' => [ 'name' => 'Romanian', 'nativeName' => 'Română' ], - 'ro_RO' => [ 'name' => 'Romanian', 'nativeName' => 'Română' ], - 'rm' => [ 'name' => 'Romansh', 'nativeName' => 'Rumantsch' ], - 'ru' => [ 'name' => 'Russian', 'nativeName' => 'Русский' ], - 'ru_RU' => [ 'name' => 'Russian', 'nativeName' => 'Русский' ], - 'rw' => [ 'name' => 'Kinyarwanda', 'nativeName' => 'Ikinyarwanda' ], - 'si' => [ 'name' => 'Sinhala', 'nativeName' => 'සිංහල' ], - 'sk' => [ 'name' => 'Slovak', 'nativeName' => 'Slovenčina' ], - 'sl' => [ 'name' => 'Slovenian', 'nativeName' => 'Slovensko' ], - 'son' => [ 'name' => 'Songhai', 'nativeName' => 'Soŋay' ], - 'sq' => [ 'name' => 'Albanian', 'nativeName' => 'Shqip' ], - 'sr' => [ 'name' => 'Serbian', 'nativeName' => 'Српски' ], - 'sr_SP' => [ 'name' => 'Serbian', 'nativeName' => 'Српски' ], - 'sr_Latn' => [ 'name' => 'Serbian', 'nativeName' => 'Srpski' ], // follows RFC 4646 - 'ss' => [ 'name' => 'Siswati', 'nativeName' => 'siSwati' ], - 'st' => [ 'name' => 'Southern Sotho', 'nativeName' => 'Sesotho' ], - 'sv' => [ 'name' => 'Swedish', 'nativeName' => 'Svenska' ], - 'sv_SE' => [ 'name' => 'Swedish', 'nativeName' => 'Svenska' ], - 'ta' => [ 'name' => 'Tamil', 'nativeName' => 'தமிழ்' ], - 'ta_IN' => [ 'name' => 'Tamil (India)', 'nativeName' => 'தமிழ் (இந்தியா)' ], - 'ta_LK' => [ 'name' => 'Tamil (Sri Lanka)', 'nativeName' => 'தமிழ் (இலங்கை)' ], - 'te' => [ 'name' => 'Telugu', 'nativeName' => 'తెలుగు' ], - 'th' => [ 'name' => 'Thai', 'nativeName' => 'ไทย' ], - 'tlh' => [ 'name' => 'Klingon', 'nativeName' => 'Klingon' ], - 'tn' => [ 'name' => 'Tswana', 'nativeName' => 'Setswana' ], - 'tr' => [ 'name' => 'Turkish', 'nativeName' => 'Türkçe' ], - 'tr_TR' => [ 'name' => 'Turkish', 'nativeName' => 'Türkçe' ], - 'ts' => [ 'name' => 'Tsonga', 'nativeName' => 'Xitsonga' ], - 'tt' => [ 'name' => 'Tatar', 'nativeName' => 'Tatarça' ], - 'tt_RU' => [ 'name' => 'Tatar', 'nativeName' => 'Tatarça' ], - 'uk' => [ 'name' => 'Ukrainian', 'nativeName' => 'Українська' ], - 'uk_UA' => [ 'name' => 'Ukrainian', 'nativeName' => 'Українська' ], - 'ur' => [ 'name' => 'Urdu', 'nativeName' => 'اُردو', 'orientation' => 'rtl' ], - 've' => [ 'name' => 'Venda', 'nativeName' => 'Tshivenḓa' ], - 'vi' => [ 'name' => 'Vietnamese', 'nativeName' => 'Tiếng Việt' ], - 'vi_VN' => [ 'name' => 'Vietnamese', 'nativeName' => 'Tiếng Việt' ], - 'wo' => [ 'name' => 'Wolof', 'nativeName' => 'Wolof' ], - 'xh' => [ 'name' => 'Xhosa', 'nativeName' => 'isiXhosa' ], - 'zh' => [ 'name' => 'Chinese (Simplified)', 'nativeName' => '中文 (简体)' ], - 'zh_CN' => [ 'name' => 'Chinese (Simplified)', 'nativeName' => '中文 (简体)' ], - 'zh_TW' => [ 'name' => 'Chinese (Traditional)', 'nativeName' => '正體中文 (繁體)' ], - 'zu' => [ 'name' => 'Zulu', 'nativeName' => 'isiZulu' ] + 'af' => ['name' => 'Afrikaans', 'nativeName' => 'Afrikaans'], + 'af_ZA' => ['name' => 'Afrikaans', 'nativeName' => 'Afrikaans'], + 'ak' => ['name' => 'Akan', 'nativeName' => 'Akan'], // unverified native name + 'ast' => ['name' => 'Asturian', 'nativeName' => 'Asturianu'], + 'ar' => ['name' => 'Arabic', 'nativeName' => 'عربي', 'orientation' => 'rtl'], + 'ar_SA' => ['name' => 'Arabic', 'nativeName' => 'عربي', 'orientation' => 'rtl'], + 'as' => ['name' => 'Assamese', 'nativeName' => 'অসমীয়া'], + 'be' => ['name' => 'Belarusian', 'nativeName' => 'Беларуская'], + 'bg' => ['name' => 'Bulgarian', 'nativeName' => 'Български'], + 'bn' => ['name' => 'Bengali', 'nativeName' => 'বাংলা'], + 'bn_BD' => ['name' => 'Bengali (Bangladesh)', 'nativeName' => 'বাংলা (বাংলাদেশ)'], + 'bn_IN' => ['name' => 'Bengali (India)', 'nativeName' => 'বাংলা (ভারত)'], + 'br' => ['name' => 'Breton', 'nativeName' => 'Brezhoneg'], + 'bs' => ['name' => 'Bosnian', 'nativeName' => 'Bosanski'], + 'ca' => ['name' => 'Catalan', 'nativeName' => 'Català'], + 'ca_ES' => ['name' => 'Catalan', 'nativeName' => 'Català'], + 'ca_valencia'=> ['name' => 'Catalan (Valencian)', 'nativeName' => 'Català (valencià)'], // not iso-639-1. a=l10n-drivers + 'cs' => ['name' => 'Czech', 'nativeName' => 'Čeština'], + 'cs_CZ' => ['name' => 'Czech', 'nativeName' => 'Čeština'], + 'cy' => ['name' => 'Welsh', 'nativeName' => 'Cymraeg'], + 'da' => ['name' => 'Danish', 'nativeName' => 'Dansk'], + 'da_DK' => ['name' => 'Danish', 'nativeName' => 'Dansk'], + 'de' => ['name' => 'German', 'nativeName' => 'Deutsch'], + 'de_AT' => ['name' => 'German (Austria)', 'nativeName' => 'Deutsch (Österreich)'], + 'de_CH' => ['name' => 'German (Switzerland)', 'nativeName' => 'Deutsch (Schweiz)'], + 'de_DE' => ['name' => 'German (Germany)', 'nativeName' => 'Deutsch (Deutschland)'], + 'dsb' => ['name' => 'Lower Sorbian', 'nativeName' => 'Dolnoserbšćina'], // iso-639-2 + 'el' => ['name' => 'Greek', 'nativeName' => 'Ελληνικά'], + 'el_GR' => ['name' => 'Greek', 'nativeName' => 'Ελληνικά'], + 'en' => ['name' => 'English', 'nativeName' => 'English'], + 'en_AU' => ['name' => 'English (Australian)', 'nativeName' => 'English (Australian)'], + 'en_CA' => ['name' => 'English (Canadian)', 'nativeName' => 'English (Canadian)'], + 'en_GB' => ['name' => 'English (British)', 'nativeName' => 'English (British)'], + 'en_NZ' => ['name' => 'English (New Zealand)', 'nativeName' => 'English (New Zealand)'], + 'en_US' => ['name' => 'English (US)', 'nativeName' => 'English (US)'], + 'en_ZA' => ['name' => 'English (South African)', 'nativeName' => 'English (South African)'], + 'eo' => ['name' => 'Esperanto', 'nativeName' => 'Esperanto'], + 'es' => ['name' => 'Spanish', 'nativeName' => 'Español'], + 'es_AR' => ['name' => 'Spanish (Argentina)', 'nativeName' => 'Español (de Argentina)'], + 'es_CL' => ['name' => 'Spanish (Chile)', 'nativeName' => 'Español (de Chile)'], + 'es_ES' => ['name' => 'Spanish (Spain)', 'nativeName' => 'Español (de España)'], + 'es_MX' => ['name' => 'Spanish (Mexico)', 'nativeName' => 'Español (de México)'], + 'et' => ['name' => 'Estonian', 'nativeName' => 'Eesti keel'], + 'eu' => ['name' => 'Basque', 'nativeName' => 'Euskara'], + 'fa' => ['name' => 'Persian', 'nativeName' => 'فارسی', 'orientation' => 'rtl'], + 'fi' => ['name' => 'Finnish', 'nativeName' => 'Suomi'], + 'fi_FI' => ['name' => 'Finnish', 'nativeName' => 'Suomi'], + 'fj_FJ' => ['name' => 'Fijian', 'nativeName' => 'Vosa vaka_Viti'], + 'fr' => ['name' => 'French', 'nativeName' => 'Français'], + 'fr_CA' => ['name' => 'French (Canada)', 'nativeName' => 'Français (Canada)'], + 'fr_FR' => ['name' => 'French (France)', 'nativeName' => 'Français (France)'], + 'fur' => ['name' => 'Friulian', 'nativeName' => 'Furlan'], + 'fur_IT' => ['name' => 'Friulian', 'nativeName' => 'Furlan'], + 'fy' => ['name' => 'Frisian', 'nativeName' => 'Frysk'], + 'fy_NL' => ['name' => 'Frisian', 'nativeName' => 'Frysk'], + 'ga' => ['name' => 'Irish', 'nativeName' => 'Gaeilge'], + 'ga_IE' => ['name' => 'Irish (Ireland)', 'nativeName' => 'Gaeilge (Éire)'], + 'gd' => ['name' => 'Gaelic (Scotland)', 'nativeName' => 'Gàidhlig'], + 'gl' => ['name' => 'Galician', 'nativeName' => 'Galego'], + 'gu' => ['name' => 'Gujarati', 'nativeName' => 'ગુજરાતી'], + 'gu_IN' => ['name' => 'Gujarati', 'nativeName' => 'ગુજરાતી'], + 'he' => ['name' => 'Hebrew', 'nativeName' => 'עברית', 'orientation' => 'rtl'], + 'he_IL' => ['name' => 'Hebrew', 'nativeName' => 'עברית', 'orientation' => 'rtl'], + 'hi' => ['name' => 'Hindi', 'nativeName' => 'हिन्दी'], + 'hi_IN' => ['name' => 'Hindi (India)', 'nativeName' => 'हिन्दी (भारत)'], + 'hr' => ['name' => 'Croatian', 'nativeName' => 'Hrvatski'], + 'hr_HR' => ['name' => 'Croatian', 'nativeName' => 'Hrvatski'], + 'hsb' => ['name' => 'Upper Sorbian', 'nativeName' => 'Hornjoserbsce'], + 'hu' => ['name' => 'Hungarian', 'nativeName' => 'Magyar'], + 'hu_HU' => ['name' => 'Hungarian', 'nativeName' => 'Magyar'], + 'hy' => ['name' => 'Armenian', 'nativeName' => 'Հայերեն'], + 'hy_AM' => ['name' => 'Armenian', 'nativeName' => 'Հայերեն'], + 'id' => ['name' => 'Indonesian', 'nativeName' => 'Bahasa Indonesia'], + 'is' => ['name' => 'Icelandic', 'nativeName' => 'íslenska'], + 'it' => ['name' => 'Italian', 'nativeName' => 'Italiano'], + 'it_IT' => ['name' => 'Italian', 'nativeName' => 'Italiano'], + 'ja' => ['name' => 'Japanese', 'nativeName' => '日本語'], + 'ja_JP' => ['name' => 'Japanese', 'nativeName' => '日本語'], // not iso-639-1 + 'ka' => ['name' => 'Georgian', 'nativeName' => 'ქართული'], + 'kk' => ['name' => 'Kazakh', 'nativeName' => 'Қазақ'], + 'kn' => ['name' => 'Kannada', 'nativeName' => 'ಕನ್ನಡ'], + 'ko' => ['name' => 'Korean', 'nativeName' => '한국어'], + 'ko_KR' => ['name' => 'Korean', 'nativeName' => '한국어'], + 'ku' => ['name' => 'Kurdish', 'nativeName' => 'Kurdî'], + 'la' => ['name' => 'Latin', 'nativeName' => 'Latina'], + 'lb' => ['name' => 'Luxembourgish', 'nativeName' => 'Lëtzebuergesch'], + 'lg' => ['name' => 'Luganda', 'nativeName' => 'Luganda'], + 'lt' => ['name' => 'Lithuanian', 'nativeName' => 'Lietuvių kalba'], + 'lv' => ['name' => 'Latvian', 'nativeName' => 'Latviešu'], + 'mai' => ['name' => 'Maithili', 'nativeName' => 'मैथिली মৈথিলী'], + 'mg' => ['name' => 'Malagasy', 'nativeName' => 'Malagasy'], + 'mi' => ['name' => 'Maori (Aotearoa)', 'nativeName' => 'Māori (Aotearoa)'], + 'mk' => ['name' => 'Macedonian', 'nativeName' => 'Македонски'], + 'ml' => ['name' => 'Malayalam', 'nativeName' => 'മലയാളം'], + 'mn' => ['name' => 'Mongolian', 'nativeName' => 'Монгол'], + 'mr' => ['name' => 'Marathi', 'nativeName' => 'मराठी'], + 'no' => ['name' => 'Norwegian', 'nativeName' => 'Norsk'], + 'no_NO' => ['name' => 'Norwegian', 'nativeName' => 'Norsk'], + 'nb' => ['name' => 'Norwegian', 'nativeName' => 'Norsk'], + 'nb_NO' => ['name' => 'Norwegian (Bokmål)', 'nativeName' => 'Norsk bokmål'], + 'ne_NP' => ['name' => 'Nepali', 'nativeName' => 'नेपाली'], + 'nn_NO' => ['name' => 'Norwegian (Nynorsk)', 'nativeName' => 'Norsk nynorsk'], + 'nl' => ['name' => 'Dutch', 'nativeName' => 'Nederlands'], + 'nl_NL' => ['name' => 'Dutch', 'nativeName' => 'Nederlands'], + 'nr' => ['name' => 'Ndebele, South', 'nativeName' => 'IsiNdebele'], + 'nso' => ['name' => 'Northern Sotho', 'nativeName' => 'Sepedi'], + 'oc' => ['name' => 'Occitan (Lengadocian)', 'nativeName' => 'Occitan (lengadocian)'], + 'or' => ['name' => 'Oriya', 'nativeName' => 'ଓଡ଼ିଆ'], + 'pa' => ['name' => 'Punjabi', 'nativeName' => 'ਪੰਜਾਬੀ'], + 'pa_IN' => ['name' => 'Punjabi', 'nativeName' => 'ਪੰਜਾਬੀ'], + 'pl' => ['name' => 'Polish', 'nativeName' => 'Polski'], + 'pl_PL' => ['name' => 'Polish', 'nativeName' => 'Polski'], + 'pt' => ['name' => 'Portuguese', 'nativeName' => 'Português'], + 'pt_BR' => ['name' => 'Portuguese (Brazilian)', 'nativeName' => 'Português (do Brasil)'], + 'pt_PT' => ['name' => 'Portuguese (Portugal)', 'nativeName' => 'Português (Europeu)'], + 'ro' => ['name' => 'Romanian', 'nativeName' => 'Română'], + 'ro_RO' => ['name' => 'Romanian', 'nativeName' => 'Română'], + 'rm' => ['name' => 'Romansh', 'nativeName' => 'Rumantsch'], + 'ru' => ['name' => 'Russian', 'nativeName' => 'Русский'], + 'ru_RU' => ['name' => 'Russian', 'nativeName' => 'Русский'], + 'rw' => ['name' => 'Kinyarwanda', 'nativeName' => 'Ikinyarwanda'], + 'si' => ['name' => 'Sinhala', 'nativeName' => 'සිංහල'], + 'sk' => ['name' => 'Slovak', 'nativeName' => 'Slovenčina'], + 'sl' => ['name' => 'Slovenian', 'nativeName' => 'Slovensko'], + 'son' => ['name' => 'Songhai', 'nativeName' => 'Soŋay'], + 'sq' => ['name' => 'Albanian', 'nativeName' => 'Shqip'], + 'sr' => ['name' => 'Serbian', 'nativeName' => 'Српски'], + 'sr_SP' => ['name' => 'Serbian', 'nativeName' => 'Српски'], + 'sr_Latn' => ['name' => 'Serbian', 'nativeName' => 'Srpski'], // follows RFC 4646 + 'ss' => ['name' => 'Siswati', 'nativeName' => 'siSwati'], + 'st' => ['name' => 'Southern Sotho', 'nativeName' => 'Sesotho'], + 'sv' => ['name' => 'Swedish', 'nativeName' => 'Svenska'], + 'sv_SE' => ['name' => 'Swedish', 'nativeName' => 'Svenska'], + 'ta' => ['name' => 'Tamil', 'nativeName' => 'தமிழ்'], + 'ta_IN' => ['name' => 'Tamil (India)', 'nativeName' => 'தமிழ் (இந்தியா)'], + 'ta_LK' => ['name' => 'Tamil (Sri Lanka)', 'nativeName' => 'தமிழ் (இலங்கை)'], + 'te' => ['name' => 'Telugu', 'nativeName' => 'తెలుగు'], + 'th' => ['name' => 'Thai', 'nativeName' => 'ไทย'], + 'tlh' => ['name' => 'Klingon', 'nativeName' => 'Klingon'], + 'tn' => ['name' => 'Tswana', 'nativeName' => 'Setswana'], + 'tr' => ['name' => 'Turkish', 'nativeName' => 'Türkçe'], + 'tr_TR' => ['name' => 'Turkish', 'nativeName' => 'Türkçe'], + 'ts' => ['name' => 'Tsonga', 'nativeName' => 'Xitsonga'], + 'tt' => ['name' => 'Tatar', 'nativeName' => 'Tatarça'], + 'tt_RU' => ['name' => 'Tatar', 'nativeName' => 'Tatarça'], + 'uk' => ['name' => 'Ukrainian', 'nativeName' => 'Українська'], + 'uk_UA' => ['name' => 'Ukrainian', 'nativeName' => 'Українська'], + 'ur' => ['name' => 'Urdu', 'nativeName' => 'اُردو', 'orientation' => 'rtl'], + 've' => ['name' => 'Venda', 'nativeName' => 'Tshivenḓa'], + 'vi' => ['name' => 'Vietnamese', 'nativeName' => 'Tiếng Việt'], + 'vi_VN' => ['name' => 'Vietnamese', 'nativeName' => 'Tiếng Việt'], + 'wo' => ['name' => 'Wolof', 'nativeName' => 'Wolof'], + 'xh' => ['name' => 'Xhosa', 'nativeName' => 'isiXhosa'], + 'zh' => ['name' => 'Chinese (Simplified)', 'nativeName' => '中文 (简体)'], + 'zh_CN' => ['name' => 'Chinese (Simplified)', 'nativeName' => '中文 (简体)'], + 'zh_TW' => ['name' => 'Chinese (Traditional)', 'nativeName' => '正體中文 (繁體)'], + 'zu' => ['name' => 'Zulu', 'nativeName' => 'isiZulu'] ]; /** @@ -244,13 +244,13 @@ class Plugins // Go through... foreach ($plugins_list as $plugin) { if (Filesystem::has($_plugin_settings = PATH['plugins'] . '/' . $plugin['dirname'] . '/settings.yaml') and - Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/'. $plugin['dirname'] .'.yaml')) { + Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/' . $plugin['dirname'] . '.yaml')) { $_plugins_cache_id .= filemtime($_plugin_settings) . filemtime($_plugin_config); } } // Create Unique Cache ID for Plugins - $plugins_cache_id = md5('plugins' . PATH['plugins'] . '/' . $_plugins_cache_id); + $plugins_cache_id = md5('plugins' . PATH['plugins'] . '/' . $_plugins_cache_id); // Get plugins list from cache or scan plugins folder and create new plugins cache item if (Cache::contains($plugins_cache_id)) { @@ -266,7 +266,7 @@ class Plugins $plugin_settings = YamlParser::decode(Filesystem::read($_plugin_settings)); } - if (Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/'. $plugin['dirname']. '.yaml')) { + if (Filesystem::has($_plugin_config = PATH['plugins'] . '/' . $plugin['dirname'] . '/' . $plugin['dirname'] . '.yaml')) { $plugin_config = YamlParser::decode(Filesystem::read($_plugin_config)); } @@ -293,8 +293,8 @@ class Plugins // Include enabled plugins if (is_array(Registry::get('plugins')) && count(Registry::get('plugins')) > 0) { foreach (Registry::get('plugins') as $plugin_name => $plugin) { - if (Registry::get('plugins.'.$plugin_name.'.enabled')) { - include_once PATH['plugins'] . '/' . $plugin_name .'/'. $plugin_name . '.php'; + if (Registry::get('plugins.' . $plugin_name . '.enabled')) { + include_once PATH['plugins'] . '/' . $plugin_name . '/' . $plugin_name . '.php'; } } } diff --git a/flextype/Shortcodes.php b/flextype/Shortcodes.php index fc122f7d..77346fcf 100644 --- a/flextype/Shortcodes.php +++ b/flextype/Shortcodes.php @@ -161,11 +161,11 @@ class Shortcodes { ($s->getParameter('q')) and $params['q'] = $s->getParameter('q'); ($s->getParameter('fm')) and $params['fm'] = $s->getParameter('fm'); - ($s->getParameter('width')) and $attributes['width'] = $s->getParameter('width'); + ($s->getParameter('width')) and $attributes['width'] = $s->getParameter('width'); ($s->getParameter('height')) and $attributes['height'] = $s->getParameter('height'); - ($s->getParameter('class')) and $attributes['class'] = $s->getParameter('class'); - ($s->getParameter('id')) and $attributes['id'] = $s->getParameter('id'); - ($s->getParameter('alt')) and $attributes['alt'] = $s->getParameter('alt'); + ($s->getParameter('class')) and $attributes['class'] = $s->getParameter('class'); + ($s->getParameter('id')) and $attributes['id'] = $s->getParameter('id'); + ($s->getParameter('alt')) and $attributes['alt'] = $s->getParameter('alt'); return Images::getImage($s->getParameter('path'), $params, $attributes); }); diff --git a/flextype/Themes.php b/flextype/Themes.php index 3d8c0b23..03b7efc0 100644 --- a/flextype/Themes.php +++ b/flextype/Themes.php @@ -74,19 +74,19 @@ class Themes Registry::set('themes', []); // Create Unique Cache ID for Theme - $theme_cache_id = md5('theme' . filemtime(PATH['themes'] .'/'. $theme . '/' . 'settings.yaml') . - filemtime(PATH['themes'] .'/'. $theme . '/' . $theme . '.yaml')); + $theme_cache_id = md5('theme' . filemtime(PATH['themes'] . '/' . $theme . '/' . 'settings.yaml') . + filemtime(PATH['themes'] . '/' . $theme . '/' . $theme . '.yaml')); // Get Theme mafifest file and write to settings.themes array if (Cache::contains($theme_cache_id)) { - Registry::set('themes.'.Registry::get('settings.theme'), Cache::fetch($theme_cache_id)); + Registry::set('themes.' . Registry::get('settings.theme'), Cache::fetch($theme_cache_id)); } else { if (Filesystem::has($theme_settings = PATH['themes'] . '/' . $theme . '/' . 'settings.yaml') and Filesystem::has($theme_config = PATH['themes'] . '/' . $theme . '/' . $theme . '.yaml')) { $theme_settings = YamlParser::decode(Filesystem::read($theme_settings)); $theme_config = YamlParser::decode(Filesystem::read($theme_config)); $_theme = array_merge($theme_settings, $theme_config); - Registry::set('themes.'.Registry::get('settings.theme'), $_theme); + Registry::set('themes.' . Registry::get('settings.theme'), $_theme); Cache::save($theme_cache_id, $_theme); } } diff --git a/flextype/parsers/FrontmatterParser.php b/flextype/parsers/FrontmatterParser.php index e139fdea..00bd813e 100644 --- a/flextype/parsers/FrontmatterParser.php +++ b/flextype/parsers/FrontmatterParser.php @@ -26,10 +26,10 @@ class FrontmatterParser { */ public static function parse(string $content) : array { - $parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL.ltrim($content)); + $parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL.ltrim($content)); - if (count($parts) < 3) return ['matter' => [], 'body' => $content]; + if (count($parts) < 3) return ['matter' => [], 'body' => $content]; - return ['matter' => trim($parts[1]), 'body' => implode(PHP_EOL.'---'.PHP_EOL, array_slice($parts, 2))]; + return ['matter' => trim($parts[1]), 'body' => implode(PHP_EOL.'---'.PHP_EOL, array_slice($parts, 2))]; } } diff --git a/flextype/parsers/YamlParser.php b/flextype/parsers/YamlParser.php index 79915bbc..8f6dce8c 100644 --- a/flextype/parsers/YamlParser.php +++ b/flextype/parsers/YamlParser.php @@ -74,7 +74,7 @@ class YamlParser { $input, $inline ? $inline : YamlParser::$inline, $indent ? $indent : YamlParser::$indent, - $flags ? $flags : YamlParser::$flag + $flags ? $flags : YamlParser::$flag ); } catch (DumpException $e) { throw new \RuntimeException('Encoding YAML failed: ' . $e->getMessage(), 0, $e); diff --git a/index.php b/index.php index 06ad6e32..60d87c5b 100755 --- a/index.php +++ b/index.php @@ -28,7 +28,7 @@ define('PATH', ['site' => ROOT_DIR . '/site', 'config' => [ 'default' => ROOT_DIR . '/flextype/config', 'site' => ROOT_DIR . '/site/config' - ], + ], 'cache' => ROOT_DIR . '/site/cache']); // Define the path to the logs directory (without trailing slash). diff --git a/site/plugins/admin/admin.php b/site/plugins/admin/admin.php index 0ed70d46..55666c24 100755 --- a/site/plugins/admin/admin.php +++ b/site/plugins/admin/admin.php @@ -43,7 +43,7 @@ if (Admin::isAdminArea()) { // // Add listner for onCurrentPageBeforeLoaded event // - Event::addListener('onCurrentEntryBeforeProcessed', function () { + Event::addListener('onCurrentEntryBeforeProcessed', function() { // Add navigation links NavigationManager::addItem('content', 'entries', '' . __('admin_entries', Registry::get('settings.locale')), Http::getBaseUrl() . '/admin/entries', ['class' => 'nav-link']); @@ -147,17 +147,17 @@ class Admin Event::dispatch('onAdminArea'); // Route the Uri - Http::getUriSegment(1) == '' and DashboardManager::getDashboardManager(); - Http::getUriSegment(1) == 'entries' and EntriesManager::getEntriesManager(); - Http::getUriSegment(1) == 'menus' and MenusManager::getMenusManager(); - Http::getUriSegment(1) == 'fieldsets' and FieldsetsManager::getFieldsetsManager(); - Http::getUriSegment(1) == 'templates' and TemplatesManager::getTemplatesManager(); - Http::getUriSegment(1) == 'snippets' and SnippetsManager::getSnippetsManager(); - Http::getUriSegment(1) == 'plugins' and PluginsManager::getPluginsManager(); - Http::getUriSegment(1) == 'information' and InformationManager::getInformationManager(); - Http::getUriSegment(1) == 'settings' and SettingsManager::getSettingsManager(); - Http::getUriSegment(1) == 'profile' and UsersManager::getProfileManager(); - Http::getUriSegment(1) == 'logout' and UsersManager::logout(); + Http::getUriSegment(1) == '' and DashboardManager::getDashboardManager(); + Http::getUriSegment(1) == 'entries' and EntriesManager::getEntriesManager(); + Http::getUriSegment(1) == 'menus' and MenusManager::getMenusManager(); + Http::getUriSegment(1) == 'fieldsets' and FieldsetsManager::getFieldsetsManager(); + Http::getUriSegment(1) == 'templates' and TemplatesManager::getTemplatesManager(); + Http::getUriSegment(1) == 'snippets' and SnippetsManager::getSnippetsManager(); + Http::getUriSegment(1) == 'plugins' and PluginsManager::getPluginsManager(); + Http::getUriSegment(1) == 'information' and InformationManager::getInformationManager(); + Http::getUriSegment(1) == 'settings' and SettingsManager::getSettingsManager(); + Http::getUriSegment(1) == 'profile' and UsersManager::getProfileManager(); + Http::getUriSegment(1) == 'logout' and UsersManager::logout(); } diff --git a/site/plugins/admin/classes/DashboardManager.php b/site/plugins/admin/classes/DashboardManager.php index b8d323c5..b18083fb 100644 --- a/site/plugins/admin/classes/DashboardManager.php +++ b/site/plugins/admin/classes/DashboardManager.php @@ -8,6 +8,6 @@ class DashboardManager { public static function getDashboardManager() { - Http::redirect(Http::getBaseUrl().'/admin/entries'); + Http::redirect(Http::getBaseUrl() . '/admin/entries'); } } diff --git a/site/plugins/admin/classes/EntriesManager.php b/site/plugins/admin/classes/EntriesManager.php index 2ed34249..d2b5d9ad 100644 --- a/site/plugins/admin/classes/EntriesManager.php +++ b/site/plugins/admin/classes/EntriesManager.php @@ -68,7 +68,7 @@ class EntriesManager if (isset($_frontmatter[$key])) { $_value = $_frontmatter[$key]; - } elseif(isset($field['value'])) { + } elseif (isset($field['value'])) { $_value = $field['value']; } else { $_value = ''; @@ -82,10 +82,10 @@ class EntriesManager // Create a entry! if (Filesystem::write( - $file, - '---'."\n". - YamlParser::encode(array_replace_recursive($frontmatter, $_frontmatter)). - '---'."\n" + $file, + '---'."\n". + YamlParser::encode(array_replace_recursive($frontmatter, $_frontmatter)). + '---'."\n" )) { Notification::set('success', __('admin_message_entry_created')); Http::redirect(Http::getBaseUrl().'/admin/entries/?entry='.Http::post('parent_entry')); @@ -116,10 +116,10 @@ class EntriesManager if (Http::get('entry') != '') { if (Token::check((Http::get('token')))) { Filesystem::copy(PATH['entries'] . '/' . Http::get('entry'), - PATH['entries'] . '/' . Http::get('entry') . '-duplicate-' . date("Ymd_His"), - true); + PATH['entries'] . '/' . Http::get('entry') . '-duplicate-' . date("Ymd_His"), + true); Notification::set('success', __('admin_message_entry_duplicated')); - Http::redirect(Http::getBaseUrl().'/admin/entries/?entry='.implode('/', array_slice(explode("/", Http::get('entry')), 0, -1))); + Http::redirect(Http::getBaseUrl() . '/admin/entries/?entry=' . implode('/', array_slice(explode("/", Http::get('entry')), 0, -1))); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -138,7 +138,7 @@ class EntriesManager PATH['entries'] . '/' . Http::post('entry_parent') . '/' . Text::safeString(Http::post('name'), '-', true) )) { Notification::set('success', __('admin_message_entry_renamed')); - Http::redirect(Http::getBaseUrl().'/admin/entries/?entry='.Http::post('entry_parent')); + Http::redirect(Http::getBaseUrl() . '/admin/entries/?entry=' . Http::post('entry_parent')); } } } else { @@ -176,13 +176,13 @@ class EntriesManager if (Filesystem::write( PATH['entries'] . '/' . Http::post('entry') . '/entry.html', - '---'."\n". - $frontmatter."\n". - '---'."\n". - $content + '---'."\n". + $frontmatter."\n". + '---'."\n". + $content )) { - Notification::set('success', __('admin_message_entry_changes_saved')); - Http::redirect(Http::getBaseUrl() . '/admin/entries?entry='.implode('/', array_slice(explode("/", Http::get('entry')), 0, -1))); + Notification::set('success', __('admin_message_entry_changes_saved')); + Http::redirect(Http::getBaseUrl() . '/admin/entries?entry='.implode('/', array_slice(explode("/", Http::get('entry')), 0, -1))); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); @@ -209,7 +209,7 @@ class EntriesManager PATH['entries'] . '/' . Http::post('parent_entry') . '/' . Text::safeString(Http::post('name_current'), '-', true) )) { Notification::set('success', __('admin_message_entry_moved')); - Http::redirect(Http::getBaseUrl().'/admin/entries/?entry='.Http::post('parent_entry')); + Http::redirect(Http::getBaseUrl() . '/admin/entries/?entry=' . Http::post('parent_entry')); } } } else { @@ -254,10 +254,10 @@ class EntriesManager if (Token::check((Http::post('token')))) { Filesystem::write( PATH['entries'] . '/' . Http::post('entry_name') . '/entry.html', - Http::post('entry_content') + Http::post('entry_content') ); Notification::set('success', __('admin_message_entry_changes_saved')); - Http::redirect(Http::getBaseUrl().'/admin/entries/edit?entry='.Http::post('entry_name').'&source=true'); + Http::redirect(Http::getBaseUrl() . '/admin/entries/edit?entry=' . Http::post('entry_name') . '&source=true'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -294,10 +294,10 @@ class EntriesManager Filesystem::write( PATH['entries'] . '/' . Http::get('entry') . '/entry.html', - '---'."\n". - $frontmatter."\n". - '---'."\n". - $content + '---'."\n". + $frontmatter."\n". + '---'."\n". + $content ); Notification::set('success', __('admin_message_entry_changes_saved')); Http::redirect(Http::getBaseUrl().'/admin/entries/edit?entry='.Http::get('entry')); @@ -336,7 +336,7 @@ class EntriesManager if (strpos(Registry::get('settings.entries.media.accept_file_types'), $file_ext = substr(strrchr($file, '.'), 1)) !== false) { if (strpos($file, strtolower($file_ext), 1)) { if ($path) { - $files[Http::getBaseUrl().'/'.$entry.'/'.$file] = Http::getBaseUrl().'/'.$entry.'/'.$file; + $files[Http::getBaseUrl() . '/' . $entry . '/' . $file] = Http::getBaseUrl() . '/' . $entry . '/' . $file; } else { $files[$file] = $file; } @@ -356,23 +356,23 @@ class EntriesManager foreach ($form as $element => $property) { // Create attributes - $property['attributes'] = Arr::keyExists($property, 'attributes') ? $property['attributes'] : [] ; + $property['attributes'] = Arr::keyExists($property, 'attributes') ? $property['attributes'] : []; // Create attribute class - $property['attributes']['class'] = Arr::keyExists($property, 'attributes.class') ? 'form-control ' . $property['attributes']['class'] : 'form-control' ; + $property['attributes']['class'] = Arr::keyExists($property, 'attributes.class') ? 'form-control ' . $property['attributes']['class'] : 'form-control'; // Create attribute size - $property['size'] = Arr::keyExists($property, 'size') ? $property['size'] : 'col-12' ; + $property['size'] = Arr::keyExists($property, 'size') ? $property['size'] : 'col-12'; // Create attribute value - $property['value'] = Arr::keyExists($property, 'value') ? $property['value'] : '' ; + $property['value'] = Arr::keyExists($property, 'value') ? $property['value'] : ''; $pos = strpos($element, '.'); if ($pos === false) { $form_element_name = $element; } else { - $form_element_name = str_replace(".", "][", "$element").']'; + $form_element_name = str_replace(".", "][", "$element") . ']'; } $pos = strpos($form_element_name, ']'); @@ -441,7 +441,7 @@ class EntriesManager if ($property['type'] == 'hidden') { echo $form_element; } else { - echo '
'; + echo '
'; echo $form_label . $form_element; echo '
'; } @@ -459,7 +459,7 @@ class EntriesManager if (Token::check((Http::get('token')))) { Filesystem::delete($files_directory . Http::get('delete_file')); Notification::set('success', __('admin_message_entry_file_deleted')); - Http::redirect(Http::getBaseUrl().'/admin/entries/edit?entry='.Http::get('entry').'&media=true'); + Http::redirect(Http::getBaseUrl() . '/admin/entries/edit?entry=' . Http::get('entry') . '&media=true'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -471,7 +471,7 @@ class EntriesManager $file = EntriesManager::uploadFile($_FILES['file'], $files_directory, Registry::get('settings.entries.media.accept_file_types'), 27000000); - if($file !== false) { + if ($file !== false) { if (in_array(pathinfo($file)['extension'], ['jpg', 'jpeg', 'png', 'gif'])) { @@ -480,17 +480,17 @@ class EntriesManager // now you are able to resize the instance if (Registry::get('settings.entries.media.upload_images_width') > 0 && Registry::get('settings.entries.media.upload_images_height') > 0) { - $img->resize(Registry::get('settings.entries.media.upload_images_width'), Registry::get('settings.entries.media.upload_images_height'), function ($constraint) { + $img->resize(Registry::get('settings.entries.media.upload_images_width'), Registry::get('settings.entries.media.upload_images_height'), function($constraint) { $constraint->aspectRatio(); $constraint->upsize(); }); } elseif (Registry::get('settings.entries.media.upload_images_width') > 0) { - $img->resize(Registry::get('settings.entries.media.upload_images_width'), null, function ($constraint) { + $img->resize(Registry::get('settings.entries.media.upload_images_width'), null, function($constraint) { $constraint->aspectRatio(); $constraint->upsize(); }); } elseif (Registry::get('settings.entries.media.upload_images_height') > 0) { - $img->resize(null, Registry::get('settings.entries.media.upload_images_height'), function ($constraint) { + $img->resize(null, Registry::get('settings.entries.media.upload_images_height'), function($constraint) { $constraint->aspectRatio(); $constraint->upsize(); }); @@ -504,10 +504,10 @@ class EntriesManager } Notification::set('success', __('admin_message_entry_file_uploaded')); - Http::redirect(Http::getBaseUrl().'/admin/entries/edit?entry='.Http::get('entry').'&media=true'); + Http::redirect(Http::getBaseUrl() . '/admin/entries/edit?entry=' . Http::get('entry') . '&media=true'); } else { Notification::set('error', __('admin_message_entry_file_not_uploaded')); - Http::redirect(Http::getBaseUrl().'/admin/entries/edit?entry='.Http::get('entry').'&media=true'); + Http::redirect(Http::getBaseUrl() . '/admin/entries/edit?entry=' . Http::get('entry') . '&media=true'); } } else { @@ -536,15 +536,15 @@ class EntriesManager */ public static function uploadFile( array $file, - string $upload_directory, - string $allowed = 'jpeg, png, gif, jpg', - int $max_size = 3000000, - string $filename = null, - bool $remove_spaces = true, - int $max_width = null, - int $max_height = null, - bool $exact = false, - int $chmod = 0644 + string $upload_directory, + string $allowed = 'jpeg, png, gif, jpg', + int $max_size = 3000000, + string $filename = null, + bool $remove_spaces = true, + int $max_width = null, + int $max_height = null, + bool $exact = false, + int $chmod = 0644 ) { // // Tests if a successful upload has been made. @@ -578,7 +578,7 @@ class EntriesManager // // Validation rule to test if an upload is an image and, optionally, is the correct size. // - if (in_array(mime_content_type($file['tmp_name']), ['image/jpeg', 'image/jpg', 'image/png','image/gif'])) { + if (in_array(mime_content_type($file['tmp_name']), ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'])) { function validateImage($file, $max_width, $max_height, $exact) { try { @@ -593,12 +593,12 @@ class EntriesManager return false; } - if (! $max_width) { + if (!$max_width) { // No limit, use the image width $max_width = $width; } - if (! $max_height) { + if (!$max_height) { // No limit, use the image height $max_height = $height; } @@ -619,7 +619,7 @@ class EntriesManager } } - if (! isset($file['tmp_name']) or ! is_uploaded_file($file['tmp_name'])) { + if (!isset($file['tmp_name']) or !is_uploaded_file($file['tmp_name'])) { // Ignore corrupted uploads return false; @@ -637,12 +637,12 @@ class EntriesManager $filename = Text::safeString(pathinfo($filename)['filename'], '-', true) . '.' . pathinfo($filename)['extension']; } - if (! is_dir($upload_directory) or ! is_writable(realpath($upload_directory))) { + if (!is_dir($upload_directory) or !is_writable(realpath($upload_directory))) { throw new \RuntimeException("Directory {$upload_directory} must be writable"); } // Make the filename into a complete path - $filename = realpath($upload_directory).DIRECTORY_SEPARATOR.$filename; + $filename = realpath($upload_directory) . DIRECTORY_SEPARATOR . $filename; if (move_uploaded_file($file['tmp_name'], $filename)) { diff --git a/site/plugins/admin/classes/FieldsetsManager.php b/site/plugins/admin/classes/FieldsetsManager.php index b472713b..6b923366 100644 --- a/site/plugins/admin/classes/FieldsetsManager.php +++ b/site/plugins/admin/classes/FieldsetsManager.php @@ -28,8 +28,8 @@ class FieldsetsManager if (!Filesystem::has($file)) { // Create a fieldset! if (Filesystem::write( - $file, - YamlParser::encode([ + $file, + YamlParser::encode([ 'title' => Http::post('title'), 'fields' => [ 'title' => [ @@ -37,8 +37,8 @@ class FieldsetsManager 'type' => 'text', 'size' => 'col-12' ] - ] - ]) + ] + ]) )) { Notification::set('success', __('admin_message_fieldset_created')); Http::redirect(Http::getBaseUrl() . '/admin/fieldsets'); @@ -90,9 +90,9 @@ class FieldsetsManager if (Http::get('fieldset') != '') { if (Token::check((Http::get('token')))) { Filesystem::copy(PATH['themes'] . '/' . Registry::get('settings.theme') . '/fieldsets/' . Http::get('fieldset') . '.yaml', - PATH['themes'] . '/' . Registry::get('settings.theme') . '/fieldsets/' . Http::get('fieldset') . '-duplicate-' . date("Ymd_His") . '.yaml'); + PATH['themes'] . '/' . Registry::get('settings.theme') . '/fieldsets/' . Http::get('fieldset') . '-duplicate-' . date("Ymd_His") . '.yaml'); Notification::set('success', __('admin_message_fieldset_duplicated')); - Http::redirect(Http::getBaseUrl().'/admin/fieldsets'); + Http::redirect(Http::getBaseUrl() . '/admin/fieldsets'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -106,11 +106,11 @@ class FieldsetsManager // Save a fieldset! if (Filesystem::write( - PATH['themes'] . '/' . Registry::get('settings.theme') . '/fieldsets/' . Http::post('name') . '.yaml', - Http::post('fieldset') + PATH['themes'] . '/' . Registry::get('settings.theme') . '/fieldsets/' . Http::post('name') . '.yaml', + Http::post('fieldset') )) { Notification::set('success', __('admin_message_fieldset_saved')); - Http::redirect(Http::getBaseUrl() . '/admin/fieldsets/edit?fieldset='.Http::post('name')); + Http::redirect(Http::getBaseUrl() . '/admin/fieldsets/edit?fieldset=' . Http::post('name')); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); diff --git a/site/plugins/admin/classes/MenusManager.php b/site/plugins/admin/classes/MenusManager.php index b5d6b2cc..02c8bee4 100644 --- a/site/plugins/admin/classes/MenusManager.php +++ b/site/plugins/admin/classes/MenusManager.php @@ -31,8 +31,8 @@ class MenusManager if (!Filesystem::has($file)) { // Create a menu! if (Filesystem::write( - $file, - YamlParser::encode(['title' => Http::post('title')]) + $file, + YamlParser::encode(['title' => Http::post('title')]) )) { Notification::set('success', __('admin_message_menu_created')); Http::redirect(Http::getBaseUrl() . '/admin/menus'); @@ -84,9 +84,9 @@ class MenusManager if (Http::get('menu') != '') { if (Token::check((Http::get('token')))) { Filesystem::copy(PATH['menus'] . '/' . Http::get('menu') . '.yaml', - PATH['menus'] . '/' . Http::get('menu') . '-duplicate-' . date("Ymd_His") . '.yaml'); + PATH['menus'] . '/' . Http::get('menu') . '-duplicate-' . date("Ymd_His") . '.yaml'); Notification::set('success', __('admin_message_menu_duplicated')); - Http::redirect(Http::getBaseUrl().'/admin/menus'); + Http::redirect(Http::getBaseUrl() . '/admin/menus'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -100,8 +100,8 @@ class MenusManager // Save a menu! if (Filesystem::write( - PATH['menus'] . '/' . Http::post('name') . '.yaml', - Http::post('menu') + PATH['menus'] . '/' . Http::post('name') . '.yaml', + Http::post('menu') )) { Notification::set('success', __('admin_message_menu_saved')); Http::redirect(Http::getBaseUrl() . '/admin/menus/edit?menu=' . Http::post('name')); @@ -122,10 +122,10 @@ class MenusManager $menus = Filesystem::getFilesList(PATH['menus'], 'yaml'); if (count($menus) > 0) { - foreach ($menus as $menu) { - $menus_list[basename($menu, '.yaml')] = YamlParser::decode(Filesystem::read($menu)); - } - } + foreach ($menus as $menu) { + $menus_list[basename($menu, '.yaml')] = YamlParser::decode(Filesystem::read($menu)); + } + } Themes::view('admin/views/templates/extends/menus/list') ->assign('menus_list', $menus_list) diff --git a/site/plugins/admin/classes/PluginsManager.php b/site/plugins/admin/classes/PluginsManager.php index 23a0f37b..670a3b10 100644 --- a/site/plugins/admin/classes/PluginsManager.php +++ b/site/plugins/admin/classes/PluginsManager.php @@ -20,9 +20,9 @@ class PluginsManager { if (Http::post('plugin_change_status')) { if (Token::check((Http::post('token')))) { - $plugin_settings = YamlParser::decode(Filesystem::read(PATH['plugins'] . '/' . Http::post('plugin') . '/' . 'settings.yaml')); + $plugin_settings = YamlParser::decode(Filesystem::read(PATH['plugins'] . '/' . Http::post('plugin') . '/' . 'settings.yaml')); Arr::set($plugin_settings, 'enabled', (Http::post('status') == 'true' ? true : false)); - Filesystem::write(PATH['plugins'] . '/' . Http::post('plugin') . '/' . 'settings.yaml', YamlParser::encode($plugin_settings)); + Filesystem::write(PATH['plugins'] . '/' . Http::post('plugin') . '/' . 'settings.yaml', YamlParser::encode($plugin_settings)); Cache::clear(); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); @@ -34,7 +34,7 @@ class PluginsManager { Registry::set('sidebar_menu_item', 'plugins'); - Event::addListener('onBeforeRequestShutdown', function () { + Event::addListener('onBeforeRequestShutdown', function() { PluginsManager::_pluginsChangeStatusAjax(); }); diff --git a/site/plugins/admin/classes/SettingsManager.php b/site/plugins/admin/classes/SettingsManager.php index f2f93257..0b56e9ce 100644 --- a/site/plugins/admin/classes/SettingsManager.php +++ b/site/plugins/admin/classes/SettingsManager.php @@ -28,7 +28,7 @@ class SettingsManager if (Token::check((Http::get('token')))) { Cache::clear(); Notification::set('success', __('admin_message_cache_files_deleted')); - Http::redirect(Http::getBaseUrl().'/admin/settings'); + Http::redirect(Http::getBaseUrl() . '/admin/settings'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -52,7 +52,7 @@ class SettingsManager if (Filesystem::write(PATH['config']['site'] . '/settings.yaml', YamlParser::encode(array_merge(Registry::get('settings'), $settings)))) { Notification::set('success', __('admin_message_settings_saved')); - Http::redirect(Http::getBaseUrl().'/admin/settings'); + Http::redirect(Http::getBaseUrl() . '/admin/settings'); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); @@ -85,17 +85,17 @@ class SettingsManager } $cache_driver = ['auto' => 'Auto Detect', - 'file' => 'File', - 'apc' => 'APC', - 'apcu' => 'APCu', - 'wincache' => 'WinCache', - 'xcache' => 'Xcache', - 'memcache' => 'Memcache', - 'memcached' => 'Memcached', - 'redis' => 'Redis', - 'sqlite3' => 'SQLite3', - 'zend' => 'Zend', - 'array' => 'Array']; + 'file' => 'File', + 'apc' => 'APC', + 'apcu' => 'APCu', + 'wincache' => 'WinCache', + 'xcache' => 'Xcache', + 'memcache' => 'Memcache', + 'memcached' => 'Memcached', + 'redis' => 'Redis', + 'sqlite3' => 'SQLite3', + 'zend' => 'Zend', + 'array' => 'Array']; Themes::view('admin/views/templates/system/settings/list') ->assign('settings', Registry::get('settings')) diff --git a/site/plugins/admin/classes/SnippetsManager.php b/site/plugins/admin/classes/SnippetsManager.php index 1791cdc1..2b9e9d57 100644 --- a/site/plugins/admin/classes/SnippetsManager.php +++ b/site/plugins/admin/classes/SnippetsManager.php @@ -31,8 +31,8 @@ class SnippetsManager if (!Filesystem::has($file)) { // Create a snippet! if (Filesystem::write( - $file, - "" + $file, + "" )) { Notification::set('success', __('admin_message_snippet_created')); Http::redirect(Http::getBaseUrl() . '/admin/snippets'); @@ -84,9 +84,9 @@ class SnippetsManager if (Http::get('snippet') != '') { if (Token::check((Http::get('token')))) { Filesystem::copy(PATH['snippets'] . '/' . Http::get('snippet') . '.php', - PATH['snippets'] . '/' . Http::get('snippet') . '-duplicate-' . date("Ymd_His") . '.php'); + PATH['snippets'] . '/' . Http::get('snippet') . '-duplicate-' . date("Ymd_His") . '.php'); Notification::set('success', __('admin_message_snippet_duplicated')); - Http::redirect(Http::getBaseUrl().'/admin/snippets'); + Http::redirect(Http::getBaseUrl() . '/admin/snippets'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -100,11 +100,11 @@ class SnippetsManager // Save a snippet! if (Filesystem::write( - PATH['snippets'] . '/' . Http::post('name') . '.php', - Http::post('snippet') + PATH['snippets'] . '/' . Http::post('name') . '.php', + Http::post('snippet') )) { Notification::set('success', __('admin_message_snippet_saved')); - Http::redirect(Http::getBaseUrl() . '/admin/snippets/edit?snippet='.Http::post('name')); + Http::redirect(Http::getBaseUrl() . '/admin/snippets/edit?snippet=' . Http::post('name')); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); diff --git a/site/plugins/admin/classes/TemplatesManager.php b/site/plugins/admin/classes/TemplatesManager.php index c3b17ed0..742f1ac6 100644 --- a/site/plugins/admin/classes/TemplatesManager.php +++ b/site/plugins/admin/classes/TemplatesManager.php @@ -30,8 +30,8 @@ class TemplatesManager if (!Filesystem::has($file)) { // Create a template! if (Filesystem::write( - $file, - "" + $file, + "" )) { Notification::set('success', __('admin_message_template_created')); Http::redirect(Http::getBaseUrl() . '/admin/templates'); @@ -88,9 +88,9 @@ class TemplatesManager if (Token::check((Http::get('token')))) { $type = (Http::get('type') && Http::get('type') == 'partial') ? 'partial' : 'template'; Filesystem::copy(PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/' . $type . 's' . '/' . Http::get('template') . '.php', - PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/' . $type . 's' . '/' . Http::get('template') . '-duplicate-' . date("Ymd_His") . '.php'); + PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/' . $type . 's' . '/' . Http::get('template') . '-duplicate-' . date("Ymd_His") . '.php'); Notification::set('success', __('admin_message_template_duplicated')); - Http::redirect(Http::getBaseUrl().'/admin/templates'); + Http::redirect(Http::getBaseUrl() . '/admin/templates'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -106,8 +106,8 @@ class TemplatesManager // Save a template! if (Filesystem::write( - PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/' . $type . 's' . '/' . Http::post('name') . '.php', - Http::post('template') + PATH['themes'] . '/' . Registry::get('settings.theme') . '/views/' . $type . 's' . '/' . Http::post('name') . '.php', + Http::post('template') )) { Notification::set('success', __('admin_message_template_saved')); Http::redirect(Http::getBaseUrl() . '/admin/templates/edit?template=' . Http::post('name') . '&type=' . $type); diff --git a/site/plugins/admin/classes/UsersManager.php b/site/plugins/admin/classes/UsersManager.php index 7c3fd595..3c65eedc 100644 --- a/site/plugins/admin/classes/UsersManager.php +++ b/site/plugins/admin/classes/UsersManager.php @@ -26,7 +26,7 @@ class UsersManager { if (Token::check((Http::get('token')))) { Session::destroy(); - Http::redirect(Http::getBaseUrl().'/admin'); + Http::redirect(Http::getBaseUrl() . '/admin'); } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } @@ -51,7 +51,7 @@ class UsersManager 'state' => 'enabled']) ); - Http::redirect(Http::getBaseUrl().'/admin/entries'); + Http::redirect(Http::getBaseUrl() . '/admin/entries'); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); @@ -89,7 +89,7 @@ class UsersManager if (password_verify(trim(Http::post('password')), $user_file['hashed_password'])) { Session::set('username', $user_file['username']); Session::set('role', $user_file['role']); - Http::redirect(Http::getBaseUrl().'/admin/entries'); + Http::redirect(Http::getBaseUrl() . '/admin/entries'); } else { Notification::set('error', __('admin_message_wrong_username_password')); } diff --git a/site/plugins/admin/views/partials/head.php b/site/plugins/admin/views/partials/head.php index 30ba9a88..dd3333f8 100755 --- a/site/plugins/admin/views/partials/head.php +++ b/site/plugins/admin/views/partials/head.php @@ -53,7 +53,7 @@ use function Flextype\Component\I18n\__; - class="content-full-size" > + class="content-full-size" >
display() ?>
diff --git a/site/plugins/admin/views/partials/sidebar.php b/site/plugins/admin/views/partials/sidebar.php index 42fa0f40..7088ee8f 100755 --- a/site/plugins/admin/views/partials/sidebar.php +++ b/site/plugins/admin/views/partials/sidebar.php @@ -16,22 +16,22 @@ use Flextype\Navigation;