예제 #1
0
파일: Hookable.php 프로젝트: docit/core
 /**
  * Run a hook
  *
  * @param       $name
  * @param array $params
  */
 protected function runHook($name, array $params = [])
 {
     Extensions::runHook($name, $params);
 }
예제 #2
0
파일: Document.php 프로젝트: docit/core
 /**
  * Render the document.
  *
  * This will run all document:render hooks and then return the
  * output. Should be called within a view.
  *
  * @return string
  */
 public function render()
 {
     $this->runHook('document:render', [$this]);
     $fsettings = $this->project->config('filters_settings');
     $filters = Extensions::getFilters($this->getProject()->config('filters'));
     if (count($filters) > 0) {
         foreach ($filters as $name => $filter) {
             if ($filter instanceof \Closure) {
                 call_user_func_array($filter, [$this, isset($fsettings[$name]) ? $fsettings[$name] : []]);
             } else {
                 $instance = app()->make($filter);
                 call_user_func_array([$instance, 'handle'], [$this, isset($fsettings[$name]) ? $fsettings[$name] : []]);
             }
         }
     }
     return $this->content;
 }
예제 #3
0
파일: routes.php 프로젝트: docit/core
<?php

use Docit\Core\Extensions;
$index = Route::get('/', ['as' => 'docit.index', 'uses' => 'DocitController@index']);
$document = Route::get('{projectSlug}/{ref?}/{document?}', ['as' => 'docit.document', 'uses' => 'DocitController@document']);
$document->where('document', '(.*)');
if (count(Extensions::getExcludedProjectNames()) > 0) {
    $document->where('projectSlug', '^((?!' . Extensions::getExcludedProjectNames(true) . ').*?)$');
}
예제 #4
0
 /**
  * addRouteProjectNameExclusions
  *
  * @param string|array $names
  */
 protected function addRouteProjectNameExclusions($names)
 {
     Extensions::addExcludedProjectNames($names);
 }