From 27c3e6253f9a62a6bec67c0c28932987ed849afc Mon Sep 17 00:00:00 2001 From: Kanti Date: Thu, 8 Jan 2015 12:33:46 +0100 Subject: [PATCH] [TASK] update composer --- composer.json | 4 +- composer.lock | 16 ++- system/upgrade/run.php | 4 +- system/vendor/autoload.php | 2 +- system/vendor/composer/autoload_real.php | 10 +- system/vendor/composer/installed.json | 106 +++++++++--------- .../michelf/php-markdown/Michelf/Markdown.php | 120 ++++++++------------- .../php-markdown/Michelf/MarkdownInterface.php | 3 + system/vendor/michelf/php-markdown/Readme.md | 10 -- 9 files changed, 116 insertions(+), 159 deletions(-) diff --git a/composer.json b/composer.json index 964b96c..e737829 100644 --- a/composer.json +++ b/composer.json @@ -4,8 +4,8 @@ "optimize-autoloader": true }, "require": { - "michelf/php-markdown": "1.4.*@dev", - "suin/php-rss-writer": ">=1.0", + "michelf/php-markdown": "~1.4", + "suin/php-rss-writer": "~1", "kanti/hub-updater": "~0.3" }, "autoload": { diff --git a/composer.lock b/composer.lock index 12057b6..cf4e011 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "fd413dc0819094cfb73068fa24dc1cf0", + "hash": "93444ef16e9607df09bdc196135e9946", "packages": [ { "name": "kanti/hub-updater", @@ -46,16 +46,16 @@ }, { "name": "michelf/php-markdown", - "version": "dev-lib", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/michelf/php-markdown.git", - "reference": "1b5a30e13974b490964a1610bab5958e83cd4b69" + "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/1b5a30e13974b490964a1610bab5958e83cd4b69", - "reference": "1b5a30e13974b490964a1610bab5958e83cd4b69", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", + "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", "shasum": "" }, "require": { @@ -93,7 +93,7 @@ "keywords": [ "markdown" ], - "time": "2014-12-08 02:09:55" + "time": "2014-05-05 02:43:50" }, { "name": "suin/php-rss-writer", @@ -144,9 +144,7 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "michelf/php-markdown": 20 - }, + "stability-flags": [], "prefer-stable": false, "platform": [], "platform-dev": [] diff --git a/system/upgrade/run.php b/system/upgrade/run.php index 2d4ed76..c78e8f2 100644 --- a/system/upgrade/run.php +++ b/system/upgrade/run.php @@ -32,5 +32,5 @@ if (isGraterThan("2.3")) {// 2.4, 2.5, ... } } -file_put_contents("index.php", file_get_contents("system/upgrade/index.php")); -rrmdir("system/upgrade/"); +//file_put_contents("index.php", file_get_contents("system/upgrade/index.php")); +//rrmdir("system/upgrade/"); diff --git a/system/vendor/autoload.php b/system/vendor/autoload.php index a008850..2677d4a 100644 --- a/system/vendor/autoload.php +++ b/system/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInita77bbbb06005e971afb84206c22613bb::getLoader(); +return ComposerAutoloaderInit202d771b98d07410d9e52c5a90cbc9e1::getLoader(); diff --git a/system/vendor/composer/autoload_real.php b/system/vendor/composer/autoload_real.php index 277c439..7593687 100644 --- a/system/vendor/composer/autoload_real.php +++ b/system/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInita77bbbb06005e971afb84206c22613bb +class ComposerAutoloaderInit202d771b98d07410d9e52c5a90cbc9e1 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInita77bbbb06005e971afb84206c22613bb return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInita77bbbb06005e971afb84206c22613bb', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit202d771b98d07410d9e52c5a90cbc9e1', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInita77bbbb06005e971afb84206c22613bb', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit202d771b98d07410d9e52c5a90cbc9e1', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ class ComposerAutoloaderInita77bbbb06005e971afb84206c22613bb $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequirea77bbbb06005e971afb84206c22613bb($file); + composerRequire202d771b98d07410d9e52c5a90cbc9e1($file); } return $loader; } } -function composerRequirea77bbbb06005e971afb84206c22613bb($file) +function composerRequire202d771b98d07410d9e52c5a90cbc9e1($file) { require $file; } diff --git a/system/vendor/composer/installed.json b/system/vendor/composer/installed.json index 23ce616..6a4582f 100644 --- a/system/vendor/composer/installed.json +++ b/system/vendor/composer/installed.json @@ -1,57 +1,4 @@ [ - { - "name": "michelf/php-markdown", - "version": "dev-lib", - "version_normalized": "dev-lib", - "source": { - "type": "git", - "url": "https://github.com/michelf/php-markdown.git", - "reference": "1b5a30e13974b490964a1610bab5958e83cd4b69" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/1b5a30e13974b490964a1610bab5958e83cd4b69", - "reference": "1b5a30e13974b490964a1610bab5958e83cd4b69", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2014-12-08 02:09:55", - "type": "library", - "extra": { - "branch-alias": { - "dev-lib": "1.4.x-dev" - } - }, - "installation-source": "source", - "autoload": { - "psr-0": { - "Michelf": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Michel Fortin", - "email": "michel.fortin@michelf.ca", - "homepage": "http://michelf.ca/", - "role": "Developer" - }, - { - "name": "John Gruber", - "homepage": "http://daringfireball.net/" - } - ], - "description": "PHP Markdown", - "homepage": "http://michelf.ca/projects/php-markdown/", - "keywords": [ - "markdown" - ] - }, { "name": "suin/php-rss-writer", "version": "1.3", @@ -138,5 +85,58 @@ } ], "description": "Simple Github Updater for Web Projects" + }, + { + "name": "michelf/php-markdown", + "version": "1.4.1", + "version_normalized": "1.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/michelf/php-markdown.git", + "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", + "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2014-05-05 02:43:50", + "type": "library", + "extra": { + "branch-alias": { + "dev-lib": "1.4.x-dev" + } + }, + "installation-source": "source", + "autoload": { + "psr-0": { + "Michelf": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "http://michelf.ca/", + "role": "Developer" + }, + { + "name": "John Gruber", + "homepage": "http://daringfireball.net/" + } + ], + "description": "PHP Markdown", + "homepage": "http://michelf.ca/projects/php-markdown/", + "keywords": [ + "markdown" + ] } ] diff --git a/system/vendor/michelf/php-markdown/Michelf/Markdown.php b/system/vendor/michelf/php-markdown/Michelf/Markdown.php index c8ced89..0d37012 100644 --- a/system/vendor/michelf/php-markdown/Michelf/Markdown.php +++ b/system/vendor/michelf/php-markdown/Michelf/Markdown.php @@ -59,9 +59,6 @@ class Markdown implements MarkdownInterface { public $predef_urls = array(); public $predef_titles = array(); - # Optional filter function for URLs - public $url_filter_func = null; - ### Parser Implementation ### @@ -596,7 +593,7 @@ class Markdown implements MarkdownInterface { if (isset($this->urls[$link_id])) { $url = $this->urls[$link_id]; - $url = $this->encodeURLAttribute($url); + $url = $this->encodeAttribute($url); $result = "titles[$link_id] ) ) { @@ -626,7 +623,7 @@ class Markdown implements MarkdownInterface { if ($unhashed != $url) $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); - $url = $this->encodeURLAttribute($url); + $url = $this->encodeAttribute($url); $result = "encodeAttribute($alt_text); if (isset($this->urls[$link_id])) { - $url = $this->encodeURLAttribute($this->urls[$link_id]); + $url = $this->encodeAttribute($this->urls[$link_id]); $result = "\"$alt_text\"";titles[$link_id])) { $title = $this->titles[$link_id]; @@ -731,7 +728,7 @@ class Markdown implements MarkdownInterface { $title =& $matches[7]; $alt_text = $this->encodeAttribute($alt_text); - $url = $this->encodeURLAttribute($url); + $url = $this->encodeAttribute($url); $result = "\"$alt_text\"";encodeAttribute($title); @@ -1263,33 +1260,6 @@ class Markdown implements MarkdownInterface { $text = str_replace('"', '"', $text); return $text; } - - - protected function encodeURLAttribute($url, &$text = null) { - # - # Encode text for a double-quoted HTML attribute containing a URL, - # applying the URL filter if set. Also generates the textual - # representation for the URL (removing mailto: or tel:) storing it in $text. - # This function is *not* suitable for attributes enclosed in single quotes. - # - if ($this->url_filter_func) - $url = call_user_func($this->url_filter_func, $url); - - if (preg_match('{^mailto:}i', $url)) - $url = $this->encodeEntityObfuscatedAttribute($url, $text, 7); - else if (preg_match('{^tel:}i', $url)) - { - $url = $this->encodeAttribute($url); - $text = substr($url, 4); - } - else - { - $url = $this->encodeAttribute($url); - $text = $url; - } - - return $url; - } protected function encodeAmpsAndAngles($text) { @@ -1314,7 +1284,7 @@ class Markdown implements MarkdownInterface { protected function doAutoLinks($text) { - $text = preg_replace_callback('{<((https?|ftp|dict|tel):[^\'">\s]+)>}i', + $text = preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i', array($this, '_doAutoLinks_url_callback'), $text); # Email addresses: @@ -1337,46 +1307,48 @@ class Markdown implements MarkdownInterface { > }xi', array($this, '_doAutoLinks_email_callback'), $text); + $text = preg_replace_callback('{<(tel:([^\'">\s]+))>}i',array($this, '_doAutoLinks_tel_callback'), $text); return $text; } + protected function _doAutoLinks_tel_callback($matches) { + $url = $this->encodeAttribute($matches[1]); + $tel = $this->encodeAttribute($matches[2]); + $link = "$tel"; + return $this->hashPart($link); + } protected function _doAutoLinks_url_callback($matches) { - $url = $this->encodeURLAttribute($matches[1], $text); - $link = "$text"; + $url = $this->encodeAttribute($matches[1]); + $link = "$url"; return $this->hashPart($link); } protected function _doAutoLinks_email_callback($matches) { - $addr = $matches[1]; - $url = $this->encodeURLAttribute("mailto:$addr", $text); - $link = "$text"; + $address = $matches[1]; + $link = $this->encodeEmailAddress($address); return $this->hashPart($link); } - protected function encodeEntityObfuscatedAttribute($text, &$tail = null, $head_length = 0) { + protected function encodeEmailAddress($addr) { # - # Input: some text to obfuscate, e.g. "mailto:foo@example.com" + # Input: an email address, e.g. "foo@example.com" # - # Output: the same text but with most characters encoded as either a - # decimal or hex entity, in the hopes of foiling most address - # harvesting spam bots. E.g.: + # Output: the email address as a mailto link, with each character + # of the address encoded as either a decimal or hex entity, in + # the hopes of foiling most address harvesting spam bots. E.g.: # - # mailto:foo + #

foo@exampl + # e.com

# # Based by a filter by Matthew Wickline, posted to BBEdit-Talk. - # With some optimizations by Milian Wolff. Forced encoding of HTML - # attribute special characters by Allan Odgaard. + # With some optimizations by Milian Wolff. # - if ($text == "") return $tail = ""; - - $chars = preg_split('/(? $char) { $ord = ord($char); # Ignore non-ascii chars. @@ -1384,17 +1356,18 @@ class Markdown implements MarkdownInterface { $r = ($seed * (1 + $key)) % 100; # Pseudo-random function. # roughly 10% raw, 45% hex, 45% dec # '@' *must* be encoded. I insist. - # '"' and '>' have to be encoded inside the attribute - if ($r > 90 && strpos('@"&>', $char) === false) /* do nothing */; + # '"' has to be encoded inside the attribute + if ($r > 90 && $char != '@' && $char != '"') /* do nothing */; else if ($r < 45) $chars[$key] = '&#x'.dechex($ord).';'; else $chars[$key] = '&#'.$ord.';'; } } + + $addr = implode('', $chars); + $text = implode('', array_slice($chars, 7)); # text without `mailto:` + $addr = "$text"; - $text = implode('', $chars); - $tail = $head_length ? implode('', array_slice($chars, $head_length)) : $text; - - return $text; + return $addr; } @@ -1678,9 +1651,9 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { ### Extra Attribute Parser ### # Expression to use to catch attributes (includes the braces) - protected $id_class_attr_catch_re = '\{((?:[ ]*[#.a-z][-_:a-zA-Z0-9=]+){1,})[ ]*\}'; + protected $id_class_attr_catch_re = '\{((?:[ ]*[#.][-_:a-zA-Z0-9]+){1,})[ ]*\}'; # Expression to use when parsing in a context when no capture is desired - protected $id_class_attr_nocatch_re = '\{(?:[ ]*[#.a-z][-_:a-zA-Z0-9=]+){1,}[ ]*\}'; + protected $id_class_attr_nocatch_re = '\{(?:[ ]*[#.][-_:a-zA-Z0-9]+){1,}[ ]*\}'; protected function doExtraAttributes($tag_name, $attr) { # @@ -1692,21 +1665,17 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { if (empty($attr)) return ""; # Split on components - preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', $attr, $matches); + preg_match_all('/[#.][-_:a-zA-Z0-9]+/', $attr, $matches); $elements = $matches[0]; # handle classes and ids (only first id taken into account) $classes = array(); - $attributes = array(); $id = false; foreach ($elements as $element) { if ($element{0} == '.') { $classes[] = substr($element, 1); } else if ($element{0} == '#') { if ($id === false) $id = substr($element, 1); - } else if (strpos($element, '=') > 0) { - $parts = explode('=', $element, 2); - $attributes[] = $parts[0] . '="' . $parts[1] . '"'; } } @@ -1718,9 +1687,6 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { if (!empty($classes)) { $attr_str .= ' class="'.implode(" ", $classes).'"'; } - if (!$this->no_markup && !empty($attributes)) { - $attr_str .= ' '.implode(" ", $attributes); - } return $attr_str; } @@ -2330,7 +2296,7 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { if (isset($this->urls[$link_id])) { $url = $this->urls[$link_id]; - $url = $this->encodeURLAttribute($url); + $url = $this->encodeAttribute($url); $result = "titles[$link_id] ) ) { @@ -2363,7 +2329,7 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { if ($unhashed != $url) $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); - $url = $this->encodeURLAttribute($url); + $url = $this->encodeAttribute($url); $result = "encodeAttribute($alt_text); if (isset($this->urls[$link_id])) { - $url = $this->encodeURLAttribute($this->urls[$link_id]); + $url = $this->encodeAttribute($this->urls[$link_id]); $result = "\"$alt_text\"";titles[$link_id])) { $title = $this->titles[$link_id]; @@ -2473,7 +2439,7 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { $attr = $this->doExtraAttributes("img", $dummy =& $matches[8]); $alt_text = $this->encodeAttribute($alt_text); - $url = $this->encodeURLAttribute($url); + $url = $this->encodeAttribute($url); $result = "\"$alt_text\"";encodeAttribute($title); diff --git a/system/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php b/system/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php index e4c2931..f8367ed 100644 --- a/system/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +++ b/system/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php @@ -32,3 +32,6 @@ interface MarkdownInterface { public function transform($text); } + + +?> \ No newline at end of file diff --git a/system/vendor/michelf/php-markdown/Readme.md b/system/vendor/michelf/php-markdown/Readme.md index 80504c2..0bccd69 100644 --- a/system/vendor/michelf/php-markdown/Readme.md +++ b/system/vendor/michelf/php-markdown/Readme.md @@ -174,16 +174,6 @@ PHP Markdown, please visit [michelf.ca/donate] or send Bitcoin to Version History --------------- -Unreleased - -* Added the ability to insert custom HTML attributes everywhere an extra - attribute block is allowed (links, images, headers). Credits to - Peter Droogmans for providing the implementation. - -* Added a `url_filter_func` configuration variable which takes a function - that can rewrite any link or image URL to something different. - - PHP Markdown Lib 1.4.1 (4 May 2014) * The HTML block parser will now treat `
` as a block-level element