@param string $md

@return string
493343
private function markdownToHtml($md)
    {
        return nl2br(
            $this->app->make('helper/text')->autolink(
                htmlspecialchars(
                    $md,
                    ENT_QUOTES,
                    APP_CHARSET,
                    true
                )
            )
        );
    }
385823
private function get_original_string($num) {
        $length = $this->table_originals[$num * 2 + 1];
        $offset = $this->table_originals[$num * 2 + 2];
        if (!$length)
            return '';
        fseek($this->STREAM, $offset);
        $data = fread($this->STREAM, $length);
        return (string)$data;
    }
437154
protected function md2annotate($entry)
    {
        if (substr($entry, 0, 7) == '/shared') {
            return array(substr($entry, 7), 'value.shared');
        }
        else if (substr($entry, 0, 8) == '/private') {
            return array(substr($entry, 8), 'value.priv');
        }

        // @TODO: log error
    }
564855
private function getFileName($key) {
		$key = str_replace(' ', '', $key);
		$cacheDir = rtrim($this->cachePath, '\\/') . '/';
		if ($this->directoryLevel > 0) {
			$hash = abs(crc32($key));
			$cacheDir .= $hash % 1024;
			for($i = 1; $i < $this->directoryLevel; ++$i) {
				if (($prefix = substr($hash, $i, 2)) !== false) {
					$cacheDir .= '/' . $prefix;
				}
			}
		}
		return $cacheDir . '/' . md5($key) . $this->cacheExt;
	}
1111196
protected function getModelPrimaryKeyString($model)
    {
        return is_array($model->getPrimaryKey()) ? implode('-', $model->getPrimaryKey()) : $model->getPrimaryKey();
    }
1169768
public static function convertDerToPem(string $der): string {
        $encoded = base64_encode($der);
        $encoded = chunk_split($encoded, 64, "\n");
        return sprintf(
            "-----BEGIN CERTIFICATE-----\n%s-----END CERTIFICATE-----\n",
            $encoded
        );
    }
1021387
protected function build($m)
    {
        $string = $m[1];

        if (substr($string, 0, 1) != '<') {
            // We matched a lone ">" character.
            return '&gt;';
        } elseif (strlen($string) == 1) {
            // We matched a lone "<" character.
            return '&lt;';
        }

        if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9\-]+)([^>]*)>?|(<!--.*?-->)$%', $string, $matches)) {
            // Seriously malformed.
            return '';
        }

        $slash = trim($matches[1]);
        $elem = &$matches[2];
        $attrlist = &$matches[3];
        $comment = &$matches[4];

        if ($comment) {
            $elem = '!--';
        }

        if (!in_array(strtolower($elem), $this->tags, true)) {
            return ''; // Disallowed HTML element.
        }

        if ($comment) {
            return $comment;
        }

        if ($slash != '') {
            return "</$elem>";
        }

        // Is there a closing XHTML slash at the end of the attributes?
        $attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist, -1, $count);
        $xhtml_slash = $count ? ' /' : '';

        // Clean up attributes.
        $attr2 = implode(' ', $this->explodeAttributes($attrlist));
        $attr2 = preg_replace('/[<>]/', '', $attr2);
        $attr2 = strlen($attr2) ? ' ' . $attr2 : '';

        return "<$elem$attr2$xhtml_slash>";
    }
49925
public function format(string $message): string
    {
        if (null === $this->params) {
            return $message;
        }

        foreach ($this->transformParams($this->params) as $key => $value) {
            $message = str_replace($key, $value, $message);
        }

        return $message;
    }
5168
public function generateFilename(): string
    {
        $options = $this->provider->getOptions();

        $options["text"] = $this->text;

        $data = serialize($options);

        return md5($data) . "." . $this->provider->getFormat();
    }
597876
public static function get()
    {
        mt_srand((int) (microtime(true) * 1000));

        $b = md5(uniqid(mt_rand(), true), true);
        $b[6] = chr((ord($b[6]) & 0x0F) | 0x40);
        $b[8] = chr((ord($b[8]) & 0x3F) | 0x80);

        return implode('-', unpack('H8a/H4b/H4c/H4d/H12e', $b));
    }
