Beispiel #1
0
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new TEST_REST();
         self::$instance->plugin_constants();
         self::$instance->plugin_requires();
         self::$instance->test_rest_load_plugin_textdomain();
         add_action('wp_enqueue_scripts', array(self::$instance, 'load_all_scripts'));
     }
     return self::$instance;
 }
Beispiel #2
0
    private function TEST_VAL()
    {
        $this->logger->write("INFO :", "Calling Update Location for Driver");
        // Cross validation if the request method is POST else it will return "Not Acceptable" status
        $val = $this->_request['val'];
        $val1 = $_POST['val'];
        $this->logger->write("INFO :", "login with val ----->" . $val);
        $this->logger->write("INFO :", "login with val1 ----->" . $val1);
        if ($val != "") {
            $success = array('status' => "Success", "val" => $val);
            $this->response($this->json($success), 200);
        } else {
            $error = array('status' => "error");
            $this->response($this->json($error), 400);
        }
    }
    /*
     *	Encode array into JSON
     */
    private function json($data)
    {
        if (is_array($data)) {
            return json_encode($data);
        }
    }
}
// Initiiate Library
$api = new TEST_REST();
$api->processApi();
?>
?>