Merge pull request #4231 from MrPetovan/bug/3639-fix-diaspora-lf-in-code-blocks

Fix Diaspora LF in code blocks/Move php-markdown to composer
pull/4238/head
Michael Vogel 2018-01-15 01:37:13 +01:00 committed by GitHub
commit 448ae08dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 666 additions and 539 deletions

View File

@ -20,7 +20,8 @@
"pear/Text_LanguageDetect": "1.*",
"pear-pear.php.net/Text_Highlighter": "*",
"paragonie/random_compat": "^2.0",
"smarty/smarty": "^3.1"
"smarty/smarty": "^3.1",
"michelf/php-markdown": "^1.7"
},
"repositories": [
{

55
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "40fc48f9b1e36f9f4960eb0ccf51a3c4",
"content-hash": "9eeabb43bd9f244c3e293ae6f4a33ffc",
"packages": [
{
"name": "defuse/php-encryption",
@ -159,6 +159,57 @@
],
"time": "2017-03-16T00:45:59+00:00"
},
{
"name": "michelf/php-markdown",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/michelf/php-markdown.git",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/1f51cc520948f66cd2af8cbc45a5ee175e774220",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-lib": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"Michelf": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Michel Fortin",
"email": "michel.fortin@michelf.ca",
"homepage": "https://michelf.ca/",
"role": "Developer"
},
{
"name": "John Gruber",
"homepage": "https://daringfireball.net/"
}
],
"description": "PHP Markdown",
"homepage": "https://michelf.ca/projects/php-markdown/",
"keywords": [
"markdown"
],
"time": "2016-10-29T18:58:20+00:00"
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.30",
@ -315,7 +366,7 @@
"license": [
"BSD-2-Clause"
],
"description": "This is a PHP implementation of \"getopt\" supporting both\nshort and long options."
"description": "This is a PHP implementation of "getopt" supporting both\nshort and long options."
},
{
"name": "pear-pear.php.net/PEAR",

View File

@ -1,14 +1,12 @@
<?php
use Friendica\App;
use Friendica\Content\Text\Markdown;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use League\HTMLToMarkdown\HtmlConverter;
require_once 'include/event.php';
require_once 'library/markdown.php';
require_once 'include/html2bbcode.php';
require_once 'include/bbcode.php';
@ -58,7 +56,7 @@ function diaspora2bb($s) {
// Escaping the hash tags
$s = preg_replace('/\#([^\s\#])/', '&#35;$1', $s);
$s = Markdown($s);
$s = Markdown::convert($s);
$regexp = "/@\{(?:([^\}]+?); )?([^\} ]+)\}/";
$s = preg_replace_callback($regexp, 'diaspora_mention2bb', $s);
@ -146,12 +144,16 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
// Extracting multi-line code blocks before the whitespace processing/code highlighter in bbcode()
$codeblocks = [];
$Text = preg_replace_callback('#\[code(?:=([^\]]*))?\](?=\n)(.*?)\[\/code\]#is',
function ($matches) use (&$codeblocks) {
$return = '#codeblock-' . count($codeblocks) . '#';
$prefix = '````' . $matches[1] . PHP_EOL;
$codeblocks[] = $prefix . trim($matches[2]) . PHP_EOL . '````';
$Text = preg_replace_callback("#\[code(?:=([^\]]*))?\](.*?)\[\/code\]#is",
function ($matches) use (&$codeblocks) {
$return = $matches[0];
if (strpos($matches[2], "\n") !== false) {
$return = '#codeblock-' . count($codeblocks) . '#';
$prefix = '````' . $matches[1] . PHP_EOL;
$codeblocks[] = $prefix . trim($matches[2]) . PHP_EOL . '````';
}
return $return;
}
, $Text);

View File

@ -95,7 +95,7 @@ function html2bbcode($message, $basepath = '')
if ($matches[1] != '') {
$prefix = '[code=' . $matches[1] . ']';
}
$codeblocks[] = $prefix . $matches[2] . '[/code]';
$codeblocks[] = $prefix . trim($matches[2]) . '[/code]';
return $return;
},
$message
@ -247,6 +247,7 @@ function html2bbcode($message, $basepath = '')
node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]');
node2bbcode($doc, 'key', array(), '[code]', '[/code]');
node2bbcode($doc, 'code', array(), '[code]', '[/code]');
$message = $doc->saveHTML();

View File

@ -1,38 +0,0 @@
<?php
/**
* @file library/markdown.php
*
* @brief Parser for Markdown files
*/
require_once "library/php-markdown/Michelf/MarkdownExtra.inc.php";
use \Michelf\MarkdownExtra;
/**
* @brief This function parses a text using php-markdown library to render Markdown syntax to HTML
*
* This function is using the php-markdown library by Michel Fortin to parse a
* string ($text).It returns the rendered HTML code from that text. The optional
* $hardwrap parameter is used to switch between inserting hard breaks after
* every linefeed, which is required for Diaspora compatibility, or not. The
* later is used for parsing documentation and README.md files.
*
* @param string $text
* @param boolean $hardwrap
* @return string
*/
function Markdown($text, $hardwrap = true) {
$a = get_app();
$stamp1 = microtime(true);
$MarkdownParser = new MarkdownExtra();
$MarkdownParser->hard_wrap = $hardwrap;
$html = $MarkdownParser->transform($text);
$a->save_timestamp($stamp1, "parser");
return $html;
}

View File

@ -4,10 +4,12 @@
*
* @brief Friendica admin
*/
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\System;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
@ -1777,9 +1779,7 @@ function admin_page_plugins(App $a)
$readme = Null;
if (is_file("addon/$plugin/README.md")) {
require_once 'library/markdown.php';
$readme = file_get_contents("addon/$plugin/README.md");
$readme = Markdown($readme, false);
$readme = Markdown::convert(file_get_contents("addon/$plugin/README.md"), false);
} elseif (is_file("addon/$plugin/README")) {
$readme = "<pre>" . file_get_contents("addon/$plugin/README") . "</pre>";
}
@ -2028,9 +2028,7 @@ function admin_page_themes(App $a)
$readme = null;
if (is_file("view/theme/$theme/README.md")) {
require_once 'library/markdown.php';
$readme = file_get_contents("view/theme/$theme/README.md");
$readme = Markdown($readme, false);
$readme = Markdown::convert(file_get_contents("view/theme/$theme/README.md"), false);
} elseif (is_file("view/theme/$theme/README")) {
$readme = "<pre>" . file_get_contents("view/theme/$theme/README") . "</pre>";
}

View File

@ -1,11 +1,11 @@
<?php
use Friendica\App;
use Friendica\Content\Text\Markdown;
require_once 'include/bbcode.php';
require_once 'library/markdown.php';
require_once 'include/bb2diaspora.php';
require_once 'include/html2bbcode.php';
require_once 'include/pgettext.php';
function visible_lf($s)
{
@ -36,31 +36,31 @@ function babel_content()
$o .= visible_lf($text) . EOL . EOL;
$html = bbcode($text);
$o .= '<h2>' . t('bb2html (raw HTML): ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode (raw HTML): ') . '</h2>' . EOL . EOL;
$o .= htmlspecialchars($html) . EOL . EOL;
//$html = bbcode($text);
$o .= '<h2>' . t('bb2html: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL;
$bbcode = html2bbcode($html);
$o .= '<h2>' . t('bb2html2bb: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
$diaspora = bb2diaspora($text);
$o .= '<h2>' . t('bb2md: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bb2diaspora: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($diaspora) . EOL . EOL;
$html = Markdown($diaspora);
$o .= '<h2>' . t('bb2md2html: ') . '</h2>' . EOL . EOL;
$html = Markdown::convert($diaspora);
$o .= '<h2>' . t('bb2diaspora => Markdown: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL;
$bbcode = diaspora2bb($diaspora);
$o .= '<h2>' . t('bb2dia2bb: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bb2diaspora => diaspora2bb: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
$bbcode = html2bbcode($html);
$o .= '<h2>' . t('bb2md2html2bb: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
}

View File

@ -1,10 +1,9 @@
<?php
use Friendica\App;
use Friendica\Content\Text\Markdown;
use Friendica\Core\System;
require_once('library/markdown.php');
if (!function_exists('load_doc_file')) {
function load_doc_file($s) {
@ -50,7 +49,7 @@ function help_content(App $a) {
$filename = "Home";
$a->page['title'] = t('Help');
} else {
$a->page['aside'] = Markdown($home, false);
$a->page['aside'] = Markdown::convert($home, false);
}
if (!strlen($text)) {
@ -61,7 +60,7 @@ function help_content(App $a) {
));
}
$html = Markdown($text, false);
$html = Markdown::convert($text, false);
if ($filename !== "Home") {
// create TOC but not for home

View File

@ -0,0 +1,39 @@
<?php
/**
* @file src/Content/Text/Markdown.php
*/
namespace Friendica\Content\Text;
use Friendica\BaseObject;
use Michelf\MarkdownExtra;
/**
* Friendica-specific usage of Markdown
*
* @author Hypolite Petovan <mrpetovan@gmail.com>
*/
class Markdown extends BaseObject
{
/**
* Converts a Markdown string into HTML. The hardwrap parameter maximizes
* compatibility with Diaspora in spite of the Markdown standard.
*
* @brief Converts a Markdown string into HTML
* @param string $text
* @param bool $hardwrap
* @return string
*/
public static function convert($text, $hardwrap = true) {
$stamp1 = microtime(true);
$MarkdownParser = new MarkdownExtra();
$MarkdownParser->hard_wrap = $hardwrap;
$html = $MarkdownParser->transform($text);
self::getApp()->save_timestamp($stamp1, "parser");
return $html;
}
}

Binary file not shown.

View File

@ -379,9 +379,9 @@ class ClassLoader
$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) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}

View File

@ -22,6 +22,7 @@ return array(
'Friendica\\Core\\NotificationsManager' => $baseDir . '/src/Core/NotificationsManager.php',
'Friendica\\Core\\PConfig' => $baseDir . '/src/Core/PConfig.php',
'Friendica\\Core\\System' => $baseDir . '/src/Core/System.php',
'Friendica\\Core\\UserImport' => $baseDir . '/src/Core/UserImport.php',
'Friendica\\Core\\Worker' => $baseDir . '/src/Core/Worker.php',
'Friendica\\Database\\DBM' => $baseDir . '/src/Database/DBM.php',
'Friendica\\Database\\DBStructure' => $baseDir . '/src/Database/DBStructure.php',
@ -354,6 +355,9 @@ return array(
'League\\HTMLToMarkdown\\ElementInterface' => $vendorDir . '/league/html-to-markdown/src/ElementInterface.php',
'League\\HTMLToMarkdown\\Environment' => $vendorDir . '/league/html-to-markdown/src/Environment.php',
'League\\HTMLToMarkdown\\HtmlConverter' => $vendorDir . '/league/html-to-markdown/src/HtmlConverter.php',
'Michelf\\Markdown' => $vendorDir . '/michelf/php-markdown/Michelf/Markdown.php',
'Michelf\\MarkdownExtra' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownExtra.php',
'Michelf\\MarkdownInterface' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownInterface.php',
'Mobile_Detect' => $vendorDir . '/mobiledetect/mobiledetectlib/Mobile_Detect.php',
'OS_Guess' => $vendorDir . '/pear-pear.php.net/PEAR/OS/Guess.php',
'PEAR' => $vendorDir . '/pear-pear.php.net/PEAR/PEAR.php',

View File

@ -6,8 +6,8 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'8170285c807a9f24f165f37b15bc9a36' => $vendorDir . '/defuse/php-encryption/Crypto.php',
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'f084d01b0a599f67676cffef638aa95b' => $vendorDir . '/smarty/smarty/libs/bootstrap.php',
);

View File

@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
return array(
'Text' => array($vendorDir . '/pear/text_languagedetect'),
'Michelf' => array($vendorDir . '/michelf/php-markdown'),
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
'Detection' => array($vendorDir . '/mobiledetect/mobiledetectlib/namespaced'),
);

View File

@ -24,7 +24,7 @@ class ComposerAutoloaderInitFriendica
spl_autoload_unregister(array('ComposerAutoloaderInitFriendica', 'loadClassLoader'));
$includePaths = require __DIR__ . '/include_paths.php';
array_push($includePaths, get_include_path());
$includePaths[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $includePaths));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());

View File

@ -7,8 +7,8 @@ namespace Composer\Autoload;
class ComposerStaticInitFriendica
{
public static $files = array (
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'8170285c807a9f24f165f37b15bc9a36' => __DIR__ . '/..' . '/defuse/php-encryption/Crypto.php',
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
'f084d01b0a599f67676cffef638aa95b' => __DIR__ . '/..' . '/smarty/smarty/libs/bootstrap.php',
);
@ -43,6 +43,13 @@ class ComposerStaticInitFriendica
0 => __DIR__ . '/..' . '/pear/text_languagedetect',
),
),
'M' =>
array (
'Michelf' =>
array (
0 => __DIR__ . '/..' . '/michelf/php-markdown',
),
),
'H' =>
array (
'HTMLPurifier' =>
@ -76,6 +83,7 @@ class ComposerStaticInitFriendica
'Friendica\\Core\\NotificationsManager' => __DIR__ . '/../..' . '/src/Core/NotificationsManager.php',
'Friendica\\Core\\PConfig' => __DIR__ . '/../..' . '/src/Core/PConfig.php',
'Friendica\\Core\\System' => __DIR__ . '/../..' . '/src/Core/System.php',
'Friendica\\Core\\UserImport' => __DIR__ . '/../..' . '/src/Core/UserImport.php',
'Friendica\\Core\\Worker' => __DIR__ . '/../..' . '/src/Core/Worker.php',
'Friendica\\Database\\DBM' => __DIR__ . '/../..' . '/src/Database/DBM.php',
'Friendica\\Database\\DBStructure' => __DIR__ . '/../..' . '/src/Database/DBStructure.php',
@ -408,6 +416,9 @@ class ComposerStaticInitFriendica
'League\\HTMLToMarkdown\\ElementInterface' => __DIR__ . '/..' . '/league/html-to-markdown/src/ElementInterface.php',
'League\\HTMLToMarkdown\\Environment' => __DIR__ . '/..' . '/league/html-to-markdown/src/Environment.php',
'League\\HTMLToMarkdown\\HtmlConverter' => __DIR__ . '/..' . '/league/html-to-markdown/src/HtmlConverter.php',
'Michelf\\Markdown' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/Markdown.php',
'Michelf\\MarkdownExtra' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/MarkdownExtra.php',
'Michelf\\MarkdownInterface' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/MarkdownInterface.php',
'Mobile_Detect' => __DIR__ . '/..' . '/mobiledetect/mobiledetectlib/Mobile_Detect.php',
'OS_Guess' => __DIR__ . '/..' . '/pear-pear.php.net/PEAR/OS/Guess.php',
'PEAR' => __DIR__ . '/..' . '/pear-pear.php.net/PEAR/PEAR.php',

View File

@ -6,12 +6,12 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
$vendorDir . '/pear-pear.php.net/Console_Getopt',
$vendorDir . '/pear-pear.php.net/Structures_Graph',
$vendorDir . '/pear-pear.php.net/XML_Parser',
$vendorDir . '/pear-pear.php.net/Text_Highlighter',
$vendorDir . '/pear-pear.php.net/XML_Util',
$vendorDir . '/pear-pear.php.net/Archive_Tar',
$vendorDir . '/pear-pear.php.net/Console_Getopt',
$vendorDir . '/pear-pear.php.net/PEAR',
$vendorDir . '/pear-pear.php.net/Structures_Graph',
$vendorDir . '/pear-pear.php.net/Text_Highlighter',
$vendorDir . '/pear-pear.php.net/XML_Parser',
$vendorDir . '/pear-pear.php.net/XML_Util',
$vendorDir . '/pear/text_languagedetect',
);

View File

@ -1,4 +1,51 @@
[
{
"name": "defuse/php-encryption",
"version": "v1.2.1",
"version_normalized": "1.2.1.0",
"source": {
"type": "git",
"url": "https://github.com/defuse/php-encryption.git",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/defuse/php-encryption/zipball/b87737b2eec06b13f025cabea847338fa203d1b4",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4",
"shasum": ""
},
"require": {
"ext-mcrypt": "*",
"ext-openssl": "*",
"php": ">=5.4.0"
},
"time": "2015-03-14T20:27:45+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"Crypto.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Hornby",
"email": "havoc@defuse.ca"
}
],
"description": "Secure PHP Encryption Library",
"keywords": [
"aes",
"cipher",
"encryption",
"mcrypt",
"security"
]
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.7.0",
@ -45,134 +92,6 @@
"html"
]
},
{
"name": "pear-pear.php.net/Console_Getopt",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Console_Getopt-1.4.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/console_getopt": "== 1.4.1.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD-2-Clause"
],
"description": "This is a PHP implementation of \"getopt\" supporting both\nshort and long options."
},
{
"name": "pear-pear.php.net/Structures_Graph",
"version": "1.1.1",
"version_normalized": "1.1.1.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Structures_Graph-1.1.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.3.0.0"
},
"replace": {
"pear-pear/structures_graph": "== 1.1.1.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"LGPL-3.0+"
],
"description": "Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed\nand undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing\nas well as for characteristic extraction from the graph topology."
},
{
"name": "pear-pear.php.net/XML_Parser",
"version": "1.3.7",
"version_normalized": "1.3.7.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/XML_Parser-1.3.7.tgz",
"reference": null,
"shasum": null
},
"require": {
"pear-pear.php.net/pear": "*",
"php": ">=4.2.0.0"
},
"replace": {
"pear-pear/xml_parser": "== 1.3.7.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD License"
],
"description": "This is an XML parser based on PHPs built-in xml extension.\nIt supports two basic modes of operation: \"func\" and \"event\". In \"func\" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in \"event\" mode it uses a set of generic callbacks.\n\nSince version 1.2.0 there's a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements.\nFurthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it."
},
{
"name": "pear-pear.php.net/Text_Highlighter",
"version": "0.8.0",
"version_normalized": "0.8.0.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Text_Highlighter-0.8.0.tgz",
"reference": null,
"shasum": null
},
"require": {
"pear-pear.php.net/console_getopt": ">=1.4.1.0",
"pear-pear.php.net/pear": ">=1.10.3.0",
"pear-pear.php.net/xml_parser": ">=1.3.7.0",
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/text_highlighter": "== 0.8.0.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"PHP License"
],
"description": "Text_Highlighter is a package for syntax highlighting.\n\nIt provides a base class provining all the functionality,\nand a descendent classes geneator class.\n\nThe main idea is to simplify creation of subclasses\nimplementing syntax highlighting for particular language.\nSubclasses do not implement any new functioanality,\nthey just provide syntax highlighting rules.\nThe rules sources are in XML format.\n\nTo create a highlighter for a language, there is no need\nto code a new class manually. Simply describe the rules\nin XML file and use Text_Highlighter_Generator to create\na new class."
},
{
"name": "league/html-to-markdown",
"version": "4.4.1",
@ -240,250 +159,56 @@
]
},
{
"name": "pear-pear.php.net/XML_Util",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/XML_Util-1.4.3.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-pcre": "*",
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/xml_util": "== 1.4.3.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD License"
],
"description": "Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more."
},
{
"name": "pear-pear.php.net/Archive_Tar",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Archive_Tar-1.4.3.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.2.0.0"
},
"replace": {
"pear-pear/archive_tar": "== 1.4.3.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"New BSD License"
],
"description": "This class provides handling of tar files in PHP.\nIt supports creating, listing, extracting and adding to tar files.\nGzip support is available if PHP has the zlib extension built-in or\nloaded. Bz2 compression is also supported with the bz2 extension loaded."
},
{
"name": "pear-pear.php.net/PEAR",
"version": "1.10.5",
"version_normalized": "1.10.5.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/PEAR-1.10.5.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-pcre": "*",
"ext-xml": "*",
"pear-pear.php.net/archive_tar": ">=1.4.0.0",
"pear-pear.php.net/console_getopt": ">=1.4.1.0",
"pear-pear.php.net/structures_graph": ">=1.1.0.0",
"pear-pear.php.net/xml_util": ">=1.3.0.0",
"php": ">=5.4.0.0"
},
"conflict": {
"pear-pear.php.net/pear_frontend_gtk": "<0.4.0.0",
"pear-pear.php.net/pear_frontend_web": "<=0.4.0.0"
},
"replace": {
"pear-pear/pear": "== 1.10.5.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"New BSD License"
],
"description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n where PHP is running on\n * the System class for quick handling of common operations\n with files and directories\n * the PEAR base class\n Features in a nutshell:\n * full support for channels\n * pre-download dependency validation\n * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n * support for optional dependency groups and limited support for sub-packaging\n * robust dependency support\n * full dependency validation on uninstall\n * remote install for hosts with only ftp access - no more problems with\n restricted host installation\n * full support for mirroring\n * support for bundling several packages into a single tarball\n * support for static dependencies on a url-based package\n * support for custom file roles and installation tasks"
},
{
"name": "pear/text_languagedetect",
"version": "v1.0.0",
"version_normalized": "1.0.0.0",
"name": "michelf/php-markdown",
"version": "1.7.0",
"version_normalized": "1.7.0.0",
"source": {
"type": "git",
"url": "https://github.com/pear/Text_LanguageDetect.git",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6"
"url": "https://github.com/michelf/php-markdown.git",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Text_LanguageDetect/zipball/bb9ff6f4970f686fac59081e916b456021fe7ba6",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6",
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/1f51cc520948f66cd2af8cbc45a5ee175e774220",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "*"
"require": {
"php": ">=5.3.0"
},
"suggest": {
"ext-mbstring": "May require the mbstring PHP extension"
},
"time": "2017-03-02T16:14:08+00:00",
"time": "2016-10-29T18:58:20+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-lib": "1.4.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Text": "./"
"Michelf": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"./"
],
"license": [
"BSD-2-Clause"
"BSD-3-Clause"
],
"authors": [
{
"name": "Nicholas Pisarro",
"email": "taak@php.net",
"role": "Lead"
}
],
"description": "Identify human languages from text samples",
"homepage": "http://pear.php.net/package/Text_LanguageDetect"
},
{
"name": "defuse/php-encryption",
"version": "v1.2.1",
"version_normalized": "1.2.1.0",
"source": {
"type": "git",
"url": "https://github.com/defuse/php-encryption.git",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/defuse/php-encryption/zipball/b87737b2eec06b13f025cabea847338fa203d1b4",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4",
"shasum": ""
},
"require": {
"ext-mcrypt": "*",
"ext-openssl": "*",
"php": ">=5.4.0"
},
"time": "2015-03-14T20:27:45+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"Crypto.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
"name": "Michel Fortin",
"email": "michel.fortin@michelf.ca",
"homepage": "https://michelf.ca/",
"role": "Developer"
},
{
"name": "Taylor Hornby",
"email": "havoc@defuse.ca"
"name": "John Gruber",
"homepage": "https://daringfireball.net/"
}
],
"description": "Secure PHP Encryption Library",
"description": "PHP Markdown",
"homepage": "https://michelf.ca/projects/php-markdown/",
"keywords": [
"aes",
"cipher",
"encryption",
"mcrypt",
"security"
]
},
{
"name": "paragonie/random_compat",
"version": "v2.0.11",
"version_normalized": "2.0.11.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"time": "2017-09-27T21:40:39+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
"markdown"
]
},
{
@ -540,6 +265,334 @@
"php mobile detect"
]
},
{
"name": "paragonie/random_compat",
"version": "v2.0.11",
"version_normalized": "2.0.11.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"time": "2017-09-27T21:40:39+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
]
},
{
"name": "pear-pear.php.net/Archive_Tar",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Archive_Tar-1.4.3.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.2.0.0"
},
"replace": {
"pear-pear/archive_tar": "== 1.4.3.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"New BSD License"
],
"description": "This class provides handling of tar files in PHP.\nIt supports creating, listing, extracting and adding to tar files.\nGzip support is available if PHP has the zlib extension built-in or\nloaded. Bz2 compression is also supported with the bz2 extension loaded."
},
{
"name": "pear-pear.php.net/Console_Getopt",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Console_Getopt-1.4.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/console_getopt": "== 1.4.1.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD-2-Clause"
],
"description": "This is a PHP implementation of &quot;getopt&quot; supporting both\nshort and long options."
},
{
"name": "pear-pear.php.net/PEAR",
"version": "1.10.5",
"version_normalized": "1.10.5.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/PEAR-1.10.5.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-pcre": "*",
"ext-xml": "*",
"pear-pear.php.net/archive_tar": ">=1.4.0.0",
"pear-pear.php.net/console_getopt": ">=1.4.1.0",
"pear-pear.php.net/structures_graph": ">=1.1.0.0",
"pear-pear.php.net/xml_util": ">=1.3.0.0",
"php": ">=5.4.0.0"
},
"conflict": {
"pear-pear.php.net/pear_frontend_gtk": "<0.4.0.0",
"pear-pear.php.net/pear_frontend_web": "<=0.4.0.0"
},
"replace": {
"pear-pear/pear": "== 1.10.5.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"New BSD License"
],
"description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n where PHP is running on\n * the System class for quick handling of common operations\n with files and directories\n * the PEAR base class\n Features in a nutshell:\n * full support for channels\n * pre-download dependency validation\n * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n * support for optional dependency groups and limited support for sub-packaging\n * robust dependency support\n * full dependency validation on uninstall\n * remote install for hosts with only ftp access - no more problems with\n restricted host installation\n * full support for mirroring\n * support for bundling several packages into a single tarball\n * support for static dependencies on a url-based package\n * support for custom file roles and installation tasks"
},
{
"name": "pear-pear.php.net/Structures_Graph",
"version": "1.1.1",
"version_normalized": "1.1.1.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Structures_Graph-1.1.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.3.0.0"
},
"replace": {
"pear-pear/structures_graph": "== 1.1.1.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"LGPL-3.0+"
],
"description": "Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed\nand undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing\nas well as for characteristic extraction from the graph topology."
},
{
"name": "pear-pear.php.net/Text_Highlighter",
"version": "0.8.0",
"version_normalized": "0.8.0.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Text_Highlighter-0.8.0.tgz",
"reference": null,
"shasum": null
},
"require": {
"pear-pear.php.net/console_getopt": ">=1.4.1.0",
"pear-pear.php.net/pear": ">=1.10.3.0",
"pear-pear.php.net/xml_parser": ">=1.3.7.0",
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/text_highlighter": "== 0.8.0.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"PHP License"
],
"description": "Text_Highlighter is a package for syntax highlighting.\n\nIt provides a base class provining all the functionality,\nand a descendent classes geneator class.\n\nThe main idea is to simplify creation of subclasses\nimplementing syntax highlighting for particular language.\nSubclasses do not implement any new functioanality,\nthey just provide syntax highlighting rules.\nThe rules sources are in XML format.\n\nTo create a highlighter for a language, there is no need\nto code a new class manually. Simply describe the rules\nin XML file and use Text_Highlighter_Generator to create\na new class."
},
{
"name": "pear-pear.php.net/XML_Parser",
"version": "1.3.7",
"version_normalized": "1.3.7.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/XML_Parser-1.3.7.tgz",
"reference": null,
"shasum": null
},
"require": {
"pear-pear.php.net/pear": "*",
"php": ">=4.2.0.0"
},
"replace": {
"pear-pear/xml_parser": "== 1.3.7.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD License"
],
"description": "This is an XML parser based on PHPs built-in xml extension.\nIt supports two basic modes of operation: \"func\" and \"event\". In \"func\" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in \"event\" mode it uses a set of generic callbacks.\n\nSince version 1.2.0 there's a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements.\nFurthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it."
},
{
"name": "pear-pear.php.net/XML_Util",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/XML_Util-1.4.3.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-pcre": "*",
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/xml_util": "== 1.4.3.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD License"
],
"description": "Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more."
},
{
"name": "pear/text_languagedetect",
"version": "v1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/pear/Text_LanguageDetect.git",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Text_LanguageDetect/zipball/bb9ff6f4970f686fac59081e916b456021fe7ba6",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "*"
},
"suggest": {
"ext-mbstring": "May require the mbstring PHP extension"
},
"time": "2017-03-02T16:14:08+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Text": "./"
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"./"
],
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Nicholas Pisarro",
"email": "taak@php.net",
"role": "Lead"
}
],
"description": "Identify human languages from text samples",
"homepage": "http://pear.php.net/package/Text_LanguageDetect"
},
{
"name": "smarty/smarty",
"version": "v3.1.31",

View File

@ -61,14 +61,14 @@ class Markdown implements MarkdownInterface {
* @var int
*/
public $tab_width = 4;
/**
* Change to `true` to disallow markup or entities.
* @var boolean
*/
public $no_markup = false;
public $no_entities = false;
/**
* Change to `true` to enable line breaks on \n without two trailling spaces
@ -94,7 +94,7 @@ class Markdown implements MarkdownInterface {
* @var callable
*/
public $header_id_func = null;
/**
* Optional function for converting code block content to HTML
* @var callable
@ -111,7 +111,7 @@ class Markdown implements MarkdownInterface {
* Class attribute to toggle "enhanced ordered list" behaviour
* setting this to true will allow ordered lists to start from the index
* number that is defined first.
*
*
* For example:
* 2. List item two
* 3. List item three
@ -155,17 +155,17 @@ class Markdown implements MarkdownInterface {
public function __construct() {
$this->_initDetab();
$this->prepareItalicsAndBold();
$this->nested_brackets_re =
$this->nested_brackets_re =
str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth).
str_repeat('\])*', $this->nested_brackets_depth);
$this->nested_url_parenthesis_re =
$this->nested_url_parenthesis_re =
str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth).
str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth);
$this->escape_chars_re = '['.preg_quote($this->escape_chars).']';
// Sort document, block, and span gamut in ascendent priority order.
asort($this->document_gamut);
asort($this->block_gamut);
@ -180,13 +180,13 @@ class Markdown implements MarkdownInterface {
protected $urls = array();
protected $titles = array();
protected $html_hashes = array();
/**
* Status flag to avoid invalid nesting.
* @var boolean
*/
protected $in_anchor = false;
/**
* Called before the transformation process starts to setup parser states.
* @return void
@ -198,7 +198,7 @@ class Markdown implements MarkdownInterface {
$this->html_hashes = array();
$this->in_anchor = false;
}
/**
* Called after the transformation process to clear any variable which may
* be taking up memory unnecessarly.
@ -221,7 +221,7 @@ class Markdown implements MarkdownInterface {
*/
public function transform($text) {
$this->setup();
# Remove UTF-8 BOM and marker character in input, if present.
$text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text);
@ -248,7 +248,7 @@ class Markdown implements MarkdownInterface {
foreach ($this->document_gamut as $method => $priority) {
$text = $this->$method($text);
}
$this->teardown();
return $text . "\n";
@ -271,7 +271,7 @@ class Markdown implements MarkdownInterface {
* @return string
*/
protected function stripLinkDefinitions($text) {
$less_than_tab = $this->tab_width - 1;
// Link defs are in the form: ^[id]: url "optional title"
@ -338,8 +338,8 @@ class Markdown implements MarkdownInterface {
* for is hard-coded:
*
* * List "a" is made of tags which can be both inline or block-level.
* These will be treated block-level when the start tag is alone on
* its line, otherwise they're not matched here and will be taken as
* These will be treated block-level when the start tag is alone on
* its line, otherwise they're not matched here and will be taken as
* inline later.
* * List "b" is made of tags which are always block-level;
*/
@ -363,7 +363,7 @@ class Markdown implements MarkdownInterface {
|
\'[^\']*\' # text inside single quotes (tolerate ">")
)*
)?
)?
';
$content =
str_repeat('
@ -380,7 +380,7 @@ class Markdown implements MarkdownInterface {
str_repeat('
</\2\s*> # closing nested tag
)
|
|
<(?!/\2\s*> # other tags with a different name
)
)*',
@ -409,9 +409,9 @@ class Markdown implements MarkdownInterface {
)
( # save in $1
# Match from `\n<tag>` to `</tag>\n`, handling nested tags
# Match from `\n<tag>` to `</tag>\n`, handling nested tags
# in between.
[ ]{0,'.$less_than_tab.'}
<('.$block_tags_b_re.')# start tag = $2
'.$attr.'> # attributes followed by > and \n
@ -429,28 +429,28 @@ class Markdown implements MarkdownInterface {
</\3> # the matching end tag
[ ]* # trailing spaces/tabs
(?=\n+|\Z) # followed by a newline or end of document
| # Special case just for <hr />. It was easier to make a special
| # Special case just for <hr />. It was easier to make a special
# case than to make the other regex more complicated.
[ ]{0,'.$less_than_tab.'}
<(hr) # start tag = $2
'.$attr.' # attributes
/?> # the matching end tag
[ ]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
| # Special case for standalone HTML comments:
[ ]{0,'.$less_than_tab.'}
(?s:
<!-- .*? -->
)
[ ]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
| # PHP and ASP-style processor instructions (<? and <%)
[ ]{0,'.$less_than_tab.'}
(?s:
<([?%]) # $2
@ -459,7 +459,7 @@ class Markdown implements MarkdownInterface {
)
[ ]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
)
)}Sxmi',
array($this, '_hashHTMLBlocks_callback'),
@ -479,9 +479,9 @@ class Markdown implements MarkdownInterface {
$key = $this->hashBlock($text);
return "\n\n$key\n\n";
}
/**
* Called whenever a tag must be hashed when a function insert an atomic
* Called whenever a tag must be hashed when a function insert an atomic
* element in the text stream. Passing $text to through this function gives
* a unique text-token which will be reverted back when calling unhash.
*
@ -498,7 +498,7 @@ class Markdown implements MarkdownInterface {
// Swap back any tag hash found in $text so we do not have to `unhash`
// multiple times at the end.
$text = $this->unhash($text);
// Then hash the block.
static $i = 0;
$key = "$boundary\x1A" . ++$i . $boundary;
@ -531,10 +531,10 @@ class Markdown implements MarkdownInterface {
/**
* Run block gamut tranformations.
*
* We need to escape raw HTML in Markdown source before doing anything
* else. This need to be done for each block, and not only at the
* We need to escape raw HTML in Markdown source before doing anything
* else. This need to be done for each block, and not only at the
* begining in the Markdown function since hashed blocks can be part of
* list items and could have been indented. Indented blocks would have
* list items and could have been indented. Indented blocks would have
* been seen as a code block in a previous pass of hashHTMLBlocks.
*
* @param string $text
@ -546,7 +546,7 @@ class Markdown implements MarkdownInterface {
}
/**
* Run block gamut tranformations, without hashing HTML blocks. This is
* Run block gamut tranformations, without hashing HTML blocks. This is
* useful when HTML blocks are known to be already hashed, like in the first
* whole-document pass.
*
@ -554,11 +554,11 @@ class Markdown implements MarkdownInterface {
* @return string
*/
protected function runBasicBlockGamut($text) {
foreach ($this->block_gamut as $method => $priority) {
$text = $this->$method($text);
}
// Finally form paragraph and restore hashed blocks.
$text = $this->formParagraphs($text);
@ -582,7 +582,7 @@ class Markdown implements MarkdownInterface {
[ ]* # Tailing spaces
$ # End of line.
}mx',
"\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n",
"\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n",
$text
);
}
@ -629,10 +629,10 @@ class Markdown implements MarkdownInterface {
*/
protected function doHardBreaks($text) {
if ($this->hard_wrap) {
return preg_replace_callback('/ *\n/',
return preg_replace_callback('/ *\n/',
array($this, '_doHardBreaks_callback'), $text);
} else {
return preg_replace_callback('/ {2,}\n/',
return preg_replace_callback('/ {2,}\n/',
array($this, '_doHardBreaks_callback'), $text);
}
}
@ -656,7 +656,7 @@ class Markdown implements MarkdownInterface {
return $text;
}
$this->in_anchor = true;
// First, handle reference-style links: [link text] [id]
$text = preg_replace_callback('{
( # wrap whole match in $1
@ -729,7 +729,7 @@ class Markdown implements MarkdownInterface {
// for shortcut links like [this][] or [this].
$link_id = $link_text;
}
// lower-case and turn embedded newlines into spaces
$link_id = strtolower($link_id);
$link_id = preg_replace('{[ ]?\n}', ' ', $link_id);
@ -737,14 +737,14 @@ class Markdown implements MarkdownInterface {
if (isset($this->urls[$link_id])) {
$url = $this->urls[$link_id];
$url = $this->encodeURLAttribute($url);
$result = "<a href=\"$url\"";
if ( isset( $this->titles[$link_id] ) ) {
$title = $this->titles[$link_id];
$title = $this->encodeAttribute($title);
$result .= " title=\"$title\"";
}
$link_text = $this->runSpanGamut($link_text);
$result .= ">$link_text</a>";
$result = $this->hashPart($result);
@ -779,7 +779,7 @@ class Markdown implements MarkdownInterface {
$title = $this->encodeAttribute($title);
$result .= " title=\"$title\"";
}
$link_text = $this->runSpanGamut($link_text);
$result .= ">$link_text</a>";
@ -807,7 +807,7 @@ class Markdown implements MarkdownInterface {
\]
)
}xs',
}xs',
array($this, '_doImages_reference_callback'), $text);
// Next, handle inline images: ![alt text](url "optional title")
@ -906,7 +906,7 @@ class Markdown implements MarkdownInterface {
* Setext-style headers:
* Header 1
* ========
*
*
* Header 2
* --------
*/
@ -944,7 +944,7 @@ class Markdown implements MarkdownInterface {
if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1])) {
return $matches[0];
}
$level = $matches[2]{0} == '=' ? 1 : 2;
// ID attribute generation
@ -977,7 +977,7 @@ class Markdown implements MarkdownInterface {
* @param string $headerValue
* @return string
*/
protected function _generateIdFromHeaderValue($headerValue) {
protected function _generateIdFromHeaderValue($headerValue) {
if (!is_callable($this->header_id_func)) {
return "";
}
@ -1035,10 +1035,10 @@ class Markdown implements MarkdownInterface {
)
)
'; // mx
// We use a different prefix before nested lists than top-level lists.
//See extended comment in _ProcessListItems().
if ($this->list_level) {
$text = preg_replace_callback('{
^
@ -1132,7 +1132,7 @@ class Markdown implements MarkdownInterface {
* without resorting to mind-reading. Perhaps the solution is to
* change the syntax rules such that sub-lists must start with a
* starting cardinal number; e.g. "1." or "a.".
*/
*/
$this->list_level++;
// Trim trailing blank lines:
@ -1166,7 +1166,7 @@ class Markdown implements MarkdownInterface {
$marker_space = $matches[3];
$tailing_blank_line =& $matches[5];
if ($leading_line || $tailing_blank_line ||
if ($leading_line || $tailing_blank_line ||
preg_match('/\n{2,}/', $item))
{
// Replace marker with the appropriate whitespace indentation
@ -1273,7 +1273,7 @@ class Markdown implements MarkdownInterface {
* @var array
*/
protected $em_strong_prepared_relist;
/**
* Prepare regular expressions for searching emphasis tokens in any
* context.
@ -1289,7 +1289,7 @@ class Markdown implements MarkdownInterface {
}
$token_relist[] = $em_re;
$token_relist[] = $strong_re;
// Construct master expression from list.
$token_re = '{(' . implode('|', $token_relist) . ')}';
$this->em_strong_prepared_relist["$em$strong"] = $token_re;
@ -1308,19 +1308,19 @@ class Markdown implements MarkdownInterface {
$em = '';
$strong = '';
$tree_char_em = false;
while (1) {
// Get prepared regular expression for seraching emphasis tokens
// in current context.
$token_re = $this->em_strong_prepared_relist["$em$strong"];
// Each loop iteration search for the next emphasis token.
// Each loop iteration search for the next emphasis token.
// Each token is then passed to handleSpanToken.
$parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
$text_stack[0] .= $parts[0];
$token =& $parts[1];
$text =& $parts[2];
if (empty($token)) {
// Reached end of text span: empty stack without emitting.
// any more emphasis.
@ -1330,7 +1330,7 @@ class Markdown implements MarkdownInterface {
}
break;
}
$token_len = strlen($token);
if ($tree_char_em) {
// Reached closing marker while inside a three-char emphasis.
@ -1369,7 +1369,7 @@ class Markdown implements MarkdownInterface {
$$tag = ''; // $$tag stands for $em or $strong
}
} else {
// Reached opening three-char emphasis marker. Push on token
// Reached opening three-char emphasis marker. Push on token
// stack; will be handled by the special condition above.
$em = $token{0};
$strong = "$em$em";
@ -1453,9 +1453,9 @@ class Markdown implements MarkdownInterface {
$bq = $this->runBlockGamut($bq); // recurse
$bq = preg_replace('/^/m', " ", $bq);
// These leading spaces cause problem with <pre> content,
// These leading spaces cause problem with <pre> content,
// so we need to fix that:
$bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
$bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
array($this, '_doBlockQuotes_callback2'), $bq);
return "\n" . $this->hashBlock("<blockquote>\n$bq\n</blockquote>") . "\n\n";
@ -1525,7 +1525,7 @@ class Markdown implements MarkdownInterface {
// // We can't call Markdown(), because that resets the hash;
// // that initialization code should be pulled into its own sub, though.
// $div_content = $this->hashHTMLBlocks($div_content);
//
//
// // Run document gamut methods on the content.
// foreach ($this->document_gamut as $method => $priority) {
// $div_content = $this->$method($div_content);
@ -1582,9 +1582,9 @@ class Markdown implements MarkdownInterface {
return $url;
}
/**
* Smart processing for ampersands and angle brackets that need to
* Smart processing for ampersands and angle brackets that need to
* be encoded. Valid character entities are left alone unless the
* no-entities mode is set.
* @param string $text
@ -1596,7 +1596,7 @@ class Markdown implements MarkdownInterface {
} else {
// Ampersand-encoding based entirely on Nat Irons's Amputator
// MT plugin: <http://bumppo.net/projects/amputator/>
$text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
$text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
'&amp;', $text);
}
// Encode remaining <'s
@ -1724,7 +1724,7 @@ class Markdown implements MarkdownInterface {
*/
protected function parseSpan($str) {
$output = '';
$span_re = '{
(
\\\\'.$this->escape_chars_re.'
@ -1752,16 +1752,16 @@ class Markdown implements MarkdownInterface {
}xs';
while (1) {
// Each loop iteration seach for either the next tag, the next
// openning code span marker, or the next escaped character.
// Each loop iteration seach for either the next tag, the next
// openning code span marker, or the next escaped character.
// Each token is then passed to handleSpanToken.
$parts = preg_split($span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE);
// Create token from text preceding tag.
if ($parts[0] != "") {
$output .= $parts[0];
}
// Check if we reach the end.
if (isset($parts[1])) {
$output .= $this->handleSpanToken($parts[1], $parts[2]);
@ -1770,7 +1770,7 @@ class Markdown implements MarkdownInterface {
break;
}
}
return $output;
}
@ -1787,7 +1787,7 @@ class Markdown implements MarkdownInterface {
return $this->hashPart("&#". ord($token{1}). ";");
case "`":
// Search for end marker in remaining text.
if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',
if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',
$str, $matches))
{
$str = $matches[2];
@ -1823,11 +1823,11 @@ class Markdown implements MarkdownInterface {
* For each line we separate the line in blocks delemited by tab characters.
* Then we reconstruct every line by adding the appropriate number of space
* between each blocks.
*
*
* @param string $text
* @return string
*/
protected function detab($text) {
protected function detab($text) {
$text = preg_replace_callback('/^.*\t.*$/m',
array($this, '_detab_callback'), $text);
@ -1842,7 +1842,7 @@ class Markdown implements MarkdownInterface {
protected function _detab_callback($matches) {
$line = $matches[0];
$strlen = $this->utf8_strlen; // strlen function for UTF-8.
// Split in blocks.
$blocks = explode("\t", $line);
// Add each blocks to the line.
@ -1850,7 +1850,7 @@ class Markdown implements MarkdownInterface {
unset($blocks[0]); // Do not add first block twice.
foreach ($blocks as $block) {
// Calculate amount of space, insert spaces, insert block.
$amount = $this->tab_width -
$amount = $this->tab_width -
$strlen($line, 'UTF-8') % $this->tab_width;
$line .= str_repeat(" ", $amount) . $block;
}
@ -1859,19 +1859,19 @@ class Markdown implements MarkdownInterface {
/**
* Check for the availability of the function in the `utf8_strlen` property
* (initially `mb_strlen`). If the function is not available, create a
* (initially `mb_strlen`). If the function is not available, create a
* function that will loosely count the number of UTF-8 characters with a
* regular expression.
* @return void
*/
protected function _initDetab() {
if (function_exists($this->utf8_strlen)) {
return;
}
$this->utf8_strlen = create_function('$text', 'return preg_match_all(
"/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
"/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
$text, $m);');
}
@ -1881,7 +1881,7 @@ class Markdown implements MarkdownInterface {
* @return string
*/
protected function unhash($text) {
return preg_replace_callback('/(.)\x1A[0-9]+\1/',
return preg_replace_callback('/(.)\x1A[0-9]+\1/',
array($this, '_unhash_callback'), $text);
}

View File

@ -118,7 +118,7 @@ class MarkdownExtra extends \Michelf\Markdown {
protected $footnotes_ref_count = array();
protected $footnotes_numbers = array();
protected $abbr_desciptions = array();
/** @var string */
/** @var @string */
protected $abbr_word_re = '';
/**

View File

@ -192,7 +192,7 @@ PHP Markdown Lib 1.7.0 (29 Oct 2016)
code block equivalent, there is no syntax for specifying a language.
Credits to styxit for the implementation.
* Fixed a Markdown Extra issue where two-space-at-end-of-line hard breaks
* Fixed a Markdwon Extra issue where two-space-at-end-of-line hard breaks
wouldn't work inside of HTML block elements such as `<p markdown="1">`
where the element expects only span-level content.

View File

@ -22,5 +22,10 @@
},
"autoload": {
"psr-0": { "Michelf": "" }
},
"extra": {
"branch-alias": {
"dev-lib": "1.4.x-dev"
}
}
}

View File

@ -19,11 +19,11 @@ REM -------------------
REM Test to see if this is a raw pear.bat (uninstalled version)
SET TMPTMPTMPTMPT=@includ
SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
FOR %%x IN ("D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
FOR %%x IN ("D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
REM Check PEAR global ENV, set them if they do not exist
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR/bin"
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR/bin"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=/composer-php.bat"
GOTO :INSTALLED

View File

@ -25,11 +25,11 @@ REM -------------------
REM Test to see if this is a raw pear.bat (uninstalled version)
SET TMPTMPTMPTMPT=@includ
SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
FOR %%x IN ("D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
FOR %%x IN ("D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
REM Check PEAR global ENV, set them if they do not exist
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR/bin"
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR/bin"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=/composer-php.bat"
GOTO :INSTALLED

View File

@ -25,11 +25,11 @@ REM -------------------
REM Test to see if this is a raw pear.bat (uninstalled version)
SET TMPTMPTMPTMPT=@includ
SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
FOR %%x IN ("D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
FOR %%x IN ("D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
REM Check PEAR global ENV, set them if they do not exist
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR/bin"
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR/bin"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=/composer-php.bat"
GOTO :INSTALLED

View File

@ -26,8 +26,8 @@ define('PEAR_IGNORE_BACKTRACE', 1);
*/
//the space is needed for windows include paths with trailing backslash
// http://pear.php.net/bugs/bug.php?id=19482
if ('D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') {
ini_set('include_path', trim('D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR '). PATH_SEPARATOR . get_include_path());
if ('D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') {
ini_set('include_path', trim('D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR '). PATH_SEPARATOR . get_include_path());
$raw = false;
} else {
// this is a raw, uninstalled pear, either a cvs checkout, or php distro

View File

@ -20,8 +20,8 @@
*/
//the space is needed for windows include paths with trailing backslash
// http://pear.php.net/bugs/bug.php?id=19482
if ('D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') {
ini_set('include_path', trim('D:\Mes Projets\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR '). PATH_SEPARATOR . get_include_path());
if ('D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') {
ini_set('include_path', trim('D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/PEAR '). PATH_SEPARATOR . get_include_path());
$raw = false;
} else {
// this is a raw, uninstalled pear, either a cvs checkout, or php distro

View File

@ -26,7 +26,7 @@ shift
if -%1- == -- GOTO noshift
GOTO doshift
:noshift
/composer-php.bat -q -d output_buffering=1 -d include_path="D:\Mes Projets\Friendica\friendica\vendor/pear-pear.php.net/Text_Highlighter" D:\Mes Projets\Friendica\friendica\vendor/pear-pear.php.net/Text_Highlighter/bin/Text/Highlighter/generate.bat %MHL_PARAMS%
/composer-php.bat -q -d output_buffering=1 -d include_path="D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/Text_Highlighter" D:\Projects\Friendica\friendica\friendica\vendor/pear-pear.php.net/Text_Highlighter/bin/Text/Highlighter/generate.bat %MHL_PARAMS%
GOTO finish
<?php

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<ruleset name="PEAR-textlanguagedetect">
<rule ref="PEAR">
<!-- we keep the old php4-style variable names for now -->
<exclude name="PEAR.NamingConventions.ValidFunctionName.PublicUnderscore"/>
<exclude name="PEAR.NamingConventions.ValidVariableName.PublicUnderscore"/>
</rule>
</ruleset>
<?xml version="1.0"?>
<ruleset name="PEAR-textlanguagedetect">
<rule ref="PEAR">
<!-- we keep the old php4-style variable names for now -->
<exclude name="PEAR.NamingConventions.ValidFunctionName.PublicUnderscore"/>
<exclude name="PEAR.NamingConventions.ValidVariableName.PublicUnderscore"/>
</rule>
</ruleset>