diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-27 15:06:43 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-27 15:06:43 +0100 |
| commit | 1851dc9b5de69e4833bbc12c7ac552d8fbd20e19 (patch) | |
| tree | d40741cab7d5e23941558f4dc7ca7c91b74d3c89 /admin | |
| parent | 265810599036c3803397969d89b30cefb583f366 (diff) | |
| download | languages-1851dc9b5de69e4833bbc12c7ac552d8fbd20e19.tar.gz languages-1851dc9b5de69e4833bbc12c7ac552d8fbd20e19.tar.bz2 languages-1851dc9b5de69e4833bbc12c7ac552d8fbd20e19.zip | |
General changes to cover uninitialized variables and style changes for PHP8.4
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/admin_languages_inc.php | 8 | ||||
| -rw-r--r-- | admin/schema_inc.php | 67 |
2 files changed, 37 insertions, 38 deletions
diff --git a/admin/admin_languages_inc.php b/admin/admin_languages_inc.php index e65aae6..356b177 100644 --- a/admin/admin_languages_inc.php +++ b/admin/admin_languages_inc.php @@ -11,7 +11,7 @@ $formLanguageToggles = array( ), 'i18n_interactive_translation' => array( 'label' => 'Interactive Translations', - 'note' => 'This will help you translate your site very effitiently by giving you direct access to the correct translation page.<br />Once you are done translating, make sure you turn this feature off and clear the language cache.<br />This feature only works when you set <em>$smarty_force_compile</em> to TRUE in your <em>config/kernel/config_inc.php</em> file', + 'note' => 'This will help you translate your site very effitiently by giving you direct access to the correct translation page.<br />Once you are done translating, make sure you turn this feature off and clear the language cache.<br />This feature only works when you set <em>$smarty_force_compile</em> to true in your <em>config/kernel/config_inc.php</em> file', 'page' => 'TranslationTutorial', 'link' => array( 'title' => 'Language cache', @@ -49,7 +49,7 @@ if( isset( $_REQUEST["prefs"] )) { "bitlanguage", ); foreach( $pref_byref_values as $britem ) { - byref_set_value( $britem, NULL, LANGUAGES_PKG_NAME ); + byref_set_value( $britem, null, LANGUAGES_PKG_NAME ); } global $gBitLanguage; $gBitLanguage->setLanguage( $gBitSystem->getConfig( 'bitlanguage' )); @@ -61,7 +61,7 @@ if( isset( $_REQUEST["prefs"] )) { } // Get list of available languages -$languages = array(); +$languages = []; $languages = $gBitLanguage->listLanguages(); -$gBitSmarty->assignByRef( "languages", $languages ); +$gBitSmarty->assign( "languages", $languages ); ?> diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 2946e63..d577c43 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -1,6 +1,6 @@ <?php -$tables = array( +$tables = [ 'i18n_languages' => " lang_code C(32) PRIMARY, @@ -35,51 +35,51 @@ $tables = array( CONSTRAINT ', CONSTRAINT `liberty_translation_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )' ", -); +]; global $gBitInstaller; foreach( array_keys( $tables ) AS $tableName ) { - $gBitInstaller->registerSchemaTable( LANGUAGES_PKG_NAME, $tableName, $tables[$tableName], TRUE ); + $gBitInstaller->registerSchemaTable( LANGUAGES_PKG_NAME, $tableName, $tables[$tableName], true ); } -$indices = array ( - 'i18n_masters_pkg_idx' => array( 'table' => 'i18n_masters', 'cols' => 'package', 'opts' => NULL ), - 'i18n_masters_created_idx' => array( 'table' => 'i18n_masters', 'cols' => 'created', 'opts' => NULL ), - 'i18n_strings_lang_idx' => array( 'table' => 'i18n_strings', 'cols' => 'lang_code', 'opts' => NULL ), - 'i18n_strings_lang_idx' => array( 'table' => 'i18n_strings', 'cols' => 'source_hash', 'opts' => NULL ), - 'i18n_strings_modif_idx' => array( 'table' => 'i18n_strings', 'cols' => 'last_modified', 'opts' => NULL ), - 'i18n_version_src_idx' => array( 'table' => 'i18n_version_map', 'cols' => 'source_hash', 'opts' => NULL ), - 'i18n_version_ver_idx' => array( 'table' => 'i18n_version_map', 'cols' => 'version', 'opts' => NULL ), -); +$indices = [ + 'i18n_masters_pkg_idx' => [ 'table' => 'i18n_masters', 'cols' => 'package', 'opts' => null ], + 'i18n_masters_created_idx' => [ 'table' => 'i18n_masters', 'cols' => 'created', 'opts' => null ], + 'i18n_strings_lang_idx' => [ 'table' => 'i18n_strings', 'cols' => 'lang_code', 'opts' => null ], + 'i18n_strings_source_idx' => [ 'table' => 'i18n_strings', 'cols' => 'source_hash', 'opts' => null ], + 'i18n_strings_modif_idx' => [ 'table' => 'i18n_strings', 'cols' => 'last_modified', 'opts' => null ], + 'i18n_version_src_idx' => [ 'table' => 'i18n_version_map', 'cols' => 'source_hash', 'opts' => null ], + 'i18n_version_ver_idx' => [ 'table' => 'i18n_version_map', 'cols' => 'version', 'opts' => null ], +]; $gBitInstaller->registerSchemaIndexes( LANGUAGES_PKG_NAME, $indices ); // ### Sequences //$sequences = array ( -// 'i18n_content_trans_id_seq' => array( 'start' => 1 ), +// 'i18n_content_trans_id_seq' => [ 'start' => 1 ], //); //$gBitInstaller->registerSchemaSequences( LIBERTY_PKG_NAME, $sequences ); -$gBitInstaller->registerPackageInfo( LANGUAGES_PKG_NAME, array( +$gBitInstaller->registerPackageInfo( LANGUAGES_PKG_NAME, [ 'description' => "This package allows you to translate your site into a different language.", 'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>', -) ); +] ); // ### Default Preferences -$gBitInstaller->registerPreferences( LANGUAGES_PKG_NAME, array( - array( LANGUAGES_PKG_NAME, 'i18n_record_untranslated','y' ), -) ); +$gBitInstaller->registerPreferences( LANGUAGES_PKG_NAME, [ + [ LANGUAGES_PKG_NAME, 'i18n_record_untranslated','y' ], +] ); // ### Default UserPermissions -$gBitInstaller->registerUserPermissions( LANGUAGES_PKG_NAME, array( - array('p_languages_create', 'Can create new languages', 'admin', LANGUAGES_PKG_NAME), - array('p_languages_edit', 'Can edit translations', 'editors', LANGUAGES_PKG_NAME), - array('p_languages_delete', 'Can delete languages', 'admin', LANGUAGES_PKG_NAME), - array('p_languages_edit_master', 'Can edit master translation strings', 'admin', LANGUAGES_PKG_NAME), - array('p_languages_import', 'Can import and export language files', 'editors', LANGUAGES_PKG_NAME), -) ); +$gBitInstaller->registerUserPermissions( LANGUAGES_PKG_NAME, [ + [ 'p_languages_create', 'Can create new languages', 'admin', LANGUAGES_PKG_NAME], + [ 'p_languages_edit', 'Can edit translations', 'editors', LANGUAGES_PKG_NAME], + [ 'p_languages_delete', 'Can delete languages', 'admin', LANGUAGES_PKG_NAME], + [ 'p_languages_edit_master', 'Can edit master translation strings', 'admin', LANGUAGES_PKG_NAME], + [ 'p_languages_import', 'Can import and export language files', 'editors', LANGUAGES_PKG_NAME], +] ); -$gBitInstaller->registerSchemaDefault( LANGUAGES_PKG_NAME, array( +$gBitInstaller->registerSchemaDefault( LANGUAGES_PKG_NAME, [ "INSERT INTO `".BIT_DB_PREFIX."i18n_languages` (`lang_code`,`native_name`,`english_name`,`right_to_left`) VALUES ('ar', 'ﺎﻠﻋﺮﺒﻳﺓ', 'Arabic','y' )", "INSERT INTO `".BIT_DB_PREFIX."i18n_languages` (`lang_code`,`native_name`,`english_name`) VALUES ('ca', 'Català', 'Catalan')", "INSERT INTO `".BIT_DB_PREFIX."i18n_languages` (`lang_code`,`native_name`,`english_name`) VALUES ('cs', 'Český', 'Czech')", @@ -119,13 +119,12 @@ $gBitInstaller->registerSchemaDefault( LANGUAGES_PKG_NAME, array( "INSERT INTO `".BIT_DB_PREFIX."i18n_languages` (`lang_code`,`native_name`,`english_name`) VALUES ('uk', 'Українська', 'Ukrainian')", "INSERT INTO `".BIT_DB_PREFIX."i18n_languages` (`lang_code`,`native_name`,`english_name`,`right_to_left`) VALUES ('ur', 'اردو', 'Urdu', 'y')", "INSERT INTO `".BIT_DB_PREFIX."i18n_languages` (`lang_code`,`native_name`,`english_name`) VALUES ('zh-cn', '简体中文', 'Chinese')", -) ); +] ); // Package requirements -$gBitInstaller->registerRequirements( LANGUAGES_PKG_NAME, array( - 'liberty' => array( 'min' => '2.1.4' ), - 'users' => array( 'min' => '2.1.0' ), - 'kernel' => array( 'min' => '2.0.0' ), - 'themes' => array( 'min' => '2.0.0' ), -)); -?> +$gBitInstaller->registerRequirements( LANGUAGES_PKG_NAME, [ + 'liberty' => [ 'min' => '5.0.0' ], + 'users' => [ 'min' => '5.0.0' ], + 'kernel' => [ 'min' => '5.0.0' ], + 'themes' => [ 'min' => '5.0.0' ], +] ); |
