ARTISAN PROJECT ArtisanSmarty
[ class tree: ArtisanSmarty ] [ index: ArtisanSmarty ] [ all elements ]

Class: Smarty

Source Location: /ccdb/bbs/lib/smarty/ArtisanSmarty.class.php

Class Smarty

Direct descendents
Child Class Description
Template compiling class

[ Top ]
Property Summary
array   $autoload_filters   This indicates which filters are automatically loaded into Smarty.
string   $cache_dir   テンプレートのキャッシュが格納されるディレクトリです。
null|string   $cache_handler_func   The function used for cache file handling. If not set, built-in caching is used.
integer   $cache_lifetime   テンプレートのキャッシュの期限(単位:秒)です。これが切れるとキャッシュは再生成されます。
boolean   $cache_modified_check   キャッシュされた内容にinsertタグが含まれない場合に、 キャッシュファイルのタイムスタンプが最後に訪れた時から変わっていないなら、 コンテンツの代わりに"304 Not Modified"レスポンスが返されます。
integer   $caching   テンプレートの出力をキャッシュするかどうかを設定します。
string   $compiler_class   Smartyがテンプレートをコンパイルするために使用するコンパイラクラスの名前を指定します。
string   $compiler_file   コンパイラクラスを含むファイル。 フルパスを書くか、そうでなければphpのinclude_path・SMARTY_DIRの中を探します。
boolean   $compile_check   phpアプリケーションの各リクエスト時に、現在のテンプレートが最後に訪れた時から変更されている
string   $compile_dir   コンパイルされたテンプレートが置かれるディレクトリです。
string   $compile_id   Set this if you want different sets of compiled files for the same templates. This is useful for things like different languages.
mixed   $config_booleanize   This tells whether or not to automatically booleanize config file variables.
string   $config_class   コンフィグ変数を読み込むクラスの名前を指定します。
string   $config_dir   テンプレートから読み込むための設定ファイル(Configファイル)を置くディレクトリです。
mixed   $config_fix_newlines   設定ファイル内のmacとdosのnewline (\r と \r\n)はそれらがパースされる時に \nにコンバートされます。
mixed   $config_overwrite   This tells if config file vars of the same name overwrite each other or not.
mixed   $config_read_hidden   This tells whether hidden sections [.foobar] are readable from the tempalates or not. Normally you would never allow this since that is the point behind hidden sections: the application can access them, but the templates cannot.
boolean   $debugging   ページロード時に、自動でデバッグコンソールウィンドウを表示します。
ブラウザの、ポップアップを許可してください。
string   $debugging_ctrl   デバッギングコンソールを有効にするための$debuggingに代わる方法です。
string   $debug_tpl   デバッグコンソールに使用されるテンプレートファイルの名前です。
設定しない場合は、デフォルトのデバッグコンソールが使用されます。
array   $default_modifiers   This is a list of the modifiers to apply to all template variables.
array   $default_resource_type   This is the resource type to be used when not specified
string   $default_template_handler_func   テンプレートファイルが見つからなかった場合、ここで指定されたPHP関数が実行されます。
boolean   $error_reporting   セットすると、Smartyのエラーレベルをコレにセットします。
string   $etc_dir   内部関数などでファイルを吐くディレクトリ
boolean   $force_compile   テンプレートが呼び出される毎に強制的にコンパイル(再コンパイル)を行います。
開発や、デバッグに使用してください。
string   $left_delimiter   テンプレートにて使用されるテンプレート言語の開始を表すデリミタです。 本家Smartyのデフォルトは"{"ですが、Javascript、CSSなどとの相性が悪い為、 ArtisanSmartyではデフォルトを"<%"としています。
integer   $php_handling   テンプレートに埋め込まれたphpコードの扱いを設定します。
array   $plugins_dir   Smartyが必要とするプラグインを置くディレクトリです。
SMARTY_DIR直下⇒カレントディレクトリ⇒phpのinclude_path の順で、配列のディレクトリを検索します。
boolean   $request_use_auto_globals   Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
string   $request_vars_order   The order in which request variables are registered, similar to variables_order in php.ini E = Environment, G = GET, P = POST, C = Cookies, S = Server
string   $right_delimiter   テンプレートにて使用されるテンプレート言語の終端を表すデリミタです。 本家Smartyのデフォルトは"}"ですが、Javascript、CSSなどとの相性が悪い為、 ArtisanSmartyではデフォルトを"%>"としています。
array   $secure_dir   安全と考えられるディレクトリの配列です。
boolean   $security   テンプレートセキュリティ機能を使用するかどうかを設定します。
array   $security_settings   ArtisanSmartyのセキュリティ設定です。
string   $template_dir   テンプレートファイルを置くディレクトリです。
テンプレートファイルを読み込む際にパスを指定しなかった場合は、このディレクトリから探します。
array   $trusted_dir   This is an array of directories where trusted php scripts reside.
boolean   $use_sub_dirs   This tells Smarty whether or not to use sub dirs in the cache/ and templates_c/ directories. sub directories better organized, but may not work well with PHP safe mode enabled.

