Example #1
0
 public static function init($options = [])
 {
     $self = new self($options);
     if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
         if (isset($_GET['reset'])) {
             echo '{ "success": "' . ($self->resetCache() ? 'yes' : 'no') . '" }';
         } else {
             if (isset($_GET['invalidate'])) {
                 echo '{ "success": "' . ($self->resetCache($_GET['invalidate']) ? 'yes' : 'no') . '" }';
             } else {
                 echo json_encode($self->getData(@$_GET['section'] ?: null));
             }
         }
         exit;
     } else {
         if (isset($_GET['reset'])) {
             $self->resetCache();
         } else {
             if (isset($_GET['invalidate'])) {
                 $self->resetCache($_GET['invalidate']);
             }
         }
     }
     return $self;
 }