Ejemplo n.º 1
0
 /**
  * @constructor
  *
  * @param {array} $options Options
  * @param {string|array} $options[source] (Required) directory of Javascript source files.
  * @param {string} $options[output] (Optional) directory for minified Javascript files, web root if omitted.
  */
 public function __construct(array $options)
 {
     $options['source'] = (array) @$options['source'];
     if (!$options['source'] || array_filter(array_map(compose('not', funcAnd('is_string', 'is_dir', 'is_readable')), $options['source']))) {
         throw new ResolverException('Invalid source directory.');
     }
     $this->srcPath = $options['source'];
     if (!empty($options['output'])) {
         if (!is_string($options['output']) || !is_dir($options['output']) || !is_writable($options['output'])) {
             throw new ResolverException('Invalid output directory.');
         }
         $this->dstPath = $options['output'];
     }
 }
Ejemplo n.º 2
0
                    }
                    chdir($cwd);
                    unset($cwd);
                    // restore working directory
                    return;
                    // then exits.
                }
            }
            unset($res);
        }
        unset($fragments);
    }
    // static view assets redirection
    // note; composer.json demands the name to be of format "vendor/name".
    return @".private/modules/{$instance->name}/views/{$matches['2']}";
}), array('source' => '/^\\/faye\\/client.js/', 'target' => array('uri' => array('port' => 8080, 'path' => '/client.js'), 'options' => array('status' => 307))), array('source' => funcAnd(matches('/^(?!(?:\\/assets|\\/service))/'), compose('not', pushesArg('pathinfo', PATHINFO_EXTENSION))), 'target' => '/'))), 65);
// Web Services
$resolver->registerResolver(new resolvers\WebServiceResolver(array('prefix' => conf::get('web::resolvers.service.prefix', '/service'))), 60);
// Post Processers
$resolver->registerResolver(new resolvers\InvokerPostProcessor(array('invokes' => 'invokes', 'unwraps' => 'core\\Utility::unwrapAssoc')), 50);
// Template resolver
// $templateResolver = new resolvers\TemplateResolver(array(
//     'render' => function($path) {
//         static $mustache;
//         if ( !$mustache ) {
//           $mustache = new Mustache_Engine();
//         }
//         $resource = util::getResourceContext();
//         return $mustache->render(file_get_contents($path), $resource);
//       }
//   , 'extensions' => 'mustache html'
Ejemplo n.º 3
0
 /**
  * Because POST can be JSON, or other formats in the future, we cannot simply
  * use $_REQUEST.
  *
  * Another difference with $_REQUEST is this also counts $_COOKIE.
  */
 public function param($name = null, $type = null)
 {
     /*! Note @ 23 Apr, 2015
      *  POST validation should be simple, just match it with some hash key stored in sessions.
      */
     // TODO: Do form validation, take reference from form key of Magento.
     $result = $this->_param($type);
     if (is_array($result)) {
         // remove meta keys and sensitive values
         $result = array_filter_keys($result, funcAnd(notIn([ini_get('session.name')]), compose('not', startsWith($this->metaPrefix))));
     }
     if ($name === null) {
         return $result;
     } else {
         $fx = prop($name);
         return $fx($result);
     }
 }