[ Top ]
Method Summary
Smarty   Smarty()   The class constructor.
void   append()   appends values to template variables
void   append_by_ref()   appends values to template variables by reference
void   assign()   assigns values to template variables
void   assign_by_ref()   assigns values to template variables by reference
void   clear_all_assign()   clear all the assigned template variables.
boolean   clear_all_cache()   clear the entire contents of cache (all templates)
void   clear_assign()   clear the given assigned template variable.
boolean   clear_cache()   clear cached content for the given template and cache id
boolean   clear_compiled_tpl()   clears compiled version of specified template resource, or all compiled template files if one is not specified.
void   clear_config()   clear configuration values
void   config_load()   load configuration values
void   display()   executes & displays the template results
void   fetch()   executes & returns or displays the template results
array   &get_config_vars()   Returns an array containing config variables
object   &get_registered_object()   return a reference to a registered object
array   &get_template_vars()   Returns an array containing template variables
string|false   is_cached()   test to see if valid cache exists for this template
void   load_filter()   load a filter of specified type and name
void   register_block()   Registers block function to be used in templates
void   register_compiler_function()   Registers compiler function
void   register_function()   Registers custom function to be used in templates
void   register_modifier()   Registers modifier to be used in templates
void   register_object()   Registers object to be used in templates
void   register_outputfilter()   Registers an output filter function to apply to a template output
void   register_postfilter()   Registers a postfilter function to apply to a compiled template after compilation
void   register_prefilter()   Registers a prefilter function to apply to a template before compiling
void   register_resource()   Registers a resource to fetch a template
boolean   template_exists()   Checks whether requested template exists.
void   trigger_error()   trigger Smarty error
void   unregister_block()   Unregisters block function
void   unregister_compiler_function()   Unregisters compiler function
void   unregister_function()   Unregisters custom function
void   unregister_modifier()   Unregisters modifier
void   unregister_object()   Unregisters object
void   unregister_outputfilter()   Unregisters an outputfilter function
void   unregister_postfilter()   Unregisters a postfilter function
void   unregister_prefilter()   Unregisters a prefilter function
void   unregister_resource()   Unregisters a resource

[ Top ]
Properties
array   $autoload_filters = array() [line 372]

This indicates which filters are automatically loaded into Smarty.

ArtisanSmarty のコンフィグ部分


[ Top ]
string   $cache_dir = 'cache' [line 186]

テンプレートのキャッシュが格納されるディレクトリです。

ArtisanSmarty のコンフィグ部分


[ Top ]
null|string   $cache_handler_func = null [line 365]

The function used for cache file handling. If not set, built-in caching is used.

ArtisanSmarty のコンフィグ部分


[ Top ]
integer   $cache_lifetime = 3600 [line 197]

