Return SVG source code as string to Twig - usage: {{ svg('bgCarousel.svg')|raw }}
@param $path
@return string
519640
public function renderSVG($path)
    {
        $fullPath   = $this->themeFullPath($path);
        $handle     = fopen($fullPath, "r");
        $contents   = fread($handle, filesize($fullPath));
        fclose($handle);


        return $contents;
    }
408241
public static function getUtilUrl($path)
    {
        global $CFG;
        if ( isset($CFG->utilroot) ) {
            return $CFG->utilroot.$path;
        }

        // From wwwroot
        $path = str_replace('.php','',$path);
        $retval = $CFG->wwwroot . '/util' . $path;
        return $retval;

        // The old way from "vendor"
        // return $CFG->vendorroot.$path;
    }
928176
protected function formatPath(string $path): string
    {
        $path = $this->filterPath($path)->withoutDotSegments();
        if ('' !== $this->base_uri->getAuthority() && '' !== $path->__toString()) {
            $path = $path->withLeadingSlash();
        }

        return (string) $path;
    }
361124
public function asset_url($path)
	{
		$url = $this->asset_path($path);

		if (filter_var($url, FILTER_VALIDATE_URL) === false)
		{
			$url = \Uri::create($url);
		}

		return $url;
	}
333675
public function buildAssetUrl(string $path) : string {
        return starts_with($path, '//') ? $path : $this->app['url']->asset($path);
    }
697054
public function includeInlineCssTags(string $path): \Twig\Markup
    {
        return Template::raw(
            Twigpack::$plugin->manifest->getCssInlineTags($path)
        );
    }
1040506
public static function encode($path) {
        
        $lastLat = 0;
        $lastLng = 0;

        $result = '';

        foreach( $path as $point ) {
            $lat = round( $point['lat'] * 1e5);
            $lng = round( $point['lng'] * 1e5);
            
            $dLat = $lat - $lastLat;
            $dLng = $lng - $lastLng;

            self::enc($dLat);
            self::enc($dLng);

            $lastLat = $lat;
            $lastLng = $lng;
        }
        return self::$result;
    }
1165500
protected function getPath($path)
	{
		$rootPath = $this->option('path');

		return $rootPath.'/'.strtolower($this->getTheme()).'/' . $path;
	}
1079334
public function compileString($path, $raw = false)
    {
        $options = $this->options;

        // set partials directory
        if (!$raw) {
            $options['basedir'][] = dirname($path);
        }

        // set raw option
        array_set($options, 'compile_helpers_only', $raw);

        // set language helper functions
        if ($this->languageHelpers) {
            if (!$raw) {
                $helpers = array_merge($this->getLanguageHelpers(), $options['helpers']);
            } elseif ($this->translateRawOutput) {
                $helpers = $this->getLanguageHelpers();
            } else {
                $helpers = [];
            }

            array_set($options, 'helpers', $helpers);
        }

        // As of LightnCandy v0.91 resolving via `basedir` and `fileext` options has been stripped from LightnCandy.
        if (!$options['partialresolver']) {
            $options['partialresolver'] = function ($context, $name) use ($options) {
                foreach ($options['basedir'] as $dir) {
                    foreach ($options['fileext'] as $ext) {
                        $path = sprintf('%s/%s.%s', rtrim($dir, DIRECTORY_SEPARATOR), $name, ltrim($ext, '.'));
                        if (file_exists($path)) {
                            return file_get_contents($path);
                        }
                    }
                }
                return "[Partial $path not found]";
            };
        }

        $contents = $this->lightncandy->compile($this->files->get($path), $options);

        if (!is_null($this->cachePath)) {
            // As of LightnCandy v0.90 generated PHP code will not includes `<?php`.
            $this->files->put($this->getCompiledPath($path, $raw), "<?php $contents");
        }
    }
376795
private function realPath($path) {
        $tpls    = explode('/', $path);
        $tpls[0] = App::id2dir($tpls[0]);
        $tpl     = implode('/', $tpls);

        return $tpl;
    }
505596
public static function encodePath($path)
    {
        if (mb_strpos($path, '/') !== false) {
            $path = explode('/', $path);
            $path = array_map('rawurlencode', $path);
            $newPath = implode('/', $path);
        } else {
            if (is_null($path)) {
                $newPath = null;
            } else {
                $newPath = rawurlencode($path);
            }
        }
        $path = str_replace('%21', '!', $newPath);

        return $path;
    }
254212
protected function makeUrl($path)
    {
        return URL::to(str_replace('{'.$this->config['html']['href'].'}', $path, $this->customUrl));
    }
1310481
public static function getUrlEncodedPath($path): string
    {
        $entities = array('+', '%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
        $replacements = array(' ', '!', '*', "'", '(', ')', ';', ':', '@', '&', '=', '+', '$', ',', '/', '?', '%', '#', '[', ']');
        $path = str_replace($entities, $replacements, urlencode($path));
        
        return $path;
    }
48815
public function asset($path)
    {
        if (null !== $this->basePath) {
            return $this->request->getUri()->getBaseUrl().'/'.trim($this->basePath, '/').'/'.$path;
        }

        return $this->request->getUri()->getBaseUrl().'/'.$path;
    }
799758
private function asPath($path)
    {
        $expr = explode(";", $path);
        $fullPath = "$";
        for ($i = 1, $n = count($expr); $i < $n; $i++) {
            $fullPath .= preg_match("/^[0-9*]+$/", $expr[$i]) ? ("[" . $expr[$i] . "]") : ("['" . $expr[$i] . "']");
        }

        return $fullPath;
    }
934235
public static function original(string $path): string
    {
        $result = $path;
        $version = self::version($path);
        if ($version) {
            $version = self::VERSION_SEPARATOR . $version;
            $result = str_replace($version, '', $result);
        }

        return $result;
    }
1026194
private function twigLoad(string $path): ?\Twig_TemplateWrapper
    {
        try {
            return $this->twigEnv->load($path);
        } catch (TwigError $exc) {
            if (defined('WP_DEBUG') && WP_DEBUG) {
                throw $exc;
            }
        }
    }