/** * Run a hook * * @param $name * @param array $params */ protected function runHook($name, array $params = []) { Extensions::runHook($name, $params); }
/** * 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; }
<?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) . ').*?)$'); }
/** * addRouteProjectNameExclusions * * @param string|array $names */ protected function addRouteProjectNameExclusions($names) { Extensions::addExcludedProjectNames($names); }