テンプレートのキャッシュの期限(単位:秒)です。これが切れるとキャッシュは再生成されます。

ArtisanSmarty のコンフィグ部分

  • 0 = 常にキャッシュの再生成します。
  • -1 = キャッシュを無期限で利用します。


[ Top ]
boolean   $cache_modified_check = false [line 206]

キャッシュされた内容にinsertタグが含まれない場合に、 キャッシュファイルのタイムスタンプが最後に訪れた時から変わっていないなら、 コンテンツの代わりに"304 Not Modified"レスポンスが返されます。

ArtisanSmarty のコンフィグ部分


[ Top ]
integer   $caching = 0 [line 179]

テンプレートの出力をキャッシュするかどうかを設定します。

ArtisanSmarty のコンフィグ部分

  • 0 = キャッシングを行いません。
  • 1 = にそのキャッシュが期限切れかどうかを調べるために、 現在の時間と $cache_lifetime の値を比較します。
  • 2 = にそのキャッシュが生成された時点の時間と $cache_lifetime の値を比較するように指示します


[ Top ]
string   $compiler_class = 'Smarty_Compiler' [line 425]

Smartyがテンプレートをコンパイルするために使用するコンパイラクラスの名前を指定します。


[ Top ]
string   $compiler_file = 'ArtisanSmarty_Compiler.class.php' [line 418]

コンパイラクラスを含むファイル。 フルパスを書くか、そうでなければphpのinclude_path・SMARTY_DIRの中を探します。


[ Top ]
boolean   $compile_check = true [line 159]

phpアプリケーションの各リクエスト時に、現在のテンプレートが最後に訪れた時から変更されている

ArtisanSmarty のコンフィグ部分 (タイムスタンプが異なる)なら、それがコンパイルされているかどうかを検査します。
もしコンパイルされていなければ、そのテンプレートを再コンパイルします。
そのテンプレートが一度もコンパイルされていなかった場合は、この設定に関係なくコンパイルを行います。


[ Top ]
string   $compile_dir = 'templates_c' [line 91]

コンパイルされたテンプレートが置かれるディレクトリです。

ArtisanSmarty のコンフィグ部分


[ Top ]
string   $compile_id = null [line 325]

Set this if you want different sets of compiled files for the same templates. This is useful for things like different languages.

ArtisanSmarty のコンフィグ部分 Instead of creating separate sets of templates per language, you set different compile_ids like 'en' and 'de'.


[ Top ]
mixed   $config_booleanize = true [line 388]

This tells whether or not to automatically booleanize config file variables.

If enabled, then the strings "on", "true", and "yes" are treated as boolean true, and "off", "false" and "no" are treated as boolean false.


[ Top ]
string   $config_class = 'Config_File' [line 432]

コンフィグ変数を読み込むクラスの名前を指定します。


[ Top ]
string   $config_dir = 'configs' [line 98]

テンプレートから読み込むための設定ファイル(Configファイル)を置くディレクトリです。

ArtisanSmarty のコンフィグ部分


[ Top ]
mixed   $config_fix_newlines = true [line 402]

設定ファイル内のmacとdosのnewline (\r と \r\n)はそれらがパースされる時に \nにコンバートされます。

デフォルトはtrueで機能がONになっています。


[ Top ]
mixed   $config_overwrite = true [line 381]

This tells if config file vars of the same name overwrite each other or not.

if disabled, same name variables are accumulated in an array.


[ Top ]
mixed   $config_read_hidden = false [line 396]

This tells whether hidden sections [.foobar] are readable from the tempalates or not. Normally you would never allow this since that is the point behind hidden sections: the application can access them, but the templates cannot.


[ Top ]
boolean   $debugging = false [line 121]

ページロード時に、自動でデバッグコンソールウィンドウを表示します。
ブラウザの、ポップアップを許可してください。

ArtisanSmarty のコンフィグ部分


