Lambda-component
[ class tree: Lambda-component ] [ index: Lambda-component ] [ all elements ]

Class: Resource

Source Location: /components/Resource.php

Class Overview


リソース Class


Author(s):

  • rooth

Version:

  • 0.0.1

    PHP version 5

     usage:
      Resource::get(string filename [, mixed keys, mixed fallback, bool sanitize]);
    
       #リソースをロードするベースディレクトリを「/path/to/lib」にセット
       Resource::setBaseDir('/path/to/lib');
       // ※. このメソッドを呼ばない場合、デフォルトではこのクラスが置かれているディレクトリが設定されます。
    
       # filename.php の値を返却する
       $rsc = Resource::get('filename');
    
       # filename.php の キー ['key1'] の値を返却する: array('key1' => 'val_1') // val_1
       $rsc = Resource::get(filename, 'key1');
    
       # filename.php の キー ['key1']['key2'] の値を返却する: array('key1' => array('key2' => 'val_2')) // VAL_2
       $rsc = Resource::get(filename, array('key1', 'key2'));
    
       # fallback: 存在しない時の代替
       $rsc = Resource::get(filename, array('key1', 'key2'), '');
    
       # 値をサニタイズしないで返却する
       $rsc = Resource::get(filename, null, array(), Resource::INSANITATION);
    
       # 指定可能なキーの深さは「5」まで。
    
          # 動作します
          $rsc = Resource::get('filename', array('key1', 'key2', 'key3', 'key4', 'key5'));
    
          # 動作しません
          $rsc = Resource::get('filename', array('key1', 'key2', 'key3', 'key4', 'key5', 'key6'));

Variables

Constants

Methods



Class Details

[line 46]
リソース Class



Tags:

author:  rooth
version:  

0.0.1

PHP version 5

 usage:
  Resource::get(string filename [, mixed keys, mixed fallback, bool sanitize]);

   #リソースをロードするベースディレクトリを「/path/to/lib」にセット
   Resource::setBaseDir('/path/to/lib');
   // ※. このメソッドを呼ばない場合、デフォルトではこのクラスが置かれているディレクトリが設定されます。

   # filename.php の値を返却する
   $rsc = Resource::get('filename');

   # filename.php の キー ['key1'] の値を返却する: array('key1' => 'val_1') // val_1
   $rsc = Resource::get(filename, 'key1');

   # filename.php の キー ['key1']['key2'] の値を返却する: array('key1' => array('key2' => 'val_2')) // VAL_2
   $rsc = Resource::get(filename, array('key1', 'key2'));

   # fallback: 存在しない時の代替
   $rsc = Resource::get(filename, array('key1', 'key2'), '');

   # 値をサニタイズしないで返却する
   $rsc = Resource::get(filename, null, array(), Resource::INSANITATION);

   # 指定可能なキーの深さは「5」まで。

      # 動作します
      $rsc = Resource::get('filename', array('key1', 'key2', 'key3', 'key4', 'key5'));

      # 動作しません
      $rsc = Resource::get('filename', array('key1', 'key2', 'key3', 'key4', 'key5', 'key6'));



[ Top ]


Class Variables

static $base_dir =

[line 50]



Tags:

access:  protected

Type:   mixed


[ Top ]

static $charset =  'UTF-8'

[line 48]



Tags:

access:  protected

Type:   mixed


[ Top ]

static $resource = array()

[line 51]



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


static method get [line 95]

static mixed get( str $file, [mixed $keys = null], [ $fallback = array()], [bool $sanitize = self::SANITATION])

リソースを返却する



Tags:

return:  存在する時:mixed / 存在しない時:空の配列
access:  public


Parameters:

str   $file   リソースファイル(.php は省略する)
mixed   $keys   取得したいキー名 null: 指定なし(すべてを取得する) str, int, float: 第1レベル array: 第2~第5レベル
bool   $sanitize   値をサニタイズするか否か
   $fallback  

[ Top ]

static method getBaseDir [line 75]

static str getBaseDir( )

ベースディレクトリを返却する



Tags:

return:  ベースディレクトリ
access:  protected


[ Top ]

static method getResource [line 156]

static array getResource( str $file)

リソースを返却する



Tags:

return:  リソースの配列
access:  protected


Parameters:

str   $file   リソースファイル

[ Top ]

static method rh [line 167]

static void rh( $mixed)

recursive htmlspecialchars



Tags:

access:  protected


Parameters:

   $mixed  

[ Top ]

static method setBaseDir [line 63]

static void setBaseDir( str $dir)

ベースディレクトリをセットする



Tags:

access:  public


Parameters:

str   $dir   ベースディレクトリ

[ Top ]

static method setResource [line 138]

static void setResource( str $file)

リソースをセットする



Tags:

access:  protected


Parameters:

str   $file   リソースファイル

[ Top ]


Class Constants

INSANITATION =  false

[line 54]


[ Top ]

SANITATION =  true

[line 53]


[ Top ]



Documentation generated on Sat, 21 May 2011 18:34:10 +0900 by phpDocumentor 1.4.1