Пример #1
0
 /**
  * Process data from the parsed ini file.
  *
  * @param  array $data
  * @return array
  */
 protected function process(array $data)
 {
     $config = array();
     foreach ($data as $section => $data) {
         //check if section has parent section or property
         if (preg_match('/[\\s\\w]{1}' . self::INHERIT_KEY . '[\\s\\w]{1}/', $section)) {
             $section = $this->inherit($section, $config);
         } else {
             //evaluate the section and if not false move forward
             $evaluator = new Evaluator($section);
             if ($evaluator->evaluate()) {
                 $section = $evaluator->getAlias();
                 $config[$section] = array();
             } else {
                 continue;
                 //conditional section that did not meet condition
             }
         }
         if (is_array($data)) {
             //this is a INI section, build the nested tree
             $this->buildNestedSection($data, $config[$section]);
         } else {
             //single property, no need to do anything
             $config[$section] = $this->parseValue($data);
         }
     }
     return $config;
 }
Пример #2
0
 function render($context, $stream)
 {
     $exp_value = Evaluator::eval_expression($this->expression, $context);
     $value = $context->applyFilters($exp_value, $this->filters);
     $value = $context->escape($value, array('filters' => $this->filters));
     $stream->write($value);
 }
Пример #3
0
 public function sitemap()
 {
     $query = \PublicRouteDriver::query();
     $urls = [];
     $routes = $query->where('directory_hidden', false)->get();
     foreach ($routes as $route) {
         if (!$route->dependencies) {
             $urls[] = route($route->name);
         } else {
             $directory = json_decode($route->directory, 1);
             foreach ($route->dependencies as $dependency) {
                 if (array_key_exists($dependency, $directory)) {
                     $parts = explode('<', $directory[$dependency]);
                     if (count($parts) == 3) {
                         $items = \Evaluator::getQuery($directory[$dependency])->get();
                         $identifier = $parts[2];
                         foreach ($items as $item) {
                             $urls[] = route($route->name, $item->{$identifier});
                         }
                     }
                 }
             }
         }
     }
     $sitemap = '<?xml version="1.0" encoding="UTF-8"?>' . \View::make('directory.sitemapxml', compact('urls'));
     return \Response::make($sitemap, 200)->header('Content-Type', 'application/xml');
 }
Пример #4
0
 /**
  * Processes a notification. No response is necessary.
  *
  * @param string $method
  * String value representing a method to invoke on the server.
  *
  * @param array $arguments
  * Array of arguments that will be passed to the method.
  */
 private function processNotification($method, $arguments)
 {
     try {
         $this->evaluator->evaluate($method, $arguments);
     } catch (Exception $exception) {
     }
 }
Пример #5
0
 public static function read_by_get_key()
 {
     $key = $_GET['Key'];
     $certificate = new Certificate();
     $evaluator = Evaluator::read_by_key($key);
     $certificate->set_by_evaluator($evaluator, false);
     $certificate->adjust();
     return $certificate->get_data();
 }
Пример #6
0
 function test($context)
 {
     $test = Evaluator::exec($this->args, $context);
     return $this->negate ? !$test : $test;
 }
Пример #7
0
 static function exec($args, $context)
 {
     return Evaluator::eval_expression($args, $context);
 }
Пример #8
0
<div class="container white">
  <div class="content left">
    <table class="data">
      <thead>
        <th>Evaluator/Email/Phone/Key</th>
        <th>Company/URL/Script</th>
        <th>Date/IP</th>
        <th>Platform</th>
        <th>Version</th>
        <th>Download</th>
        <th>Installed</th>
      </thead>
      <tbody>
        <?php 
