Get the evaluated contents of the view at the given path.

@param string $path
@param array $data
@return string
198323
protected function evaluatePath($path, $data)
	{
		foreach ($data as $var => $val)
			$this->smarty->assign($var, $val);

		return $this->smarty->fetch($path);
	}
914449
public static function path(array $data, $path, $default = null)
    {
        $path = (array) $path;

        foreach ($path as $key) {
            if (!is_array($data) || !array_key_exists($key, $data)) {
                return $default;
            }
            $data = $data[$key];
        }

        return $data;
    }
303535
public static function get($path, $data = [])
	{
		ob_start();

		extract($data);

		try {
			$basePath = static::getInstance()->basePath;

			if ($basePath !== null) {
				if (mb_substr($path, 0, 1) === static::DIRECTORY_SEPARATOR) {
					$path = mb_substr($path, 1);
				}

				if (mb_substr($basePath, -1) === static::DIRECTORY_SEPARATOR) {
					$basePath = mb_substr($basePath, 0, -1);
				}

				$path = $basePath . static::DIRECTORY_SEPARATOR . $path;
			}

			include $path;
		} catch (\Exception $e) {
			ob_get_clean();
			throw $e;
		}

		return ob_get_clean();
	}
732008
public function getNodeContent($path)
    {
        $node = $this->getNode($path);
        if ($node) {
            switch (get_class($node)) {
                case "DOMAttr" :
                    $content = $node->value;
                    break;
                case "DOMElement" :
                    $content = $node->nodeValue;
                    break;
            }

            return $content;
        } else {
            return null;
        }
    }
577920
static function GetContents($path)
    {
        if (!self::Exists($path))
            throw new Exceptions\PathNotFoundException("File $path doesn't exist");
        
        if (!self::IsReadable($path))
            throw new Exceptions\PathNoAccessException("File $path cannot be read");
        
        return file_get_contents($path);
    }
1091586
public function get_data($path=NULL) {
		$myIndexList = array();
		$path = $this->fix_path($path);
		
		if(is_null($path) || (strlen($path) < 1)) {
			//they just want ALL THE DATA.
			$retval = $this->data;
		}
		else {
			//get the list of indices in our data that we have to traverse.
			$myIndexList = $this->explode_path($path);
			
			//set an initial retval.
			$retval = $this->get_data_segment($this->data, $myIndexList[0]); 
			unset($myIndexList[0]);
			
			if(count($myIndexList) > 0) {
				foreach($myIndexList as $indexName) {
					$retval = $this->get_data_segment($retval, $indexName);
					if(is_null($retval)) {
						//hmm... well, if it's null, it's nothing which can have a sub-index.  Stop here.
						break;
					}
				}
			}
		}
		
		return($retval);
		
	}
171134
public function getDownloadLink($path, array $data = []): string
    {
        if (null === ($data = $this->getDownloadData($path, $data))) {
            return '';
        }

        return $data['href'];
    }
194926
public static function get($file, $data = [])
    {
        $path = self::load('views.' . $file);

        extract($data, EXTR_SKIP);

        include $path;
    }
243011
private function get_folder_contents( $path ) {

		$items = array();
		$uid   = opendir( $path );
		if ( $uid ) {
			return $this->load_folder_items( $uid, $path );
		}

		return $items;
	}
873320
public function getDownloadData($path, array $data = []): ?array
    {
        $path = Controller::replaceInsertTags($path);

        if (Validator::isUuid($path)) {
            $file = System::getContainer()->get('huh.utils.file')->getFileFromUuid($path);
        } else {
            try {
                $file = new File(urldecode($path));
            } catch (\Exception $e) {
                return null;
            }
        }

        if (null === $file) {
            return null;
        }

        $model = $file->getModel();

        if (null === $model) {
            try {
                Dbafs::addResource($file->path);
            } catch (\Exception $e) {
                return null;
            }

            if (null === $model) {
                return null;
            }
        }

        $requestedFile = System::getContainer()->get('huh.request')->getGet('file', true);

        // Send the file to the browser and do not send a 404 header (see #4632)
        if ('' != $requestedFile && $requestedFile == $file->path) {
            try {
                Controller::sendFileToBrowser($requestedFile);
            } catch (ResponseException $e) {
                $e->getResponse()->send();
            }

            return null;
        }

        $fileData['model'] = $file->getModel()->row();

        $allowedDownload = StringUtil::trimsplit(',', strtolower(Config::get('allowedDownload')));

        // Return if the file type is not allowed
        if (!\in_array($file->extension, $allowedDownload)) {
            return null;
        }

        if (!isset($data['linkTitle'])) {
            $fileData['linkTitle'] = StringUtil::specialchars($file->basename);
        }

        $strHref = Environment::get('request');

        // Remove an existing file parameter (see #5683)
        if (preg_match('/(&(amp;)?|\?)file=/', $strHref)) {
            $strHref = preg_replace('/(&(amp;)?|\?)file=[^&]+/', '', $strHref);
        }

        $strHref .= (false !== strpos($strHref, '?') ? '&amp;' : '?').'file='.System::urlEncode($file->value);

        $fileData['link'] = $fileData['linkTitle'];
        $fileData['title'] = StringUtil::specialchars($data['titleText'] ?: sprintf($GLOBALS['TL_LANG']['MSC']['download'], $file->basename));
        $fileData['href'] = $strHref;
        $fileData['filesize'] = System::getReadableSize($file->filesize, 1);
        $fileData['icon'] = Image::getPath($file->icon);
        $fileData['mime'] = $file->mime;
        $fileData['extension'] = $file->extension;
        $fileData['path'] = $file->dirname;

        return array_merge($fileData, $data);
    }
