<?php
/**
 * Ajax class
 *
 * this class contain the methods that deals with Ajax
 *
 *
 * LICENSE: Open source
 *
 * @category   general
 * @package    core system
 * @subpackage parent
 * @copyright  coderg
 * @license    http://coderg.com
 * @version    .01
 * @link       http://coderg.com
 * @since      2018
 */
class Ajax{
    /**
     *  is_Ajax
     *  check if There Is Ajax Request
     *  @return true if There Is Ajax Request
     */
    public function is_Ajax() {
    return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
    }
    /**
     *  DataToJson
     *  Convert Array To Json
     * @param    $var (array) The Array That Will Be Converted
     *  @return (string) if $var is array , FALSE otherwise
     */
    public function DataToJson(array $var)
    {
        if(is_array($var))
        {
          return json_encode($var);
        }
         return FALSE;
    }



}



?>