diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index fb0339f38..b1c47f26f 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -193,7 +193,7 @@ class LeftAndMain extends Controller implements PermissionProvider { CMSMenu::add_link( 'Help', _t('LeftAndMain.HELP', 'Help', 'Menu title'), - self::$help_link + $this->config()->help_link ); // Allow customisation of the access check by a extension @@ -1413,7 +1413,11 @@ class LeftAndMain extends Controller implements PermissionProvider { $cache = SS_Cache::factory('LeftAndMain_CMSVersion'); $cacheKey = filemtime($composerLockPath); $versions = $cache->load($cacheKey); - if(!$versions) $versions = array(); + if($versions) { + $versions = json_decode($versions, true); + } else { + $versions = array(); + } if(!$versions && $jsonData = file_get_contents($composerLockPath)) { $lockData = json_decode($jsonData); if($lockData && isset($lockData->packages)) { @@ -1429,7 +1433,7 @@ class LeftAndMain extends Controller implements PermissionProvider { } } } - + // Fall back to static version file foreach($modules as $moduleName => $moduleSpec) { if(!isset($versions[$moduleName])) { diff --git a/admin/templates/Includes/ModelAdmin_Content.ss b/admin/templates/Includes/ModelAdmin_Content.ss index 3c8740c51..7f985ad1e 100644 --- a/admin/templates/Includes/ModelAdmin_Content.ss +++ b/admin/templates/Includes/ModelAdmin_Content.ss @@ -16,7 +16,7 @@ diff --git a/docs/en/changelogs/3.1.0.md b/docs/en/changelogs/3.1.0.md index 2d08c92d0..a5d27292d 100644 --- a/docs/en/changelogs/3.1.0.md +++ b/docs/en/changelogs/3.1.0.md @@ -426,3 +426,5 @@ you can enable those warnings and future-proof your code already. * `ScheduledTask`, `QuarterHourlyTask`, `HourlyTask`, `DailyTask`, `MonthlyTask`, `WeeklyTask` and `YearlyTask` are deprecated, please extend from `BuildTask` or `CliController`, and invoke them in self-defined frequencies through Unix cronjobs etc. + * `i18n::$common_locales` and `i18n::$common_languages` are now accessed via the Config API, and contain associative rather than indexed arrays. + Before: `array('de_DE' => array('German', 'Deutsch'))`, after: `array('de_DE' => array('name' => 'German', 'native' => 'Deutsch'))`. \ No newline at end of file diff --git a/email/Email.php b/email/Email.php index 90f040477..714650bb9 100644 --- a/email/Email.php +++ b/email/Email.php @@ -116,7 +116,7 @@ class Email extends ViewableData { * @var string The default administrator email address. * This will be set in the config on a site-by-site basis */ - private static $admin_email_address = ''; + private static $admin_email = ''; /** * Send every email generated by the Email class to the given address. diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index ccbf86b49..f75e05367 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -692,7 +692,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { */ protected function getFieldsForImage($url, $file) { if($file->File instanceof Image) { - $formattedImage = $file->File->generateFormattedImage('SetWidth', Image::$asset_preview_width); + $formattedImage = $file->File->generateFormattedImage('SetWidth', Config::inst()->get('Image', 'asset_preview_width')); $thumbnailURL = $formattedImage ? $formattedImage->URL : $url; } else { $thumbnailURL = $url; diff --git a/i18n/i18n.php b/i18n/i18n.php index a16b1993d..5c9cd1116 100644 --- a/i18n/i18n.php +++ b/i18n/i18n.php @@ -125,7 +125,7 @@ class i18n extends Object implements TemplateGlobalProvider { */ public static function get_js_i18n() { Deprecation::notice('3.2', 'Use the "i18n.js_i18n" config setting instead'); - return self::$js_i18n; + return Config::inst()->get('i18n', 'js_i18n'); } /** @@ -653,96 +653,350 @@ class i18n extends Object implements TemplateGlobalProvider { ); /** + * @config * @var array $common_languages A list of commonly used languages, in the form * langcode => array( EnglishName, NativeName) */ - public static $common_languages = array( - 'af' => array('Afrikaans', 'Afrikaans'), - 'sq' => array('Albanian', 'shqip'), - 'ar' => array('Arabic', 'العربية'), - 'eu' => array('Basque', 'euskera'), - 'be' => array('Belarusian', - 'Беларуская мова'), - 'bn' => array('Bengali', 'বাংলা'), - 'bg' => array('Bulgarian', 'български'), - 'ca' => array('Catalan', 'català'), - 'zh_yue' => array('Chinese (Cantonese)', '廣東話 [广东话]'), - 'zh_cmn' => array('Chinese (Mandarin)', '普通話 [普通话]'), - 'hr' => array('Croatian', 'Hrvatski'), - 'zh' => array('Chinese','中国的'), - 'cs' => array('Czech', 'čeština'), - 'cy' => array('Welsh', 'Welsh/Cymraeg'), - 'da' => array('Danish', 'dansk'), - 'nl' => array('Dutch', 'Nederlands'), - 'en' => array('English', 'English'), - 'eo' => array('Esperanto', 'Esperanto'), - 'et' => array('Estonian', 'eesti keel'), - 'fo' => array('Faroese', 'Føroyska'), - 'fi' => array('Finnish', 'suomi'), - 'fr' => array('French', 'français'), - 'gd' => array('Gaelic', 'Gaeilge'), - 'gl' => array('Galician', 'Galego'), - 'de' => array('German', 'Deutsch'), - 'el' => array('Greek', 'ελληνικά'), - 'gu' => array('Gujarati', 'ગુજરાતી'), - 'ha' => array('Hausa', 'حَوْسَ'), - 'he' => array('Hebrew', 'עברית'), - 'hi' => array('Hindi', 'हिन्दी'), - 'hu' => array('Hungarian', 'magyar'), - 'is' => array('Icelandic', 'Íslenska'), - 'io' => array('Ido', 'Ido'), - 'id' => array('Indonesian', 'Bahasa Indonesia'), - 'ga' => array('Irish', 'Irish'), - 'it' => array('Italian', 'italiano'), - 'ja' => array('Japanese', '日本語'), - 'jv' => array('Javanese', 'basa Jawa'), - 'ko' => array('Korean', '한국어 [韓國語]'), - 'ku' => array('Kurdish', 'Kurdí'), - 'lv' => array('Latvian', 'latviešu'), - 'lt' => array('Lithuanian', 'lietuviškai'), - 'lmo' => array('Lombard', 'Lombardo'), - 'mk' => array('Macedonian', 'македонски'), - 'mi' => array('Maori', 'Māori'), - 'ms' => array('Malay', 'Bahasa melayu'), - 'mt' => array('Maltese', 'Malti'), - 'mr' => array('Marathi', 'मराठी'), - 'ne' => array('Nepali', 'नेपाली'), - 'no' => array('Norwegian', 'Norsk'), - 'om' => array('Oromo', 'Afaan Oromo'), - 'fa' => array('Persian', 'فارسى'), - 'pl' => array('Polish', 'polski'), - 'pt_PT' => array('Portuguese (Portugal)', 'português (Portugal)'), - 'pt_BR' => array('Portuguese (Brazil)', 'português (Brazil)'), - 'pa' => array('Punjabi', 'ਪੰਜਾਬੀ'), - 'qu' => array('Quechua', 'Quechua'), - 'rm' => array('Romansh', 'rumantsch'), - 'ro' => array('Romanian', 'român'), - 'ru' => array('Russian', 'Русский'), - 'sco' => array('Scots', 'Scoats leid, Lallans'), - 'sr' => array('Serbian', 'српски'), - 'sk' => array('Slovak', 'slovenčina'), - 'sl' => array('Slovenian', 'slovenščina'), - 'es' => array('Spanish', 'español'), - 'sv' => array('Swedish', 'Svenska'), - 'tl' => array('Tagalog', 'Tagalog'), - 'ta' => array('Tamil', 'தமிழ்'), - 'te' => array('Telugu', 'తెలుగు'), - 'to' => array('Tonga', 'chiTonga'), - 'ts' => array('Tsonga', 'xiTshonga'), - 'tn' => array('Tswana', 'seTswana'), - 'tr' => array('Turkish', 'Türkçe'), - 'tk' => array('Turkmen', 'түркmенче'), - 'tw' => array('Twi', 'twi'), - 'uk' => array('Ukrainian', 'Українська'), - 'ur' => array('Urdu', 'اردو'), - 'uz' => array('Uzbek', 'ўзбек'), - 've' => array('Venda', 'tshiVenḓa'), - 'vi' => array('Vietnamese', 'tiếng việt'), - 'wa' => array('Walloon', 'walon'), - 'wo' => array('Wolof', 'Wollof'), - 'xh' => array('Xhosa', 'isiXhosa'), - 'yi' => array('Yiddish', 'ײִדיש'), - 'zu' => array('Zulu', 'isiZulu') + private static $common_languages = array( + 'af' => array( + 'name' => 'Afrikaans', + 'native' => 'Afrikaans' + ), + 'sq' => array( + 'name' => 'Albanian', + 'native' => 'shqip' + ), + 'ar' => array( + 'name' => 'Arabic', + 'native' => 'العربية' + ), + 'eu' => array( + 'name' => 'Basque', + 'native' => 'euskera' + ), + 'be' => array( + 'name' => 'Belarusian', + 'native' => 'Беларуская мова' + ), + 'bn' => array( + 'name' => 'Bengali', + 'native' => 'বাংলা' + ), + 'bg' => array( + 'name' => 'Bulgarian', + 'native' => 'български' + ), + 'ca' => array( + 'name' => 'Catalan', + 'native' => 'català' + ), + 'zh_yue' => array( + 'name' => 'Chinese (Cantonese)', + 'native' => '廣東話 [广东话]' + ), + 'zh_cmn' => array( + 'name' => 'Chinese (Mandarin)', + 'native' => '普通話 [普通话]' + ), + 'hr' => array( + 'name' => 'Croatian', + 'native' => 'Hrvatski' + ), + 'zh' => array( + 'name' => 'Chinese','中国的' + ), + 'cs' => array( + 'name' => 'Czech', + 'native' => 'čeština' + ), + 'cy' => array( + 'name' => 'Welsh', + 'native' => 'Welsh/Cymraeg' + ), + 'da' => array( + 'name' => 'Danish', + 'native' => 'dansk' + ), + 'nl' => array( + 'name' => 'Dutch', + 'native' => 'Nederlands' + ), + 'en' => array( + 'name' => 'English', + 'native' => 'English' + ), + 'eo' => array( + 'name' => 'Esperanto', + 'native' => 'Esperanto' + ), + 'et' => array( + 'name' => 'Estonian', + 'native' => 'eesti keel' + ), + 'fo' => array( + 'name' => 'Faroese', + 'native' => 'Føroyska' + ), + 'fi' => array( + 'name' => 'Finnish', + 'native' => 'suomi' + ), + 'fr' => array( + 'name' => 'French', + 'native' => 'français' + ), + 'gd' => array( + 'name' => 'Gaelic', + 'native' => 'Gaeilge' + ), + 'gl' => array( + 'name' => 'Galician', + 'native' => 'Galego' + ), + 'de' => array( + 'name' => 'German', + 'native' => 'Deutsch' + ), + 'el' => array( + 'name' => 'Greek', + 'native' => 'ελληνικά' + ), + 'gu' => array( + 'name' => 'Gujarati', + 'native' => 'ગુજરાતી' + ), + 'ha' => array( + 'name' => 'Hausa', + 'native' => 'حَوْسَ' + ), + 'he' => array( + 'name' => 'Hebrew', + 'native' => 'עברית' + ), + 'hi' => array( + 'name' => 'Hindi', + 'native' => 'हिन्दी' + ), + 'hu' => array( + 'name' => 'Hungarian', + 'native' => 'magyar' + ), + 'is' => array( + 'name' => 'Icelandic', + 'native' => 'Íslenska' + ), + 'io' => array( + 'name' => 'Ido', + 'native' => 'Ido' + ), + 'id' => array( + 'name' => 'Indonesian', + 'native' => 'Bahasa Indonesia' + ), + 'ga' => array( + 'name' => 'Irish', + 'native' => 'Irish' + ), + 'it' => array( + 'name' => 'Italian', + 'native' => 'italiano' + ), + 'ja' => array( + 'name' => 'Japanese', + 'native' => '日本語' + ), + 'jv' => array( + 'name' => 'Javanese', + 'native' => 'basa Jawa' + ), + 'ko' => array( + 'name' => 'Korean', + 'native' => '한국어 [韓國語]' + ), + 'ku' => array( + 'name' => 'Kurdish', + 'native' => 'Kurdí' + ), + 'lv' => array( + 'name' => 'Latvian', + 'native' => 'latviešu' + ), + 'lt' => array( + 'name' => 'Lithuanian', + 'native' => 'lietuviškai' + ), + 'lmo' => array( + 'name' => 'Lombard', + 'native' => 'Lombardo' + ), + 'mk' => array( + 'name' => 'Macedonian', + 'native' => 'македонски' + ), + 'mi' => array( + 'name' => 'Maori', + 'native' => 'Māori' + ), + 'ms' => array( + 'name' => 'Malay', + 'native' => 'Bahasa melayu' + ), + 'mt' => array( + 'name' => 'Maltese', + 'native' => 'Malti' + ), + 'mr' => array( + 'name' => 'Marathi', + 'native' => 'मराठी' + ), + 'ne' => array( + 'name' => 'Nepali', + 'native' => 'नेपाली' + ), + 'no' => array( + 'name' => 'Norwegian', + 'native' => 'Norsk' + ), + 'om' => array( + 'name' => 'Oromo', + 'native' => 'Afaan Oromo' + ), + 'fa' => array( + 'name' => 'Persian', + 'native' => 'فارسى' + ), + 'pl' => array( + 'name' => 'Polish', + 'native' => 'polski' + ), + 'pt_PT' => array( + 'name' => 'Portuguese (Portugal)', + 'native' => 'português (Portugal)' + ), + 'pt_BR' => array( + 'name' => 'Portuguese (Brazil)', + 'native' => 'português (Brazil)' + ), + 'pa' => array( + 'name' => 'Punjabi', + 'native' => 'ਪੰਜਾਬੀ' + ), + 'qu' => array( + 'name' => 'Quechua', + 'native' => 'Quechua' + ), + 'rm' => array( + 'name' => 'Romansh', + 'native' => 'rumantsch' + ), + 'ro' => array( + 'name' => 'Romanian', + 'native' => 'român' + ), + 'ru' => array( + 'name' => 'Russian', + 'native' => 'Русский' + ), + 'sco' => array( + 'name' => 'Scots', + 'native' => 'Scoats leid, Lallans' + ), + 'sr' => array( + 'name' => 'Serbian', + 'native' => 'српски' + ), + 'sk' => array( + 'name' => 'Slovak', + 'native' => 'slovenčina' + ), + 'sl' => array( + 'name' => 'Slovenian', + 'native' => 'slovenščina' + ), + 'es' => array( + 'name' => 'Spanish', + 'native' => 'español' + ), + 'sv' => array( + 'name' => 'Swedish', + 'native' => 'Svenska' + ), + 'tl' => array( + 'name' => 'Tagalog', + 'native' => 'Tagalog' + ), + 'ta' => array( + 'name' => 'Tamil', + 'native' => 'தமிழ்' + ), + 'te' => array( + 'name' => 'Telugu', + 'native' => 'తెలుగు' + ), + 'to' => array( + 'name' => 'Tonga', + 'native' => 'chiTonga' + ), + 'ts' => array( + 'name' => 'Tsonga', + 'native' => 'xiTshonga' + ), + 'tn' => array( + 'name' => 'Tswana', + 'native' => 'seTswana' + ), + 'tr' => array( + 'name' => 'Turkish', + 'native' => 'Türkçe' + ), + 'tk' => array( + 'name' => 'Turkmen', + 'native' => 'түркmенче' + ), + 'tw' => array( + 'name' => 'Twi', + 'native' => 'twi' + ), + 'uk' => array( + 'name' => 'Ukrainian', + 'native' => 'Українська' + ), + 'ur' => array( + 'name' => 'Urdu', + 'native' => 'اردو' + ), + 'uz' => array( + 'name' => 'Uzbek', + 'native' => 'ўзбек' + ), + 've' => array( + 'name' => 'Venda', + 'native' => 'tshiVenḓa' + ), + 'vi' => array( + 'name' => 'Vietnamese', + 'native' => 'tiếng việt' + ), + 'wa' => array( + 'name' => 'Walloon', + 'native' => 'walon' + ), + 'wo' => array( + 'name' => 'Wolof', + 'native' => 'Wollof' + ), + 'xh' => array( + 'name' => 'Xhosa', + 'native' => 'isiXhosa' + ), + 'yi' => array( + 'name' => 'Yiddish', + 'native' => 'ײִדיש' + ), + 'zu' => array( + 'name' => 'Zulu', + 'native' => 'isiZulu' + ) ); /** @@ -752,90 +1006,338 @@ class i18n extends Object implements TemplateGlobalProvider { * not the locale key. */ private static $common_locales = array( - 'af_ZA' => array('Afrikaans', 'Afrikaans'), - 'sq_AL' => array('Albanian', 'shqip'), - 'ar_EG' => array('Arabic', 'العربية'), - 'eu_ES' => array('Basque', 'euskera'), - 'be_BY' => array('Belarusian', - 'Беларуская мова'), - 'bn_BD' => array('Bengali', 'বাংলা'), - 'bg_BG' => array('Bulgarian', 'български'), - 'ca_ES' => array('Catalan', 'català'), - 'zh_CN' => array('Chinese','中国的'), - 'zh_yue' => array('Chinese (Cantonese)', '廣東話 [广东话]'), - 'zh_cmn' => array('Chinese (Mandarin)', '普通話 [普通话]'), - 'hr_HR' => array('Croatian', 'Hrvatski'), - 'cs_CZ' => array('Czech', 'čeština'), - 'cy_GB' => array('Welsh', 'Welsh/Cymraeg'), - 'da_DK' => array('Danish', 'dansk'), - 'nl_NL' => array('Dutch', 'Nederlands'), - 'en_NZ' => array('English (NZ)', 'English (NZ)'), - 'en_US' => array('English (US)', 'English (US)'), - 'en_GB' => array('English (UK)', 'English (UK)'), - 'eo_XX' => array('Esperanto', 'Esperanto'), - 'et_EE' => array('Estonian', 'eesti keel'), - 'fo_FO' => array('Faroese', 'Føroyska'), - 'fi_FI' => array('Finnish', 'suomi'), - 'fr_FR' => array('French', 'français'), - 'gd_GB' => array('Gaelic', 'Gaeilge'), - 'gl_ES' => array('Galician', 'Galego'), - 'de_DE' => array('German', 'Deutsch'), - 'el_GR' => array('Greek', 'ελληνικά'), - 'gu_IN' => array('Gujarati', 'ગુજરાતી'), - 'ha_NG' => array('Hausa', 'حَوْسَ'), - 'he_IL' => array('Hebrew', 'עברית'), - 'hi_IN' => array('Hindi', 'हिन्दी'), - 'hu_HU' => array('Hungarian', 'magyar'), - 'is_IS' => array('Icelandic', 'Íslenska'), - 'id_ID' => array('Indonesian', 'Bahasa Indonesia'), - 'ga_IE' => array('Irish', 'Irish'), - 'it_IT' => array('Italian', 'italiano'), - 'ja_JP' => array('Japanese', '日本語'), - 'jv_ID' => array('Javanese', 'basa Jawa'), - 'ko_KR' => array('Korean', '한국어 [韓國語]'), - 'ku_IQ' => array('Kurdish', 'Kurdí'), - 'lv_LV' => array('Latvian', 'latviešu'), - 'lt_LT' => array('Lithuanian', 'lietuviškai'), - 'mk_MK' => array('Macedonian', 'македонски'), - 'mi_NZ' => array('Maori', 'Māori'), - 'ms_MY' => array('Malay', 'Bahasa melayu'), - 'mt_MT' => array('Maltese', 'Malti'), - 'mr_IN' => array('Marathi', 'मराठी'), - 'ne_NP' => array('Nepali', 'नेपाली'), - 'nb_NO' => array('Norwegian', 'Norsk'), - 'om_ET' => array('Oromo', 'Afaan Oromo'), - 'fa_IR' => array('Persian', 'فارسى'), - 'pl_PL' => array('Polish', 'polski'), - 'pt_PT' => array('Portuguese (Portugal)', 'português (Portugal)'), - 'pt_BR' => array('Portuguese (Brazil)', 'português (Brazil)'), - 'pa_IN' => array('Punjabi', 'ਪੰਜਾਬੀ'), - 'qu_PE' => array('Quechua', 'Quechua'), - 'rm_CH' => array('Romansh', 'rumantsch'), - 'ro_RO' => array('Romanian', 'român'), - 'ru_RU' => array('Russian', 'Русский'), - 'sco_SCO' => array('Scots', 'Scoats leid, Lallans'), - 'sr_RS' => array('Serbian', 'српски'), - 'sk_SK' => array('Slovak', 'slovenčina'), - 'sl_SI' => array('Slovenian', 'slovenščina'), - 'es_ES' => array('Spanish', 'español'), - 'sv_SE' => array('Swedish', 'Svenska'), - 'tl_PH' => array('Tagalog', 'Tagalog'), - 'ta_IN' => array('Tamil', 'தமிழ்'), - 'te_IN' => array('Telugu', 'తెలుగు'), - 'to_TO' => array('Tonga', 'chiTonga'), - 'ts_ZA' => array('Tsonga', 'xiTshonga'), - 'tn_ZA' => array('Tswana', 'seTswana'), - 'tr_TR' => array('Turkish', 'Türkçe'), - 'tk_TM' => array('Turkmen', 'түркmенче'), - 'tw_GH' => array('Twi', 'twi'), - 'uk_UA' => array('Ukrainian', 'Українська'), - 'ur_PK' => array('Urdu', 'اردو'), - 'uz_UZ' => array('Uzbek', 'ўзбек'), - 've_ZA' => array('Venda', 'tshiVenḓa'), - 'vi_VN' => array('Vietnamese', 'tiếng việt'), - 'wo_SN' => array('Wolof', 'Wollof'), - 'xh_ZA' => array('Xhosa', 'isiXhosa'), - 'zu_ZA' => array('Zulu', 'isiZulu'), + 'af_ZA' => array( + 'name' => 'Afrikaans', + 'native' => 'Afrikaans' + ), + 'sq_AL' => array( + 'name' => 'Albanian', + 'native' => 'shqip' + ), + 'ar_EG' => array( + 'name' => 'Arabic', + 'native' => 'العربية' + ), + 'eu_ES' => array( + 'name' => 'Basque', + 'native' => 'euskera' + ), + 'be_BY' => array( + 'name' => 'Belarusian', + 'native' => 'Беларуская мова' + ), + 'bn_BD' => array( + 'name' => 'Bengali', + 'native' => 'বাংলা' + ), + 'bg_BG' => array( + 'name' => 'Bulgarian', + 'native' => 'български' + ), + 'ca_ES' => array( + 'name' => 'Catalan', + 'native' => 'català' + ), + 'zh_CN' => array( + 'name' => 'Chinese', + 'native' => '中国的' + ), + 'zh_yue' => array( + 'name' => 'Chinese (Cantonese)', + 'native' => '廣東話 [广东话]' + ), + 'zh_cmn' => array( + 'name' => 'Chinese (Mandarin)', + 'native' => '普通話 [普通话]' + ), + 'hr_HR' => array( + 'name' => 'Croatian', + 'native' => 'Hrvatski' + ), + 'cs_CZ' => array( + 'name' => 'Czech', + 'native' => 'čeština' + ), + 'cy_GB' => array( + 'name' => 'Welsh', + 'native' => 'Welsh/Cymraeg' + ), + 'da_DK' => array( + 'name' => 'Danish', + 'native' => 'dansk' + ), + 'nl_NL' => array( + 'name' => 'Dutch', + 'native' => 'Nederlands' + ), + 'en_NZ' => array( + 'name' => 'English (NZ)', + 'native' => 'English (NZ)' + ), + 'en_US' => array( + 'name' => 'English (US)', + 'native' => 'English (US)' + ), + 'en_GB' => array( + 'name' => 'English (UK)', + 'native' => 'English (UK)' + ), + 'eo_XX' => array( + 'name' => 'Esperanto', + 'native' => 'Esperanto' + ), + 'et_EE' => array( + 'name' => 'Estonian', + 'native' => 'eesti keel' + ), + 'fo_FO' => array( + 'name' => 'Faroese', + 'native' => 'Føroyska' + ), + 'fi_FI' => array( + 'name' => 'Finnish', + 'native' => 'suomi' + ), + 'fr_FR' => array( + 'name' => 'French', + 'native' => 'français' + ), + 'gd_GB' => array( + 'name' => 'Gaelic', + 'native' => 'Gaeilge' + ), + 'gl_ES' => array( + 'name' => 'Galician', + 'native' => 'Galego' + ), + 'de_DE' => array( + 'name' => 'German', + 'native' => 'Deutsch' + ), + 'el_GR' => array( + 'name' => 'Greek', + 'native' => 'ελληνικά' + ), + 'gu_IN' => array( + 'name' => 'Gujarati', + 'native' => 'ગુજરાતી' + ), + 'ha_NG' => array( + 'name' => 'Hausa', + 'native' => 'حَوْسَ' + ), + 'he_IL' => array( + 'name' => 'Hebrew', + 'native' => 'עברית' + ), + 'hi_IN' => array( + 'name' => 'Hindi', + 'native' => 'हिन्दी' + ), + 'hu_HU' => array( + 'name' => 'Hungarian', + 'native' => 'magyar' + ), + 'is_IS' => array( + 'name' => 'Icelandic', + 'native' => 'Íslenska' + ), + 'id_ID' => array( + 'name' => 'Indonesian', + 'native' => 'Bahasa Indonesia' + ), + 'ga_IE' => array( + 'name' => 'Irish', + 'native' => 'Irish' + ), + 'it_IT' => array( + 'name' => 'Italian', + 'native' => 'italiano' + ), + 'ja_JP' => array( + 'name' => 'Japanese', + 'native' => '日本語' + ), + 'jv_ID' => array( + 'name' => 'Javanese', + 'native' => 'basa Jawa' + ), + 'ko_KR' => array( + 'name' => 'Korean', + 'native' => '한국어 [韓國語]' + ), + 'ku_IQ' => array( + 'name' => 'Kurdish', + 'native' => 'Kurdí' + ), + 'lv_LV' => array( + 'name' => 'Latvian', + 'native' => 'latviešu' + ), + 'lt_LT' => array( + 'name' => 'Lithuanian', + 'native' => 'lietuviškai' + ), + 'mk_MK' => array( + 'name' => 'Macedonian', + 'native' => 'македонски' + ), + 'mi_NZ' => array( + 'name' => 'Maori', + 'native' => 'Māori' + ), + 'ms_MY' => array( + 'name' => 'Malay', + 'native' => 'Bahasa melayu' + ), + 'mt_MT' => array( + 'name' => 'Maltese', + 'native' => 'Malti' + ), + 'mr_IN' => array( + 'name' => 'Marathi', + 'native' => 'मराठी' + ), + 'ne_NP' => array( + 'name' => 'Nepali', + 'native' => 'नेपाली' + ), + 'nb_NO' => array( + 'name' => 'Norwegian', + 'native' => 'Norsk' + ), + 'om_ET' => array( + 'name' => 'Oromo', + 'native' => 'Afaan Oromo' + ), + 'fa_IR' => array( + 'name' => 'Persian', + 'native' => 'فارسى' + ), + 'pl_PL' => array( + 'name' => 'Polish', + 'native' => 'polski' + ), + 'pt_PT' => array( + 'name' => 'Portuguese (Portugal)', + 'native' => 'português (Portugal)' + ), + 'pt_BR' => array( + 'name' => 'Portuguese (Brazil)', + 'native' => 'português (Brazil)' + ), + 'pa_IN' => array( + 'name' => 'Punjabi', + 'native' => 'ਪੰਜਾਬੀ' + ), + 'qu_PE' => array( + 'name' => 'Quechua', + 'native' => 'Quechua' + ), + 'rm_CH' => array( + 'name' => 'Romansh', + 'native' => 'rumantsch' + ), + 'ro_RO' => array( + 'name' => 'Romanian', + 'native' => 'român' + ), + 'ru_RU' => array( + 'name' => 'Russian', + 'native' => 'Русский' + ), + 'sco_SCO' => array( + 'name' => 'Scots', + 'native' => 'Scoats leid, Lallans' + ), + 'sr_RS' => array( + 'name' => 'Serbian', + 'native' => 'српски' + ), + 'sk_SK' => array( + 'name' => 'Slovak', + 'native' => 'slovenčina' + ), + 'sl_SI' => array( + 'name' => 'Slovenian', + 'native' => 'slovenščina' + ), + 'es_ES' => array( + 'name' => 'Spanish', + 'native' => 'español' + ), + 'sv_SE' => array( + 'name' => 'Swedish', + 'native' => 'Svenska' + ), + 'tl_PH' => array( + 'name' => 'Tagalog', + 'native' => 'Tagalog' + ), + 'ta_IN' => array( + 'name' => 'Tamil', + 'native' => 'தமிழ்' + ), + 'te_IN' => array( + 'name' => 'Telugu', + 'native' => 'తెలుగు' + ), + 'to_TO' => array( + 'name' => 'Tonga', + 'native' => 'chiTonga' + ), + 'ts_ZA' => array( + 'name' => 'Tsonga', + 'native' => 'xiTshonga' + ), + 'tn_ZA' => array( + 'name' => 'Tswana', + 'native' => 'seTswana' + ), + 'tr_TR' => array( + 'name' => 'Turkish', + 'native' => 'Türkçe' + ), + 'tk_TM' => array( + 'name' => 'Turkmen', + 'native' => 'түркmенче' + ), + 'tw_GH' => array( + 'name' => 'Twi', + 'native' => 'twi' + ), + 'uk_UA' => array( + 'name' => 'Ukrainian', + 'native' => 'Українська' + ), + 'ur_PK' => array( + 'name' => 'Urdu', + 'native' => 'اردو' + ), + 'uz_UZ' => array( + 'name' => 'Uzbek', + 'native' => 'ўзбек' + ), + 've_ZA' => array( + 'name' => 'Venda', + 'native' => 'tshiVenḓa' + ), + 'vi_VN' => array( + 'name' => 'Vietnamese', + 'native' => 'tiếng việt' + ), + 'wo_SN' => array( + 'name' => 'Wolof', + 'native' => 'Wollof' + ), + 'xh_ZA' => array( + 'name' => 'Xhosa', + 'native' => 'isiXhosa' + ), + 'zu_ZA' => array( + 'name' => 'Zulu', + 'native' => 'isiZulu' + ), ); /** @@ -1673,8 +2175,8 @@ class i18n extends Object implements TemplateGlobalProvider { */ public static function get_common_languages($native = false) { $languages = array(); - foreach (self::$common_languages as $code => $name) { - $languages[$code] = ($native ? $name[1] : $name[0]); + foreach (Config::inst()->get('i18n', 'common_languages') as $code => $name) { + $languages[$code] = ($native ? $name['native'] : $name['name']); } return $languages; } @@ -1688,7 +2190,7 @@ class i18n extends Object implements TemplateGlobalProvider { public static function get_common_locales($native = false) { $languages = array(); foreach (Config::inst()->get('i18n', 'common_locales') as $code => $name) { - $languages[$code] = ($native ? $name[1] : $name[0]); + $languages[$code] = ($native ? $name['native'] : $name['name']); } return $languages; } @@ -1748,11 +2250,11 @@ class i18n extends Object implements TemplateGlobalProvider { * @return Name of the language */ public static function get_language_name($code, $native = false) { - $langs = self::$common_languages; + $langs = Config::inst()->get('i18n', 'common_languages'); if($native) { - return (isset($langs[$code][1])) ? $langs[$code][1] : false; + return (isset($langs[$code]['native'])) ? $langs[$code]['native'] : false; } else { - return (isset($langs[$code][0])) ? $langs[$code][0] : false; + return (isset($langs[$code]['name'])) ? $langs[$code]['name'] : false; } } diff --git a/model/DataExtension.php b/model/DataExtension.php index 9ce91ad1b..041630200 100644 --- a/model/DataExtension.php +++ b/model/DataExtension.php @@ -7,30 +7,6 @@ */ abstract class DataExtension extends Extension { - /** - * Statics on a {@link DataObject} subclass - * which can be extended by an extension. This list is - * limited for security and performance reasons. - * - * Keys are the static names, and the values are whether or not the value is an array that should - * be merged. - * - * @var array - */ - protected static $extendable_statics = array( - 'db' => true, - 'has_one' => true, - 'belongs_to' => true, - 'indexes' => true, - 'defaults' => true, - 'has_many' => true, - 'many_many' => true, - 'belongs_many_many' => true, - 'many_many_extraFields' => true, - 'searchable_fields' => true, - 'api_access' => false, - ); - public static function get_extra_config($class, $extension, $args) { if(method_exists($extension, 'extraDBFields')) { $extraStaticsMethod = 'extraDBFields'; diff --git a/statics.diff b/statics.diff deleted file mode 100644 index 7938eaf1e..000000000 --- a/statics.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- /Users/ingo/Silverstripe/ss-3.1/framework/security/Security.php -+++ /Users/ingo/Silverstripe/ss-3.1/framework/security/Security.php -@@ -52,2 +52,3 @@ -+ * @config - */ -- protected static $encryption_algorithm = 'blowfish'; -+ private static $encryption_algorithm = 'blowfish'; ---- /Users/ingo/Silverstripe/ss-3.1/framework/security/Security.php -+++ /Users/ingo/Silverstripe/ss-3.1/framework/security/Security.php -@@ -52,2 +52,3 @@ -+ * @config - */ -- protected static $encryption_algorithm = 'blowfish'; -+ private static $encryption_algorithm = 'blowfish'; ---- /Users/ingo/Silverstripe/ss-3.1/framework/security/Security.php -+++ /Users/ingo/Silverstripe/ss-3.1/framework/security/Security.php -@@ -52,2 +52,3 @@ -+ * @config - */ -- protected static $encryption_algorithm = 'blowfish'; -+ private static $encryption_algorithm = 'blowfish'; diff --git a/tests/i18n/i18nTest.php b/tests/i18n/i18nTest.php index a95723cfd..4a76ed92e 100644 --- a/tests/i18n/i18nTest.php +++ b/tests/i18n/i18nTest.php @@ -563,6 +563,15 @@ class i18nTest extends SapphireTest { SS_ClassLoader::instance()->popManifest(); } + public function testGetLanguageName() { + Config::inst()->update( + 'i18n', + 'common_languages', + array('de_CGN' => array('name' => 'German (Cologne)', 'native' => 'Kölsch')) + ); + $this->assertEquals('German (Cologne)', i18n::get_language_name('de_CGN')); + $this->assertEquals('Kölsch', i18n::get_language_name('de_CGN', true)); + } } class i18nTest_DataObject extends DataObject implements TestOnly {