199620
public function get($path = null)
    {
        if ($path === null) {
            return $this->data;
        }

        $keys = explode('/', $path);
        $data = $this->data;
        foreach ($keys as $key) {
            if (is_array($data) && array_key_exists($key, $data)) {
                $data = $data[$key];
            } else {
                return null;
            }
        }

        return $data;
    }
327636
public static function getViewFilePath($path) {
        if (empty($path)) {
            return false;
        }

        if ((strpos($path, '/') !== false || strpos($path, '\\') !== false) && is_file($result = $path)) {
            return $result;
        }

        if (self::isRelativePath($path) && is_file($result = self::mapPath($path))) {
            return $result;
        }

        if (is_file($result = PHPMVC_VIEW_PATH . PHPMVC_VIEW . PHPMVC_DS . $path)) {
            return $result;
        }
       
        if (is_file($result = PHPMVC_SHARED_PATH . $path)) {
            return $result;
        }

        if (($result = self::appendPhpExtension($path)) !== false) {
            return self::getViewFilePath($result);
        }

        return false;
    }
809619
public function render(array $data = [], string $path = 'gridView', array $mergeData = []): string
    {
        if (request()->ajax() || request()->wantsJson()) {
            $path = $path === 'gridView' ? 'part.grid' : $path;
        }

        return static::view($path, $data, $mergeData)->render();
    }
125939
private function buildQuery(array $data, string $path = ''): string
    {
        if ([] === $data) {
            return '';
        }

        $query = '';
        foreach ($data as $key => $value) {
            if (null === $value) {
                continue;
            }

            $subPath = '' !== $path ? $path.'['.$key.']' : (string) $key;
            if (is_array($value)) {
                $query .= $this->buildQuery($value, $subPath);
            } else {
                $query .= $subPath.'='.urlencode($this->getValueAsString($value));
            }
            $query .= '&';
        }

        $query = substr($query, 0, -strlen('&'));

        return $query;
    }
163595
public function dataDir($path = '')
    {
        $path = (empty($path) || starts_with($path, DIRECTORY_SEPARATOR)) ? $path : "/{$path}";

        return __COUNTRIES_DIR__.$this->toDir("/src/data$path");
    }
197478
public function renderView($viewPath, array $data = null)
    {
        $this->setView($viewPath);

        !$data or extract($data);
        ob_start();

        if (file_exists(rtrim(
                $this->getViewPath(), $this->getFileExt()
            ) . $this->getFileExt())) {

            /** @noinspection PhpIncludeInspection */
            include rtrim(
                    $this->getViewPath(), $this->getFileExt()
                ) . $this->getFileExt();

        } elseif (file_exists(rtrim(
                $this->getViewFallbackPath(), $this->getFileExt()
            ) . $this->getFileExt())) {

            /** @noinspection PhpIncludeInspection */
            include rtrim(
                    $this->getViewFallbackPath(), $this->getFileExt()
                ) . $this->getFileExt();

        } else {
            throw new ViewNotFoundException('View ' . rtrim(
                    $this->getViewPath(), $this->getFileExt()
                ) . $this->getFileExt() . ' not found');
        }

        $rendered = ob_get_contents();
        ob_end_clean();

        return $rendered;
    }
1026332
public static function md($path, $data = [])
		{
			// find file
			$abspath = preg_match('%^(/|[a-z]:)%i', $path) === 1
				? $path
				: \View::getFinder()->find($path);

			// get contents
			$contents = file_get_contents($abspath);

			// update values
			$data['route'] = app(SketchpadConfig::class)->route;
			foreach ($data as $key => $value)
			{
				$contents = preg_replace('/\{\{\s*' .$key. '\s*\}\}/', $value, $contents);
			}

			// return
			return '<div data-format="markdown">' .$contents. '</div>';
		}