OSDN Git Service

- fixed bug "ethna i18n" command did not work when Smarty delimiter was changed.
authorYoshinari Takaoka <mumumu@mumumu.org>
Tue, 15 Sep 2009 04:49:42 +0000 (13:49 +0900)
committerYoshinari Takaoka <mumumu@mumumu.org>
Tue, 15 Sep 2009 04:49:42 +0000 (13:49 +0900)
CHANGES
class/Ethna_Renderer.php
class/Renderer/Ethna_Renderer_Smarty.php
skel/etc.ini.php

diff --git a/CHANGES b/CHANGES
index 8f2496a..c5aa291 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -26,7 +26,7 @@
 -- デフォルトで生成されるレイアウトテンプレートの調整
 -- cssの変更
 -- UrlHandler と .htaccess (mod_rewrite) を利用するためのひな形を生成
-
+- Smarty の設定(現在はデリミタのみ)を [appid]-ini.php に書くことが出来るようにした
 
 *** bug fix
 
@@ -42,6 +42,7 @@
 -- http://sourceforge.jp/ticket/browse.php?group_id=1343&tid=17894
 - Ethna_Plugin_Logwriter の debug_backtrace の一部が取得できず、E_NOTICE が出るバグを修正 (thanks: http://www.remix.gr.jp/)
 - cli 環境で Ethna_Session::start を叩いたときに $_SERVER 変数がないために E_NOTICE が出る問題を修正
+- Smartyのデリミタを変更している場合にi18nコマンドが機能しないバグを修正 (#18668)
 
 ** 2.5.0-preview5
 
index 7aa1ec4..67feb22 100644 (file)
@@ -29,6 +29,9 @@ class Ethna_Renderer
     /** @var    object  Ethna_Controller    controllerオブジェクト($controllerの省略形) */
     var $ctl;
 
+    /** @var    array   [appid]-ini.phpのレンダラ設定 */
+    var $config;
+
     /** @var    string  template directory  */
     var $template_dir;
 
@@ -58,6 +61,8 @@ class Ethna_Renderer
         $this->template = null;
         $this->prop = array();
         $this->plugin_registry = array();
+        $config = $this->ctl->getConfig();
+        $this->config = $config->get('renderer'); 
     }
 
     /**
index d756d74..4de9e99 100644 (file)
@@ -34,6 +34,8 @@ class Ethna_Renderer_Smarty extends Ethna_Renderer
         
         $this->engine =& new Smarty;
         
+        // ディレクトリ関連は Controllerによって実行時に設定
+        // TODO: iniファイルによって上書き可にするかは要検討
         $template_dir = $controller->getTemplatedir();
         $compile_dir = $controller->getDirectory('template_c');
 
@@ -43,7 +45,18 @@ class Ethna_Renderer_Smarty extends Ethna_Renderer
         $this->engine->compile_dir = $this->compile_dir;
         $this->engine->compile_id = md5($this->template_dir);
 
-        // 一応がんばってみる
+        //  デリミタは Ethna_Config を見る
+        $smarty_config = isset($this->config['smarty'])
+                       ? $this->config['smarty']
+                       : array();
+        if (array_key_exists('left_delimiter', $smarty_config)) {
+            $this->engine->left_delimiter = $smarty_config['left_delimiter'];
+        }
+        if (array_key_exists('right_delimiter', $smarty_config)) {
+            $this->engine->right_delimiter = $smarty_config['right_delimiter'];
+        }
+
+        // コンパイルディレクトリは必須なので一応がんばってみる
         if (is_dir($this->engine->compile_dir) === false) {
             Ethna_Util::mkdir($this->engine->compile_dir, 0755);
         }
index 86f4399..17cf325 100644 (file)
@@ -61,6 +61,14 @@ $config = array(
     // mail 
     //'mail_func_workaround' => false,
 
+    // Smarty
+    //'renderer' => array(
+    //    'smarty' => array(
+    //        'left_delimiter' => '{',
+    //        'right_delimiter' => '}',
+    //    ),
+    //),
+
     // csrf
     // 'csrf' => 'Session',
 );