/**
  * Initialize all activated plugin by including is index.php file.
  * Also load all language files for plugins available in plugins directory.
  */
 static function init()
 {
     $dir = PLUGINS_ROOT . DS;
     if ($handle = opendir($dir)) {
         while (false !== ($plugin_id = readdir($handle))) {
             $file = $dir . $plugin_id . DS . 'i18n' . DS . I18n::getLocale() . '-message.php';
             $default_file = PLUGINS_ROOT . DS . $plugin_id . DS . 'i18n' . DS . DEFAULT_LOCALE . '-message.php';
             if (file_exists($file)) {
                 $array = (include $file);
                 I18n::add($array);
             }
             if (file_exists($default_file)) {
                 $array = (include $default_file);
                 I18n::addDefault($array);
             }
         }
     }
     self::$plugins = unserialize(Setting::get('plugins'));
     foreach (self::$plugins as $plugin_id => $tmp) {
         $file = PLUGINS_ROOT . DS . $plugin_id . DS . 'index.php';
         if (file_exists($file)) {
             include $file;
         }
     }
 }
Exemplo n.º 2
0
 public function run()
 {
     DB::table('options')->delete();
     $i18n_site_name = I18n::add(array('fr' => 'Dynamix', 'en' => 'Dynamix'), 'title');
     $i18n_blog_charset = I18n::add(array('fr' => 'UTF-8', 'en' => 'UTF-8'), 'title');
     $i18n_timezone = I18n::add(array('fr' => 'Europe/Paris', 'en' => 'Europe/Paris'), 'title');
     $i18n_date_format = I18n::add(array('fr' => 'j F Y', 'en' => 'j F Y'), 'title');
     $i18n_time_format = I18n::add(array('fr' => 'G \\h i \\m\\i\\n', 'en' => 'G \\h i \\m\\i\\n'), 'title');
     $i18n_social_title = I18n::add(array('fr' => '', 'en' => ''), 'title');
     $i18n_social_description = I18n::add(array('fr' => '', 'en' => ''), 'title');
     DB::table('options')->insert(array(array('key' => 'site_url', 'value' => 'http://dynam.ix'), array('key' => 'i18n_site_name', 'value' => $i18n_site_name), array('key' => 'admin_email', 'value' => '*****@*****.**'), array('key' => 'cover_path', 'value' => 'http%3A%2F%2Fdynam.ix%2Fuploads%2Fpictures%2Falbum%2520cute%2520kitten%2Fcute-kitten-1.jpg'), array('key' => 'twitter_id', 'value' => null), array('key' => 'i18n_social_title', 'value' => $i18n_social_title), array('key' => 'i18n_social_description', 'value' => $i18n_social_description), array('key' => 'mailserver_url', 'value' => null), array('key' => 'mailserver_login', 'value' => null), array('key' => 'mailserver_pass', 'value' => null), array('key' => 'mailserver_port', 'value' => null), array('key' => 'i18n_blog_charset', 'value' => $i18n_blog_charset), array('key' => 'i18n_timezone', 'value' => $i18n_timezone), array('key' => 'i18n_date_format', 'value' => $i18n_date_format), array('key' => 'i18n_time_format', 'value' => $i18n_time_format), array('key' => 'disqus_config', 'value' => null), array('key' => 'analytics', 'value' => null)));
 }
Exemplo n.º 3
0
Arquivo: i18n.php Projeto: raku/MorCMS
 /**
  * Get value from db table
  * @param string $string
  * @param string $lang
  * @return string 
  */
 public static function get($string, $lang = null)
 {
     if (Kohana::$environment == Kohana::DEVELOPMENT) {
         if (!$lang) {
             // Use the global target language
             $lang = I18n::$lang;
         }
         // Load the translation table for this language
         $table = I18n::load($lang);
         // Return the translated string if it exists
         return isset($table[I18n::$view . '|' . $string]) ? $table[I18n::$view . '|' . $string] : I18n::add($string);
     } else {
         return parent::get($string, $lang);
     }
 }
Exemplo n.º 4
0
 /**
  * Initialize all activated plugin by including is index.php file
  */
 static function init()
 {
     self::$plugins = unserialize(Setting::get('plugins'));
     foreach (self::$plugins as $plugin_id => $tmp) {
         $file = CORE_ROOT . '/plugins/' . $plugin_id . '/index.php';
         if (file_exists($file)) {
             include $file;
         }
         $file = CORE_ROOT . '/plugins/' . $plugin_id . '/i18n/' . I18n::getLocale() . '-message.php';
         if (file_exists($file)) {
             $array = (include $file);
             I18n::add($array);
         }
     }
 }
Exemplo n.º 5
0
 public function run()
 {
     DB::table('navigations')->delete();
     $title1 = new I18n();
     $title1->i18n_type_id = I18nType::where('name', '=', 'title')->first()->id;
     $title1->save();
     $title1->translate('fr', 'Accueil');
     $title1->translate('en', 'Home');
     $title7 = new I18n();
     $title7->i18n_type_id = I18nType::where('name', '=', 'title')->first()->id;
     $title7->save();
     $title7->translate('fr', 'Contact');
     $title7->translate('en', 'Contact');
     DB::table('navigations')->insert(array(array('i18n_title' => $title1->id, 'parent_id' => 0, 'order' => 1, 'navigable_id' => 1, 'navigable_type' => 'Page'), array('i18n_title' => $title7->id, 'parent_id' => 0, 'order' => 2, 'navigable_id' => 2, 'navigable_type' => 'Page')));
     //Admin navigation group
     DB::table('admin_navigation_groups')->delete();
     $adminNav1 = I18n::add(array('fr' => 'Racine', 'en' => 'Root'), 'key', 'admin.admin_navigation_root');
     $adminNav2 = I18n::add(array('fr' => 'Gestion des contenus', 'en' => 'Content managment'), 'key', 'admin.admin_navigation_content');
     $adminNav3 = I18n::add(array('fr' => 'Gestion des utilisateurs', 'en' => 'User managment'), 'key', 'admin.admin_navigation_user');
     $adminNav4 = I18n::add(array('fr' => 'Traduction', 'en' => 'Translation'), 'key', 'admin.admin_navigation_translation');
     $adminNav5 = I18n::add(array('fr' => 'Option', 'en' => 'Option'), 'key', 'admin.admin_navigation_option');
     DB::table('admin_navigation_groups')->insert(array(array('i18n_title' => $adminNav1, 'parent_id' => 0, 'order' => 0, 'deletable' => false), array('i18n_title' => $adminNav2, 'parent_id' => 0, 'order' => 1, 'deletable' => true), array('i18n_title' => $adminNav3, 'parent_id' => 0, 'order' => 2, 'deletable' => true), array('i18n_title' => $adminNav4, 'parent_id' => 0, 'order' => 3, 'deletable' => true), array('i18n_title' => $adminNav5, 'parent_id' => 0, 'order' => 4, 'deletable' => true)));
 }