[ Top ]
string   $debugging_ctrl = 'NONE' [line 149]

デバッギングコンソールを有効にするための$debuggingに代わる方法です。

ArtisanSmarty のコンフィグ部分

  • NONE =>これを無効にする事を意味します
  • URL => QUERY_STRINGの中にキーワード"SMARTY_DEBUG"が含まれていた時にデバッギングコンソールが有効になる事を意味します。
$debuggingが"true"の場合は、この設定は無視されます。

Information Tags:
Link:  http://www.foo.dom/index.php?SMARTY_DEBUG

[ Top ]
string   $debug_tpl = '' [line 136]

デバッグコンソールに使用されるテンプレートファイルの名前です。
設定しない場合は、デフォルトのデバッグコンソールが使用されます。

ArtisanSmarty のコンフィグ部分


[ Top ]
array   $default_modifiers = array() [line 344]

This is a list of the modifiers to apply to all template variables.

ArtisanSmarty のコンフィグ部分 Put each modifier in a separate array element in the order you want them applied. example:


1 array('escape:"htmlall"');


[ Top ]
array   $default_resource_type = 'file' [line 358]

This is the resource type to be used when not specified

ArtisanSmarty のコンフィグ部分 at the beginning of the resource path. examples: $smarty->display('file:index.tpl'); $smarty->display('db:index.tpl'); $smarty->display('index.tpl'); // will use default resource type {include file="file:index.tpl"} {include file="db:index.tpl"} {include file="index.tpl"} {* will use default resource type *}


[ Top ]
string   $default_template_handler_func = '' [line 410]

テンプレートファイルが見つからなかった場合、ここで指定されたPHP関数が実行されます。


[ Top ]
boolean   $error_reporting = null [line 128]

セットすると、Smartyのエラーレベルをコレにセットします。

ArtisanSmarty のコンフィグ部分


[ Top ]
string   $etc_dir = 'etc' [line 105]

内部関数などでファイルを吐くディレクトリ

ArtisanSmarty のコンフィグ部分


[ Top ]
boolean   $force_compile = false [line 167]

テンプレートが呼び出される毎に強制的にコンパイル(再コンパイル)を行います。
開発や、デバッグに使用してください。

ArtisanSmarty のコンフィグ部分


[ Top ]
string   $left_delimiter = '<%' [line 286]

テンプレートにて使用されるテンプレート言語の開始を表すデリミタです。 本家Smartyのデフォルトは"{"ですが、Javascript、CSSなどとの相性が悪い為、 ArtisanSmartyではデフォルトを"<%"としています。

ArtisanSmarty のコンフィグ部分


[ Top ]
integer   $php_handling = SMARTY_PHP_PASSTHRU [line 220]

テンプレートに埋め込まれたphpコードの扱いを設定します。

ArtisanSmarty のコンフィグ部分 テンプレート内のphpタグに囲まれたphpコードには影響を及ぼさない事に注意して下さい。

  • SMARTY_PHP_PASSTHRU -> phpコードを実行せずにそのまま出力します。
  • SMARTY_PHP_QUOTE -> phpコードをhtmlの要素として表示します。
  • SMARTY_PHP_REMOVE -> phpコードをテンプレートから除去します。
  • SMARTY_PHP_ALLOW -> phpコードを実行します。


[ Top ]
array   $plugins_dir = array('plugins') [line 113]

Smartyが必要とするプラグインを置くディレクトリです。
SMARTY_DIR直下⇒カレントディレクトリ⇒phpのinclude_path の順で、配列のディレクトリを検索します。

ArtisanSmarty のコンフィグ部分


[ Top ]
boolean   $request_use_auto_globals = true [line 315]

Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)

ArtisanSmarty のコンフィグ部分 are uses as request-vars or $_*[]-vars. note: if request_use_auto_globals is true, then $request_vars_order has no effect, but the php-ini-value "gpc_order"


