示例#1
0
 public function __construct($table = '')
 {
     parent::__construct();
     $this->_error = array();
     $this->_fields = array();
     if (empty($table)) {
         $this->_table = StringHelper::camelToFlat(__CLASS__);
     } else {
         $this->_table = $table;
     }
 }
示例#2
0
 public function addReferrer($url = '', $historic = false)
 {
     if (!$url) {
         if (!($url = $this->autoReferrer($historic))) {
             return false;
         }
     }
     $url = StringHelper::camelToFlat($url);
     $arr = $_SESSION['appReferrers'];
     // copy
     // search for previous entry with same url
     while ($tmp = @array_pop($arr)) {
         if ($tmp == $url) {
             // been to this page, need to clean referrers
             $_SESSION['appReferrers'] = $arr;
             break;
         }
     }
     // add url to referrer
     $_SESSION['appReferrers'][] = $url;
     return true;
 }
示例#3
0
 /**
  * autoload class
  * @parameter would require the type of class to be said in there
  */
 private static function autoLoad($name)
 {
     $str = StringHelper::camelToFlat($name);
     $type = 'class';
     $sep = strrpos($str, '_');
     if ($sep) {
         $class = substr($str, 0, $sep);
         $type = substr($str, $sep + 1);
         switch ($type) {
             case 'helper':
             case 'class':
             case 'controller':
             case 'model':
             case 'view':
                 // valid type
                 break;
             default:
                 // invalid type, must be a core class
                 $type = 'class';
                 break;
         }
     }
     return self::load($name, $type);
 }