Пример #1
0
 public function __construct($routeName, $tableName)
 {
     global $db;
     $this->_routeName = $routeName;
     $this->_tableName = $tableName;
     $query = "DESCRIBE {$tableName}";
     $result = $this->runQuery($query, "no fetch");
     $tableColumns = array();
     foreach ($result as $row) {
         if ($row['Key'] != "") {
             $this->_tableIndex = $row['Field'];
         }
         $tableColumns[] = array($row['Type'] => $row['Field']);
     }
     $this->_tableColumns = $tableColumns;
     $query = preg_replace("/request={$routeName}\\/{0,1}&{0,1}/", "", $_SERVER["QUERY_STRING"]);
     if (strpos($_SERVER["QUERY_STRING"], "&") === false) {
         $request = "{$routeName}/" . $query;
     } else {
         $request = "{$routeName}/?" . $query;
     }
     parent::__construct($request);
     $this->Request = urldecode($request);
 }
Пример #2
0
 /**
  * Constructor. Creates a new endpoint.
  * @param string  $endpoint Endpoint name
  * @param array   $params   Endpoint params
  * @param boolean $signed   OAuth signed endpoint. Default set to false.
  */
 public function __construct($endpoint, $params = array(), $signed = FALSE)
 {
     $ep = array("method" => "GET", "endpoint" => $endpoint, "params" => $params, "signed" => $signed);
     // Constructs a new endpoint
     parent::__construct($ep);
 }
Пример #3
0
 /**
  * Create a new public Ajax endpoint with preconfigured headers for JSON values.
  * @param string $action The action name associated to your endpoint.
  * @param callable $handler The callback executed each time the endpoint is requested.
  */
 public function __construct($action, callable $handler)
 {
     parent::__construct($action, $handler, true);
 }