[ Top ]
string   $request_vars_order = 'EGPCS' [line 305]

The order in which request variables are registered, similar to variables_order in php.ini E = Environment, G = GET, P = POST, C = Cookies, S = Server

ArtisanSmarty のコンフィグ部分


[ Top ]
string   $right_delimiter = '%>' [line 296]

テンプレートにて使用されるテンプレート言語の終端を表すデリミタです。 本家Smartyのデフォルトは"}"ですが、Javascript、CSSなどとの相性が悪い為、 ArtisanSmartyではデフォルトを"%>"としています。

ArtisanSmarty のコンフィグ部分


[ Top ]
array   $secure_dir = array() [line 243]

安全と考えられるディレクトリの配列です。

ArtisanSmarty のコンフィグ部分 これは、$securityが使用されたときには、 このディレクトリにあるテンプレートのみを使用する事が許されます。
一要素一ディレクトリで指定し、 また、$template_dirは指定せずとも、使用可能です。


[ Top ]
boolean   $security = false [line 232]

テンプレートセキュリティ機能を使用するかどうかを設定します。

ArtisanSmarty のコンフィグ部分 使用すると、テンプレートの様々な機能が抑制されます。
あまり信用がおけないグループがテンプレートを編集する などと言う場合に最適なセキュリティを提供します。
(たとえば、テンプレート内でphpの実行が出来ません。)

API Tags:
See:  Smarty::$security_settings


[ Top ]
array   $security_settings = array(
'PHP_HANDLING' => false,
'IF_FUNCS' => array('array', 'list',
'isset', 'empty',
'count', 'sizeof',
'in_array', 'is_array',
'true', 'false', 'null'),'INCLUDE_ANY'=>false,'PHP_TAGS'=>false,'MODIFIER_FUNCS'=>array('count'),'ALLOW_CONSTANTS'=>false)
[line 258]

ArtisanSmartyのセキュリティ設定です。

ArtisanSmarty のコンフィグ部分 $security使用時の動作を示します。

  • PHP_HANDLING -> true/falseで指定します。trueの場合、セキュリティのために$php_handlingをチェックしません。
  • IF_FUNCS -> ifステートメントにて使用可能なphp関数の名前の配列です。
  • INCLUDE_ANY -> true/falseで指定します。trueの場合、テンプレートは$secure_dirのリストに関係なくローカルシステムからインクルード可能です。
  • PHP_TAGS -> true/falseで指定します。trueの場合、phpタグがテンプレートで使用できます。
  • MODIFIER_FUNCS -> 変数の修正子として使用可能なphp関数の名前の配列です。


[ Top ]
string   $template_dir = 'templates' [line 84]

テンプレートファイルを置くディレクトリです。
テンプレートファイルを読み込む際にパスを指定しなかった場合は、このディレクトリから探します。

ArtisanSmarty のコンフィグ部分


[ Top ]
array   $trusted_dir = array() [line 277]

This is an array of directories where trusted php scripts reside.

ArtisanSmarty のコンフィグ部分 $security is disabled during their inclusion/execution.


[ Top ]
boolean   $use_sub_dirs = false [line 335]

This tells Smarty whether or not to use sub dirs in the cache/ and templates_c/ directories. sub directories better organized, but may not work well with PHP safe mode enabled.

ArtisanSmarty のコンフィグ部分


[ Top ]
Methods
Constructor Smarty  [line 601]

  Smarty Smarty( )

The class constructor.



[ Top ]
append  [line 645]

  void append( array|string $tpl_var, [mixed $value = null], [mixed $merge = false]  )

appends values to template variables

Parameters:
array|string   $tpl_var:  the template variable name(s)
mixed   $value:  the value to append


[ Top ]
append_by_ref  [line 685]

  void append_by_ref( string $tpl_var, mixed &$value, [mixed $merge = false]  )

appends values to template variables by reference

Parameters:
string   $tpl_var:  the template variable name
mixed   $value:  the referenced value to append


