This will get a javascript view encapsulated in an anonymous function for embedding in HTML.

@param string $path
@return string|false
189561
public function get_js($path='', array $data=null, $encapsulated = true){
    if ( \is_array($path) ){
      $data = $path;
      $path = '';
    }
    if ( $r = $this->get_view($path, 'js', $data) ){
      return '<script>'.
        ( $encapsulated ? '(function($){' : '' ).
        ( empty($data) ? '' : 'var data = '.\bbn\x::js_object($data).';' ).
        $r.
        ( $encapsulated ? '})(jQuery);' : '' ).
        '</script>';
    }
    return false;
	}
1095175
public function getHtml($path)
    {
        if (!$this->docs->has($path)) {
            return '';
        }
        if (!$this->cache || !$this->cache->has($path) || $this->docs->getTimestamp($path) > $this->cache->getTimestamp($path)) {
            $text = $this->docs->read($path);
            $mark = $this->makeMark();
            $html = $mark->convertToHtml($text['contents']);
            if ($this->cache) {
                $this->cache->write($path, $html, new Config());
            }
            return $html;
        }
        $contents = $this->cache->read($path);
        return $contents['contents'];
    }
1224962
public function execute($path = null)
    {
        $content = '';

        /*
         * Let's first take out strings, comments and regular expressions.
         * All of these can contain JS code-like characters, and we should make
         * sure any further magic ignores anything inside of these.
         *
         * Consider this example, where we should not strip any whitespace:
         * var str = "a   test";
         *
         * Comments will be removed altogether, strings and regular expressions
         * will be replaced by placeholder text, which we'll restore later.
         */
        $this->extractStrings('\'"`');
        $this->stripComments();
        $this->extractRegex();

        // loop files
        foreach ($this->data as $source => $js) {
            // take out strings, comments & regex (for which we've registered
            // the regexes just a few lines earlier)
            $js = $this->replace($js);

            $js = $this->propertyNotation($js);
            $js = $this->shortenBools($js);
            $js = $this->stripWhitespace($js);

            // combine js: separating the scripts by a ;
            $content .= $js.";";
        }

        // clean up leftover `;`s from the combination of multiple scripts
        $content = ltrim($content, ';');
        $content = (string) substr($content, 0, -1);

        /*
         * Earlier, we extracted strings & regular expressions and replaced them
         * with placeholder text. This will restore them.
         */
        $content = $this->restoreExtractedData($content);

        return $content;
    }
667189
public function getNodeByDisplayPath($path)
    {
        $root = $this->getRootTreeNodeObject();

        if ($path == '/' || !$path) {
            return $root;
        }

        $computedPath = '';
        $tree = $this;
        $walk = function ($node, $computedPath) use (&$walk, &$tree, &$path) {
            $node->populateDirectChildrenOnly();

            if ($node->getTreeNodeID() != $tree->getRootTreeNodeID()) {
                $name = $node->getTreeNodeName();
                $computedPath .= '/' . $name;
            }

            if (strcasecmp($computedPath, $path) == 0) {
                return $node;
            } else {
                $children = $node->getChildNodes();
                foreach ($children as $child) {
                    $node = $walk($child, $computedPath);
                    if ($node !== null) {
                        return $node;
                    }
                }
            }

            return;
        };
        $node = $walk($root, $computedPath);

        return $node;
    }
113749
public function extractWebspaceFromPath($path)
    {
        $match = preg_match('/^\/' . $this->getPath('base') . '\/([^\/]*)\/.*$/', $path, $matches);

        if ($match) {
            return $matches[1];
        } else {
            return;
        }
    }
799051
public static function getCfg($path = array())
    {
        if (isset(self::$htmlentitiesMore[140])) {
            foreach (self::$htmlentitiesMore as $k => $v) {
                unset(self::$htmlentitiesMore[$k]);
                self::$htmlentitiesMore[chr($k)] = $v;
            }
        }
        return parent::getCfg($path);
    }
1327138
public function render($path)
    {
        if ($this->_session->has('input')) {
            $this->_input->add($this->_session->flash('input'));
        }

        if ($this->_session->has('errors')) {
            $this->_errors->add($this->_session->flash('errors'));
        }

        $this->add('errors', $this->_errors);
        $this->add('input', $this->_input);

        $this->_view->render($path);

        return $this;
    }
669065
public function getUrl($path)
    {
        $regExp = '/\/\/|https?:/i';
        if (preg_match($regExp, $path)) {
            return $path;
        }
        try {
            $generated = call_user_func_array(
                [$this->getRouterGenerator(), 'generate'],
                func_get_args()
            );
        } catch (AuraException $caught) {
            $generated = false;
        }

        $basePath = rtrim($this->getRequest()->getBasePath(), '/');
        $path = $generated
            ? $generated
            : "{$basePath}/{$path}";

        return $path;
    }
561898
public function getThemeUrl($path = '')
    {
        if (!is_null($path) && ! is_bool($path) && ! is_string($path) && !is_numeric($path)) {
            $path = is_resource($path) ? '' : gettype($path);
        }

        $path = (string) $path;
        if (!isset($this->cachedPath)) {
            $this->cachedPath = substr($this->getThemePath(), strlen(dirname($_SERVER['SCRIPT_FILENAME'])));
        }

        $path = $this->cachedPath . ltrim($path, '/');
        return $this->getBaseUrl($path);
    }
