Пример #1
0
#!/usr/bin/php
<?php 
/**
 * @copyright (c) 2015
 * @author Chris Allen, Robert Strutts 
 */
if (!empty($_SERVER['REQUEST_URI'])) {
    echo "Direct access denied!";
    exit;
}
$mem_baseline = memory_get_usage();
require 'config.php';
require '../cx/startup.php';
$app->load_cli_controller();
cx_get_memory_stats();
// If debug on, shows memory stats
Пример #2
0
 public static function ok($data = array())
 {
     $data['result'] = true;
     $code = 200;
     // OK
     if (cx\app\static_request::init('post', 'debug')->compair_it('true')) {
         $echo = false;
         $post = true;
         $data['memory_used'] = cx_get_memory_stats($echo, $post);
     }
     if (isset($data['code'])) {
         if ($data['code'] > 199 && $data['code'] < 209) {
             $code = $data['code'];
         }
         unset($data['code']);
     }
     if (isset($data['response'])) {
         switch ($data['response']) {
             case self::CREATED:
                 $long_code = "201 Created";
                 break;
             case self::ACCEPTED:
                 $long_code = "202 Accepted";
                 break;
             case self::NON_AUTHORITATIVE:
                 $long_code = "203 Non-Authoritative Information";
                 break;
             case self::NO_CONTENT:
                 $long_code = "204 No Content";
                 break;
             case self::RESET_CONTENT:
                 $long_code = "205 Reset Content";
                 break;
             case self::PARTIAL_CONTENT:
                 $long_code = "206 Partial Content";
                 break;
             case self::ALREADY_REPORTED:
                 $long_code = "208 Already Reported";
                 break;
             case self::OK:
                 $long_code = "200 OK";
                 break;
             default:
                 $long_code = $code;
                 break;
         }
     } else {
         $long_code = $code;
     }
     self::encode($data, $long_code);
 }