[ Top ]
assign  [line 613]

  void assign( array|string $tpl_var, [mixed $value = null]  )

assigns values to template variables

Parameters:
array|string   $tpl_var:  the template variable name(s)
mixed   $value:  the value to assign


[ Top ]
assign_by_ref  [line 633]

  void assign_by_ref( string $tpl_var, mixed &$value  )

assigns values to template variables by reference

Parameters:
string   $tpl_var:  the template variable name
mixed   $value:  the referenced value to assign


[ Top ]
clear_all_assign  [line 1039]

  void clear_all_assign( )

clear all the assigned template variables.



[ Top ]
clear_all_cache  [line 1003]

  boolean clear_all_cache( [string $exp_time = null]  )

clear the entire contents of cache (all templates)

Parameters:
string   $exp_time:  expire time

API Tags:
Return:  results of smarty_core_rm_auto()


[ Top ]
clear_assign  [line 707]

  void clear_assign( string $tpl_var  )

clear the given assigned template variable.

Parameters:
string   $tpl_var:  the template variable to clear


[ Top ]
clear_cache  [line 971]

  boolean clear_cache( [string $tpl_file = null], [string $cache_id = null], [string $compile_id = null], [string $exp_time = null]  )

clear cached content for the given template and cache id

Parameters:
string   $tpl_file:  name of template file
string   $cache_id:  name of cache_id
string   $compile_id:  name of compile_id
string   $exp_time:  expiration time


[ Top ]
clear_compiled_tpl  [line 1054]

  boolean clear_compiled_tpl( [string $tpl_file = null], [string $compile_id = null], [string $exp_time = null]  )

clears compiled version of specified template resource, or all compiled template files if one is not specified.

This function is for advanced use only, not normally needed.

Parameters:
string   $tpl_file: 
string   $compile_id: 
string   $exp_time: 

API Tags:
Return:  results of smarty_core_rm_auto()


[ Top ]
clear_config  [line 1381]

  void clear_config( [string $var = null]  )

clear configuration values

Parameters:
string   $var: 


[ Top ]
config_load  [line 1354]

  void config_load( string $file, [string $section = null], [string $scope = 'global']  )

load configuration values

Parameters:
string   $file: 
string   $section: 
string   $scope: 


[ Top ]
display  [line 1139]

  void display( string $resource_name, [string $cache_id = null], [string $compile_id = null]  )

executes & displays the template results

Parameters:
string   $resource_name: 
string   $cache_id: 
string   $compile_id: 


[ Top ]
fetch  [line 1152]

  void fetch( string $resource_name, [string $cache_id = null], [string $compile_id = null], [boolean $display = false]  )

executes & returns or displays the template results

Parameters:
string   $resource_name: 
string   $cache_id: 
string   $compile_id: 
boolean   $display: 


[ Top ]
get_config_vars  [line 1107]

  array &get_config_vars( [string $name = null], string $type  )

Returns an array containing config variables

Parameters:
string   $name: 
string   $type: 


[ Top ]
get_registered_object  [line 1366]

  object &get_registered_object( string $name  )

return a reference to a registered object

Parameters:
string   $name: 


[ Top ]
get_template_vars  [line 1087]

  array &get_template_vars( [string $name = null], string $type  )

Returns an array containing template variables

Parameters:
string   $name: 
string   $type: 


[ Top ]
is_cached  [line 1017]

  string|false is_cached( string $tpl_file, [string $cache_id = null], [string $compile_id = null]  )

test to see if valid cache exists for this template

Parameters:
string   $tpl_file:  name of template file
string   $cache_id: 
string   $compile_id: 

API Tags:
Return:  results of _read_cache_file()


[ Top ]
load_filter  [line 945]

  void load_filter( string $type, string $name  )

load a filter of specified type and name

Parameters:
string   $type:  filter type
string   $name:  filter name


[ Top ]
register_block  [line 774]

<