Commit 8d234df0 authored by profix898's avatar profix898

- task: complete i18n handling for D6 (#228864)

- task: rename some functions to avoid namespace conflicts in addon modules
parent 6a14a6e3
......@@ -74,8 +74,18 @@ function _gallery_init($full = FALSE, $vars = NULL, $report_error = TRUE) {
$uid = isset($vars) ? (isset($vars['uid']) ? $vars['uid'] : NULL) : (($user->uid > 0) ? $user->uid : NULL);
// Language-prefix url rewrite
if (function_exists('language_url_rewrite') && $language->prefix) {
$embed_uri = str_replace('index.php?q=', 'index.php?q='. $language->prefix .'/', $embed_uri);
if (function_exists('language_url_rewrite') && variable_get('language_count', 1) > 1 && !empty($language->prefix)) {
switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
$default = language_default();
if ($language->language == $default->language) {
break;
}
case LANGUAGE_NEGOTIATION_PATH:
$embed_uri = str_replace('index.php?q=', 'index.php?q='. $language->prefix .'/', $embed_uri);
break;
default:
}
}
// Prepare array with init parameters
......@@ -166,10 +176,10 @@ function _gallery_init($full = FALSE, $vars = NULL, $report_error = TRUE) {
$g2_session =& $GLOBALS['gallery']->getSession();
$g2_session->doNotUseTempId();
//
list ($ret, $g2_admin) = GalleryCoreApi::isUserInSiteAdminGroup();
/*list ($ret, $g2_admin) = GalleryCoreApi::isUserInSiteAdminGroup();
if (!$ret && $g2_admin) {
$g2_session->put('session.siteAdminActivityTimestamp', time());
}
}*/
$ready['half'] = $params['fullInit'] ? ($ready['full'] = TRUE) : TRUE;
......@@ -184,7 +194,7 @@ function gallery_handle_request() {
global $language;
// Remove the language-prefix for G2
if (!empty($_GET['g2_path']) && function_exists('language_url_rewrite')) {
if (!empty($_GET['g2_path']) && function_exists('language_url_rewrite') && variable_get('language_count', 1) > 1) {
$args = explode('/', $_GET['g2_path']);
$prefix = array_shift($args);
if (!empty($language->prefix) && $language->prefix == $prefix) {
......@@ -255,10 +265,10 @@ function gallery_get_language($lang = '', $user = NULL) {
}
/**
* Function gallery_get_themes().
* Function gallery_list_themes().
* (retrieve all (active) themes from Gallery2)
*/
function gallery_get_themes() {
function gallery_list_themes() {
if (!_gallery_init()) {
return array();
}
......@@ -288,10 +298,10 @@ function gallery_get_themes() {
}
/**
* Function gallery_get_image_frames().
* Function gallery_list_image_frames().
* (retrieve all image frames from Gallery2)
*/
function gallery_get_image_frames() {
function gallery_list_image_frames() {
if (!_gallery_init()) {
return array('none' => t('None'));
}
......@@ -597,9 +607,9 @@ function gallery_context(&$params, $setcontext = FALSE) {
}
/**
* Function gallery_get_blocks().
* Function gallery_list_blocks().
*/
function gallery_get_blocks($plugin_names = NULL) {
function gallery_list_blocks($plugin_names = NULL) {
if (!_gallery_init()) {
return array();
}
......
......@@ -56,7 +56,7 @@ function _gallery_block_map($refresh = FALSE) {
if (!$cache || $refresh) {
// Rebuild block map
$block_map = array();
$g2_blocks = gallery_get_blocks();
$g2_blocks = gallery_list_blocks();
foreach ($g2_blocks as $plugin => $blocks) {
foreach (array_keys($blocks) as $block) {
switch ($block) {
......@@ -97,7 +97,7 @@ function _gallery_block_map($refresh = FALSE) {
* Function _gallery_block_options().
*/
function _gallery_block_options(&$type_map, &$param_map) {
$g2_blocks = gallery_get_blocks();
$g2_blocks = gallery_list_blocks();
$type_map = $g2_blocks['imageblock']['ImageBlock']['vars']['blocks']['choices'];
$param_map = array(
'heading' => t('Heading'),
......@@ -128,7 +128,7 @@ function _gallery_block_block($delta) {
return FALSE;
}
// Add custom parameters
$g2_blocks = gallery_get_blocks();
$g2_blocks = gallery_list_blocks();
if (isset($g2_blocks[$plugin][$plugin_block]['vars'])) {
foreach ($g2_blocks[$plugin][$plugin_block]['vars'] as $parameter => $options) {
$block = strtolower($plugin_block .'_'. $parameter);
......
......@@ -124,7 +124,7 @@ function _gallery_block_admin_description($element) {
* Function _gallery_block_admin_block_params().
*/
function _gallery_block_admin_block_params($delta, $plugin, $plugin_block) {
$g2_blocks = gallery_get_blocks();
$g2_blocks = gallery_list_blocks();
// Image block specific settings
if ($plugin_block == 'ImageBlock') {
......@@ -272,7 +272,7 @@ function _gallery_block_admin_imageblock($element, $title = 'Gallery Image/Grid
t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
array('!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']))) : '';
$image_frames = gallery_get_image_frames();
$image_frames = gallery_list_image_frames();
$form['imageblock'][$element .'_album_frame'] = array(
'#type' => 'select',
......
......@@ -208,19 +208,18 @@ function _gallery_install($form_state) {
'#description' => t(''),
);
// Check for advanced_help module
if (!module_exists('advanced_help')) {
drupal_set_message(t('If you install the <a href="@url">advanced help</a> module, Gallery module will provide more
and better help.', array('@url' => 'http://drupal.org/project/advanced_help')));
}
else {
$install_help = theme('advanced_help_topic', 'gallery', 'install', t('Install Tutorial'));
drupal_set_message(t('Dont know where to start? Try the "!install-help" page.', array('!install-help' => $install_help)));
}
if (!isset($form_state['storage'])) {
$install_status = _gallery_install_status_init();
$install_status['step'] = GALLERY_INSTALL_STEP_PHPMEMORY;
// Check for advanced_help module
if (!module_exists('advanced_help')) {
drupal_set_message(t('If you install the <a href="@url">advanced help</a> module, Gallery module will provide more
and better help.', array('@url' => 'http://drupal.org/project/advanced_help')));
}
else {
$install_help = theme('advanced_help_topic', 'gallery', 'install', t('Install Tutorial'));
drupal_set_message(t('Dont know where to start? Try the "!install-help" page.', array('!install-help' => $install_help)));
}
}
else {
$install_status = $form_state['storage'];
......
......@@ -48,7 +48,7 @@ function _gallery_settings_general() {
'#type' => 'select',
'#title' => t('Gallery embedded theme'),
'#default_value' => variable_get('gallery_embed_theme', 'default'),
'#options' => array('default' => t('Gallery default')) + gallery_get_themes(),
'#options' => array('default' => t('Gallery default')) + gallery_list_themes(),
'#description' => t('Gallery2 theme to be used for embedded gallery.'),
);
$form['theme']['gallery_root_album'] = _gallery_settings_album_select(
......@@ -305,7 +305,7 @@ function _gallery_settings_filter() {
'#description' => $desc,
);
$image_frames = gallery_get_image_frames();
$image_frames = gallery_list_image_frames();
_gallery_block_options($type_map, $param_map);
$type_map['specificItem'] = t('Specific item');
......@@ -561,7 +561,7 @@ function _gallery_settings_search() {
'#description' => $search_desc,
);
$image_frames = gallery_get_image_frames();
$image_frames = gallery_list_image_frames();
_gallery_block_options($type_map, $param_map);
if ($plugin_status['search'] == GALLERY_PLUGIN_ENABLED) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment