Generates the html directory index for a given url.

@param string $path

@return string
552998
public function generateDirectoryIndex($path)
    {
        $html = $this->generateHeader($path ? $path : '/', $path);

        $node = $this->server->tree->getNodeForPath($path);
        if ($node instanceof DAV\ICollection) {
            $html .= "<section><h1>Nodes</h1>\n";
            $html .= '<table class="nodeTable">';

            $subNodes = $this->server->getPropertiesForChildren($path, [
                '{DAV:}displayname',
                '{DAV:}resourcetype',
                '{DAV:}getcontenttype',
                '{DAV:}getcontentlength',
                '{DAV:}getlastmodified',
            ]);

            foreach ($subNodes as $subPath => $subProps) {
                $subNode = $this->server->tree->getNodeForPath($subPath);
                $fullPath = $this->server->getBaseUri().HTTP\encodePath($subPath);
                list(, $displayPath) = Uri\split($subPath);

                $subNodes[$subPath]['subNode'] = $subNode;
                $subNodes[$subPath]['fullPath'] = $fullPath;
                $subNodes[$subPath]['displayPath'] = $displayPath;
            }
            uasort($subNodes, [$this, 'compareNodes']);

            foreach ($subNodes as $subProps) {
                $type = [
                    'string' => 'Unknown',
                    'icon' => 'cog',
                ];
                if (isset($subProps['{DAV:}resourcetype'])) {
                    $type = $this->mapResourceType($subProps['{DAV:}resourcetype']->getValue(), $subProps['subNode']);
                }

                $html .= '<tr>';
                $html .= '<td class="nameColumn"><a href="'.$this->escapeHTML($subProps['fullPath']).'"><span class="oi" data-glyph="'.$this->escapeHTML($type['icon']).'"></span> '.$this->escapeHTML($subProps['displayPath']).'</a></td>';
                $html .= '<td class="typeColumn">'.$this->escapeHTML($type['string']).'</td>';
                $html .= '<td>';
                if (isset($subProps['{DAV:}getcontentlength'])) {
                    $html .= $this->escapeHTML($subProps['{DAV:}getcontentlength'].' bytes');
                }
                $html .= '</td><td>';
                if (isset($subProps['{DAV:}getlastmodified'])) {
                    $lastMod = $subProps['{DAV:}getlastmodified']->getTime();
                    $html .= $this->escapeHTML($lastMod->format('F j, Y, g:i a'));
                }
                $html .= '</td><td>';
                if (isset($subProps['{DAV:}displayname'])) {
                    $html .= $this->escapeHTML($subProps['{DAV:}displayname']);
                }
                $html .= '</td>';

                $buttonActions = '';
                if ($subProps['subNode'] instanceof DAV\IFile) {
                    $buttonActions = '<a href="'.$this->escapeHTML($subProps['fullPath']).'?sabreAction=info"><span class="oi" data-glyph="info"></span></a>';
                }
                $this->server->emit('browserButtonActions', [$subProps['fullPath'], $subProps['subNode'], &$buttonActions]);

                $html .= '<td>'.$buttonActions.'</td>';
                $html .= '</tr>';
            }

            $html .= '</table>';
        }

        $html .= '</section>';
        $html .= '<section><h1>Properties</h1>';
        $html .= '<table class="propTable">';

        // Allprops request
        $propFind = new PropFindAll($path);
        $properties = $this->server->getPropertiesByNode($propFind, $node);

        $properties = $propFind->getResultForMultiStatus()[200];

        foreach ($properties as $propName => $propValue) {
            if (!in_array($propName, $this->uninterestingProperties)) {
                $html .= $this->drawPropertyRow($propName, $propValue);
            }
        }

        $html .= '</table>';
        $html .= '</section>';

        /* Start of generating actions */

        $output = '';
        if ($this->enablePost) {
            $this->server->emit('onHTMLActionsPanel', [$node, &$output, $path]);
        }

        if ($output) {
            $html .= '<section><h1>Actions</h1>';
            $html .= "<div class=\"actions\">\n";
            $html .= $output;
            $html .= "</div>\n";
            $html .= "</section>\n";
        }

        $html .= $this->generateFooter();

        $this->server->httpResponse->setHeader('Content-Security-Policy', "default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';");

        return $html;
    }
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;
    }
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'];
    }
1327718
private static function load($path)
    {
        $path = str_replace('.', '/', $path);

        $path = FULL_PATH . $path;

        if(substr($path, -4) != '.php')
        {
            $path = $path . '.php';
        }

        return $path;
    }
