コード例 #1
0
ファイル: _functions.php プロジェクト: voitto/dbscript
function virtual_resource()
{
    global $request;
    $model = model_path() . classify($request->resource) . ".php";
    if (!file_exists($model)) {
        return true;
    }
    return false;
}
コード例 #2
0
ファイル: database.php プロジェクト: voitto/dbscript
 /**
  * Get Objects
  * 
  * return the data model objects in an array
  * 
  * @author Brian Hendrickson <*****@*****.**>
  * @access public
  * @return Model[]
  */
 function &get_objects()
 {
     trigger_before('get_objects', $this, $this);
     $objects = array();
     $skip = array('.', '..');
     $paths = array(model_path());
     if (isset($GLOBALS['PATH']['apps'])) {
         foreach ($GLOBALS['PATH']['apps'] as $k => $v) {
             $paths[] = $v['model_path'];
         }
     }
     foreach ($paths as $path) {
         if ($handle = opendir($path)) {
             while (false !== ($file = readdir($handle))) {
                 if (!in_array($file, $skip) && substr($file, -4) == '.php') {
                     $o = substr($file, 0, -4);
                     $objects[$o] =& $this->get_table(tableize($o));
                 }
             }
         }
         foreach ($objects as $name => $model) {
             $model->save();
         }
         closedir($handle);
     }
     return $objects;
 }