Example #1
0
 /**
  * Makes API require a unique key for each request.
  * @param  boolean $boolean
  * @param  string $users_table_name Optional parameter that defines the name of the table in the database to be used to store information about the users making the requests. If none is specified "users" will be used.
  * @param  string $key_column_name Optional parameter that defines the name of the column in the database to be used for the API key. If none is specified "API_key" will be used.
  * @param  string $hit_count_column_name Optional parameter that defines the name of the column in the database to be used for the API hit count. If none is specified "API_hits" will be used.
  * @param  string $hit_date_column_name Optional parameter that defines the name of the column in the database to be used for the API hit date. If none is specified "API_hit_date" will be used.
  * @return void
  */
 public function set_key_required($boolean, $users_table_name = false, $key_column_name = false, $hit_count_column_name = false, $hit_date_column_name = false)
 {
     $this->API_key_required = (bool) $boolean;
     if ($users_table_name) {
         Database::$users_table = (string) $users_table_name;
     }
     if ($key_column_name) {
         $this->API_key_column_name = $key_column_name;
     }
     if ($hit_count_column_name) {
         $this->API_hit_count_column_name = $hit_count_column_name;
     }
     if ($hit_date_column_name) {
         $this->API_hit_date_column_name = $hit_date_column_name;
     }
 }