| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 | 
							- <?php
 
- /**
 
-  * @file
 
-  * Internationalization (i18n) module - Path translation
 
-  */
 
- /**
 
-  * Implements hook_menu()
 
-  */
 
- function i18n_path_menu() {
 
-   $items['admin/config/regional/i18n_translation/path'] = array(
 
-     'title' => 'Paths',
 
-     'description' => 'Path translation.',
 
-     'page callback' => 'i18n_path_admin_overview',
 
-     'access arguments' => array('administer site configuration'),
 
-     'file' => 'i18n_path.admin.inc',
 
-     'type' => MENU_LOCAL_TASK,
 
-     'weight' => 10,
 
-   );
 
-   $items['admin/config/regional/i18n_translation/path/list'] = array(
 
-     'title' => 'Paths',
 
-     'type' => MENU_DEFAULT_LOCAL_TASK,
 
-     'weight' => -10,
 
-   );
 
-   $items['admin/config/regional/i18n_translation/path/add'] = array(
 
-     'title' => 'Add path translation',
 
-     'page callback' => 'drupal_get_form',
 
-     'page arguments' => array('i18n_path_admin_form'),
 
-     'access arguments' => array('administer site configuration'),
 
-     'file' => 'i18n_path.admin.inc',
 
-     'type' => MENU_LOCAL_ACTION,
 
-     'parent' => 'admin/config/regional/i18n_translation',
 
-   );
 
-   $items['admin/config/regional/i18n_translation/path/edit/%i18n_path_translation_set'] = array(
 
-     'title' => 'Edit path translation',
 
-     'page callback' => 'drupal_get_form',
 
-     'page arguments' => array('i18n_path_admin_form', 6),
 
-     'access arguments' => array('administer site configuration'),
 
-     'file' => 'i18n_path.admin.inc',
 
-     'type' => MENU_LOCAL_TASK,
 
-     'context' => MENU_CONTEXT_INLINE,
 
-   );
 
-   $items['admin/config/regional/i18n_translation/path/delete/%i18n_path_translation_set'] = array(
 
-     'title' => 'Delete path translation',
 
-     'page callback' => 'drupal_get_form',
 
-     'page arguments' => array('i18n_translation_set_delete_confirm', 6),
 
-     'access arguments' => array('administer site configuration'),
 
-     'file' => 'i18n_path.admin.inc',
 
-     'type' => MENU_LOCAL_TASK,
 
-     'context' => MENU_CONTEXT_INLINE,
 
-   );
 
-   return $items;
 
- }
 
- /**
 
-  * Implements hook_url_outbound_alter()
 
-  */
 
- /*
 
- function i18n_path_url_outbound_alter(&$path, &$options, $original_path) {
 
-   if (!empty($options['language'])) {
 
-     $langcode = $options['language']->language;
 
-     $original = $options['alias'] ? drupal_get_normal_path($path, $langcode) : $original_path;
 
-     if (($translations = i18n_path_get_translations($path)) && !empty($translations[$langcode])) {
 
-       $path = $options['alias'] ? drupal_get_path_alias($translations[$langcode], $langcode) : $translations[$langcode];
 
-     }
 
-   }
 
- }
 
- */
 
- /**
 
-  * Get translations for path
 
-  */
 
- function i18n_path_get_translations($path) {
 
-   static $translations;
 
-   if (!isset($translations)) {
 
-     $translations = drupal_static(__FUNCTION__, array());
 
-   }
 
-   if (!isset($translations[$path])) {
 
-     $translations[$path] = db_query('SELECT p.language, p.path FROM {i18n_path} p INNER JOIN {i18n_path} ps ON p.tsid = ps.tsid WHERE ps.path = :path',
 
-       array(':path' => $path)
 
-     )->fetchAllKeyed();
 
-   }
 
-   return $translations[$path];
 
- }
 
- /**
 
-  * Implements hook_i18n_object_info().
 
-  */
 
- function i18n_path_i18n_object_info() {
 
-   return array(
 
-     'path' => array(
 
-       'title' => t('Path'),
 
-       'class' => 'i18n_path_object',
 
-       'key' => array('path', 'language'),
 
-       'translation set' => TRUE,
 
-     )
 
-   );
 
- }
 
- /**
 
-  * Implements hook_i18n_translation_set_info()
 
-  */
 
- function i18n_path_i18n_translation_set_info() {
 
-   return array(
 
-     'path' => array(
 
-       'title' => t('Path'),
 
-       'class' => 'i18n_path_translation_set',
 
-       'table' => 'i18n_path',
 
-       'field' => 'tsid',
 
-       'placeholder' => '%i18n_path_translation_set',
 
-       'edit path' => 'admin/config/regional/i18n_translation/path/edit/%i18n_path_translation_set',
 
-       'delete path' => 'admin/config/regional/i18n_translation/path/delete/%i18n_path_translation_set',
 
-       'list path' => 'admin/config/regional/i18n_translation/path',
 
-     ),
 
-   );  
 
- }
 
- /**
 
-  * Implements hook_i18n_translate_path()
 
-  */
 
- function i18n_path_i18n_translate_path($path) {
 
-   if ($translations = i18n_path_get_translations($path)) {
 
-     $result = array();
 
-     foreach ($translations as $langcode => $translated) {
 
-       $result[$langcode] = array(
 
-         'href' => $translated,
 
-       );
 
-     }
 
-     return $result;
 
-   }
 
- }
 
- /**
 
-  * Load translation set. Menu loading callback.
 
-  */
 
- function i18n_path_translation_set_load($tsid) {
 
-   return i18n_translation_set_load($tsid, 'path');
 
- }
 
 
  |