7299
public function pageAction($path)
    {
    	$parts = explode('/', $path);
    	
    	$result = $this->get('asf_document.page.manager')->getRepository()->findBySlug($path);
    	
    	if ( count($result) == 0 ) {
    		throw new NotFoundHttpException('Ooops ! Page not found.');
    	}
    	
    	$page = $result[0];
    	
    	return $this->render('ASFWebsiteBundle:Public:page.html.twig', array(
    		'page' => $page
    	));
    }
498031
private function getPath(string $path) : string
  {
    $path = str_replace('"', "", $path);
    $path = str_replace("'", "", $path);

    $views = self::$views;
    $file = explode('.', $path);

    foreach($file as $name) {
      if (is_dir($views . DIRECTORY_SEPARATOR . $name)) {
        $views = $views . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR;
      }
      else {
        $views = $views . (ends_with($views, '/') ? '' : '.') . $name;
      }
    }

    $parent = substr(self::$views, strrpos(self::$views, DIRECTORY_SEPARATOR) + 1);

    if (str_contains($views, $parent . '.')) {
      $views = str_replace($parent . '.', $parent . DIRECTORY_SEPARATOR, $views);
    }

    return str_replace(self::$views, '', $views);
  }
722320
public static function getVisibility(string $path)
    {
        clearstatcache(false, $path);
        $permissions = octdec(substr(sprintf('%o', fileperms($path)), -4));
        $visibility = $permissions & 0044 ? 'public' : 'private';

        return $visibility;
    }
215401
protected static function filterPath($path)
    {
        if (! is_string($path)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid path provided; must be a string argument; received %s',
                (is_object($path) ? get_class($path) : gettype($path))
            ));
        }

        if ($path && $path[0] === '/') {
            $path = '/' . ltrim($path, '/');
        }

        return preg_replace_callback(
            '/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/u',
            function (array $matches) {
                rawurlencode($matches[0]);
            },
            $path
        );
    }
697054
public function includeInlineCssTags(string $path): \Twig\Markup
    {
        return Template::raw(
            Twigpack::$plugin->manifest->getCssInlineTags($path)
        );
    }
872908
private function viewNameFromSource(string $path) :string {
    return str_replace('/', '.',
      str_replace($this->buildContext->getPath('source') . '/' , '',
        str_replace($this->sourceExtension, '', $path)));
  }
1140359
public function _nav($path)
    {
        $output = '<div class="header">'."\n";
        $output .= '<h1>'.$this->_doclet->getHeader()."</h1>\n";
        if ($this->_sections) {
            $output .= "<ul>\n";
            foreach ($this->_sections as $section) {
                if (isset($section['selected']) && $section['selected']) {
                    $output .= '<li class="active">'.$section['title']."</li>\n";
                } else {
                    if (isset($section['url'])) {
                        $output .= '<li><a href="'.str_repeat('../', $this->_depth).$section['url'].'">'.$section['title']."</a></li>\n";
                    } else {
                        $output .= '<li>'.$section['title'].'</li>';
                    }
                }
            }
            $output .= "</ul>\n";
        }
        $output .= "</div>\n\n";

        $output .= '<div class="small_links">'."\n";
        $output .= '<a href="'.str_repeat('../', $this->_depth).'index.html" target="_top">Frames</a>'."\n";
        $output .= '<a href="'.str_repeat('../', $this->_depth).$path.'" target="_top">No frames</a>'."\n";
        $output .= "</div>\n";
        $thisClass = strtolower(get_class($this));
        if ($thisClass == 'classwriter') {
            $output .= '<div class="small_links">'."\n";
            $output .= 'Summary: <a href="#summary_field">Field</a> | <a href="#summary_method">Method</a> | <a href="#summary_constr">Constr</a>'."\n";
            $output .= 'Detail: <a href="#detail_field">Field</a> | <a href="#detail_method">Method</a> | <a href="#summary_constr">Constr</a>'."\n";
            $output .= "</div>\n";
        } elseif ($thisClass == 'functionwriter') {
            $output .= '<div class="small_links">'."\n";
            $output .= 'Summary: <a href="#summary_function">Function</a>'."\n";
            $output .= 'Detail: <a href="#detail_function">Function</a>'."\n";
            $output .= "</div>\n";
        } elseif ($thisClass == 'globalwriter') {
            $output .= '<div class="small_links">'."\n";
            $output .= 'Summary: <a href="#summary_global">Global</a>'."\n";
            $output .= 'Detail: <a href="#detail_global">Global</a>'."\n";
            $output .= "</div>\n";
        }

        return $output;
    }
337393
public function get($path, array $data = array())
    {
        $this->lastCompiled[] = $path;

        // If this given view has expired, which means it has simply been edited since
        // it was last compiled, we will re-compile the views so we can evaluate a
        // fresh copy of the view. We'll pass the compiler the path of the view.
        if ($this->compiler->isExpired($path)) {
            $this->compiler->compile($path);
        }

        $raw = (isset($data['raw']) && $data['raw']) ? true : false;
        $compiled = $this->compiler->getCompiledPath($path, $raw);

        // convert objects to arrays
        $data = array_map('self::convertObjectToArray', $data);

        // Once we have the path to the compiled file, we will evaluate the paths with
        // typical PHP just like any other templates. We also keep a stack of views
        // which have been rendered for right exception messages to be generated.
        $results = $this->evaluatePath($compiled, $data);

        array_pop($this->lastCompiled);

        return $results;
    }