update inbox list
This commit is contained in:
46
vendor/scrivo/highlight.php/HighlightUtilities/_internals.php
vendored
Normal file
46
vendor/scrivo/highlight.php/HighlightUtilities/_internals.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (c) 2019 Geert Bergman (geert@scrivo.nl), highlight.php
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of "highlight.js", "highlight.php", nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Remove the `.css` extension from a string if it has one.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function _getNoCssExtension($name)
|
||||
{
|
||||
if (substr($name, -4, 4) === ".css") {
|
||||
$name = preg_replace("/\.css$/", "", $name);
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
479
vendor/scrivo/highlight.php/HighlightUtilities/_themeColors.php
vendored
Normal file
479
vendor/scrivo/highlight.php/HighlightUtilities/_themeColors.php
vendored
Normal file
@@ -0,0 +1,479 @@
|
||||
<?php
|
||||
|
||||
// DO NOT MODIFY. This file is automatically generated.
|
||||
|
||||
/**
|
||||
* Get the background color for a specific CSS theme.
|
||||
*
|
||||
* @param string $theme The theme name
|
||||
*
|
||||
* @throws \DomainException when no stylesheet with this name exists
|
||||
*
|
||||
* @return float[]
|
||||
*/
|
||||
function _getThemeBackgroundColor($theme)
|
||||
{
|
||||
$colors = array(
|
||||
'a11y-dark' => array(
|
||||
'r' => 43.0,
|
||||
'g' => 43.0,
|
||||
'b' => 43.0,
|
||||
),
|
||||
'a11y-light' => array(
|
||||
'r' => 254.0,
|
||||
'g' => 254.0,
|
||||
'b' => 254.0,
|
||||
),
|
||||
'agate' => array(
|
||||
'r' => 51.0,
|
||||
'g' => 51.0,
|
||||
'b' => 51.0,
|
||||
),
|
||||
'an-old-hope' => array(
|
||||
'r' => 28.0,
|
||||
'g' => 29.0,
|
||||
'b' => 33.0,
|
||||
),
|
||||
'androidstudio' => array(
|
||||
'r' => 40.0,
|
||||
'g' => 43.0,
|
||||
'b' => 46.0,
|
||||
),
|
||||
'arduino-light' => array(
|
||||
'r' => 255.0,
|
||||
'g' => 255.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'arta' => array(
|
||||
'r' => 34.0,
|
||||
'g' => 34.0,
|
||||
'b' => 34.0,
|
||||
),
|
||||
'ascetic' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'atelier-cave-dark' => array(
|
||||
'r' => 25.0,
|
||||
'g' => 23.0,
|
||||
'b' => 28.0,
|
||||
),
|
||||
'atelier-cave-light' => array(
|
||||
'r' => 239.0,
|
||||
'g' => 236.0,
|
||||
'b' => 244.0,
|
||||
),
|
||||
'atelier-dune-dark' => array(
|
||||
'r' => 32.0,
|
||||
'g' => 32.0,
|
||||
'b' => 29.0,
|
||||
),
|
||||
'atelier-dune-light' => array(
|
||||
'r' => 254.0,
|
||||
'g' => 251.0,
|
||||
'b' => 236.0,
|
||||
),
|
||||
'atelier-estuary-dark' => array(
|
||||
'r' => 34.0,
|
||||
'g' => 34.0,
|
||||
'b' => 27.0,
|
||||
),
|
||||
'atelier-estuary-light' => array(
|
||||
'r' => 244.0,
|
||||
'g' => 243.0,
|
||||
'b' => 236.0,
|
||||
),
|
||||
'atelier-forest-dark' => array(
|
||||
'r' => 27.0,
|
||||
'g' => 25.0,
|
||||
'b' => 24.0,
|
||||
),
|
||||
'atelier-forest-light' => array(
|
||||
'r' => 241.0,
|
||||
'g' => 239.0,
|
||||
'b' => 238.0,
|
||||
),
|
||||
'atelier-heath-dark' => array(
|
||||
'r' => 27.0,
|
||||
'g' => 24.0,
|
||||
'b' => 27.0,
|
||||
),
|
||||
'atelier-heath-light' => array(
|
||||
'r' => 247.0,
|
||||
'g' => 243.0,
|
||||
'b' => 247.0,
|
||||
),
|
||||
'atelier-lakeside-dark' => array(
|
||||
'r' => 22.0,
|
||||
'g' => 27.0,
|
||||
'b' => 29.0,
|
||||
),
|
||||
'atelier-lakeside-light' => array(
|
||||
'r' => 235.0,
|
||||
'g' => 248.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'atelier-plateau-dark' => array(
|
||||
'r' => 27.0,
|
||||
'g' => 24.0,
|
||||
'b' => 24.0,
|
||||
),
|
||||
'atelier-plateau-light' => array(
|
||||
'r' => 244.0,
|
||||
'g' => 236.0,
|
||||
'b' => 236.0,
|
||||
),
|
||||
'atelier-savanna-dark' => array(
|
||||
'r' => 23.0,
|
||||
'g' => 28.0,
|
||||
'b' => 25.0,
|
||||
),
|
||||
'atelier-savanna-light' => array(
|
||||
'r' => 236.0,
|
||||
'g' => 244.0,
|
||||
'b' => 238.0,
|
||||
),
|
||||
'atelier-seaside-dark' => array(
|
||||
'r' => 19.0,
|
||||
'g' => 21.0,
|
||||
'b' => 19.0,
|
||||
),
|
||||
'atelier-seaside-light' => array(
|
||||
'r' => 244.0,
|
||||
'g' => 251.0,
|
||||
'b' => 244.0,
|
||||
),
|
||||
'atelier-sulphurpool-dark' => array(
|
||||
'r' => 32.0,
|
||||
'g' => 39.0,
|
||||
'b' => 70.0,
|
||||
),
|
||||
'atelier-sulphurpool-light' => array(
|
||||
'r' => 245.0,
|
||||
'g' => 247.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'atom-one-dark-reasonable' => array(
|
||||
'r' => 40.0,
|
||||
'g' => 44.0,
|
||||
'b' => 52.0,
|
||||
),
|
||||
'atom-one-dark' => array(
|
||||
'r' => 40.0,
|
||||
'g' => 44.0,
|
||||
'b' => 52.0,
|
||||
),
|
||||
'atom-one-light' => array(
|
||||
'r' => 250.0,
|
||||
'g' => 250.0,
|
||||
'b' => 250.0,
|
||||
),
|
||||
'brown-paper' => array(
|
||||
'r' => 183.0,
|
||||
'g' => 166.0,
|
||||
'b' => 142.0,
|
||||
),
|
||||
'codepen-embed' => array(
|
||||
'r' => 34.0,
|
||||
'g' => 34.0,
|
||||
'b' => 34.0,
|
||||
),
|
||||
'color-brewer' => array(
|
||||
'r' => 255.0,
|
||||
'g' => 255.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'darcula' => array(
|
||||
'r' => 43.0,
|
||||
'g' => 43.0,
|
||||
'b' => 43.0,
|
||||
),
|
||||
'dark' => array(
|
||||
'r' => 68.0,
|
||||
'g' => 68.0,
|
||||
'b' => 68.0,
|
||||
),
|
||||
'darkula' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'default' => array(
|
||||
'r' => 240.0,
|
||||
'g' => 240.0,
|
||||
'b' => 240.0,
|
||||
),
|
||||
'docco' => array(
|
||||
'r' => 248.0,
|
||||
'g' => 248.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'dracula' => array(
|
||||
'r' => 40.0,
|
||||
'g' => 42.0,
|
||||
'b' => 54.0,
|
||||
),
|
||||
'far' => array(
|
||||
'r' => 0.0,
|
||||
'g' => 0.0,
|
||||
'b' => 128.0,
|
||||
),
|
||||
'foundation' => array(
|
||||
'r' => 238.0,
|
||||
'g' => 238.0,
|
||||
'b' => 238.0,
|
||||
),
|
||||
'github-gist' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'github' => array(
|
||||
'r' => 248.0,
|
||||
'g' => 248.0,
|
||||
'b' => 248.0,
|
||||
),
|
||||
'gml' => array(
|
||||
'r' => 34.0,
|
||||
'g' => 34.0,
|
||||
'b' => 34.0,
|
||||
),
|
||||
'googlecode' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'gradient-dark' => array(
|
||||
'r' => 80.0,
|
||||
'g' => 31.0,
|
||||
'b' => 122.0,
|
||||
),
|
||||
'grayscale' => array(
|
||||
'r' => 255.0,
|
||||
'g' => 255.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'gruvbox-dark' => array(
|
||||
'r' => 40.0,
|
||||
'g' => 40.0,
|
||||
'b' => 40.0,
|
||||
),
|
||||
'gruvbox-light' => array(
|
||||
'r' => 251.0,
|
||||
'g' => 241.0,
|
||||
'b' => 199.0,
|
||||
),
|
||||
'hopscotch' => array(
|
||||
'r' => 50.0,
|
||||
'g' => 41.0,
|
||||
'b' => 49.0,
|
||||
),
|
||||
'hybrid' => array(
|
||||
'r' => 29.0,
|
||||
'g' => 31.0,
|
||||
'b' => 33.0,
|
||||
),
|
||||
'idea' => array(
|
||||
'r' => 255.0,
|
||||
'g' => 255.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'ir-black' => array(
|
||||
'r' => 0.0,
|
||||
'g' => 0.0,
|
||||
'b' => 0.0,
|
||||
),
|
||||
'isbl-editor-dark' => array(
|
||||
'r' => 64.0,
|
||||
'g' => 64.0,
|
||||
'b' => 64.0,
|
||||
),
|
||||
'isbl-editor-light' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'kimbie.dark' => array(
|
||||
'r' => 34.0,
|
||||
'g' => 26.0,
|
||||
'b' => 15.0,
|
||||
),
|
||||
'kimbie.light' => array(
|
||||
'r' => 251.0,
|
||||
'g' => 235.0,
|
||||
'b' => 212.0,
|
||||
),
|
||||
'lightfair' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'magula' => array(
|
||||
'r' => 244.0,
|
||||
'g' => 244.0,
|
||||
'b' => 244.0,
|
||||
),
|
||||
'mono-blue' => array(
|
||||
'r' => 234.0,
|
||||
'g' => 238.0,
|
||||
'b' => 243.0,
|
||||
),
|
||||
'monokai-sublime' => array(
|
||||
'r' => 35.0,
|
||||
'g' => 36.0,
|
||||
'b' => 31.0,
|
||||
),
|
||||
'monokai' => array(
|
||||
'r' => 39.0,
|
||||
'g' => 40.0,
|
||||
'b' => 34.0,
|
||||
),
|
||||
'night-owl' => array(
|
||||
'r' => 1.0,
|
||||
'g' => 22.0,
|
||||
'b' => 39.0,
|
||||
),
|
||||
'nord' => array(
|
||||
'r' => 46.0,
|
||||
'g' => 52.0,
|
||||
'b' => 64.0,
|
||||
),
|
||||
'obsidian' => array(
|
||||
'r' => 40.0,
|
||||
'g' => 43.0,
|
||||
'b' => 46.0,
|
||||
),
|
||||
'ocean' => array(
|
||||
'r' => 43.0,
|
||||
'g' => 48.0,
|
||||
'b' => 59.0,
|
||||
),
|
||||
'paraiso-dark' => array(
|
||||
'r' => 47.0,
|
||||
'g' => 30.0,
|
||||
'b' => 46.0,
|
||||
),
|
||||
'paraiso-light' => array(
|
||||
'r' => 231.0,
|
||||
'g' => 233.0,
|
||||
'b' => 219.0,
|
||||
),
|
||||
'pojoaque' => array(
|
||||
'r' => 24.0,
|
||||
'g' => 25.0,
|
||||
'b' => 20.0,
|
||||
),
|
||||
'purebasic' => array(
|
||||
'r' => 255.0,
|
||||
'g' => 255.0,
|
||||
'b' => 223.0,
|
||||
),
|
||||
'qtcreator_dark' => array(
|
||||
'r' => 0.0,
|
||||
'g' => 0.0,
|
||||
'b' => 0.0,
|
||||
),
|
||||
'qtcreator_light' => array(
|
||||
'r' => 255.0,
|
||||
'g' => 255.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'railscasts' => array(
|
||||
'r' => 35.0,
|
||||
'g' => 35.0,
|
||||
'b' => 35.0,
|
||||
),
|
||||
'rainbow' => array(
|
||||
'r' => 71.0,
|
||||
'g' => 73.0,
|
||||
'b' => 73.0,
|
||||
),
|
||||
'routeros' => array(
|
||||
'r' => 240.0,
|
||||
'g' => 240.0,
|
||||
'b' => 240.0,
|
||||
),
|
||||
'school-book' => array(
|
||||
'r' => 246.0,
|
||||
'g' => 246.0,
|
||||
'b' => 174.0,
|
||||
),
|
||||
'shades-of-purple' => array(
|
||||
'r' => 45.0,
|
||||
'g' => 43.0,
|
||||
'b' => 87.0,
|
||||
),
|
||||
'solarized-dark' => array(
|
||||
'r' => 0.0,
|
||||
'g' => 43.0,
|
||||
'b' => 54.0,
|
||||
),
|
||||
'solarized-light' => array(
|
||||
'r' => 253.0,
|
||||
'g' => 246.0,
|
||||
'b' => 227.0,
|
||||
),
|
||||
'sunburst' => array(
|
||||
'r' => 0.0,
|
||||
'g' => 0.0,
|
||||
'b' => 0.0,
|
||||
),
|
||||
'tomorrow-night-blue' => array(
|
||||
'r' => 0.0,
|
||||
'g' => 36.0,
|
||||
'b' => 81.0,
|
||||
),
|
||||
'tomorrow-night-bright' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'tomorrow-night-eighties' => array(
|
||||
'r' => 45.0,
|
||||
'g' => 45.0,
|
||||
'b' => 45.0,
|
||||
),
|
||||
'tomorrow-night' => array(
|
||||
'r' => 29.0,
|
||||
'g' => 31.0,
|
||||
'b' => 33.0,
|
||||
),
|
||||
'tomorrow' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'vs' => array(
|
||||
'r' => 255,
|
||||
'g' => 255,
|
||||
'b' => 255,
|
||||
),
|
||||
'vs2015' => array(
|
||||
'r' => 30.0,
|
||||
'g' => 30.0,
|
||||
'b' => 30.0,
|
||||
),
|
||||
'xcode' => array(
|
||||
'r' => 255.0,
|
||||
'g' => 255.0,
|
||||
'b' => 255.0,
|
||||
),
|
||||
'xt256' => array(
|
||||
'r' => 0.0,
|
||||
'g' => 0.0,
|
||||
'b' => 0.0,
|
||||
),
|
||||
'zenburn' => array(
|
||||
'r' => 63.0,
|
||||
'g' => 63.0,
|
||||
'b' => 63.0,
|
||||
),
|
||||
);
|
||||
|
||||
if (!isset($colors[$theme])) {
|
||||
throw new DomainException("There is no stylesheet by the name of '$theme'");
|
||||
}
|
||||
|
||||
return $colors[$theme];
|
||||
}
|
||||
200
vendor/scrivo/highlight.php/HighlightUtilities/functions.php
vendored
Normal file
200
vendor/scrivo/highlight.php/HighlightUtilities/functions.php
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (c) 2019 Geert Bergman (geert@scrivo.nl), highlight.php
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of "highlight.js", "highlight.php", nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace HighlightUtilities;
|
||||
|
||||
require_once __DIR__ . '/_internals.php';
|
||||
require_once __DIR__ . '/_themeColors.php';
|
||||
|
||||
/**
|
||||
* Get a list of available stylesheets.
|
||||
*
|
||||
* By default, a list of filenames without the `.css` extension will be returned.
|
||||
* This can be configured with the `$filePaths` argument.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 9.15.8.1
|
||||
*
|
||||
* @param bool $filePaths Return absolute paths to stylesheets instead
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
function getAvailableStyleSheets($filePaths = false)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
$folder = getStyleSheetFolder();
|
||||
$dh = @dir($folder);
|
||||
|
||||
if ($dh) {
|
||||
while (($entry = $dh->read()) !== false) {
|
||||
if (substr($entry, -4, 4) !== ".css") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($filePaths) {
|
||||
$results[] = implode(DIRECTORY_SEPARATOR, array($folder, $entry));
|
||||
} else {
|
||||
$results[] = basename($entry, ".css");
|
||||
}
|
||||
}
|
||||
|
||||
$dh->close();
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the RGB representation used for the background of a given theme as an
|
||||
* array of three numbers.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 9.18.1.1
|
||||
*
|
||||
* @param string $name The stylesheet name (with or without the extension)
|
||||
*
|
||||
* @throws \DomainException when no stylesheet with this name exists
|
||||
*
|
||||
* @return float[] An array representing RGB numerical values
|
||||
*/
|
||||
function getThemeBackgroundColor($name)
|
||||
{
|
||||
return _getThemeBackgroundColor(_getNoCssExtension($name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of the given stylesheet.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 9.15.8.1
|
||||
*
|
||||
* @param string $name The stylesheet name (with or without the extension)
|
||||
*
|
||||
* @throws \DomainException when the no stylesheet with this name exists
|
||||
*
|
||||
* @return false|string The CSS content of the stylesheet or FALSE when
|
||||
* the stylesheet content could be read
|
||||
*/
|
||||
function getStyleSheet($name)
|
||||
{
|
||||
$path = getStyleSheetPath($name);
|
||||
|
||||
return file_get_contents($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the absolute path to the folder containing the stylesheets distributed in this package.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 9.15.8.1
|
||||
*
|
||||
* @return string An absolute path to the folder
|
||||
*/
|
||||
function getStyleSheetFolder()
|
||||
{
|
||||
$paths = array(__DIR__, '..', 'styles');
|
||||
|
||||
return implode(DIRECTORY_SEPARATOR, $paths);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the absolute path to a given stylesheet distributed in this package.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 9.15.8.1
|
||||
*
|
||||
* @param string $name The stylesheet name (with or without the extension)
|
||||
*
|
||||
* @throws \DomainException when the no stylesheet with this name exists
|
||||
*
|
||||
* @return string The absolute path to the stylesheet with the given name
|
||||
*/
|
||||
function getStyleSheetPath($name)
|
||||
{
|
||||
$name = _getNoCssExtension($name);
|
||||
$path = implode(DIRECTORY_SEPARATOR, array(getStyleSheetFolder(), $name)) . ".css";
|
||||
|
||||
if (!file_exists($path)) {
|
||||
throw new \DomainException("There is no stylesheet with by the name of '$name'.");
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the HTML generated by Highlighter and split it up into an array of lines.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 9.15.6.1
|
||||
*
|
||||
* @param string $html An HTML string generated by `Highlighter::highlight()`
|
||||
*
|
||||
* @throws \RuntimeException when the DOM extension is not available
|
||||
* @throws \UnexpectedValueException when the given HTML could not be parsed
|
||||
*
|
||||
* @return string[]|false An array of lines of code as strings. False if an error occurred in splitting up by lines
|
||||
*/
|
||||
function splitCodeIntoArray($html)
|
||||
{
|
||||
if (!extension_loaded("dom")) {
|
||||
throw new \RuntimeException("The DOM extension is not loaded but is required.");
|
||||
}
|
||||
|
||||
$dom = new \DOMDocument();
|
||||
|
||||
if (!$dom->loadHTML($html)) {
|
||||
throw new \UnexpectedValueException("The given HTML could not be parsed correctly.");
|
||||
}
|
||||
|
||||
$spans = $dom->getElementsByTagName("span");
|
||||
|
||||
/** @var \DOMElement $span */
|
||||
foreach ($spans as $span) {
|
||||
$classes = $span->getAttribute("class");
|
||||
$renderedSpan = $dom->saveHTML($span);
|
||||
|
||||
if (preg_match('/\R/', $renderedSpan)) {
|
||||
$finished = preg_replace(
|
||||
'/\R/',
|
||||
sprintf('</span>%s<span class="%s">', PHP_EOL, $classes),
|
||||
$renderedSpan
|
||||
);
|
||||
$html = str_replace($renderedSpan, $finished, $html);
|
||||
}
|
||||
}
|
||||
|
||||
return preg_split('/\R/', $html);
|
||||
}
|
||||
Reference in New Issue
Block a user