Exemple #1
0
 function __construct()
 {
     parent::__construct();
     $this->rest = REST_Server::instance();
     $this->_table = 'common_account_info';
     $this->_primary = 'account_id';
 }
Exemple #2
0
 public function __construct()
 {
     if (get_parent_class()) {
         parent::__construct();
     }
     $this->callMethod('api_');
 }
Exemple #3
0
 /**
  * @static
  * @return REST_Server
  */
 public static function instance()
 {
     if (self::$self == NULL) {
         self::$self = new self();
     }
     return self::$self;
 }
Exemple #4
0
 /**
  * 主要check流程
  *
  * @param string $key
  */
 public function check($key = NULL)
 {
     self::getkey($key);
     $ready = $this->cache->get($this->key);
     if ($ready == FALSE) {
         $this->cache->set($this->key, array(time()));
         return;
     }
     $ready_ = $ready;
     if (self::checkCountAndTime($ready_)) {
         $this->rest->error(REST_Code::STATUS_ERROR_Api_QUENCY_M);
     }
     unset($ready_);
     array_push($ready, time());
     $this->cache->set($this->key, $ready);
 }
Exemple #5
0
 public function init()
 {
     $validator = new BaseValid();
     $validator->executeFilterMethod($this->getRequest());
     $this->check = REST_Check::instance();
     $this->rest = REST_Server::instance();
     $this->client = REST_Client::instance();
     $this->params = array_merge($_POST, $_GET);
     //$this->db       = DB_Contect::db();
     //$this->quantity = REST_Quantity::instance();
     //$this->modified = REST_Modified::instance();
     // $this->session  = Yaf_Session::getInstance();
     // $this->mkData   = REST_Mkdata::instance();
     //  $this->setScaffoldConfig();
     //  $this->ScaffoldRoute();
     //$this->setConfig();
 }
Exemple #6
0
}
require_once 'functions.php';
// Define Splitters
require_once 'REST/Url.php';
REST_Url::registerSplitter('index', function ($url, $sec) {
    if ($url == '') {
        $url .= 'index.xml';
        $sec->set('index');
    } elseif (preg_match('/^index/', $url)) {
        $sec->set('index');
    }
    return $url;
});
REST_Url::registerSplitter('id', function ($url, $sec) {
    if (preg_match('/(^[0-9]+)/', $url, $m)) {
        $sec->set($m[1]);
    }
    return $url;
});
// Define Resources
require_once 'REST/Url.php';
$projects = REST_Url::factory('/{index}.xml')->addConstant('test', 'all callbacks can access to this content through the REST_Parameter class')->bindMethod('GET', 'list_of_projects_in_xml')->bindMethod('POST', 'add_new_project', array('name'))->bindMethod('OPTIONS', 'options');
$project = REST_Url::factory('/{id}.xml')->bindMethod('GET', 'get_project_in_xml')->bindMethod('DELETE', 'delete_project');
$issues = REST_Url::factory('/{id}/{index}.xml')->bindMethod('GET', 'list_of_issues_in_xml')->bindMethod('POST', 'add_new_issue', array(array('description', 'd', 'desc')));
$issue = REST_Url::factory('/{id}/{id}.(xml|html)')->bindMethod('GET', 'get_issue')->bindMethod('DELETE', 'delete_issue');
// Launch the server
require_once 'REST/Server.php';
$options = array('base' => '/rest_server_test');
REST_Server::factory($options)->register($projects)->register($project)->register($issues)->register($issue)->listen();
// Save datas
file_put_contents('data.txt', serialize($datas));
Exemple #7
0
 function __construct()
 {
     $this->rest = REST_Server::instance();
 }