コード例 #1
0
ファイル: class.silk_smarty.php プロジェクト: JackSpratt/silk
 public static function get_instance($have_db = true)
 {
     if (self::$instance == NULL) {
         self::$instance = new SilkSmarty($have_db);
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: silk.api.php プロジェクト: JackSpratt/silk
/**
 * Returns a reference to the global smarty object.  Replaces
 * the global $gCms; $config =& $gCms->GetSmarty() routine.
 */
function smarty()
{
    return SilkSmarty::get_instance();
}
コード例 #3
0
 /**
  * Getter overload method.  Called when an $obj->field and field
  * does not exist in the object's variable list.  In this case,
  * it will get a db or smarty instance (for backwards 
  * compatibility), or call get on the given field name.
  *
  * @param string The field to look up
  * @return mixed The value for that field, if it exists
  * @author Ted Kulp
  **/
 function __get($name)
 {
     if ($name == 'db') {
         return SilkDatabase::get_instance();
     } else {
         if ($name == 'smarty') {
             return SilkSmarty::get_instance();
         } else {
             return $this->get($name);
         }
     }
 }