Пример #1
0
 function html_encode_recursive($data)
 {
     if (!is_scalar($data) && $data !== NULL) {
         foreach ($data as $rk => $rv) {
             if (!is_scalar($rv) && $data !== NULL) {
                 $data[$rk] = html_encode_recursive($rv);
             } else {
                 $data[$rk] = htmlentities($rv);
             }
         }
         return $data;
     }
     return htmlentities($data);
 }
Пример #2
0
 /**
  * Performs a database query based on given conditions
  * @param  string  $query    	Database statement to execute
  * @param  boolean $response 	Whether to return response or not
  * @param  array   $data     	Data to manipulate
  * @param  array   $filters  	Filters to include in database statement, if any
  * @return mixed            	Query result
  */
 public static function execute($query, $response = TRUE, $data = array(), $filters = array())
 {
     try {
         $query = self::parse_arguments($query, $data, $filters);
         $result = self::$db->query($query);
         if ($response) {
             return html_encode_recursive($result);
         }
         return FALSE;
     } catch (APIexception $e) {
         die($e->output());
     }
 }