$evaluators = Evaluator::read(['*'], FALSE, ['email_date > CURRENT_DATE - INTERVAL 2 MONTH'], 'email_date DESC');
foreach ($evaluators as $evaluator) {
    $downloads = EvaluatorDownload::read_by_evaluator_id($evaluator['id']);
    $downs = [];
    if (is_array($downloads)) {
        foreach ($downloads as $download) {
            if ($download['download_date']) {
                $installed = $download['installed_count'] > 0 ? $download['installed_date'] . '(' . $download['installed_count'] . ')' : '?';
                $downs[] = ['platform' => $download['platform'], 'version' => $download['version'], 'download' => $download['download_date'], 'installed' => $installed];
            }
        }
    }
    if (count($downs) == 0) {
        $downs[] = ['platform' => '', 'version' => '', 'download' => '', 'installed' => ''];
    }
    echo '<tr>';
    foreach (['name/email/phone/key', 'company/url/scripting', 'email_date/ip'] as $field) {
Пример #9
0
 public function __construct($name, IEvaluationContext $context = null)
 {
     parent::__construct($context);
     $this->name = $name;
 }
Пример #10
0
 /**
  * @return bool
  */
 public function isTrue()
 {
     return $this->evaluator->evaluate($this->parsedRule ?: $this->parser->parse($this->rule));
 }
Пример #11
0
 public function __construct($value, IEvaluationContext $context = null)
 {
     parent::__construct($context);
     $this->value = $value;
 }
Пример #12
0
 public function installed($params = [])
 {
     $key = $params['key'];
     $version = $params['version'];
     $status = isset($params['Status']) ? $params['Status'] : '';
     $evaluator = Evaluator::read_by_key($key);
     if (isset($evaluator['downloads']) && $version >= 1 && $version <= count($evaluator['downloads'])) {
         // downloads are in reverse order (newest to oldest)
         // version number 1 is the oldest
         $idx = count($evaluator['downloads']) - $version;
         $id = $evaluator['downloads'][$idx]['id'];
         $update = ['installed_date' => gmdate('Y-m-d'), 'status' => $status];
         EvaluatorDownload::update($update, $id, 'installed_count = installed_count+1');
     }
     // show the news page
     Render::html(Doc::by_name('news')['content']);
 }
 public function importTableHeaderFromCSV($file)
 {
     $filename = $file . ".csv";
     if (!fileExists($filename) and $this->entityexist($file)) {
         echo "import can only in a new table";
         die;
     }
     $CSVHandler = new CSVHandler($filename);
     $CSVHandler->countColumns();
     $data = $CSVHandler->getHeaders();
     $HelperFunctions = new HelperFunctions();
     $data = $HelperFunctions->array_trim($data);
     $Evaluator = new Evaluator();
     $date = array_filter($data, $Evaluator->returnOnlyLettersNumbersUnderscore($data));
     $sql = "CREATE TABLE IF NOT EXISTS ` " . $file . " ` (";
     for ($i = 0; $i <= $CSVHandler->countColumns(); $i++) {
         if ($i == 0) {
             $sql .= "`" . $data[$i] . "` int(11) NOT NULL auto_increment";
         }
         $sql .= "`" . $data[$i] . "` varchar(255) NOT NULL default ''";
         if ($i == 0) {
             $sql .= "PRIMARY KEY  (`" . $data[$i] . "`)";
         }
     }
     $sql .= ")";
     $result = $this->executeGenericStatement($sql);
     if (empty($result)) {
         return NULL;
     }
 }
Пример #14
0
 /**
  * Filter datas
  *
  * @return void
  */
 protected function applyFilter()
 {
     if (!$this->initialized) {
         $evaluator = new Evaluator();
         foreach ($this->datas as $key => $data) {
             foreach ($this->clauses as $clause) {
                 if (!$evaluator->evaluate($clause, $data)) {
                     unset($this->datas[$key]);
                 }
             }
         }
         $this->datas = array_values($this->datas);
         $this->initialized = true;
     }
 }
Пример #15
0
 public function run($input)
 {
     $tokens = $this->tokeniser->parse($input);
     $ast = $this->parser->parse($tokens);
     return $this->evaluator->evaluate($ast);
 }
Пример #16
0
 private function evaluate($text)
 {
     $evaluated = \Evaluator::evaluateTextInView($text);
     return $evaluated;
 }