Compare commits
6 Commits
afd97d41ef
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2783fc22f | ||
|
|
fe38b3db2d | ||
|
|
a9dd0ab799 | ||
|
|
49beaa601a | ||
|
|
168974e6ce | ||
|
|
24682c9947 |
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[submodule "parsedown"]
|
||||||
|
path = parsedown
|
||||||
|
url = https://github.com/erusev/parsedown.git
|
||||||
|
[submodule "parsedown-extra"]
|
||||||
|
path = parsedown-extra
|
||||||
|
url = https://github.com/erusev/parsedown-extra.git
|
||||||
2
.htaccess
Normal file
2
.htaccess
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
RewriteEngine On
|
||||||
|
ErrorDocument 404 http://tylda.org/404/
|
||||||
16
404.php
Normal file
16
404.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php include "header.php"; ?>
|
||||||
|
|
||||||
|
<i style="margin-bottom: 2rem;"><?php echo $slogan; ?></i>
|
||||||
|
<div id="top-bar">
|
||||||
|
<h1>> BŁĄD 404</h1>
|
||||||
|
<i>nieznaleziono</i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article id="content">
|
||||||
|
|
||||||
|
<p>Halo, co to za strona? Ona istnieje? Nie znaleźliśmy jej, co mam ci powiedzieć...</p>
|
||||||
|
<img src="/static/img/reaction.png" alt="Tak się teraz mogą czuć czytelnicy">
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<?php include "footer.php"; ?>
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"require": {
|
|
||||||
"erusev/parsedown": "^1.8",
|
|
||||||
"erusev/parsedown-extra": "^0.8.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
126
composer.lock
generated
126
composer.lock
generated
@@ -1,126 +0,0 @@
|
|||||||
{
|
|
||||||
"_readme": [
|
|
||||||
"This file locks the dependencies of your project to a known state",
|
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
|
||||||
"This file is @generated automatically"
|
|
||||||
],
|
|
||||||
"content-hash": "0e530aa9abec7b5b8c25831c48fdfc63",
|
|
||||||
"packages": [
|
|
||||||
{
|
|
||||||
"name": "erusev/parsedown",
|
|
||||||
"version": "1.8.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/erusev/parsedown.git",
|
|
||||||
"reference": "96baaad00f71ba04d76e45b4620f54d3beabd6f7"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/96baaad00f71ba04d76e45b4620f54d3beabd6f7",
|
|
||||||
"reference": "96baaad00f71ba04d76e45b4620f54d3beabd6f7",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"ext-mbstring": "*",
|
|
||||||
"php": ">=7.1"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^7.5|^8.5|^9.6"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"Parsedown": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Emanuil Rusev",
|
|
||||||
"email": "hello@erusev.com",
|
|
||||||
"homepage": "http://erusev.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Parser for Markdown.",
|
|
||||||
"homepage": "http://parsedown.org",
|
|
||||||
"keywords": [
|
|
||||||
"markdown",
|
|
||||||
"parser"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/erusev/parsedown/issues",
|
|
||||||
"source": "https://github.com/erusev/parsedown/tree/1.8.0"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://github.com/erusev",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2026-02-16T11:41:01+00:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "erusev/parsedown-extra",
|
|
||||||
"version": "0.8.1",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/erusev/parsedown-extra.git",
|
|
||||||
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/91ac3ff98f0cea243bdccc688df43810f044dcef",
|
|
||||||
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"erusev/parsedown": "^1.7.4"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^4.8.35"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"ParsedownExtra": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Emanuil Rusev",
|
|
||||||
"email": "hello@erusev.com",
|
|
||||||
"homepage": "http://erusev.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "An extension of Parsedown that adds support for Markdown Extra.",
|
|
||||||
"homepage": "https://github.com/erusev/parsedown-extra",
|
|
||||||
"keywords": [
|
|
||||||
"markdown",
|
|
||||||
"markdown extra",
|
|
||||||
"parsedown",
|
|
||||||
"parser"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/erusev/parsedown-extra/issues",
|
|
||||||
"source": "https://github.com/erusev/parsedown-extra/tree/0.8.x"
|
|
||||||
},
|
|
||||||
"time": "2019-12-30T23:20:37+00:00"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"packages-dev": [],
|
|
||||||
"aliases": [],
|
|
||||||
"minimum-stability": "stable",
|
|
||||||
"stability-flags": {},
|
|
||||||
"prefer-stable": false,
|
|
||||||
"prefer-lowest": false,
|
|
||||||
"platform": {},
|
|
||||||
"platform-dev": {},
|
|
||||||
"plugin-api-version": "2.9.0"
|
|
||||||
}
|
|
||||||
16
fingerprint.php
Normal file
16
fingerprint.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php include "header.php"; ?>
|
||||||
|
|
||||||
|
<i style="margin-bottom: 2rem;"><?php echo $slogan; ?></i>
|
||||||
|
<div id="top-bar">
|
||||||
|
<h1>> SSH Fingerprint</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article id="content">
|
||||||
|
|
||||||
|
<p>SHA256:MPApCxVOpQc/9rXExcYC2bDwM9SzSwRx2RSaEhGoGEw (RSA)</p>
|
||||||
|
<p>SHA256:Jeciv5YkUraww9aAxtz/nzsWywKx649dqUuMjDAzER0 (ED25519)</p>
|
||||||
|
<p>SHA256:65R9vGOH/3c/E5upbYB2yhK83fO0cts9c6hShg/ylio (ECDSA)</p>
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<?php include "footer.php"; ?>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<footer id="footer">
|
<footer id="footer">
|
||||||
<a class="link" href="https://tylda.org/git/v0id1st/main">Źródło strony</a>
|
<a class="link" href="https://tylda.org/git/v0id1st/main">Źródło strony</a>
|
||||||
<a class="link" href="/stats.php">Statystyki</a>
|
<a class="link" href="/stats.php">Statystyki</a>
|
||||||
|
<a class="link" href="/fingerprint.php">SSH fingerprint</a>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
18
index.php
18
index.php
@@ -20,8 +20,26 @@ include 'header.php';
|
|||||||
|
|
||||||
$slogans = file("slogans.txt");
|
$slogans = file("slogans.txt");
|
||||||
$slogan = $slogans[rand(0, count($slogans) - 1)];
|
$slogan = $slogans[rand(0, count($slogans) - 1)];
|
||||||
|
$activeUsers = json_decode(file_get_contents('/opt/html/online.json'), true);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<pre class="scroll">
|
||||||
|
<h3>Użytkownicy online: <?php
|
||||||
|
if (!empty($activeUsers)) {
|
||||||
|
echo '<marquee scrollamount="3" behavior="alternate">';
|
||||||
|
foreach ($activeUsers as $user) {
|
||||||
|
$username = htmlspecialchars($user);
|
||||||
|
echo "<a href='/~$username'>$username</a> ";
|
||||||
|
}
|
||||||
|
echo '</marquee>';
|
||||||
|
} else {
|
||||||
|
echo "/dev/null";
|
||||||
|
}
|
||||||
|
|
||||||
|
?></h3>
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
|
||||||
<pre class="ascii">
|
<pre class="ascii">
|
||||||
/$$ /$$ /$$
|
/$$ /$$ /$$
|
||||||
| $$ | $$ | $$
|
| $$ | $$ | $$
|
||||||
|
|||||||
1
parsedown
Submodule
1
parsedown
Submodule
Submodule parsedown added at 4e433a8d57
1
parsedown-extra
Submodule
1
parsedown-extra
Submodule
Submodule parsedown-extra added at cf4dc29794
@@ -86,12 +86,12 @@ footer#footer {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
a[href] {
|
||||||
color: var(--link);
|
color: var(--link);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link:hover {
|
a[href]:hover {
|
||||||
color: var(--link-hover);
|
color: var(--link-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,11 +103,54 @@ footer#footer > *:not(:last-child)::after {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pre.ascii {
|
pre.ascii {
|
||||||
|
margin-top: 2rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scroll {
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: pre;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll h3 {
|
||||||
|
flex-shrink:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll a:before {
|
||||||
|
content:"~";
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll marquee {
|
||||||
|
margin-bottom: -.3rem;
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll a {
|
||||||
|
padding: .3rem
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-list a {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex: 10em;
|
||||||
|
padding-bottom: .3rem;
|
||||||
|
padding-top: .3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-list a:before {
|
||||||
|
content:"~";
|
||||||
|
}
|
||||||
|
|
||||||
.user_home {
|
.user_home {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 100px 30px 100px 100px 40px 120px 15px;
|
grid-template-columns: 100px 30px 100px 100px 40px 120px 15px;
|
||||||
|
|||||||
BIN
static/img/reaction.png
Normal file
BIN
static/img/reaction.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -26,7 +26,7 @@ error_reporting(E_ALL);
|
|||||||
<li>Ostatni server load: <?=shell_exec("/usr/bin/top -n 1 | grep Load | cut -d' ' -f3,4,5");?></li>
|
<li>Ostatni server load: <?=shell_exec("/usr/bin/top -n 1 | grep Load | cut -d' ' -f3,4,5");?></li>
|
||||||
<li>Wolny RAM: <?=shell_exec("/usr/bin/free -h | grep Mem | awk '{print \$NF}'");?>
|
<li>Wolny RAM: <?=shell_exec("/usr/bin/free -h | grep Mem | awk '{print \$NF}'");?>
|
||||||
</ul>
|
</ul>
|
||||||
<img src="stats.png" style="max-width: 650px">
|
<img src="/static/img/stats.png" style="max-width: 650px">
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
31
users.php
31
users.php
@@ -1,20 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include 'header.php';
|
include 'header.php';
|
||||||
|
|
||||||
|
$activeUsers = json_decode(file_get_contents('/opt/html/online.json'), true);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<h1>> Users </h1>
|
<h1>> Users </h1>
|
||||||
<article id="content">
|
<article id="content">
|
||||||
Lista użytkowników i linki do ich blogów
|
Lista użytkowników obecnie aktywnych:
|
||||||
|
|
||||||
|
<div class="user-list">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (!empty($activeUsers)) {
|
||||||
|
foreach ($activeUsers as $user) {
|
||||||
|
$username = htmlspecialchars($user);
|
||||||
|
echo "<a class=\"users\" href='/~$username'>$username</a>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "...";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
Lista użytkowników i linki do ich blogów:
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
|
<div class="user-list">
|
||||||
<?php
|
<?php
|
||||||
$host=htmlspecialchars($_SERVER['SERVER_NAME']);
|
$host=htmlspecialchars($_SERVER['SERVER_NAME']);
|
||||||
//$host="";
|
//$host="";
|
||||||
foreach (scandir("/home/") as $file) {
|
foreach (scandir("/home/") as $file) {
|
||||||
if (in_array($file, array('.', '..'))) continue;
|
if (in_array($file, array('.', '..'))) continue;
|
||||||
echo "<li><a href=\"/~$file\">~$file</a></li>";
|
echo "<a href=\"/~$file\">$file</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
22
vendor/autoload.php
vendored
22
vendor/autoload.php
vendored
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// autoload.php @generated by Composer
|
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 50600) {
|
|
||||||
if (!headers_sent()) {
|
|
||||||
header('HTTP/1.1 500 Internal Server Error');
|
|
||||||
}
|
|
||||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
|
||||||
if (!ini_get('display_errors')) {
|
|
||||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
|
||||||
fwrite(STDERR, $err);
|
|
||||||
} elseif (!headers_sent()) {
|
|
||||||
echo $err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new RuntimeException($err);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
|
||||||
|
|
||||||
return ComposerAutoloaderInit7e1495fb2e8a2820ba6766561cd0f083::getLoader();
|
|
||||||
579
vendor/composer/ClassLoader.php
vendored
579
vendor/composer/ClassLoader.php
vendored
@@ -1,579 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Composer.
|
|
||||||
*
|
|
||||||
* (c) Nils Adermann <naderman@naderman.de>
|
|
||||||
* Jordi Boggiano <j.boggiano@seld.be>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Composer\Autoload;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
|
||||||
*
|
|
||||||
* $loader = new \Composer\Autoload\ClassLoader();
|
|
||||||
*
|
|
||||||
* // register classes with namespaces
|
|
||||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
|
||||||
* $loader->add('Symfony', __DIR__.'/framework');
|
|
||||||
*
|
|
||||||
* // activate the autoloader
|
|
||||||
* $loader->register();
|
|
||||||
*
|
|
||||||
* // to enable searching the include path (eg. for PEAR packages)
|
|
||||||
* $loader->setUseIncludePath(true);
|
|
||||||
*
|
|
||||||
* In this example, if you try to use a class in the Symfony\Component
|
|
||||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
|
||||||
* the autoloader will first look for the class under the component/
|
|
||||||
* directory, and it will then fallback to the framework/ directory if not
|
|
||||||
* found before giving up.
|
|
||||||
*
|
|
||||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
|
||||||
*
|
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
|
||||||
* @see https://www.php-fig.org/psr/psr-0/
|
|
||||||
* @see https://www.php-fig.org/psr/psr-4/
|
|
||||||
*/
|
|
||||||
class ClassLoader
|
|
||||||
{
|
|
||||||
/** @var \Closure(string):void */
|
|
||||||
private static $includeFile;
|
|
||||||
|
|
||||||
/** @var string|null */
|
|
||||||
private $vendorDir;
|
|
||||||
|
|
||||||
// PSR-4
|
|
||||||
/**
|
|
||||||
* @var array<string, array<string, int>>
|
|
||||||
*/
|
|
||||||
private $prefixLengthsPsr4 = array();
|
|
||||||
/**
|
|
||||||
* @var array<string, list<string>>
|
|
||||||
*/
|
|
||||||
private $prefixDirsPsr4 = array();
|
|
||||||
/**
|
|
||||||
* @var list<string>
|
|
||||||
*/
|
|
||||||
private $fallbackDirsPsr4 = array();
|
|
||||||
|
|
||||||
// PSR-0
|
|
||||||
/**
|
|
||||||
* List of PSR-0 prefixes
|
|
||||||
*
|
|
||||||
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
|
||||||
*
|
|
||||||
* @var array<string, array<string, list<string>>>
|
|
||||||
*/
|
|
||||||
private $prefixesPsr0 = array();
|
|
||||||
/**
|
|
||||||
* @var list<string>
|
|
||||||
*/
|
|
||||||
private $fallbackDirsPsr0 = array();
|
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
private $useIncludePath = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array<string, string>
|
|
||||||
*/
|
|
||||||
private $classMap = array();
|
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
private $classMapAuthoritative = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array<string, bool>
|
|
||||||
*/
|
|
||||||
private $missingClasses = array();
|
|
||||||
|
|
||||||
/** @var string|null */
|
|
||||||
private $apcuPrefix;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array<string, self>
|
|
||||||
*/
|
|
||||||
private static $registeredLoaders = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string|null $vendorDir
|
|
||||||
*/
|
|
||||||
public function __construct($vendorDir = null)
|
|
||||||
{
|
|
||||||
$this->vendorDir = $vendorDir;
|
|
||||||
self::initializeIncludeClosure();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array<string, list<string>>
|
|
||||||
*/
|
|
||||||
public function getPrefixes()
|
|
||||||
{
|
|
||||||
if (!empty($this->prefixesPsr0)) {
|
|
||||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
|
||||||
}
|
|
||||||
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array<string, list<string>>
|
|
||||||
*/
|
|
||||||
public function getPrefixesPsr4()
|
|
||||||
{
|
|
||||||
return $this->prefixDirsPsr4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return list<string>
|
|
||||||
*/
|
|
||||||
public function getFallbackDirs()
|
|
||||||
{
|
|
||||||
return $this->fallbackDirsPsr0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return list<string>
|
|
||||||
*/
|
|
||||||
public function getFallbackDirsPsr4()
|
|
||||||
{
|
|
||||||
return $this->fallbackDirsPsr4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array<string, string> Array of classname => path
|
|
||||||
*/
|
|
||||||
public function getClassMap()
|
|
||||||
{
|
|
||||||
return $this->classMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<string, string> $classMap Class to filename map
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function addClassMap(array $classMap)
|
|
||||||
{
|
|
||||||
if ($this->classMap) {
|
|
||||||
$this->classMap = array_merge($this->classMap, $classMap);
|
|
||||||
} else {
|
|
||||||
$this->classMap = $classMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a set of PSR-0 directories for a given prefix, either
|
|
||||||
* appending or prepending to the ones previously set for this prefix.
|
|
||||||
*
|
|
||||||
* @param string $prefix The prefix
|
|
||||||
* @param list<string>|string $paths The PSR-0 root directories
|
|
||||||
* @param bool $prepend Whether to prepend the directories
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function add($prefix, $paths, $prepend = false)
|
|
||||||
{
|
|
||||||
$paths = (array) $paths;
|
|
||||||
if (!$prefix) {
|
|
||||||
if ($prepend) {
|
|
||||||
$this->fallbackDirsPsr0 = array_merge(
|
|
||||||
$paths,
|
|
||||||
$this->fallbackDirsPsr0
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$this->fallbackDirsPsr0 = array_merge(
|
|
||||||
$this->fallbackDirsPsr0,
|
|
||||||
$paths
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$first = $prefix[0];
|
|
||||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
|
||||||
$this->prefixesPsr0[$first][$prefix] = $paths;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($prepend) {
|
|
||||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
|
||||||
$paths,
|
|
||||||
$this->prefixesPsr0[$first][$prefix]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
|
||||||
$this->prefixesPsr0[$first][$prefix],
|
|
||||||
$paths
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a set of PSR-4 directories for a given namespace, either
|
|
||||||
* appending or prepending to the ones previously set for this namespace.
|
|
||||||
*
|
|
||||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
|
||||||
* @param list<string>|string $paths The PSR-4 base directories
|
|
||||||
* @param bool $prepend Whether to prepend the directories
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function addPsr4($prefix, $paths, $prepend = false)
|
|
||||||
{
|
|
||||||
$paths = (array) $paths;
|
|
||||||
if (!$prefix) {
|
|
||||||
// Register directories for the root namespace.
|
|
||||||
if ($prepend) {
|
|
||||||
$this->fallbackDirsPsr4 = array_merge(
|
|
||||||
$paths,
|
|
||||||
$this->fallbackDirsPsr4
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$this->fallbackDirsPsr4 = array_merge(
|
|
||||||
$this->fallbackDirsPsr4,
|
|
||||||
$paths
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
|
||||||
// Register directories for a new namespace.
|
|
||||||
$length = strlen($prefix);
|
|
||||||
if ('\\' !== $prefix[$length - 1]) {
|
|
||||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
|
||||||
}
|
|
||||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
|
||||||
$this->prefixDirsPsr4[$prefix] = $paths;
|
|
||||||
} elseif ($prepend) {
|
|
||||||
// Prepend directories for an already registered namespace.
|
|
||||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
|
||||||
$paths,
|
|
||||||
$this->prefixDirsPsr4[$prefix]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// Append directories for an already registered namespace.
|
|
||||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
|
||||||
$this->prefixDirsPsr4[$prefix],
|
|
||||||
$paths
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a set of PSR-0 directories for a given prefix,
|
|
||||||
* replacing any others previously set for this prefix.
|
|
||||||
*
|
|
||||||
* @param string $prefix The prefix
|
|
||||||
* @param list<string>|string $paths The PSR-0 base directories
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function set($prefix, $paths)
|
|
||||||
{
|
|
||||||
if (!$prefix) {
|
|
||||||
$this->fallbackDirsPsr0 = (array) $paths;
|
|
||||||
} else {
|
|
||||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a set of PSR-4 directories for a given namespace,
|
|
||||||
* replacing any others previously set for this namespace.
|
|
||||||
*
|
|
||||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
|
||||||
* @param list<string>|string $paths The PSR-4 base directories
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setPsr4($prefix, $paths)
|
|
||||||
{
|
|
||||||
if (!$prefix) {
|
|
||||||
$this->fallbackDirsPsr4 = (array) $paths;
|
|
||||||
} else {
|
|
||||||
$length = strlen($prefix);
|
|
||||||
if ('\\' !== $prefix[$length - 1]) {
|
|
||||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
|
||||||
}
|
|
||||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
|
||||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Turns on searching the include path for class files.
|
|
||||||
*
|
|
||||||
* @param bool $useIncludePath
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setUseIncludePath($useIncludePath)
|
|
||||||
{
|
|
||||||
$this->useIncludePath = $useIncludePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Can be used to check if the autoloader uses the include path to check
|
|
||||||
* for classes.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function getUseIncludePath()
|
|
||||||
{
|
|
||||||
return $this->useIncludePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Turns off searching the prefix and fallback directories for classes
|
|
||||||
* that have not been registered with the class map.
|
|
||||||
*
|
|
||||||
* @param bool $classMapAuthoritative
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
|
||||||
{
|
|
||||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should class lookup fail if not found in the current class map?
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isClassMapAuthoritative()
|
|
||||||
{
|
|
||||||
return $this->classMapAuthoritative;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
|
||||||
*
|
|
||||||
* @param string|null $apcuPrefix
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setApcuPrefix($apcuPrefix)
|
|
||||||
{
|
|
||||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
|
||||||
public function getApcuPrefix()
|
|
||||||
{
|
|
||||||
return $this->apcuPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers this instance as an autoloader.
|
|
||||||
*
|
|
||||||
* @param bool $prepend Whether to prepend the autoloader or not
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function register($prepend = false)
|
|
||||||
{
|
|
||||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
|
||||||
|
|
||||||
if (null === $this->vendorDir) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($prepend) {
|
|
||||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
|
||||||
} else {
|
|
||||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
|
||||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unregisters this instance as an autoloader.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function unregister()
|
|
||||||
{
|
|
||||||
spl_autoload_unregister(array($this, 'loadClass'));
|
|
||||||
|
|
||||||
if (null !== $this->vendorDir) {
|
|
||||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the given class or interface.
|
|
||||||
*
|
|
||||||
* @param string $class The name of the class
|
|
||||||
* @return true|null True if loaded, null otherwise
|
|
||||||
*/
|
|
||||||
public function loadClass($class)
|
|
||||||
{
|
|
||||||
if ($file = $this->findFile($class)) {
|
|
||||||
$includeFile = self::$includeFile;
|
|
||||||
$includeFile($file);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the path to the file where the class is defined.
|
|
||||||
*
|
|
||||||
* @param string $class The name of the class
|
|
||||||
*
|
|
||||||
* @return string|false The path if found, false otherwise
|
|
||||||
*/
|
|
||||||
public function findFile($class)
|
|
||||||
{
|
|
||||||
// class map lookup
|
|
||||||
if (isset($this->classMap[$class])) {
|
|
||||||
return $this->classMap[$class];
|
|
||||||
}
|
|
||||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (null !== $this->apcuPrefix) {
|
|
||||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
|
||||||
if ($hit) {
|
|
||||||
return $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$file = $this->findFileWithExtension($class, '.php');
|
|
||||||
|
|
||||||
// Search for Hack files if we are running on HHVM
|
|
||||||
if (false === $file && defined('HHVM_VERSION')) {
|
|
||||||
$file = $this->findFileWithExtension($class, '.hh');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $this->apcuPrefix) {
|
|
||||||
apcu_add($this->apcuPrefix.$class, $file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false === $file) {
|
|
||||||
// Remember that this class does not exist.
|
|
||||||
$this->missingClasses[$class] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
|
||||||
*
|
|
||||||
* @return array<string, self>
|
|
||||||
*/
|
|
||||||
public static function getRegisteredLoaders()
|
|
||||||
{
|
|
||||||
return self::$registeredLoaders;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $class
|
|
||||||
* @param string $ext
|
|
||||||
* @return string|false
|
|
||||||
*/
|
|
||||||
private function findFileWithExtension($class, $ext)
|
|
||||||
{
|
|
||||||
// PSR-4 lookup
|
|
||||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
|
||||||
|
|
||||||
$first = $class[0];
|
|
||||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
|
||||||
$subPath = $class;
|
|
||||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
|
||||||
$subPath = substr($subPath, 0, $lastPos);
|
|
||||||
$search = $subPath . '\\';
|
|
||||||
if (isset($this->prefixDirsPsr4[$search])) {
|
|
||||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
|
||||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
|
||||||
if (file_exists($file = $dir . $pathEnd)) {
|
|
||||||
return $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PSR-4 fallback dirs
|
|
||||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
|
||||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
|
||||||
return $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PSR-0 lookup
|
|
||||||
if (false !== $pos = strrpos($class, '\\')) {
|
|
||||||
// namespaced class name
|
|
||||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
|
||||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
|
||||||
} else {
|
|
||||||
// PEAR-like class name
|
|
||||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->prefixesPsr0[$first])) {
|
|
||||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
|
||||||
if (0 === strpos($class, $prefix)) {
|
|
||||||
foreach ($dirs as $dir) {
|
|
||||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
|
||||||
return $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PSR-0 fallback dirs
|
|
||||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
|
||||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
|
||||||
return $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PSR-0 include paths.
|
|
||||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
|
||||||
return $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private static function initializeIncludeClosure()
|
|
||||||
{
|
|
||||||
if (self::$includeFile !== null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scope isolated include.
|
|
||||||
*
|
|
||||||
* Prevents access to $this/self from included files.
|
|
||||||
*
|
|
||||||
* @param string $file
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
self::$includeFile = \Closure::bind(static function($file) {
|
|
||||||
include $file;
|
|
||||||
}, null, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
396
vendor/composer/InstalledVersions.php
vendored
396
vendor/composer/InstalledVersions.php
vendored
@@ -1,396 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Composer.
|
|
||||||
*
|
|
||||||
* (c) Nils Adermann <naderman@naderman.de>
|
|
||||||
* Jordi Boggiano <j.boggiano@seld.be>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Composer;
|
|
||||||
|
|
||||||
use Composer\Autoload\ClassLoader;
|
|
||||||
use Composer\Semver\VersionParser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is copied in every Composer installed project and available to all
|
|
||||||
*
|
|
||||||
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
|
||||||
*
|
|
||||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
|
||||||
*
|
|
||||||
* @final
|
|
||||||
*/
|
|
||||||
class InstalledVersions
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
private static $selfDir = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var mixed[]|null
|
|
||||||
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
|
||||||
*/
|
|
||||||
private static $installed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
private static $installedIsLocalDir;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool|null
|
|
||||||
*/
|
|
||||||
private static $canGetVendors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array[]
|
|
||||||
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
|
||||||
*/
|
|
||||||
private static $installedByVendor = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
|
||||||
*
|
|
||||||
* @return string[]
|
|
||||||
* @psalm-return list<string>
|
|
||||||
*/
|
|
||||||
public static function getInstalledPackages()
|
|
||||||
{
|
|
||||||
$packages = array();
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
$packages[] = array_keys($installed['versions']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (1 === \count($packages)) {
|
|
||||||
return $packages[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of all package names with a specific type e.g. 'library'
|
|
||||||
*
|
|
||||||
* @param string $type
|
|
||||||
* @return string[]
|
|
||||||
* @psalm-return list<string>
|
|
||||||
*/
|
|
||||||
public static function getInstalledPackagesByType($type)
|
|
||||||
{
|
|
||||||
$packagesByType = array();
|
|
||||||
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
foreach ($installed['versions'] as $name => $package) {
|
|
||||||
if (isset($package['type']) && $package['type'] === $type) {
|
|
||||||
$packagesByType[] = $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $packagesByType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the given package is installed
|
|
||||||
*
|
|
||||||
* This also returns true if the package name is provided or replaced by another package
|
|
||||||
*
|
|
||||||
* @param string $packageName
|
|
||||||
* @param bool $includeDevRequirements
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function isInstalled($packageName, $includeDevRequirements = true)
|
|
||||||
{
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
if (isset($installed['versions'][$packageName])) {
|
|
||||||
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the given package satisfies a version constraint
|
|
||||||
*
|
|
||||||
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
|
||||||
*
|
|
||||||
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
|
||||||
*
|
|
||||||
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
|
||||||
* @param string $packageName
|
|
||||||
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
|
||||||
{
|
|
||||||
$constraint = $parser->parseConstraints((string) $constraint);
|
|
||||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
|
||||||
|
|
||||||
return $provided->matches($constraint);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a version constraint representing all the range(s) which are installed for a given package
|
|
||||||
*
|
|
||||||
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
|
||||||
* whether a given version of a package is installed, and not just whether it exists
|
|
||||||
*
|
|
||||||
* @param string $packageName
|
|
||||||
* @return string Version constraint usable with composer/semver
|
|
||||||
*/
|
|
||||||
public static function getVersionRanges($packageName)
|
|
||||||
{
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
if (!isset($installed['versions'][$packageName])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ranges = array();
|
|
||||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
|
||||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
|
||||||
}
|
|
||||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
|
||||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
|
||||||
}
|
|
||||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
|
||||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
|
||||||
}
|
|
||||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
|
||||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode(' || ', $ranges);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $packageName
|
|
||||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
|
||||||
*/
|
|
||||||
public static function getVersion($packageName)
|
|
||||||
{
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
if (!isset($installed['versions'][$packageName])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $installed['versions'][$packageName]['version'];
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $packageName
|
|
||||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
|
||||||
*/
|
|
||||||
public static function getPrettyVersion($packageName)
|
|
||||||
{
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
if (!isset($installed['versions'][$packageName])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $installed['versions'][$packageName]['pretty_version'];
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $packageName
|
|
||||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
|
||||||
*/
|
|
||||||
public static function getReference($packageName)
|
|
||||||
{
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
if (!isset($installed['versions'][$packageName])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $installed['versions'][$packageName]['reference'];
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $packageName
|
|
||||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
|
||||||
*/
|
|
||||||
public static function getInstallPath($packageName)
|
|
||||||
{
|
|
||||||
foreach (self::getInstalled() as $installed) {
|
|
||||||
if (!isset($installed['versions'][$packageName])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
|
||||||
*/
|
|
||||||
public static function getRootPackage()
|
|
||||||
{
|
|
||||||
$installed = self::getInstalled();
|
|
||||||
|
|
||||||
return $installed[0]['root'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the raw installed.php data for custom implementations
|
|
||||||
*
|
|
||||||
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
|
||||||
* @return array[]
|
|
||||||
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
|
||||||
*/
|
|
||||||
public static function getRawData()
|
|
||||||
{
|
|
||||||
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
if (null === self::$installed) {
|
|
||||||
// only require the installed.php file if this file is loaded from its dumped location,
|
|
||||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
|
||||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
|
||||||
self::$installed = include __DIR__ . '/installed.php';
|
|
||||||
} else {
|
|
||||||
self::$installed = array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$installed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
|
||||||
*
|
|
||||||
* @return array[]
|
|
||||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
|
||||||
*/
|
|
||||||
public static function getAllRawData()
|
|
||||||
{
|
|
||||||
return self::getInstalled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lets you reload the static array from another file
|
|
||||||
*
|
|
||||||
* This is only useful for complex integrations in which a project needs to use
|
|
||||||
* this class but then also needs to execute another project's autoloader in process,
|
|
||||||
* and wants to ensure both projects have access to their version of installed.php.
|
|
||||||
*
|
|
||||||
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
|
||||||
* the data it needs from this class, then call reload() with
|
|
||||||
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
|
||||||
* the project in which it runs can then also use this class safely, without
|
|
||||||
* interference between PHPUnit's dependencies and the project's dependencies.
|
|
||||||
*
|
|
||||||
* @param array[] $data A vendor/composer/installed.php data set
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
|
||||||
*/
|
|
||||||
public static function reload($data)
|
|
||||||
{
|
|
||||||
self::$installed = $data;
|
|
||||||
self::$installedByVendor = array();
|
|
||||||
|
|
||||||
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
|
|
||||||
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
|
|
||||||
// so we have to assume it does not, and that may result in duplicate data being returned when listing
|
|
||||||
// all installed packages for example
|
|
||||||
self::$installedIsLocalDir = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private static function getSelfDir()
|
|
||||||
{
|
|
||||||
if (self::$selfDir === null) {
|
|
||||||
self::$selfDir = strtr(__DIR__, '\\', '/');
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$selfDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array[]
|
|
||||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
|
||||||
*/
|
|
||||||
private static function getInstalled()
|
|
||||||
{
|
|
||||||
if (null === self::$canGetVendors) {
|
|
||||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
|
||||||
}
|
|
||||||
|
|
||||||
$installed = array();
|
|
||||||
$copiedLocalDir = false;
|
|
||||||
|
|
||||||
if (self::$canGetVendors) {
|
|
||||||
$selfDir = self::getSelfDir();
|
|
||||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
|
||||||
$vendorDir = strtr($vendorDir, '\\', '/');
|
|
||||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
|
||||||
$installed[] = self::$installedByVendor[$vendorDir];
|
|
||||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
|
||||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
|
||||||
$required = require $vendorDir.'/composer/installed.php';
|
|
||||||
self::$installedByVendor[$vendorDir] = $required;
|
|
||||||
$installed[] = $required;
|
|
||||||
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
|
|
||||||
self::$installed = $required;
|
|
||||||
self::$installedIsLocalDir = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
|
|
||||||
$copiedLocalDir = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === self::$installed) {
|
|
||||||
// only require the installed.php file if this file is loaded from its dumped location,
|
|
||||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
|
||||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
|
||||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
|
||||||
$required = require __DIR__ . '/installed.php';
|
|
||||||
self::$installed = $required;
|
|
||||||
} else {
|
|
||||||
self::$installed = array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self::$installed !== array() && !$copiedLocalDir) {
|
|
||||||
$installed[] = self::$installed;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $installed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
21
vendor/composer/LICENSE
vendored
21
vendor/composer/LICENSE
vendored
@@ -1,21 +0,0 @@
|
|||||||
|
|
||||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is furnished
|
|
||||||
to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
10
vendor/composer/autoload_classmap.php
vendored
10
vendor/composer/autoload_classmap.php
vendored
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// autoload_classmap.php @generated by Composer
|
|
||||||
|
|
||||||
$vendorDir = dirname(__DIR__);
|
|
||||||
$baseDir = dirname($vendorDir);
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
|
||||||
);
|
|
||||||
11
vendor/composer/autoload_namespaces.php
vendored
11
vendor/composer/autoload_namespaces.php
vendored
@@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// autoload_namespaces.php @generated by Composer
|
|
||||||
|
|
||||||
$vendorDir = dirname(__DIR__);
|
|
||||||
$baseDir = dirname($vendorDir);
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'ParsedownExtra' => array($vendorDir . '/erusev/parsedown-extra'),
|
|
||||||
'Parsedown' => array($vendorDir . '/erusev/parsedown'),
|
|
||||||
);
|
|
||||||
9
vendor/composer/autoload_psr4.php
vendored
9
vendor/composer/autoload_psr4.php
vendored
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// autoload_psr4.php @generated by Composer
|
|
||||||
|
|
||||||
$vendorDir = dirname(__DIR__);
|
|
||||||
$baseDir = dirname($vendorDir);
|
|
||||||
|
|
||||||
return array(
|
|
||||||
);
|
|
||||||
38
vendor/composer/autoload_real.php
vendored
38
vendor/composer/autoload_real.php
vendored
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
|
||||||
|
|
||||||
class ComposerAutoloaderInit7e1495fb2e8a2820ba6766561cd0f083
|
|
||||||
{
|
|
||||||
private static $loader;
|
|
||||||
|
|
||||||
public static function loadClassLoader($class)
|
|
||||||
{
|
|
||||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
|
||||||
require __DIR__ . '/ClassLoader.php';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Composer\Autoload\ClassLoader
|
|
||||||
*/
|
|
||||||
public static function getLoader()
|
|
||||||
{
|
|
||||||
if (null !== self::$loader) {
|
|
||||||
return self::$loader;
|
|
||||||
}
|
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit7e1495fb2e8a2820ba6766561cd0f083', 'loadClassLoader'), true, true);
|
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit7e1495fb2e8a2820ba6766561cd0f083', 'loadClassLoader'));
|
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInit7e1495fb2e8a2820ba6766561cd0f083::getInitializer($loader));
|
|
||||||
|
|
||||||
$loader->register(true);
|
|
||||||
|
|
||||||
return $loader;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
35
vendor/composer/autoload_static.php
vendored
35
vendor/composer/autoload_static.php
vendored
@@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// autoload_static.php @generated by Composer
|
|
||||||
|
|
||||||
namespace Composer\Autoload;
|
|
||||||
|
|
||||||
class ComposerStaticInit7e1495fb2e8a2820ba6766561cd0f083
|
|
||||||
{
|
|
||||||
public static $prefixesPsr0 = array (
|
|
||||||
'P' =>
|
|
||||||
array (
|
|
||||||
'ParsedownExtra' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/erusev/parsedown-extra',
|
|
||||||
),
|
|
||||||
'Parsedown' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/erusev/parsedown',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
public static $classMap = array (
|
|
||||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
||||||
);
|
|
||||||
|
|
||||||
public static function getInitializer(ClassLoader $loader)
|
|
||||||
{
|
|
||||||
return \Closure::bind(function () use ($loader) {
|
|
||||||
$loader->prefixesPsr0 = ComposerStaticInit7e1495fb2e8a2820ba6766561cd0f083::$prefixesPsr0;
|
|
||||||
$loader->classMap = ComposerStaticInit7e1495fb2e8a2820ba6766561cd0f083::$classMap;
|
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
119
vendor/composer/installed.json
vendored
119
vendor/composer/installed.json
vendored
@@ -1,119 +0,0 @@
|
|||||||
{
|
|
||||||
"packages": [
|
|
||||||
{
|
|
||||||
"name": "erusev/parsedown",
|
|
||||||
"version": "1.8.0",
|
|
||||||
"version_normalized": "1.8.0.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/erusev/parsedown.git",
|
|
||||||
"reference": "96baaad00f71ba04d76e45b4620f54d3beabd6f7"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/96baaad00f71ba04d76e45b4620f54d3beabd6f7",
|
|
||||||
"reference": "96baaad00f71ba04d76e45b4620f54d3beabd6f7",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"ext-mbstring": "*",
|
|
||||||
"php": ">=7.1"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^7.5|^8.5|^9.6"
|
|
||||||
},
|
|
||||||
"time": "2026-02-16T11:41:01+00:00",
|
|
||||||
"type": "library",
|
|
||||||
"installation-source": "dist",
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"Parsedown": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Emanuil Rusev",
|
|
||||||
"email": "hello@erusev.com",
|
|
||||||
"homepage": "http://erusev.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Parser for Markdown.",
|
|
||||||
"homepage": "http://parsedown.org",
|
|
||||||
"keywords": [
|
|
||||||
"markdown",
|
|
||||||
"parser"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/erusev/parsedown/issues",
|
|
||||||
"source": "https://github.com/erusev/parsedown/tree/1.8.0"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://github.com/erusev",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"install-path": "../erusev/parsedown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "erusev/parsedown-extra",
|
|
||||||
"version": "0.8.1",
|
|
||||||
"version_normalized": "0.8.1.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/erusev/parsedown-extra.git",
|
|
||||||
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/91ac3ff98f0cea243bdccc688df43810f044dcef",
|
|
||||||
"reference": "91ac3ff98f0cea243bdccc688df43810f044dcef",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"erusev/parsedown": "^1.7.4"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^4.8.35"
|
|
||||||
},
|
|
||||||
"time": "2019-12-30T23:20:37+00:00",
|
|
||||||
"type": "library",
|
|
||||||
"installation-source": "dist",
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"ParsedownExtra": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Emanuil Rusev",
|
|
||||||
"email": "hello@erusev.com",
|
|
||||||
"homepage": "http://erusev.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "An extension of Parsedown that adds support for Markdown Extra.",
|
|
||||||
"homepage": "https://github.com/erusev/parsedown-extra",
|
|
||||||
"keywords": [
|
|
||||||
"markdown",
|
|
||||||
"markdown extra",
|
|
||||||
"parsedown",
|
|
||||||
"parser"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/erusev/parsedown-extra/issues",
|
|
||||||
"source": "https://github.com/erusev/parsedown-extra/tree/0.8.x"
|
|
||||||
},
|
|
||||||
"install-path": "../erusev/parsedown-extra"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dev": true,
|
|
||||||
"dev-package-names": []
|
|
||||||
}
|
|
||||||
41
vendor/composer/installed.php
vendored
41
vendor/composer/installed.php
vendored
@@ -1,41 +0,0 @@
|
|||||||
<?php return array(
|
|
||||||
'root' => array(
|
|
||||||
'name' => '__root__',
|
|
||||||
'pretty_version' => 'dev-main',
|
|
||||||
'version' => 'dev-main',
|
|
||||||
'reference' => '83f577250deb40576ca6a1aa2866dd230d826776',
|
|
||||||
'type' => 'library',
|
|
||||||
'install_path' => __DIR__ . '/../../',
|
|
||||||
'aliases' => array(),
|
|
||||||
'dev' => true,
|
|
||||||
),
|
|
||||||
'versions' => array(
|
|
||||||
'__root__' => array(
|
|
||||||
'pretty_version' => 'dev-main',
|
|
||||||
'version' => 'dev-main',
|
|
||||||
'reference' => '83f577250deb40576ca6a1aa2866dd230d826776',
|
|
||||||
'type' => 'library',
|
|
||||||
'install_path' => __DIR__ . '/../../',
|
|
||||||
'aliases' => array(),
|
|
||||||
'dev_requirement' => false,
|
|
||||||
),
|
|
||||||
'erusev/parsedown' => array(
|
|
||||||
'pretty_version' => '1.8.0',
|
|
||||||
'version' => '1.8.0.0',
|
|
||||||
'reference' => '96baaad00f71ba04d76e45b4620f54d3beabd6f7',
|
|
||||||
'type' => 'library',
|
|
||||||
'install_path' => __DIR__ . '/../erusev/parsedown',
|
|
||||||
'aliases' => array(),
|
|
||||||
'dev_requirement' => false,
|
|
||||||
),
|
|
||||||
'erusev/parsedown-extra' => array(
|
|
||||||
'pretty_version' => '0.8.1',
|
|
||||||
'version' => '0.8.1.0',
|
|
||||||
'reference' => '91ac3ff98f0cea243bdccc688df43810f044dcef',
|
|
||||||
'type' => 'library',
|
|
||||||
'install_path' => __DIR__ . '/../erusev/parsedown-extra',
|
|
||||||
'aliases' => array(),
|
|
||||||
'dev_requirement' => false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
25
vendor/composer/platform_check.php
vendored
25
vendor/composer/platform_check.php
vendored
@@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// platform_check.php @generated by Composer
|
|
||||||
|
|
||||||
$issues = array();
|
|
||||||
|
|
||||||
if (!(PHP_VERSION_ID >= 70100)) {
|
|
||||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.0". You are running ' . PHP_VERSION . '.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($issues) {
|
|
||||||
if (!headers_sent()) {
|
|
||||||
header('HTTP/1.1 500 Internal Server Error');
|
|
||||||
}
|
|
||||||
if (!ini_get('display_errors')) {
|
|
||||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
|
||||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
|
||||||
} elseif (!headers_sent()) {
|
|
||||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new \RuntimeException(
|
|
||||||
'Composer detected issues in your platform: ' . implode(' ', $issues)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
30
vendor/erusev/parsedown-extra/.travis.yml
vendored
30
vendor/erusev/parsedown-extra/.travis.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
language: php
|
|
||||||
|
|
||||||
dist: trusty
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- php: 5.3
|
|
||||||
dist: precise
|
|
||||||
- php: 5.4
|
|
||||||
- php: 5.5
|
|
||||||
- php: 5.6
|
|
||||||
- php: 7.0
|
|
||||||
- php: 7.1
|
|
||||||
- php: 7.2
|
|
||||||
- php: 7.3
|
|
||||||
- php: 7.4
|
|
||||||
- php: nightly
|
|
||||||
fast_finish: true
|
|
||||||
allow_failures:
|
|
||||||
- php: nightly
|
|
||||||
- php: hhvm-nightly
|
|
||||||
|
|
||||||
install:
|
|
||||||
- composer install --prefer-source
|
|
||||||
|
|
||||||
script:
|
|
||||||
- vendor/bin/phpunit
|
|
||||||
- vendor/bin/phpunit vendor/erusev/parsedown/test/CommonMarkTestWeak.php || true
|
|
||||||
- '[ -z "$TRAVIS_TAG" ] || [ "$TRAVIS_TAG" == "$(php -r "require(\"ParsedownExtra.php\"); echo ParsedownExtra::version;")" ]'
|
|
||||||
20
vendor/erusev/parsedown-extra/LICENSE.txt
vendored
20
vendor/erusev/parsedown-extra/LICENSE.txt
vendored
@@ -1,20 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2013 Emanuil Rusev, erusev.com
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
538
vendor/erusev/parsedown-extra/ParsedownExtra.php
vendored
538
vendor/erusev/parsedown-extra/ParsedownExtra.php
vendored
@@ -1,538 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Parsedown Extra
|
|
||||||
# https://github.com/erusev/parsedown-extra
|
|
||||||
#
|
|
||||||
# (c) Emanuil Rusev
|
|
||||||
# http://erusev.com
|
|
||||||
#
|
|
||||||
# For the full license information, view the LICENSE file that was distributed
|
|
||||||
# with this source code.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
class ParsedownExtra extends Parsedown
|
|
||||||
{
|
|
||||||
# ~
|
|
||||||
|
|
||||||
const version = '0.8.1';
|
|
||||||
|
|
||||||
# ~
|
|
||||||
|
|
||||||
function __construct()
|
|
||||||
{
|
|
||||||
if (version_compare(parent::version, '1.7.4') < 0)
|
|
||||||
{
|
|
||||||
throw new Exception('ParsedownExtra requires a later version of Parsedown');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->BlockTypes[':'] []= 'DefinitionList';
|
|
||||||
$this->BlockTypes['*'] []= 'Abbreviation';
|
|
||||||
|
|
||||||
# identify footnote definitions before reference definitions
|
|
||||||
array_unshift($this->BlockTypes['['], 'Footnote');
|
|
||||||
|
|
||||||
# identify footnote markers before before links
|
|
||||||
array_unshift($this->InlineTypes['['], 'FootnoteMarker');
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# ~
|
|
||||||
|
|
||||||
function text($text)
|
|
||||||
{
|
|
||||||
$markup = parent::text($text);
|
|
||||||
|
|
||||||
# merge consecutive dl elements
|
|
||||||
|
|
||||||
$markup = preg_replace('/<\/dl>\s+<dl>\s+/', '', $markup);
|
|
||||||
|
|
||||||
# add footnotes
|
|
||||||
|
|
||||||
if (isset($this->DefinitionData['Footnote']))
|
|
||||||
{
|
|
||||||
$Element = $this->buildFootnoteElement();
|
|
||||||
|
|
||||||
$markup .= "\n" . $this->element($Element);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $markup;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Blocks
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Abbreviation
|
|
||||||
|
|
||||||
protected function blockAbbreviation($Line)
|
|
||||||
{
|
|
||||||
if (preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches))
|
|
||||||
{
|
|
||||||
$this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2];
|
|
||||||
|
|
||||||
$Block = array(
|
|
||||||
'hidden' => true,
|
|
||||||
);
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Footnote
|
|
||||||
|
|
||||||
protected function blockFootnote($Line)
|
|
||||||
{
|
|
||||||
if (preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches))
|
|
||||||
{
|
|
||||||
$Block = array(
|
|
||||||
'label' => $matches[1],
|
|
||||||
'text' => $matches[2],
|
|
||||||
'hidden' => true,
|
|
||||||
);
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function blockFootnoteContinue($Line, $Block)
|
|
||||||
{
|
|
||||||
if ($Line['text'][0] === '[' and preg_match('/^\[\^(.+?)\]:/', $Line['text']))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($Block['interrupted']))
|
|
||||||
{
|
|
||||||
if ($Line['indent'] >= 4)
|
|
||||||
{
|
|
||||||
$Block['text'] .= "\n\n" . $Line['text'];
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$Block['text'] .= "\n" . $Line['text'];
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function blockFootnoteComplete($Block)
|
|
||||||
{
|
|
||||||
$this->DefinitionData['Footnote'][$Block['label']] = array(
|
|
||||||
'text' => $Block['text'],
|
|
||||||
'count' => null,
|
|
||||||
'number' => null,
|
|
||||||
);
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Definition List
|
|
||||||
|
|
||||||
protected function blockDefinitionList($Line, $Block)
|
|
||||||
{
|
|
||||||
if ( ! isset($Block) or isset($Block['type']))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$Element = array(
|
|
||||||
'name' => 'dl',
|
|
||||||
'handler' => 'elements',
|
|
||||||
'text' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
$terms = explode("\n", $Block['element']['text']);
|
|
||||||
|
|
||||||
foreach ($terms as $term)
|
|
||||||
{
|
|
||||||
$Element['text'] []= array(
|
|
||||||
'name' => 'dt',
|
|
||||||
'handler' => 'line',
|
|
||||||
'text' => $term,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$Block['element'] = $Element;
|
|
||||||
|
|
||||||
$Block = $this->addDdElement($Line, $Block);
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function blockDefinitionListContinue($Line, array $Block)
|
|
||||||
{
|
|
||||||
if ($Line['text'][0] === ':')
|
|
||||||
{
|
|
||||||
$Block = $this->addDdElement($Line, $Block);
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isset($Block['interrupted']) and $Line['indent'] === 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($Block['interrupted']))
|
|
||||||
{
|
|
||||||
$Block['dd']['handler'] = 'text';
|
|
||||||
$Block['dd']['text'] .= "\n\n";
|
|
||||||
|
|
||||||
unset($Block['interrupted']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$text = substr($Line['body'], min($Line['indent'], 4));
|
|
||||||
|
|
||||||
$Block['dd']['text'] .= "\n" . $text;
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Header
|
|
||||||
|
|
||||||
protected function blockHeader($Line)
|
|
||||||
{
|
|
||||||
$Block = parent::blockHeader($Line);
|
|
||||||
|
|
||||||
if (! isset($Block)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
|
|
||||||
{
|
|
||||||
$attributeString = $matches[1][0];
|
|
||||||
|
|
||||||
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
|
|
||||||
|
|
||||||
$Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Markup
|
|
||||||
|
|
||||||
protected function blockMarkupComplete($Block)
|
|
||||||
{
|
|
||||||
if ( ! isset($Block['void']))
|
|
||||||
{
|
|
||||||
$Block['markup'] = $this->processTag($Block['markup']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Setext
|
|
||||||
|
|
||||||
protected function blockSetextHeader($Line, array $Block = null)
|
|
||||||
{
|
|
||||||
$Block = parent::blockSetextHeader($Line, $Block);
|
|
||||||
|
|
||||||
if (! isset($Block)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE))
|
|
||||||
{
|
|
||||||
$attributeString = $matches[1][0];
|
|
||||||
|
|
||||||
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
|
|
||||||
|
|
||||||
$Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Inline Elements
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Footnote Marker
|
|
||||||
|
|
||||||
protected function inlineFootnoteMarker($Excerpt)
|
|
||||||
{
|
|
||||||
if (preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches))
|
|
||||||
{
|
|
||||||
$name = $matches[1];
|
|
||||||
|
|
||||||
if ( ! isset($this->DefinitionData['Footnote'][$name]))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->DefinitionData['Footnote'][$name]['count'] ++;
|
|
||||||
|
|
||||||
if ( ! isset($this->DefinitionData['Footnote'][$name]['number']))
|
|
||||||
{
|
|
||||||
$this->DefinitionData['Footnote'][$name]['number'] = ++ $this->footnoteCount; # » &
|
|
||||||
}
|
|
||||||
|
|
||||||
$Element = array(
|
|
||||||
'name' => 'sup',
|
|
||||||
'attributes' => array('id' => 'fnref'.$this->DefinitionData['Footnote'][$name]['count'].':'.$name),
|
|
||||||
'handler' => 'element',
|
|
||||||
'text' => array(
|
|
||||||
'name' => 'a',
|
|
||||||
'attributes' => array('href' => '#fn:'.$name, 'class' => 'footnote-ref'),
|
|
||||||
'text' => $this->DefinitionData['Footnote'][$name]['number'],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'extent' => strlen($matches[0]),
|
|
||||||
'element' => $Element,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private $footnoteCount = 0;
|
|
||||||
|
|
||||||
#
|
|
||||||
# Link
|
|
||||||
|
|
||||||
protected function inlineLink($Excerpt)
|
|
||||||
{
|
|
||||||
$Link = parent::inlineLink($Excerpt);
|
|
||||||
|
|
||||||
if (! isset($Link)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$remainder = substr($Excerpt['text'], $Link['extent']);
|
|
||||||
|
|
||||||
if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches))
|
|
||||||
{
|
|
||||||
$Link['element']['attributes'] += $this->parseAttributeData($matches[1]);
|
|
||||||
|
|
||||||
$Link['extent'] += strlen($matches[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $Link;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# ~
|
|
||||||
#
|
|
||||||
|
|
||||||
protected function unmarkedText($text)
|
|
||||||
{
|
|
||||||
$text = parent::unmarkedText($text);
|
|
||||||
|
|
||||||
if (isset($this->DefinitionData['Abbreviation']))
|
|
||||||
{
|
|
||||||
foreach ($this->DefinitionData['Abbreviation'] as $abbreviation => $meaning)
|
|
||||||
{
|
|
||||||
$pattern = '/\b'.preg_quote($abbreviation, '/').'\b/';
|
|
||||||
|
|
||||||
$text = preg_replace($pattern, '<abbr title="'.$meaning.'">'.$abbreviation.'</abbr>', $text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Util Methods
|
|
||||||
#
|
|
||||||
|
|
||||||
protected function addDdElement(array $Line, array $Block)
|
|
||||||
{
|
|
||||||
$text = substr($Line['text'], 1);
|
|
||||||
$text = trim($text);
|
|
||||||
|
|
||||||
unset($Block['dd']);
|
|
||||||
|
|
||||||
$Block['dd'] = array(
|
|
||||||
'name' => 'dd',
|
|
||||||
'handler' => 'line',
|
|
||||||
'text' => $text,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset($Block['interrupted']))
|
|
||||||
{
|
|
||||||
$Block['dd']['handler'] = 'text';
|
|
||||||
|
|
||||||
unset($Block['interrupted']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$Block['element']['text'] []= & $Block['dd'];
|
|
||||||
|
|
||||||
return $Block;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildFootnoteElement()
|
|
||||||
{
|
|
||||||
$Element = array(
|
|
||||||
'name' => 'div',
|
|
||||||
'attributes' => array('class' => 'footnotes'),
|
|
||||||
'handler' => 'elements',
|
|
||||||
'text' => array(
|
|
||||||
array(
|
|
||||||
'name' => 'hr',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'name' => 'ol',
|
|
||||||
'handler' => 'elements',
|
|
||||||
'text' => array(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
|
|
||||||
|
|
||||||
foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData)
|
|
||||||
{
|
|
||||||
if ( ! isset($DefinitionData['number']))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$text = $DefinitionData['text'];
|
|
||||||
|
|
||||||
$text = parent::text($text);
|
|
||||||
|
|
||||||
$numbers = range(1, $DefinitionData['count']);
|
|
||||||
|
|
||||||
$backLinksMarkup = '';
|
|
||||||
|
|
||||||
foreach ($numbers as $number)
|
|
||||||
{
|
|
||||||
$backLinksMarkup .= ' <a href="#fnref'.$number.':'.$definitionId.'" rev="footnote" class="footnote-backref">↩</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$backLinksMarkup = substr($backLinksMarkup, 1);
|
|
||||||
|
|
||||||
if (substr($text, - 4) === '</p>')
|
|
||||||
{
|
|
||||||
$backLinksMarkup = ' '.$backLinksMarkup;
|
|
||||||
|
|
||||||
$text = substr_replace($text, $backLinksMarkup.'</p>', - 4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$text .= "\n".'<p>'.$backLinksMarkup.'</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$Element['text'][1]['text'] []= array(
|
|
||||||
'name' => 'li',
|
|
||||||
'attributes' => array('id' => 'fn:'.$definitionId),
|
|
||||||
'rawHtml' => "\n".$text."\n",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $Element;
|
|
||||||
}
|
|
||||||
|
|
||||||
# ~
|
|
||||||
|
|
||||||
protected function parseAttributeData($attributeString)
|
|
||||||
{
|
|
||||||
$Data = array();
|
|
||||||
|
|
||||||
$attributes = preg_split('/[ ]+/', $attributeString, - 1, PREG_SPLIT_NO_EMPTY);
|
|
||||||
|
|
||||||
foreach ($attributes as $attribute)
|
|
||||||
{
|
|
||||||
if ($attribute[0] === '#')
|
|
||||||
{
|
|
||||||
$Data['id'] = substr($attribute, 1);
|
|
||||||
}
|
|
||||||
else # "."
|
|
||||||
{
|
|
||||||
$classes []= substr($attribute, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($classes))
|
|
||||||
{
|
|
||||||
$Data['class'] = implode(' ', $classes);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
# ~
|
|
||||||
|
|
||||||
protected function processTag($elementMarkup) # recursive
|
|
||||||
{
|
|
||||||
# http://stackoverflow.com/q/1148928/200145
|
|
||||||
libxml_use_internal_errors(true);
|
|
||||||
|
|
||||||
$DOMDocument = new DOMDocument;
|
|
||||||
|
|
||||||
# http://stackoverflow.com/q/11309194/200145
|
|
||||||
$elementMarkup = mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8');
|
|
||||||
|
|
||||||
# http://stackoverflow.com/q/4879946/200145
|
|
||||||
$DOMDocument->loadHTML($elementMarkup);
|
|
||||||
$DOMDocument->removeChild($DOMDocument->doctype);
|
|
||||||
$DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->firstChild, $DOMDocument->firstChild);
|
|
||||||
|
|
||||||
$elementText = '';
|
|
||||||
|
|
||||||
if ($DOMDocument->documentElement->getAttribute('markdown') === '1')
|
|
||||||
{
|
|
||||||
foreach ($DOMDocument->documentElement->childNodes as $Node)
|
|
||||||
{
|
|
||||||
$elementText .= $DOMDocument->saveHTML($Node);
|
|
||||||
}
|
|
||||||
|
|
||||||
$DOMDocument->documentElement->removeAttribute('markdown');
|
|
||||||
|
|
||||||
$elementText = "\n".$this->text($elementText)."\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach ($DOMDocument->documentElement->childNodes as $Node)
|
|
||||||
{
|
|
||||||
$nodeMarkup = $DOMDocument->saveHTML($Node);
|
|
||||||
|
|
||||||
if ($Node instanceof DOMElement and ! in_array($Node->nodeName, $this->textLevelElements))
|
|
||||||
{
|
|
||||||
$elementText .= $this->processTag($nodeMarkup);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$elementText .= $nodeMarkup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# because we don't want for markup to get encoded
|
|
||||||
$DOMDocument->documentElement->nodeValue = 'placeholder\x1A';
|
|
||||||
|
|
||||||
$markup = $DOMDocument->saveHTML($DOMDocument->documentElement);
|
|
||||||
$markup = str_replace('placeholder\x1A', $elementText, $markup);
|
|
||||||
|
|
||||||
return $markup;
|
|
||||||
}
|
|
||||||
|
|
||||||
# ~
|
|
||||||
|
|
||||||
protected function sortFootnotes($A, $B) # callback
|
|
||||||
{
|
|
||||||
return $A['number'] - $B['number'];
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Fields
|
|
||||||
#
|
|
||||||
|
|
||||||
protected $regexAttribute = '(?:[#.][-\w]+[ ]*)';
|
|
||||||
}
|
|
||||||
31
vendor/erusev/parsedown-extra/README.md
vendored
31
vendor/erusev/parsedown-extra/README.md
vendored
@@ -1,31 +0,0 @@
|
|||||||
> You might also like [Caret](http://caret.io?ref=parsedown) - our Markdown editor for the Desktop.
|
|
||||||
|
|
||||||
## Parsedown Extra
|
|
||||||
|
|
||||||
[](https://travis-ci.org/erusev/parsedown-extra)
|
|
||||||
|
|
||||||
An extension of [Parsedown](http://parsedown.org) that adds support for [Markdown Extra](https://michelf.ca/projects/php-markdown/extra/).
|
|
||||||
|
|
||||||
[See Demo](http://parsedown.org/extra/)
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
Include both `Parsedown.php` and `ParsedownExtra.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown-extra).
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
``` php
|
|
||||||
$Extra = new ParsedownExtra();
|
|
||||||
|
|
||||||
echo $Extra->text('# Header {.sth}'); # prints: <h1 class="sth">Header</h1>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Questions
|
|
||||||
|
|
||||||
**Who uses Parsedown Extra?**
|
|
||||||
|
|
||||||
[October CMS](http://octobercms.com/), [Bolt CMS](http://bolt.cm/), [Kirby CMS](http://getkirby.com/), [Grav CMS](http://getgrav.org/), [Statamic CMS](http://www.statamic.com/) and [more](https://www.versioneye.com/php/erusev:parsedown-extra/references).
|
|
||||||
|
|
||||||
**How can I help?**
|
|
||||||
|
|
||||||
Use it, star it, share it and in case you feel generous, [donate some money](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).
|
|
||||||
33
vendor/erusev/parsedown-extra/composer.json
vendored
33
vendor/erusev/parsedown-extra/composer.json
vendored
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "erusev/parsedown-extra",
|
|
||||||
"description": "An extension of Parsedown that adds support for Markdown Extra.",
|
|
||||||
"keywords": ["markdown", "markdown extra", "parser", "parsedown"],
|
|
||||||
"homepage": "https://github.com/erusev/parsedown-extra",
|
|
||||||
"type": "library",
|
|
||||||
"license": "MIT",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Emanuil Rusev",
|
|
||||||
"email": "hello@erusev.com",
|
|
||||||
"homepage": "http://erusev.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
"erusev/parsedown": "^1.7.4"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^4.8.35"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {"ParsedownExtra": ""}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-0": {
|
|
||||||
"TestParsedown": "test/",
|
|
||||||
"ParsedownExtraTest": "test/",
|
|
||||||
"ParsedownTest": "vendor/erusev/parsedown/test/",
|
|
||||||
"CommonMarkTest": "vendor/erusev/parsedown/test/",
|
|
||||||
"CommonMarkTestWeak": "vendor/erusev/parsedown/test/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit bootstrap="vendor/autoload.php" colors="true">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite>
|
|
||||||
<file>test/ParsedownExtraTest.php</file>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
</phpunit>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class ParsedownExtraTest extends ParsedownTest
|
|
||||||
{
|
|
||||||
protected function initDirs()
|
|
||||||
{
|
|
||||||
$dirs = parent::initDirs();
|
|
||||||
$dirs[] = __DIR__ . '/data/';
|
|
||||||
return $dirs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class TestParsedown extends ParsedownExtra
|
|
||||||
{
|
|
||||||
public function getTextLevelElements()
|
|
||||||
{
|
|
||||||
return $this->textLevelElements;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
|
|
||||||
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.
|
|
||||||
The abbreviation <abbr title="Markup Language">ML</abbr> is contained in the abbreviation <abbr title="Hyper Text Markup Language">HTML</abbr>.</p>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
The HTML specification
|
|
||||||
is maintained by the W3C.
|
|
||||||
The abbreviation ML is contained in the abbreviation HTML.
|
|
||||||
|
|
||||||
*[HTML]: Hyper Text Markup Language
|
|
||||||
*[W3C]: World Wide Web Consortium
|
|
||||||
*[ML]: Markup Language
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<p>footnote <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup> and another one <sup id="fnref1:2"><a href="#fn:2" class="footnote-ref">2</a></sup></p>
|
|
||||||
<div class="footnotes">
|
|
||||||
<hr />
|
|
||||||
<ol>
|
|
||||||
<li id="fn:1">
|
|
||||||
<p>line 1
|
|
||||||
line 2</p>
|
|
||||||
<blockquote>
|
|
||||||
<p>quote</p>
|
|
||||||
</blockquote>
|
|
||||||
<p>another paragraph <a href="#fnref1:1" rev="footnote" class="footnote-backref">↩</a></p>
|
|
||||||
</li>
|
|
||||||
<li id="fn:2">
|
|
||||||
<p>paragraph</p>
|
|
||||||
<p>another paragraph <a href="#fnref1:2" rev="footnote" class="footnote-backref">↩</a></p>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
footnote [^1] and another one [^2]
|
|
||||||
|
|
||||||
[^1]: line 1
|
|
||||||
line 2
|
|
||||||
|
|
||||||
> quote
|
|
||||||
|
|
||||||
another paragraph
|
|
||||||
|
|
||||||
[^2]:
|
|
||||||
paragraph
|
|
||||||
|
|
||||||
another paragraph
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<dl>
|
|
||||||
<dt>Term 1</dt>
|
|
||||||
<dd>one</dd>
|
|
||||||
<dd>two
|
|
||||||
extra line</dd>
|
|
||||||
<dt>Term 2</dt>
|
|
||||||
<dd><p>lazy
|
|
||||||
line</p></dd>
|
|
||||||
<dd><p>multiple</p>
|
|
||||||
<p>paragraphs</p></dd>
|
|
||||||
<dd><p>nested</p>
|
|
||||||
<pre><code>code block</code></pre>
|
|
||||||
<blockquote>
|
|
||||||
<p>quote
|
|
||||||
block</p>
|
|
||||||
</blockquote></dd>
|
|
||||||
</dl>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
Term 1
|
|
||||||
: one
|
|
||||||
: two
|
|
||||||
extra line
|
|
||||||
|
|
||||||
Term 2
|
|
||||||
|
|
||||||
: lazy
|
|
||||||
line
|
|
||||||
|
|
||||||
: multiple
|
|
||||||
|
|
||||||
paragraphs
|
|
||||||
|
|
||||||
: nested
|
|
||||||
|
|
||||||
code block
|
|
||||||
|
|
||||||
> quote
|
|
||||||
> block
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<p>first <sup id="fnref1:1"><a href="#fn:1" class="footnote-ref">1</a></sup> second <sup id="fnref1:2"><a href="#fn:2" class="footnote-ref">2</a></sup>.</p>
|
|
||||||
<p>first <sup id="fnref1:a"><a href="#fn:a" class="footnote-ref">3</a></sup> second <sup id="fnref1:b"><a href="#fn:b" class="footnote-ref">4</a></sup>.</p>
|
|
||||||
<p>second time <sup id="fnref2:1"><a href="#fn:1" class="footnote-ref">1</a></sup></p>
|
|
||||||
<div class="footnotes">
|
|
||||||
<hr />
|
|
||||||
<ol>
|
|
||||||
<li id="fn:1">
|
|
||||||
<p>one <a href="#fnref1:1" rev="footnote" class="footnote-backref">↩</a> <a href="#fnref2:1" rev="footnote" class="footnote-backref">↩</a></p>
|
|
||||||
</li>
|
|
||||||
<li id="fn:2">
|
|
||||||
<p>two <a href="#fnref1:2" rev="footnote" class="footnote-backref">↩</a></p>
|
|
||||||
</li>
|
|
||||||
<li id="fn:a">
|
|
||||||
<p>one <a href="#fnref1:a" rev="footnote" class="footnote-backref">↩</a></p>
|
|
||||||
</li>
|
|
||||||
<li id="fn:b">
|
|
||||||
<p>two <a href="#fnref1:b" rev="footnote" class="footnote-backref">↩</a></p>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
first [^1] second [^2].
|
|
||||||
|
|
||||||
[^1]: one
|
|
||||||
[^2]: two
|
|
||||||
|
|
||||||
first [^a] second [^b].
|
|
||||||
|
|
||||||
[^a]: one
|
|
||||||
[^b]: two
|
|
||||||
|
|
||||||
second time [^1]
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<div class="example">
|
|
||||||
<p><em>markdown</em></p>
|
|
||||||
<p>This is another paragraph. It contains <em>inline markup</em>.</p>
|
|
||||||
<div>
|
|
||||||
_no markdown_
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<div>
|
|
||||||
<p><em>markdown</em></p>
|
|
||||||
<div>
|
|
||||||
<p><em>markdown</em></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<div>
|
|
||||||
_no markdown_
|
|
||||||
<div>
|
|
||||||
<p><em>markdown</em></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<div markdown="0">
|
|
||||||
_no markdown_
|
|
||||||
</div>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<div class="example" markdown="1">
|
|
||||||
_markdown_
|
|
||||||
|
|
||||||
This is another paragraph. It contains <em>inline markup</em>.
|
|
||||||
<div>
|
|
||||||
_no markdown_
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<div markdown="1">
|
|
||||||
_markdown_
|
|
||||||
<div markdown="1">
|
|
||||||
_markdown_
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<div>
|
|
||||||
_no markdown_
|
|
||||||
<div markdown="1">
|
|
||||||
_markdown_
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<div markdown="0">
|
|
||||||
_no markdown_
|
|
||||||
</div>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<h1 id="header1">Header 1</h1>
|
|
||||||
<h2 id="header2">Header 2</h2>
|
|
||||||
<h2 class="main">The Site</h2>
|
|
||||||
<h2 id="the-site" class="main shine">The Site</h2>
|
|
||||||
<p><a href="http://parsedown.org" id="link" class="primary upper-case">link</a></p>
|
|
||||||
<p><img src="/md.png" alt="logo" id="logo" class="big" /></p>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
Header 1 {#header1}
|
|
||||||
========
|
|
||||||
|
|
||||||
## Header 2 ## {#header2}
|
|
||||||
|
|
||||||
## The Site ## {.main}
|
|
||||||
|
|
||||||
## The Site ## {.main .shine #the-site}
|
|
||||||
|
|
||||||
[link](http://parsedown.org) {.primary #link .upper-case}
|
|
||||||
|
|
||||||
 {#logo .big}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
on:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
phpunit:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
php:
|
|
||||||
- '7.1'
|
|
||||||
- '7.2'
|
|
||||||
- '7.3'
|
|
||||||
- '7.4'
|
|
||||||
- '8.0'
|
|
||||||
- '8.1'
|
|
||||||
- '8.2'
|
|
||||||
- '8.3'
|
|
||||||
- '8.4'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout the source code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '${{ matrix.php }}'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: composer install
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: |
|
|
||||||
vendor/bin/phpunit
|
|
||||||
vendor/bin/phpunit test/CommonMarkTestWeak.php || true
|
|
||||||
20
vendor/erusev/parsedown/LICENSE.txt
vendored
20
vendor/erusev/parsedown/LICENSE.txt
vendored
@@ -1,20 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2013-2018 Emanuil Rusev, erusev.com
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
1995
vendor/erusev/parsedown/Parsedown.php
vendored
1995
vendor/erusev/parsedown/Parsedown.php
vendored
File diff suppressed because it is too large
Load Diff
98
vendor/erusev/parsedown/README.md
vendored
98
vendor/erusev/parsedown/README.md
vendored
@@ -1,98 +0,0 @@
|
|||||||
# Parsedown
|
|
||||||
|
|
||||||
[](https://packagist.org/packages/erusev/parsedown)
|
|
||||||
[](https://packagist.org/packages/erusev/parsedown)
|
|
||||||
[](https://packagist.org/packages/erusev/parsedown)
|
|
||||||
|
|
||||||
Better Markdown Parser in PHP — <a href="https://parsedown.org/demo">demo</a>
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- One file
|
|
||||||
- No dependencies
|
|
||||||
- [Super fast](http://parsedown.org/speed)
|
|
||||||
- Extensible
|
|
||||||
- [GitHub flavored](https://github.github.com/gfm)
|
|
||||||
- [Tested](http://parsedown.org/tests/) in PHP 7.1+
|
|
||||||
- [Markdown Extra extension](https://github.com/erusev/parsedown-extra)
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Install the [composer package]:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
composer require erusev/parsedown
|
|
||||||
```
|
|
||||||
|
|
||||||
Or download the [latest release] and include `Parsedown.php`
|
|
||||||
|
|
||||||
[composer package]: https://packagist.org/packages/erusev/parsedown "The Parsedown package on packagist.org"
|
|
||||||
[latest release]: https://github.com/erusev/parsedown/releases/latest "The latest release of Parsedown"
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```php
|
|
||||||
$Parsedown = new Parsedown();
|
|
||||||
|
|
||||||
echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also parse inline markdown only:
|
|
||||||
|
|
||||||
```php
|
|
||||||
echo $Parsedown->line('Hello _Parsedown_!'); # prints: Hello <em>Parsedown</em>!
|
|
||||||
```
|
|
||||||
|
|
||||||
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
|
|
||||||
|
|
||||||
## Security
|
|
||||||
|
|
||||||
Parsedown is capable of escaping user-input within the HTML that it generates. Additionally Parsedown will apply sanitisation to additional scripting vectors (such as scripting link destinations) that are introduced by the markdown syntax itself.
|
|
||||||
|
|
||||||
To tell Parsedown that it is processing untrusted user-input, use the following:
|
|
||||||
|
|
||||||
```php
|
|
||||||
$Parsedown->setSafeMode(true);
|
|
||||||
```
|
|
||||||
|
|
||||||
If instead, you wish to allow HTML within untrusted user-input, but still want output to be free from XSS it is recommended that you make use of a HTML sanitiser that allows HTML tags to be whitelisted, like [HTML Purifier](http://htmlpurifier.org/).
|
|
||||||
|
|
||||||
In both cases you should strongly consider employing defence-in-depth measures, like [deploying a Content-Security-Policy](https://scotthelme.co.uk/content-security-policy-an-introduction/) (a browser security feature) so that your page is likely to be safe even if an attacker finds a vulnerability in one of the first lines of defence above.
|
|
||||||
|
|
||||||
Safe mode does not necessarily yield safe results when using extensions to Parsedown. Extensions should be evaluated on their own to determine their specific safety against XSS.
|
|
||||||
|
|
||||||
## Escaping HTML
|
|
||||||
|
|
||||||
> WARNING: This method is not safe from XSS!
|
|
||||||
|
|
||||||
If you wish to escape HTML in trusted input, you can use the following:
|
|
||||||
|
|
||||||
```php
|
|
||||||
$Parsedown->setMarkupEscaped(true);
|
|
||||||
```
|
|
||||||
|
|
||||||
Beware that this still allows users to insert unsafe scripting vectors, ex: `[xss](javascript:alert%281%29)`.
|
|
||||||
|
|
||||||
## Questions
|
|
||||||
|
|
||||||
**How does Parsedown work?**
|
|
||||||
|
|
||||||
It tries to read Markdown like a human. First, it looks at the lines. It’s interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines).
|
|
||||||
|
|
||||||
We call this approach "line based". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages.
|
|
||||||
|
|
||||||
**Is it compliant with CommonMark?**
|
|
||||||
|
|
||||||
It passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve.
|
|
||||||
|
|
||||||
**Who uses it?**
|
|
||||||
|
|
||||||
[Laravel Framework](https://laravel.com/), [Bolt CMS](http://bolt.cm/), [Grav CMS](http://getgrav.org/), [Herbie CMS](http://www.getherbie.org/), [Kirby CMS](http://getkirby.com/), [October CMS](http://octobercms.com/), [Pico CMS](http://picocms.org), [Statamic CMS](http://www.statamic.com/), [phpDocumentor](http://www.phpdoc.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony Demo](https://github.com/symfony/demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents).
|
|
||||||
|
|
||||||
**How can I help?**
|
|
||||||
|
|
||||||
Use it, star it, share it and if you feel generous, [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).
|
|
||||||
|
|
||||||
**What else should I know?**
|
|
||||||
|
|
||||||
I also make [Nota](https://nota.md/) — a notes app designed for local Markdown files.
|
|
||||||
33
vendor/erusev/parsedown/composer.json
vendored
33
vendor/erusev/parsedown/composer.json
vendored
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "erusev/parsedown",
|
|
||||||
"description": "Parser for Markdown.",
|
|
||||||
"keywords": ["markdown", "parser"],
|
|
||||||
"homepage": "http://parsedown.org",
|
|
||||||
"type": "library",
|
|
||||||
"license": "MIT",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Emanuil Rusev",
|
|
||||||
"email": "hello@erusev.com",
|
|
||||||
"homepage": "http://erusev.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
"php": ">=7.1",
|
|
||||||
"ext-mbstring": "*"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^7.5|^8.5|^9.6"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {"Parsedown": ""}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-0": {
|
|
||||||
"TestParsedown": "test/",
|
|
||||||
"ParsedownTest": "test/",
|
|
||||||
"CommonMarkTest": "test/",
|
|
||||||
"CommonMarkTestWeak": "test/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
438
wiki/COPYRIGHT.md
Normal file
438
wiki/COPYRIGHT.md
Normal file
@@ -0,0 +1,438 @@
|
|||||||
|
Attribution-NonCommercial-ShareAlike 4.0 International
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||||
|
does not provide legal services or legal advice. Distribution of
|
||||||
|
Creative Commons public licenses does not create a lawyer-client or
|
||||||
|
other relationship. Creative Commons makes its licenses and related
|
||||||
|
information available on an "as-is" basis. Creative Commons gives no
|
||||||
|
warranties regarding its licenses, any material licensed under their
|
||||||
|
terms and conditions, or any related information. Creative Commons
|
||||||
|
disclaims all liability for damages resulting from their use to the
|
||||||
|
fullest extent possible.
|
||||||
|
|
||||||
|
Using Creative Commons Public Licenses
|
||||||
|
|
||||||
|
Creative Commons public licenses provide a standard set of terms and
|
||||||
|
conditions that creators and other rights holders may use to share
|
||||||
|
original works of authorship and other material subject to copyright
|
||||||
|
and certain other rights specified in the public license below. The
|
||||||
|
following considerations are for informational purposes only, are not
|
||||||
|
exhaustive, and do not form part of our licenses.
|
||||||
|
|
||||||
|
Considerations for licensors: Our public licenses are
|
||||||
|
intended for use by those authorized to give the public
|
||||||
|
permission to use material in ways otherwise restricted by
|
||||||
|
copyright and certain other rights. Our licenses are
|
||||||
|
irrevocable. Licensors should read and understand the terms
|
||||||
|
and conditions of the license they choose before applying it.
|
||||||
|
Licensors should also secure all rights necessary before
|
||||||
|
applying our licenses so that the public can reuse the
|
||||||
|
material as expected. Licensors should clearly mark any
|
||||||
|
material not subject to the license. This includes other CC-
|
||||||
|
licensed material, or material used under an exception or
|
||||||
|
limitation to copyright. More considerations for licensors:
|
||||||
|
wiki.creativecommons.org/Considerations_for_licensors
|
||||||
|
|
||||||
|
Considerations for the public: By using one of our public
|
||||||
|
licenses, a licensor grants the public permission to use the
|
||||||
|
licensed material under specified terms and conditions. If
|
||||||
|
the licensor's permission is not necessary for any reason--for
|
||||||
|
example, because of any applicable exception or limitation to
|
||||||
|
copyright--then that use is not regulated by the license. Our
|
||||||
|
licenses grant only permissions under copyright and certain
|
||||||
|
other rights that a licensor has authority to grant. Use of
|
||||||
|
the licensed material may still be restricted for other
|
||||||
|
reasons, including because others have copyright or other
|
||||||
|
rights in the material. A licensor may make special requests,
|
||||||
|
such as asking that all changes be marked or described.
|
||||||
|
Although not required by our licenses, you are encouraged to
|
||||||
|
respect those requests where reasonable. More considerations
|
||||||
|
for the public:
|
||||||
|
wiki.creativecommons.org/Considerations_for_licensees
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
|
||||||
|
Public License
|
||||||
|
|
||||||
|
By exercising the Licensed Rights (defined below), You accept and agree
|
||||||
|
to be bound by the terms and conditions of this Creative Commons
|
||||||
|
Attribution-NonCommercial-ShareAlike 4.0 International Public License
|
||||||
|
("Public License"). To the extent this Public License may be
|
||||||
|
interpreted as a contract, You are granted the Licensed Rights in
|
||||||
|
consideration of Your acceptance of these terms and conditions, and the
|
||||||
|
Licensor grants You such rights in consideration of benefits the
|
||||||
|
Licensor receives from making the Licensed Material available under
|
||||||
|
these terms and conditions.
|
||||||
|
|
||||||
|
|
||||||
|
Section 1 -- Definitions.
|
||||||
|
|
||||||
|
a. Adapted Material means material subject to Copyright and Similar
|
||||||
|
Rights that is derived from or based upon the Licensed Material
|
||||||
|
and in which the Licensed Material is translated, altered,
|
||||||
|
arranged, transformed, or otherwise modified in a manner requiring
|
||||||
|
permission under the Copyright and Similar Rights held by the
|
||||||
|
Licensor. For purposes of this Public License, where the Licensed
|
||||||
|
Material is a musical work, performance, or sound recording,
|
||||||
|
Adapted Material is always produced where the Licensed Material is
|
||||||
|
synched in timed relation with a moving image.
|
||||||
|
|
||||||
|
b. Adapter's License means the license You apply to Your Copyright
|
||||||
|
and Similar Rights in Your contributions to Adapted Material in
|
||||||
|
accordance with the terms and conditions of this Public License.
|
||||||
|
|
||||||
|
c. BY-NC-SA Compatible License means a license listed at
|
||||||
|
creativecommons.org/compatiblelicenses, approved by Creative
|
||||||
|
Commons as essentially the equivalent of this Public License.
|
||||||
|
|
||||||
|
d. Copyright and Similar Rights means copyright and/or similar rights
|
||||||
|
closely related to copyright including, without limitation,
|
||||||
|
performance, broadcast, sound recording, and Sui Generis Database
|
||||||
|
Rights, without regard to how the rights are labeled or
|
||||||
|
categorized. For purposes of this Public License, the rights
|
||||||
|
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||||
|
Rights.
|
||||||
|
|
||||||
|
e. Effective Technological Measures means those measures that, in the
|
||||||
|
absence of proper authority, may not be circumvented under laws
|
||||||
|
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||||
|
Treaty adopted on December 20, 1996, and/or similar international
|
||||||
|
agreements.
|
||||||
|
|
||||||
|
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||||
|
any other exception or limitation to Copyright and Similar Rights
|
||||||
|
that applies to Your use of the Licensed Material.
|
||||||
|
|
||||||
|
g. License Elements means the license attributes listed in the name
|
||||||
|
of a Creative Commons Public License. The License Elements of this
|
||||||
|
Public License are Attribution, NonCommercial, and ShareAlike.
|
||||||
|
|
||||||
|
h. Licensed Material means the artistic or literary work, database,
|
||||||
|
or other material to which the Licensor applied this Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
i. Licensed Rights means the rights granted to You subject to the
|
||||||
|
terms and conditions of this Public License, which are limited to
|
||||||
|
all Copyright and Similar Rights that apply to Your use of the
|
||||||
|
Licensed Material and that the Licensor has authority to license.
|
||||||
|
|
||||||
|
j. Licensor means the individual(s) or entity(ies) granting rights
|
||||||
|
under this Public License.
|
||||||
|
|
||||||
|
k. NonCommercial means not primarily intended for or directed towards
|
||||||
|
commercial advantage or monetary compensation. For purposes of
|
||||||
|
this Public License, the exchange of the Licensed Material for
|
||||||
|
other material subject to Copyright and Similar Rights by digital
|
||||||
|
file-sharing or similar means is NonCommercial provided there is
|
||||||
|
no payment of monetary compensation in connection with the
|
||||||
|
exchange.
|
||||||
|
|
||||||
|
l. Share means to provide material to the public by any means or
|
||||||
|
process that requires permission under the Licensed Rights, such
|
||||||
|
as reproduction, public display, public performance, distribution,
|
||||||
|
dissemination, communication, or importation, and to make material
|
||||||
|
available to the public including in ways that members of the
|
||||||
|
public may access the material from a place and at a time
|
||||||
|
individually chosen by them.
|
||||||
|
|
||||||
|
m. Sui Generis Database Rights means rights other than copyright
|
||||||
|
resulting from Directive 96/9/EC of the European Parliament and of
|
||||||
|
the Council of 11 March 1996 on the legal protection of databases,
|
||||||
|
as amended and/or succeeded, as well as other essentially
|
||||||
|
equivalent rights anywhere in the world.
|
||||||
|
|
||||||
|
n. You means the individual or entity exercising the Licensed Rights
|
||||||
|
under this Public License. Your has a corresponding meaning.
|
||||||
|
|
||||||
|
|
||||||
|
Section 2 -- Scope.
|
||||||
|
|
||||||
|
a. License grant.
|
||||||
|
|
||||||
|
1. Subject to the terms and conditions of this Public License,
|
||||||
|
the Licensor hereby grants You a worldwide, royalty-free,
|
||||||
|
non-sublicensable, non-exclusive, irrevocable license to
|
||||||
|
exercise the Licensed Rights in the Licensed Material to:
|
||||||
|
|
||||||
|
a. reproduce and Share the Licensed Material, in whole or
|
||||||
|
in part, for NonCommercial purposes only; and
|
||||||
|
|
||||||
|
b. produce, reproduce, and Share Adapted Material for
|
||||||
|
NonCommercial purposes only.
|
||||||
|
|
||||||
|
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||||
|
Exceptions and Limitations apply to Your use, this Public
|
||||||
|
License does not apply, and You do not need to comply with
|
||||||
|
its terms and conditions.
|
||||||
|
|
||||||
|
3. Term. The term of this Public License is specified in Section
|
||||||
|
6(a).
|
||||||
|
|
||||||
|
4. Media and formats; technical modifications allowed. The
|
||||||
|
Licensor authorizes You to exercise the Licensed Rights in
|
||||||
|
all media and formats whether now known or hereafter created,
|
||||||
|
and to make technical modifications necessary to do so. The
|
||||||
|
Licensor waives and/or agrees not to assert any right or
|
||||||
|
authority to forbid You from making technical modifications
|
||||||
|
necessary to exercise the Licensed Rights, including
|
||||||
|
technical modifications necessary to circumvent Effective
|
||||||
|
Technological Measures. For purposes of this Public License,
|
||||||
|
simply making modifications authorized by this Section 2(a)
|
||||||
|
(4) never produces Adapted Material.
|
||||||
|
|
||||||
|
5. Downstream recipients.
|
||||||
|
|
||||||
|
a. Offer from the Licensor -- Licensed Material. Every
|
||||||
|
recipient of the Licensed Material automatically
|
||||||
|
receives an offer from the Licensor to exercise the
|
||||||
|
Licensed Rights under the terms and conditions of this
|
||||||
|
Public License.
|
||||||
|
|
||||||
|
b. Additional offer from the Licensor -- Adapted Material.
|
||||||
|
Every recipient of Adapted Material from You
|
||||||
|
automatically receives an offer from the Licensor to
|
||||||
|
exercise the Licensed Rights in the Adapted Material
|
||||||
|
under the conditions of the Adapter's License You apply.
|
||||||
|
|
||||||
|
c. No downstream restrictions. You may not offer or impose
|
||||||
|
any additional or different terms or conditions on, or
|
||||||
|
apply any Effective Technological Measures to, the
|
||||||
|
Licensed Material if doing so restricts exercise of the
|
||||||
|
Licensed Rights by any recipient of the Licensed
|
||||||
|
Material.
|
||||||
|
|
||||||
|
6. No endorsement. Nothing in this Public License constitutes or
|
||||||
|
may be construed as permission to assert or imply that You
|
||||||
|
are, or that Your use of the Licensed Material is, connected
|
||||||
|
with, or sponsored, endorsed, or granted official status by,
|
||||||
|
the Licensor or others designated to receive attribution as
|
||||||
|
provided in Section 3(a)(1)(A)(i).
|
||||||
|
|
||||||
|
b. Other rights.
|
||||||
|
|
||||||
|
1. Moral rights, such as the right of integrity, are not
|
||||||
|
licensed under this Public License, nor are publicity,
|
||||||
|
privacy, and/or other similar personality rights; however, to
|
||||||
|
the extent possible, the Licensor waives and/or agrees not to
|
||||||
|
assert any such rights held by the Licensor to the limited
|
||||||
|
extent necessary to allow You to exercise the Licensed
|
||||||
|
Rights, but not otherwise.
|
||||||
|
|
||||||
|
2. Patent and trademark rights are not licensed under this
|
||||||
|
Public License.
|
||||||
|
|
||||||
|
3. To the extent possible, the Licensor waives any right to
|
||||||
|
collect royalties from You for the exercise of the Licensed
|
||||||
|
Rights, whether directly or through a collecting society
|
||||||
|
under any voluntary or waivable statutory or compulsory
|
||||||
|
licensing scheme. In all other cases the Licensor expressly
|
||||||
|
reserves any right to collect such royalties, including when
|
||||||
|
the Licensed Material is used other than for NonCommercial
|
||||||
|
purposes.
|
||||||
|
|
||||||
|
|
||||||
|
Section 3 -- License Conditions.
|
||||||
|
|
||||||
|
Your exercise of the Licensed Rights is expressly made subject to the
|
||||||
|
following conditions.
|
||||||
|
|
||||||
|
a. Attribution.
|
||||||
|
|
||||||
|
1. If You Share the Licensed Material (including in modified
|
||||||
|
form), You must:
|
||||||
|
|
||||||
|
a. retain the following if it is supplied by the Licensor
|
||||||
|
with the Licensed Material:
|
||||||
|
|
||||||
|
i. identification of the creator(s) of the Licensed
|
||||||
|
Material and any others designated to receive
|
||||||
|
attribution, in any reasonable manner requested by
|
||||||
|
the Licensor (including by pseudonym if
|
||||||
|
designated);
|
||||||
|
|
||||||
|
ii. a copyright notice;
|
||||||
|
|
||||||
|
iii. a notice that refers to this Public License;
|
||||||
|
|
||||||
|
iv. a notice that refers to the disclaimer of
|
||||||
|
warranties;
|
||||||
|
|
||||||
|
v. a URI or hyperlink to the Licensed Material to the
|
||||||
|
extent reasonably practicable;
|
||||||
|
|
||||||
|
b. indicate if You modified the Licensed Material and
|
||||||
|
retain an indication of any previous modifications; and
|
||||||
|
|
||||||
|
c. indicate the Licensed Material is licensed under this
|
||||||
|
Public License, and include the text of, or the URI or
|
||||||
|
hyperlink to, this Public License.
|
||||||
|
|
||||||
|
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||||
|
reasonable manner based on the medium, means, and context in
|
||||||
|
which You Share the Licensed Material. For example, it may be
|
||||||
|
reasonable to satisfy the conditions by providing a URI or
|
||||||
|
hyperlink to a resource that includes the required
|
||||||
|
information.
|
||||||
|
3. If requested by the Licensor, You must remove any of the
|
||||||
|
information required by Section 3(a)(1)(A) to the extent
|
||||||
|
reasonably practicable.
|
||||||
|
|
||||||
|
b. ShareAlike.
|
||||||
|
|
||||||
|
In addition to the conditions in Section 3(a), if You Share
|
||||||
|
Adapted Material You produce, the following conditions also apply.
|
||||||
|
|
||||||
|
1. The Adapter's License You apply must be a Creative Commons
|
||||||
|
license with the same License Elements, this version or
|
||||||
|
later, or a BY-NC-SA Compatible License.
|
||||||
|
|
||||||
|
2. You must include the text of, or the URI or hyperlink to, the
|
||||||
|
Adapter's License You apply. You may satisfy this condition
|
||||||
|
in any reasonable manner based on the medium, means, and
|
||||||
|
context in which You Share Adapted Material.
|
||||||
|
|
||||||
|
3. You may not offer or impose any additional or different terms
|
||||||
|
or conditions on, or apply any Effective Technological
|
||||||
|
Measures to, Adapted Material that restrict exercise of the
|
||||||
|
rights granted under the Adapter's License You apply.
|
||||||
|
|
||||||
|
|
||||||
|
Section 4 -- Sui Generis Database Rights.
|
||||||
|
|
||||||
|
Where the Licensed Rights include Sui Generis Database Rights that
|
||||||
|
apply to Your use of the Licensed Material:
|
||||||
|
|
||||||
|
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||||
|
to extract, reuse, reproduce, and Share all or a substantial
|
||||||
|
portion of the contents of the database for NonCommercial purposes
|
||||||
|
only;
|
||||||
|
|
||||||
|
b. if You include all or a substantial portion of the database
|
||||||
|
contents in a database in which You have Sui Generis Database
|
||||||
|
Rights, then the database in which You have Sui Generis Database
|
||||||
|
Rights (but not its individual contents) is Adapted Material,
|
||||||
|
including for purposes of Section 3(b); and
|
||||||
|
|
||||||
|
c. You must comply with the conditions in Section 3(a) if You Share
|
||||||
|
all or a substantial portion of the contents of the database.
|
||||||
|
|
||||||
|
For the avoidance of doubt, this Section 4 supplements and does not
|
||||||
|
replace Your obligations under this Public License where the Licensed
|
||||||
|
Rights include other Copyright and Similar Rights.
|
||||||
|
|
||||||
|
|
||||||
|
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||||
|
|
||||||
|
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||||
|
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||||
|
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||||
|
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||||
|
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||||
|
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||||
|
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||||
|
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||||
|
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||||
|
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||||
|
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||||
|
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||||
|
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||||
|
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||||
|
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||||
|
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||||
|
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||||
|
|
||||||
|
c. The disclaimer of warranties and limitation of liability provided
|
||||||
|
above shall be interpreted in a manner that, to the extent
|
||||||
|
possible, most closely approximates an absolute disclaimer and
|
||||||
|
waiver of all liability.
|
||||||
|
|
||||||
|
|
||||||
|
Section 6 -- Term and Termination.
|
||||||
|
|
||||||
|
a. This Public License applies for the term of the Copyright and
|
||||||
|
Similar Rights licensed here. However, if You fail to comply with
|
||||||
|
this Public License, then Your rights under this Public License
|
||||||
|
terminate automatically.
|
||||||
|
|
||||||
|
b. Where Your right to use the Licensed Material has terminated under
|
||||||
|
Section 6(a), it reinstates:
|
||||||
|
|
||||||
|
1. automatically as of the date the violation is cured, provided
|
||||||
|
it is cured within 30 days of Your discovery of the
|
||||||
|
violation; or
|
||||||
|
|
||||||
|
2. upon express reinstatement by the Licensor.
|
||||||
|
|
||||||
|
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||||
|
right the Licensor may have to seek remedies for Your violations
|
||||||
|
of this Public License.
|
||||||
|
|
||||||
|
c. For the avoidance of doubt, the Licensor may also offer the
|
||||||
|
Licensed Material under separate terms or conditions or stop
|
||||||
|
distributing the Licensed Material at any time; however, doing so
|
||||||
|
will not terminate this Public License.
|
||||||
|
|
||||||
|
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
|
||||||
|
Section 7 -- Other Terms and Conditions.
|
||||||
|
|
||||||
|
a. The Licensor shall not be bound by any additional or different
|
||||||
|
terms or conditions communicated by You unless expressly agreed.
|
||||||
|
|
||||||
|
b. Any arrangements, understandings, or agreements regarding the
|
||||||
|
Licensed Material not stated herein are separate from and
|
||||||
|
independent of the terms and conditions of this Public License.
|
||||||
|
|
||||||
|
|
||||||
|
Section 8 -- Interpretation.
|
||||||
|
|
||||||
|
a. For the avoidance of doubt, this Public License does not, and
|
||||||
|
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||||
|
conditions on any use of the Licensed Material that could lawfully
|
||||||
|
be made without permission under this Public License.
|
||||||
|
|
||||||
|
b. To the extent possible, if any provision of this Public License is
|
||||||
|
deemed unenforceable, it shall be automatically reformed to the
|
||||||
|
minimum extent necessary to make it enforceable. If the provision
|
||||||
|
cannot be reformed, it shall be severed from this Public License
|
||||||
|
without affecting the enforceability of the remaining terms and
|
||||||
|
conditions.
|
||||||
|
|
||||||
|
c. No term or condition of this Public License will be waived and no
|
||||||
|
failure to comply consented to unless expressly agreed to by the
|
||||||
|
Licensor.
|
||||||
|
|
||||||
|
d. Nothing in this Public License constitutes or may be interpreted
|
||||||
|
as a limitation upon, or waiver of, any privileges and immunities
|
||||||
|
that apply to the Licensor or You, including from the legal
|
||||||
|
processes of any jurisdiction or authority.
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Creative Commons is not a party to its public
|
||||||
|
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||||
|
its public licenses to material it publishes and in those instances
|
||||||
|
will be considered the “Licensor.” The text of the Creative Commons
|
||||||
|
public licenses is dedicated to the public domain under the CC0 Public
|
||||||
|
Domain Dedication. Except for the limited purpose of indicating that
|
||||||
|
material is shared under a Creative Commons public license or as
|
||||||
|
otherwise permitted by the Creative Commons policies published at
|
||||||
|
creativecommons.org/policies, Creative Commons does not authorize the
|
||||||
|
use of the trademark "Creative Commons" or any other trademark or logo
|
||||||
|
of Creative Commons without its prior written consent including,
|
||||||
|
without limitation, in connection with any unauthorized modifications
|
||||||
|
to any of its public licenses or any other arrangements,
|
||||||
|
understandings, or agreements concerning use of licensed material. For
|
||||||
|
the avoidance of doubt, this paragraph does not form part of the
|
||||||
|
public licenses.
|
||||||
|
|
||||||
|
Creative Commons may be contacted at creativecommons.org.
|
||||||
|
|
||||||
10
wiki/README.md
Normal file
10
wiki/README.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# wiki tylda.org
|
||||||
|
każdy artykuł posiada na początku wartości:
|
||||||
|
|
||||||
|
title [nazwa twojego artykułu]
|
||||||
|
|
||||||
|
authors: [twoja nazwa na tyldzie]
|
||||||
|
|
||||||
|
category: [tylda, poradniki, technologia, linki]
|
||||||
|
|
||||||
|
po utworzeniu nowego artykułu utwórz PR'a lub wyślij patcha mailem.
|
||||||
@@ -1,60 +1,67 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include '../header.php';
|
include '../header.php';
|
||||||
|
include '../parsedown/Parsedown.php';
|
||||||
|
include '../parsedown-extra/ParsedownExtra.php';
|
||||||
|
|
||||||
|
$Parsedown = new Parsedown();
|
||||||
|
$Parsedown->setMarkupEscaped(true);
|
||||||
|
$Extra = new ParsedownExtra();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<pre class="ascii">
|
|
||||||
/$$$$$$$$ /$$ /$$ /$$ /$$ /$$ /$$ /$$
|
|
||||||
|__ $$__/ | $$ | $$ | $$ /$ | $$|__/| $$ |__/
|
|
||||||
| $$ /$$ /$$| $$ /$$$$$$$ /$$$$$$ | $$ /$$$| $$ /$$| $$ /$$ /$$
|
|
||||||
| $$| $$ | $$| $$ /$$__ $$ |____ $$ | $$/$$ $$ $$| $$| $$ /$$/| $$
|
|
||||||
| $$| $$ | $$| $$| $$ | $$ /$$$$$$$ | $$$$_ $$$$| $$| $$$$$$/ | $$
|
|
||||||
| $$| $$ | $$| $$| $$ | $$ /$$__ $$ | $$$/ \ $$$| $$| $$_ $$ | $$
|
|
||||||
| $$| $$$$$$$| $$| $$$$$$$| $$$$$$$ | $$/ \ $$| $$| $$ \ $$| $$
|
|
||||||
|__/ \____ $$|__/ \_______/ \_______/ |__/ \__/|__/|__/ \__/|__/
|
|
||||||
/$$ | $$
|
|
||||||
| $$$$$$/
|
|
||||||
\______/
|
|
||||||
</pre>
|
|
||||||
<i style="margin-bottom: 2rem;"><?php echo $slogan; ?></i>
|
|
||||||
<div id="top-bar">
|
<div id="top-bar">
|
||||||
<h1>> Wiki</h1>
|
<h1>> Wiki</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<article id="content">
|
<article id="content">
|
||||||
<i>Wiki jest aktualnie w trakcie tworzenia, poniżej znajdziesz najważniejsze informacje, które przydadzą Ci się na starcie ;)</i><br />
|
<p>Artykuły na naszej wiki:</p>
|
||||||
<h2>Poruszanie się po systemie</h2>
|
|
||||||
<p>Po zalogowaniu domyślnie będziesz mieć otwartą sesję TMUX z trzema zakładkami: <b>Mail (neomutt)</b>, <b>IRC (weechat)</b> oraz <b>shell</b> i kilkoma keybindami.</p>
|
|
||||||
<p>Keybindy, które mogą Ci się tu przydać to:</p>
|
|
||||||
<ul>
|
|
||||||
<li><b>F1</b> - przejście do karty pierwszej (mail)</li>
|
|
||||||
<li><b>F2</b> - przejście do karty drugiej (IRC)</li>
|
|
||||||
<li><b>F3</b> - przejście do karty trzeciej (shell)</li>
|
|
||||||
<li><b>F12</b> - zamknięcie sesji TMUX i wylogowanie (domyślnie)</li>
|
|
||||||
</ul>
|
|
||||||
<p>Możesz oczywiście dostosować całość do siebie, konfiguracja keybinów jest dostępna w twoim katalogu domowym w pliku <b>.tmux.conf</b></p>
|
|
||||||
<p>Jeśli chodzi o Weechat (IRC), najważniejsze, co musisz znać to <b>Alt + 1-9</b>, żeby poruszać się po kanałach :)</p><br /><br />
|
|
||||||
<h2>Usługi publiczne</h2>
|
|
||||||
<p>Domyślnie dla twojego konta uruchomiona jest strona internetowa na protokole HTTPS pod linkiem: <b>tylda.org/~username</b>. Pliki tejże strony możesz śmiało edytować, usuwać i robić z nimi co chcesz. Strona jest w twoim katalogu domowym pod <i>public_html</i>.</p>
|
|
||||||
<p>Dodatkowo dla każdego jest również uruchomiona kapsuła gemini dostępna pod linkiem: <b>gemini://tylda.org/~username</b>. Pliki kapsuły są dla ciebie dostępne w katalogu domowym pod <i>public_gemini</i>.</p><br /><br />
|
|
||||||
<h2>Git</h2>
|
|
||||||
<p>Na ten moment publiczna rejestracja na gitea jest wyłączona, boty się rejestrowały. Natomiast każdemu, kto chce założyć swoje repo lub wspomóc nas przy tworzeniu projektu zachęcam do kontaktu na mail/IRC z <b>v0id1st</b> lub <b>smoorg</b>, założymy bez problemu.</p>
|
|
||||||
|
|
||||||
<h2>Webring</h2>
|
|
||||||
<p>Webring jest prostym mechanizmem "skakania" po stronach użytkowników tylda.org. Każde konto jest domyślnie dodane do webringa, jeśli chcesz usunąć swoje to skaskuj plik <b>.webring</b> w swoim katalogu <b>public_html</b>.</p>
|
|
||||||
<p>Żeby dodać nawigację webring na swoją stronę, można przykładowo dorzucić taki HTML:</p>
|
|
||||||
<pre>
|
|
||||||
<?php
|
<?php
|
||||||
echo htmlspecialchars('
|
|
||||||
<nav class="webring">
|
$categories = ['tylda', 'poradniki', 'technologia', 'linki'];
|
||||||
<a href="https://tylda.org/webring/?action=prev">← poprzedni</a>
|
$category_to_articles = [];
|
||||||
<a href="https://tylda.org/webring/?action=random">losowy</a>
|
|
||||||
<a href="https://tylda.org/webring/?action=next">następny →</a>
|
foreach (glob("source/*.md") as $file)
|
||||||
</nav>
|
{
|
||||||
');
|
$article = basename($file, ".md");
|
||||||
|
$title = preg_match("/title: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : $article;
|
||||||
|
$title = ucfirst($title);
|
||||||
|
$category = preg_match("/category: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : 'default';
|
||||||
|
|
||||||
|
if (array_key_exists($category, $category_to_articles))
|
||||||
|
array_push($category_to_articles[$category], [$article, $title]);
|
||||||
|
else
|
||||||
|
$category_to_articles[$category] = [[$article, $title]];
|
||||||
|
|
||||||
|
ksort($category_to_articles);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($categories as $category)
|
||||||
|
{
|
||||||
|
echo '<b> > '.ucwords($category).'</b>';
|
||||||
|
echo '<ul>';
|
||||||
|
|
||||||
|
$article_titles = [];
|
||||||
|
$article_names = [];
|
||||||
|
|
||||||
|
foreach ($category_to_articles[$category] as $article)
|
||||||
|
{
|
||||||
|
array_push($article_names, $article[0]);
|
||||||
|
array_push($article_titles, $article[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$name_to_title = array_combine($article_names, $article_titles);
|
||||||
|
asort($name_to_title);
|
||||||
|
|
||||||
|
foreach ($name_to_title as $name => $title)
|
||||||
|
echo '<li><a href="/wiki/page.php?article='.$name.'">'.$title.'</a></li>';
|
||||||
|
echo '</ul><br>';
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</pre>
|
|
||||||
<p>Linki będą działały automatycznie.</p>
|
<p>Artykuły są publiczne pod licencją <a href=./COPYRIGHT.md>CC BY-NC-SA 4.0</a>.</p>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
42
wiki/page.php
Normal file
42
wiki/page.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
include '../header.php';
|
||||||
|
include '../parsedown/Parsedown.php';
|
||||||
|
include '../parsedown-extra/ParsedownExtra.php';
|
||||||
|
|
||||||
|
$Parsedown = new Parsedown();
|
||||||
|
$Parsedown->setMarkupEscaped(true);
|
||||||
|
$Extra = new ParsedownExtra();
|
||||||
|
|
||||||
|
$article = $_GET['article'] ?? '';
|
||||||
|
$article = basename($article);
|
||||||
|
|
||||||
|
$path = __DIR__ . "/source/{$article}.md";
|
||||||
|
if (!is_file($path)) {
|
||||||
|
http_response_code(404);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$raw = file_get_contents($path);
|
||||||
|
|
||||||
|
$title = preg_match("/^title:\s*(.*)$/mi", $raw, $m) ? trim($m[1]) : ucfirst($article);
|
||||||
|
$authors = preg_match("/^authors:\s*(.*)$/mi", $raw, $m) ? trim($m[1]) : ucfirst($article);
|
||||||
|
|
||||||
|
$body = preg_replace("/^(title|category|authors):[^\r\n]*\r?\n/m", "", $raw);
|
||||||
|
|
||||||
|
$html = $Extra->text($body);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="top-bar">
|
||||||
|
<h1>> <?php echo htmlspecialchars($title); ?></h1>
|
||||||
|
<p>osoby autorskie: <a href=/~<?php echo $authors ?>>~<?php echo $authors ?></a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article id="content">
|
||||||
|
<?php echo $html; ?>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include '../footer.php'
|
||||||
|
|
||||||
|
?>
|
||||||
5
wiki/source/cloud.md
Normal file
5
wiki/source/cloud.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
title: Cloud
|
||||||
|
authors: v0id1st
|
||||||
|
category: linki
|
||||||
|
|
||||||
|
Posiadamy własną instancję Nextcloud znajduje się pod adresem: [https://cloud.tylda.org/](https://cloud.tylda.org)
|
||||||
5
wiki/source/gitea.md
Normal file
5
wiki/source/gitea.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
title: Gitea
|
||||||
|
authors: v0id1st
|
||||||
|
category: tylda
|
||||||
|
|
||||||
|
Na ten moment publiczna rejestracja na gitea jest wyłączona, boty się rejestrowały. Natomiast każdemu, kto chce założyć swoje repo lub wspomóc nas przy tworzeniu projektu zachęcam do kontaktu na mail/IRC z <b>v0id1st</b> lub <b>smoorg</b>, założymy bez problemu.
|
||||||
17
wiki/source/moving.md
Normal file
17
wiki/source/moving.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
title: Poruszanie się po systemie
|
||||||
|
authors: v0id1st
|
||||||
|
category: tylda
|
||||||
|
|
||||||
|
Po zalogowaniu domyślnie będziesz mieć otwartą sesję TMUX z trzema zakładkami: Mail (neomutt), IRC (weechat) oraz shell i kilkoma keybindami.
|
||||||
|
|
||||||
|
Keybindy, które mogą Ci się tu przydać to:
|
||||||
|
|
||||||
|
F1 - przejście do karty pierwszej (mail)
|
||||||
|
F2 - przejście do karty drugiej (IRC)
|
||||||
|
F3 - przejście do karty trzeciej (shell)
|
||||||
|
F12 - zamknięcie sesji TMUX i wylogowanie (domyślnie)
|
||||||
|
Możesz oczywiście dostosować całość do siebie, konfiguracja keybinów jest dostępna w twoim katalogu domowym w pliku .tmux.conf
|
||||||
|
|
||||||
|
Jeśli chodzi o Weechat (IRC), najważniejsze, co musisz znać to Alt + 1-9, żeby poruszać się po kanałach :)
|
||||||
|
|
||||||
|
|
||||||
7
wiki/source/public_services.md
Normal file
7
wiki/source/public_services.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
title: Usługi publiczne
|
||||||
|
authors: v0id1st
|
||||||
|
category: tylda
|
||||||
|
|
||||||
|
Domyślnie dla twojego konta uruchomiona jest strona internetowa na protokole HTTPS pod linkiem: tylda.org/~username. Pliki tejże strony możesz śmiało edytować, usuwać i robić z nimi co chcesz. Strona jest w twoim katalogu domowym pod public_html.
|
||||||
|
|
||||||
|
Dodatkowo dla każdego jest również uruchomiona kapsuła gemini dostępna pod linkiem: gemini://tylda.org/~username. Pliki kapsuły są dla ciebie dostępne w katalogu domowym pod public_gemini.
|
||||||
12
wiki/source/vim.md
Normal file
12
wiki/source/vim.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
title: Wprowadzenie do edytora Vim
|
||||||
|
authors: io
|
||||||
|
category: poradniki
|
||||||
|
|
||||||
|
`vim` to jest edytor tekstu, a w sumie klon edytora `vi`. `vim` posiada własną licencję tzw. Vim License, jest to licensja Charityware kompatybilna z GPL.
|
||||||
|
Dodam, że to bardzo powszechny program w tych kręgach :)
|
||||||
|
|
||||||
|
### Tryby Pracy
|
||||||
|
`vim` jako edytor modalny używa trybów pracy. Takich trybów jest wiele ale z praktycznych powodów omawiam parę z nich.
|
||||||
|
Po uruchomieniu edytora poprzez komendę `vim` wrzuca nas w domyślny - NORMAL. Aby wprowadzić tekst można wcisnąć klawisz `Insert` lub małą literę `i`. Edytor wskaże, że obecny tryb jako INSERT tym samym jesteśmy w stanie wprowadzać tekst. Aby opuścić tryb INSERT należy wsciśnać `Esc`, lub też `C-c` albo `C-[`, zakładając że nam się śpieszy.
|
||||||
|
Inny tryb VISUAL to tryb w którym możemy zaznaczyć pole tekstu i ewentualnie potem nim manipulować. W tryb można wejść poprzez wciśnięcie małej litery `v`.
|
||||||
|
Jest też tryb REPLACE
|
||||||
14
wiki/source/webring.md
Normal file
14
wiki/source/webring.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
title: webring
|
||||||
|
authors: v0id1st
|
||||||
|
category: technologia
|
||||||
|
|
||||||
|
Webring jest prostym mechanizmem "skakania" po stronach użytkowników tylda.org. Każde konto jest domyślnie dodane do webringa, jeśli chcesz usunąć swoje to skaskuj plik **.webring** w swoim katalogu **public_html**.
|
||||||
|
Żeby dodać nawigację webring na swoją stronę, można przykładowo dorzucić taki HTML:
|
||||||
|
```php
|
||||||
|
<nav class="webring">
|
||||||
|
<a href="https://tylda.org/webring/?action=prev">← poprzedni</a>
|
||||||
|
<a href="https://tylda.org/webring/?action=random">losowy</a>
|
||||||
|
<a href="https://tylda.org/webring/?action=next">następny →</a>
|
||||||
|
</nav>
|
||||||
|
```
|
||||||
|
Linki będą działały automatycznie.
|
||||||
Reference in New Issue
Block a user