1233601
public function filename($id)
    {
        if (isset($this->filenameCache[$id])) {
            return $this->filenameCache[$id];
        }

        $dir = $this->dir;
        $filename = $id;

        if ($this->subDirs) {
            $parts = explode(CacheCache\Cache::$namespaceSeparator, $id);
            $filename = array_pop($parts);
            $dir .= DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $parts);
            if (!file_exists($dir)) {
                mkdir($dir, 0777, true);
            }
        }

        if (!$this->idAsFilename) {
            $filename = md5($filename);
        }

        if (!empty($this->fileExtension)) {
            $filename .= $this->fileExtension;
        }

        $filename = $dir . DIRECTORY_SEPARATOR . $filename;
        $this->filenameCache[$id] = $filename;
        return $filename;
    }
260091
public function query( $query ): string {

		global $wpdb;

		if ( empty( $this->query_starts ) && ! empty( $wpdb->queries ) ) {
			/** @var array $wpdb->queries */
			$this->query_starts[ count( $wpdb->queries ) ] = microtime( true );
		} else {
			$this->query_starts[] = microtime( true );
		}

		return $query;
	}
105930
protected function getFilename($data)
    {
        $options = [
            'q', 'query_string', 'path_info', 'php_self',
        ];
        $root = $data['data_dir'];

        foreach ($options as $option) {
            if (!array_key_exists($option, $data)) {
                continue;
            }
            $name = $this->translateName($data[$option]);
            if ($name) {
                return $root . '/' . $name . '.md';
            }
        }
    }
111087
public static function getTransformPathForAsset($asset): string
    {
        /** @var Volume $volume */
        try {
            $volume = $asset->getVolume();
        } catch (InvalidConfigException $e) {
            \Craft::error($e->getMessage(), __METHOD__);
            throw new ImagerException($e->getMessage(), $e->getCode(), $e);
        }

        /** @var ConfigModel $settings */
        $config = ImagerService::getConfig();

        $hashPath = $config->hashPath;
        $addVolumeToPath = $config->addVolumeToPath;

        if ($hashPath) {
            return FileHelper::normalizePath('/' . md5('/' . ($addVolumeToPath ? mb_strtolower($volume->handle) . '/' : '') . $asset->folderPath . '/') . '/' . $asset->id . '/');
        }

        return FileHelper::normalizePath('/' . ($addVolumeToPath ? mb_strtolower($volume->handle) . '/' : '') . $asset->folderPath . '/' . $asset->id . '/');
    }
787972
protected function _getCacheId($prefix = 'minify')
    {
        $name = preg_replace('/[^a-zA-Z0-9\\.=_,]/', '', $this->selectionId);
        $name = preg_replace('/\\.+/', '.', $name);
        $name = substr($name, 0, 100 - 34 - strlen($prefix));
        $md5 = md5(serialize(array(
            Minify_SourceSet::getDigest($this->sources),
            $this->options['minifiers'],
            $this->options['minifierOptions'],
            $this->options['postprocessor'],
            $this->options['bubbleCssImports'],
            Minify::VERSION,
        )));

        return "{$prefix}_{$name}_{$md5}";
    }
911393
protected function renderQueryString($asset = null)
    {
        $querystring = '';

        $asset = $asset ?? $this->asset;

        if (!empty($this->query)) {
            if (Utils::contains($asset, '?')) {
                $querystring .=  '&' . $this->query;
            } else {
                $querystring .= '?' . $this->query;
            }
        }

        if ($this->timestamp) {
            if (Utils::contains($asset, '?') || $querystring) {
                $querystring .=  '&' . $this->timestamp;
            } else {
                $querystring .= '?' . $this->timestamp;
            }
        }

        return $querystring;
    }
726022
public function getStartCmd(): string
    {
        $cmdFormat = 'php -S %s:%d -t %s %s >/dev/null 2>&1 & echo $!';

        return sprintf($cmdFormat, $this->host, $this->port, $this->docRoot, $this->directives, $this->iniPath);
    }