1018486
public function normalizeDirectoryPath($path)
    {
        $path = $this->normalizePath($path);

        if (is_link($path)) {
            $path = realpath($path);
        }

        return $path;
    }
317963
public static function getFolder(string $path)
    {
        $arrFolders = explode(DIRECTORY_SEPARATOR, $path);
        $fullPath = "";
        if ($arrFolders[0] !== "") {
            $fullPath = $arrFolders[0];
        }
        unset($arrFolders[0]);
        foreach ($arrFolders as $folder) {
            $fullPath .= DIRECTORY_SEPARATOR . $folder;
            if (file_exists($fullPath) && is_dir($fullPath)) {
                continue;
            }
            mkdir($fullPath, 0775);
        }
        return $path;
    }
634971
public function urlGenerator($path)
    {
        if ($this->getCloudFront() === true) {
            $url = $this->cdn_helper->parseUrl($this->getCloudFrontUrl());

            return $url['scheme'].'://'.$url['host'].'/'.$path;
        }

        $url = $this->cdn_helper->parseUrl($this->getUrl());

        $bucket = $this->getBucket();
        $bucket = (!empty($bucket)) ? $bucket.'.' : '';

        return $url['scheme'].'://'.$bucket.$url['host'].'/'.$path;
    }
1205233
public function getPathUrl($path)
    {
        $path = $this->validatePath($path);

        $fullPath = $this->storagePath.implode("/", array_map("rawurlencode", explode("/", $path)));

        return Url::to($fullPath);
    }
389636
public function getUrl(string $path = '')
    {
        if (is_multisite() && defined(SUBDOMAIN_INSTALL) && SUBDOMAIN_INSTALL) {
            return sprintf(
                '%s/%s/themes/%s',
                get_home_url(),
                CONTENT_DIR,
                $this->getDirectory()
            ).($path ? '/'.$path : $path);
        }

        return get_template_directory_uri().($path ? '/'.$path : $path);
    }
481208
private function getPhpFilesFromPath(string $path)
    {
        $directoryIterator = new RecursiveDirectoryIterator($path);
        foreach (new RecursiveIteratorIterator($directoryIterator) as $file) {
            if (! in_array($file->getExtension(), $this->fileExtensions)) {
                continue;
            }

            if ($this->fileShouldBeIgnored($file)) {
                continue;
            }

            $this->files->push(new File(['displayPath' => $file->getPathName(), 'fullPath' => $file->getRealPath()]));
        }
    }
814994
public static function generateTitleFromRoute($path)
    {
        $path = str_replace([':', '*', '$'], '', $path);
        $path = preg_replace('/\<(.*)\>/iU', '', $path);
        $path = str_replace(' ', '', ucwords(str_replace('/', ' ', $path)));

        return $path;
    }
1362012
private static function createIndexFilesToPreventDirectoryListing($path)
    {
        if (!self::isPathWithinTmpFolder($path)) {
            return;
        }
        $filesToCreate = array(
            $path . '/index.htm',
            $path . '/index.php'
        );
        foreach ($filesToCreate as $file) {
            @file_put_contents($file, 'Nothing to see here.');
        }
    }
288836
static function path_to_url( $path )
    {
        // We are replacing DIRECTORY_SEPARATOR with forward slash here 
        // to avoid issues in Windows systems
        $path    = str_replace( DIRECTORY_SEPARATOR, '/', $path);
        $abspath = str_replace( DIRECTORY_SEPARATOR, '/', ABSPATH);
        $url     = str_replace( $abspath, '', $path );

        return esc_url_raw( site_url( $url ) );
    }
657118
public function getUrlFromPath($path)
    {
        $path = ltrim($path, '/');

        $host = 'https://'.($this->use_sandbox ? 'sandbox-' : '').'api.uber.com';

        return $host.($this->version ? '/'.$this->version : '').'/'.$path;
    }
270150
public function getUrl($path)
    {
        if (isset($this->bundleDir)) {
            $path = '/' . $this->bundleDir . '/' . self::THEMES_FOLDER . '/' . ltrim($path, '/');
        }

        return parent::getUrl($path);
    }
913358
protected function generateTypeNameFromPath($path)
    {
        $name = str_replace($this->getTypesDirectory(), '', $path);
        $name = str_replace('.php', '', $name);
        $name = trim($name, '\/');

        return str_replace(['/', '\\'], '\\', $name);
    }
419550
public static function getFileNameFromPath($path)
    {
        $matches = [];
        $pattern = sprintf('|([^\%s.]+\.[A-Za-z0-9.]+)$|', DIRECTORY_SEPARATOR);

        if ((bool)preg_match($pattern, $path, $matches)) {
            return $matches[1];
        }

        return '';
    }