Exemplo n.º 1
0
 protected function _retrieveUrl()
 {
     if ($this->usesModRewrite) {
         $self = $this->_server->needs('PHP_SELF');
         //            if(($pathInfo = $this->_server->get('PATH_INFO')) || ($pathInfo = $this->_server->get('ORIG_PATH_INFO'))){
         //                $self = substr($self, 0, strlen($self) - strlen($pathInfo));
         //            }
         if (($pos = strrpos($self, '/')) !== false) {
             $self = substr($self, 0, $pos);
         } else {
             $self = substr($self, 0, strrpos($self, '\\'));
         }
         $url = substr($this->_server->needs('REQUEST_URI'), strlen($self));
         if ($url === false) {
             $url = '';
         } elseif ($url !== '') {
             $posQueryString = strpos($url, '?');
             if ($posQueryString !== false) {
                 $url = substr($url, 0, $posQueryString);
             }
         }
         $url = substr($url, 1);
     } else {
         if ($this->_server->has('PATH_INFO')) {
             $url = substr($this->_server->get('PATH_INFO'), 1);
         } else {
             $url = substr($this->_server->get('ORIG_PATH_INFO'), 1);
         }
     }
     if (substr($url, -1, 1) != '/') {
         $url .= '/';
     }
     return $url;
 }
Exemplo n.º 2
0
<?php

use Cyantree\Grout\AutoLoader;
use Cyantree\Grout\Filter\ArrayFilter;
use Cyantree\Mosaic\Outputs\ReadableOutput;
use Cyantree\Mosaic\Outputs\JsonOutput;
use Cyantree\Mosaic\Mosaic;
require_once __DIR__ . '/../../../autoload.php';
ini_set('memory_limit', '1024M');
AutoLoader::init();
$options = new ArrayFilter(getopt('f:c:j:o:', ['debug']));
$outputMode = $options->get('o', 'readable');
$s = new Mosaic();
$s->debug = $options->has('debug');
$s->basePath = realpath(dirname($options->needs('f'))) . '/';
$s->applicationPath = __DIR__ . '/../src/';
$s->configuration->load($options->needs('f'));
if ($options->has('c')) {
    $s->configuration->extend(json_decode(rawurldecode($options->get('c'))));
}
if ($options->has('j')) {
    $includedJobs = explode(',', $options->get('j'));
} else {
    $includedJobs = null;
}
$jobs = $s->compile($includedJobs);
switch ($outputMode) {
    case 'json':
        $output = new JsonOutput();
        break;
    default: