r20150831

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
flash 2015-08-31 23:57:36 +02:00
parent 292112b854
commit 949c39b597
479 changed files with 2518 additions and 1813 deletions

View file

@ -52,7 +52,9 @@
"20150825",
"20150826",
"20150828",
"20150829"
"20150829",
"20150830",
"20150831"
]
@ -2311,6 +2313,36 @@
"user": "Flashwave"
}
],
"20150830": [
{
"type": "ADD",
"change": "Added donation tracker frontend.",
"user": "Flashwave"
}
],
"20150831": [
{
"type": "UPD",
"change": "Changed main navigation to font awesome icons.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed bug in settings panel with parent sections.",
"user": "Flashwave"
},
{
"type": "UPD",
"change": "Updated twig libraries and switched to the unmodified Parsedown branch.",
"user": "Flashwave"
}
]
}

View file

@ -2,7 +2,7 @@
/*
* Payment components (only slightly convoluted)
*/
namespace Sakura;
use \PayPal\Api\Payer;

View file

@ -1435,4 +1435,42 @@ class Users {
}
// Get Premium tracker data
public static function getPremiumTrackerData() {
// Create data array
$data = [];
// Get database stuff
$table = Database::fetch('premium_log', true, null, ['id', true]);
// Add raw table data to data array
$data['table'] = $table;
// Create balance entry
$data['balance'] = 0.0;
// Create users entry
$data['users'] = [];
// Calculate the thing
foreach($table as $row) {
// Calculate balance
$data['balance'] = $data['balance'] + $row['amount'];
// Add userdata to table
if(!array_key_exists($row['uid'], $data['users'])) {
$data['users'][$row['uid']] = new User($row['uid']);
}
}
// Return the data
return $data;
}
}

View file

@ -3,9 +3,9 @@
"php": ">=5.4.0",
"ext-curl": "*",
"ext-json": "*",
"twig/twig": "~1.18",
"phpmailer/phpmailer": "~5.2",
"flashwave/parsedown": "~1.5",
"twig/twig": "*",
"phpmailer/phpmailer": "*",
"erusev/parsedown": "*",
"paypal/rest-api-sdk-php": "*"
}
}

44
_sakura/composer.lock generated
View file

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "becd1aabf8b14aea30aa9218aee65fdd",
"hash": "eece9a97b0a0328b534ad22d30aab9bf",
"packages": [
{
"name": "flashwave/parsedown",
"version": "1.5.1",
"name": "erusev/parsedown",
"version": "1.5.4",
"source": {
"type": "git",
"url": "https://github.com/flashii/parsedown.git",
"reference": "9da19c1108c39df9b42adc42e39b8371070652d0"
"url": "https://github.com/erusev/parsedown.git",
"reference": "0e89e3714bda18973184d30646306bb0a482bd96"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/flashii/parsedown/zipball/9da19c1108c39df9b42adc42e39b8371070652d0",
"reference": "9da19c1108c39df9b42adc42e39b8371070652d0",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/0e89e3714bda18973184d30646306bb0a482bd96",
"reference": "0e89e3714bda18973184d30646306bb0a482bd96",
"shasum": ""
},
"type": "library",
@ -26,7 +26,7 @@
"Parsedown": ""
}
},
"notification-url": "http://packagist.org/downloads/",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@ -43,20 +43,20 @@
"markdown",
"parser"
],
"time": "2015-01-24 13:01:47"
"time": "2015-08-03 09:24:05"
},
{
"name": "paypal/rest-api-sdk-php",
"version": "v1.5.0",
"version": "v1.5.1",
"source": {
"type": "git",
"url": "https://github.com/paypal/PayPal-PHP-SDK.git",
"reference": "18e4eaaf319b48de2457abb7b2b1807cfe704c0a"
"reference": "70b03c51879fa3d2392d89052b96e92f6e6f6512"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/18e4eaaf319b48de2457abb7b2b1807cfe704c0a",
"reference": "18e4eaaf319b48de2457abb7b2b1807cfe704c0a",
"url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/70b03c51879fa3d2392d89052b96e92f6e6f6512",
"reference": "70b03c51879fa3d2392d89052b96e92f6e6f6512",
"shasum": ""
},
"require": {
@ -91,7 +91,7 @@
"rest",
"sdk"
],
"time": "2015-06-25 17:12:03"
"time": "2015-08-17 19:32:59"
},
{
"name": "phpmailer/phpmailer",
@ -150,25 +150,29 @@
},
{
"name": "twig/twig",
"version": "v1.18.2",
"version": "v1.21.1",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "e8e6575abf6102af53ec283f7f14b89e304fa602"
"reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e8e6575abf6102af53ec283f7f14b89e304fa602",
"reference": "e8e6575abf6102af53ec283f7f14b89e304fa602",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/ca8d3aa90b6a01c82e07909fe815d6b443e75a23",
"reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23",
"shasum": ""
},
"require": {
"php": ">=5.2.7"
},
"require-dev": {
"symfony/debug": "~2.7",
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
"dev-master": "1.21-dev"
}
},
"autoload": {
@ -203,7 +207,7 @@
"keywords": [
"templating"
],
"time": "2015-06-06 23:31:24"
"time": "2015-08-26 08:58:31"
}
],
"packages-dev": [],

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20150829');
define('SAKURA_VERSION', '20150831');
define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false);

View file

@ -160,33 +160,33 @@
<div class="header" id="header">
<a class="logo" href="//{{ sakura.urlMain }}/">{{ sakura.siteName }}</a>
<div class="menu">
<div class="menu-nav" id="navMenuSite">
<div class="menu-nav fa" id="navMenuSite">
<!-- Navigation menu, displayed on left side of the bar. -->
<a class="menu-item" href="/" title="Return to the front page of Flashii">Home</a>
<a class="menu-item" href="/news" title="Here you can read updates on Flashii">News</a>
<a class="menu-item" href="//chat.{{ sakura.urlMain }}/" title="Chat with other Flashii members">Chat</a>
<a class="menu-item fa-home" href="/" title="Home"></a>
<a class="menu-item fa-newspaper-o" href="/news" title="News"></a>
<a class="menu-item fa-commenting" href="//chat.{{ sakura.urlMain }}/" title="Chat"></a>
{% if user.checkPermission('FORUM', 'USE_FORUM') %}
<a class="menu-item" href="/forum" title="Discuss things with other members but static">Forums</a>
<a class="menu-item fa-list" href="/forum" title="Forums"></a>
{% endif %}
<a class="menu-item" href="/search" title="Search on Flashii">Search</a>
<a class="menu-item fa-search" href="/search" title="Search"></a>
{% if session.checkLogin %}
<a class="menu-item" href="/members" title="View a list with all the activated user accounts">Members</a>
<a class="menu-item menu-donate" href="/support" title="Give us money to keep the site (and other services) up and running">Support us</a>
<a class="menu-item fa-users" href="/members" title="Members"></a>
<a class="menu-item menu-donate fa-heart" href="/support" title="Support us"></a>
{% endif %}
</div>
<div class="menu-ucp" id="navMenuUser">
<div class="menu-ucp fa" id="navMenuUser">
<!-- User menu, displayed on right side of the bar. -->
{% if session.checkLogin %}
<a class="menu-item avatar" href="/u/{{ user.data.id }}" title="View and edit your own profile" style="background-image: url('/a/{{ user.data.id }}'); width: auto; color: {{ user.colour }}; font-weight: 700;">{{ user.data.username }}</a>
<a class="menu-item" href="/messages" title="Read your private message">Messages</a>
<a class="menu-item" href="/manage" title="Manage the site">Manage</a>
<a class="menu-item" href="/settings" title="Change your settings">Settings</a>
<a class="menu-item" href="/logout?mode=logout&amp;time={{ php.time }}&amp;session={{ php.sessionid }}&amp;redirect={{ sakura.currentPage }}" title="End your login session" id="headerLogoutLink">Logout</a>
<a class="menu-item avatar" href="/u/{{ user.data.id }}" title="Logged in as {{ user.data.username }}" style="background-image: url('/a/{{ user.data.id }}'); width: auto; color: {{ user.colour }}; font-weight: 700;"></a>
<a class="menu-item fa-envelope" href="/messages" title="Messages"></a>
<a class="menu-item fa-gavel" href="/manage" title="Manage"></a>
<a class="menu-item fa-cogs" href="/settings" title="Settings"></a>
<a class="menu-item fa-sign-out" href="/logout?mode=logout&amp;time={{ php.time }}&amp;session={{ php.sessionid }}&amp;redirect={{ sakura.currentPage }}" title="Logout" id="headerLogoutLink"></a>
{% else %}
{% if sakura.lockAuth %}
<div class="menu-item" style="padding-left: 10px; padding-right: 10px;">Authentication is locked</div>
<div class="menu-item fa-lock" style="padding-left: 10px; padding-right: 10px;" title="Authentication is locked"></div>
{% else %}
<a class="menu-item" href="/authenticate" title="Login to Flashii">Login or Register</a>
<a class="menu-item fa-sign-in" href="/authenticate" title="Login"></a>
{% endif %}
{% endif %}
</div>

View file

@ -0,0 +1,66 @@
{% include 'global/header.tpl' %}
<div class="content support">
<div class="head">Donation Tracker</div>
<h1 class="stylised" style="margin: 1em auto; text-align: center;">Our current overall balance is &#8364;{{ page.premiumData.balance|number_format(2) }}</h1>
<div class="sectionHeader">
Donation Log
</div>
<table>
<thead>
<tr>
<th>
Supporter
</th>
<th>
Amount
</th>
<th>
Action
</th>
</tr>
</thead>
<tfoot>
<tr>
<th>
Supporter
</th>
<th>
Amount
</th>
<th>
Action
</th>
</tr>
</tfoot>
<tbody>
{% for supporter in page.premiumTable[page.currentPage] %}
<tr>
<td>
{{ page.premiumData.users[supporter.uid].data.username }}
</td>
<td style="color: {% if supporter.amount > 0 %}#0A0{% else %}#A00{% endif %};">
&#8364;{{ supporter.amount|number_format(2) }}
</td>
<td>
{{ supporter.comment }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if page.premiumTable|length > 1 %}
<div class="pagination" style="float: right;">
{% if page.currentPage > 0 %}
<a href="/support/tracker/{{ page.currentPage }}"><span class="fa fa-step-backward"></span></a>
{% endif %}
{% for count,navpage in page.premiumTable %}
<a href="/support/tracker/{{ count + 1 }}"{% if count == page.currentPage %} class="current"{% endif %}>{{ count + 1 }}</a>
{% endfor %}
{% if page.currentPage + 1 < page.premiumTable|length %}
<a href="/support/tracker/{{ page.currentPage + 2 }}"><span class="fa fa-step-forward"></span></a>
{% endif %}
</div>
<div class="clear"></div>
{% endif %}
</div>
{% include 'global/footer.tpl' %}

View file

@ -351,7 +351,7 @@ class ClassLoader
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
@ -361,7 +361,7 @@ class ClassLoader
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
@ -380,7 +380,7 @@ class ClassLoader
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
@ -390,7 +390,7 @@ class ClassLoader
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}

21
_sakura/vendor/composer/LICENSE vendored Normal file
View file

@ -0,0 +1,21 @@
Copyright (c) 2015 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.

View file

@ -8,5 +8,5 @@ $baseDir = dirname($vendorDir);
return array(
'Twig_' => array($vendorDir . '/twig/twig/lib'),
'PayPal' => array($vendorDir . '/paypal/rest-api-sdk-php/lib'),
'Parsedown' => array($vendorDir . '/flashwave/parsedown'),
'Parsedown' => array($vendorDir . '/erusev/parsedown'),
);

View file

@ -1,104 +1,4 @@
[
{
"name": "flashwave/parsedown",
"version": "1.5.1",
"version_normalized": "1.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/flashii/parsedown.git",
"reference": "9da19c1108c39df9b42adc42e39b8371070652d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/flashii/parsedown/zipball/9da19c1108c39df9b42adc42e39b8371070652d0",
"reference": "9da19c1108c39df9b42adc42e39b8371070652d0",
"shasum": ""
},
"time": "2015-01-24 13:01:47",
"type": "library",
"installation-source": "source",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "http://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"
]
},
{
"name": "twig/twig",
"version": "v1.18.2",
"version_normalized": "1.18.2.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "e8e6575abf6102af53ec283f7f14b89e304fa602"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e8e6575abf6102af53ec283f7f14b89e304fa602",
"reference": "e8e6575abf6102af53ec283f7f14b89e304fa602",
"shasum": ""
},
"require": {
"php": ">=5.2.7"
},
"time": "2015-06-06 23:31:24",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Twig_": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
},
{
"name": "Twig Team",
"homepage": "http://twig.sensiolabs.org/contributors",
"role": "Contributors"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "http://twig.sensiolabs.org",
"keywords": [
"templating"
]
},
{
"name": "phpmailer/phpmailer",
"version": "v5.2.10",
@ -157,18 +57,81 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP"
},
{
"name": "paypal/rest-api-sdk-php",
"version": "v1.5.0",
"version_normalized": "1.5.0.0",
"name": "twig/twig",
"version": "v1.21.1",
"version_normalized": "1.21.1.0",
"source": {
"type": "git",
"url": "https://github.com/paypal/PayPal-PHP-SDK.git",
"reference": "18e4eaaf319b48de2457abb7b2b1807cfe704c0a"
"url": "https://github.com/twigphp/Twig.git",
"reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/18e4eaaf319b48de2457abb7b2b1807cfe704c0a",
"reference": "18e4eaaf319b48de2457abb7b2b1807cfe704c0a",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/ca8d3aa90b6a01c82e07909fe815d6b443e75a23",
"reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23",
"shasum": ""
},
"require": {
"php": ">=5.2.7"
},
"require-dev": {
"symfony/debug": "~2.7",
"symfony/phpunit-bridge": "~2.7"
},
"time": "2015-08-26 08:58:31",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.21-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Twig_": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
},
{
"name": "Twig Team",
"homepage": "http://twig.sensiolabs.org/contributors",
"role": "Contributors"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "http://twig.sensiolabs.org",
"keywords": [
"templating"
]
},
{
"name": "paypal/rest-api-sdk-php",
"version": "v1.5.1",
"version_normalized": "1.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/paypal/PayPal-PHP-SDK.git",
"reference": "70b03c51879fa3d2392d89052b96e92f6e6f6512"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/70b03c51879fa3d2392d89052b96e92f6e6f6512",
"reference": "70b03c51879fa3d2392d89052b96e92f6e6f6512",
"shasum": ""
},
"require": {
@ -179,7 +142,7 @@
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"time": "2015-06-25 17:12:03",
"time": "2015-08-17 19:32:59",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -205,5 +168,46 @@
"rest",
"sdk"
]
},
{
"name": "erusev/parsedown",
"version": "1.5.4",
"version_normalized": "1.5.4.0",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "0e89e3714bda18973184d30646306bb0a482bd96"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/0e89e3714bda18973184d30646306bb0a482bd96",
"reference": "0e89e3714bda18973184d30646306bb0a482bd96",
"shasum": ""
},
"time": "2015-08-03 09:24:05",
"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"
]
}
]

View file

@ -0,0 +1,16 @@
language: php
php:
- 7.0
- 5.6
- 5.5
- 5.4
- 5.3
- hhvm
- hhvm-nightly
matrix:
fast_finish: true
allow_failures:
- php: 7.0
- php: hhvm-nightly

View file

@ -17,7 +17,7 @@ class Parsedown
{
# ~
const version = '1.5.1';
const version = '1.5.4';
# ~
@ -107,12 +107,6 @@ class Parsedown
# ~
protected $DefinitionTypes = array(
'[' => array('Reference'),
);
# ~
protected $unmarkedBlockTypes = array(
'Code',
);
@ -169,7 +163,7 @@ class Parsedown
# ~
if (isset($CurrentBlock['incomplete']))
if (isset($CurrentBlock['continuable']))
{
$Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock);
@ -185,8 +179,6 @@ class Parsedown
{
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
unset($CurrentBlock['incomplete']);
}
}
@ -226,7 +218,7 @@ class Parsedown
if (method_exists($this, 'block'.$blockType.'Continue'))
{
$Block['incomplete'] = true;
$Block['continuable'] = true;
}
$CurrentBlock = $Block;
@ -253,7 +245,7 @@ class Parsedown
# ~
if (isset($CurrentBlock['incomplete']) and method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
if (isset($CurrentBlock['continuable']) and method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
{
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
@ -394,16 +386,16 @@ class Parsedown
protected function blockFencedCode($Line)
{
if (preg_match('/^(['.$Line['text'][0].']{3,})[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches))
if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches))
{
$Element = array(
'name' => 'code',
'text' => '',
);
if (isset($matches[2]))
if (isset($matches[1]))
{
$class = 'language-'.$matches[2];
$class = 'language-'.$matches[1];
$Element['attributes'] = array(
'class' => $class,
@ -673,7 +665,9 @@ class Parsedown
if (preg_match('/^<(\w*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
{
if (in_array($matches[1], $this->textLevelElements))
$element = strtolower($matches[1]);
if (in_array($element, $this->textLevelElements))
{
return;
}
@ -987,15 +981,13 @@ class Parsedown
{
$markup = '';
$unexaminedText = $text;
# $excerpt is based on the first occurrence of a marker
$markerPosition = 0;
while ($excerpt = strpbrk($unexaminedText, $this->inlineMarkerList))
while ($excerpt = strpbrk($text, $this->inlineMarkerList))
{
$marker = $excerpt[0];
$markerPosition += strpos($unexaminedText, $marker);
$markerPosition = strpos($text, $marker);
$Excerpt = array('text' => $excerpt, 'context' => $text);
@ -1008,34 +1000,42 @@ class Parsedown
continue;
}
if (isset($Inline['position']) and $Inline['position'] > $markerPosition) # position is ahead of marker
# makes sure that the inline belongs to "our" marker
if (isset($Inline['position']) and $Inline['position'] > $markerPosition)
{
continue;
}
# sets a default inline position
if ( ! isset($Inline['position']))
{
$Inline['position'] = $markerPosition;
}
# the text that comes before the inline
$unmarkedText = substr($text, 0, $Inline['position']);
# compile the unmarked text
$markup .= $this->unmarkedText($unmarkedText);
# compile the inline
$markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']);
# remove the examined text
$text = substr($text, $Inline['position'] + $Inline['extent']);
$unexaminedText = $text;
$markerPosition = 0;
continue 2;
}
$unexaminedText = substr($excerpt, 1);
# the marker does not belong to an inline
$markerPosition ++;
$unmarkedText = substr($text, 0, $markerPosition + 1);
$markup .= $this->unmarkedText($unmarkedText);
$text = substr($text, $markerPosition + 1);
}
$markup .= $this->unmarkedText($text);
@ -1197,7 +1197,7 @@ class Parsedown
return;
}
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]+"|\'[^\']+\'))?[)]/', $remainder, $matches))
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
{
$Element['attributes']['href'] = $matches[1];
@ -1212,7 +1212,7 @@ class Parsedown
{
if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
{
$definition = $matches[1] ? $matches[1] : $Element['text'];
$definition = strlen($matches[1]) ? $matches[1] : $Element['text'];
$definition = strtolower($definition);
$extent += strlen($matches[0]);
@ -1402,7 +1402,7 @@ class Parsedown
if (isset($Element['handler']))
{
$markup .= $this->$Element['handler']($Element['text']);
$markup .= $this->{$Element['handler']}($Element['text']);
}
else
{

View file

@ -1,16 +1,21 @@
## Parsedown
[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown)
<!--[![Total Downloads](http://img.shields.io/packagist/dt/erusev/parsedown.svg?style=flat-square)](https://packagist.org/packages/erusev/parsedown)-->
Better Markdown Parser in PHP
[[ demo ]](http://parsedown.org/demo)
[Demo](http://parsedown.org/demo) |
[Benchmarks](http://parsedown.org/speed) |
[Tests](http://parsedown.org/tests/) |
[Documentation](https://github.com/erusev/parsedown/wiki/)
### Features
* [Fast](http://parsedown.org/speed)
* [Consistent](http://parsedown.org/consistency)
* Super Fast
* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown)
* [Tested](http://parsedown.org/tests/) in PHP 5.2, 5.3, 5.4, 5.5, 5.6 and [hhvm](http://www.hhvm.com/)
* [Extensible](https://github.com/erusev/parsedown/wiki/Writing-Extensions)
* Extensible
* Tested in 5.3 to 5.6
* [Markdown Extra extension](https://github.com/erusev/parsedown-extra)
### Installation
@ -25,7 +30,7 @@ $Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>
```
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/Usage) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
### Questions
@ -45,4 +50,4 @@ It passes most of the CommonMark tests. Most of the tests that don't pass deal w
**How can I help?**
Use it, star it, share it and if you feel generous, [donate some money](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).
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).

View file

@ -0,0 +1,2 @@
<p><img src="/md.png" alt="alt" title="title" /></p>
<p><img src="/md.png" alt="blank title" title="" /></p>

View file

@ -0,0 +1,3 @@
![alt](/md.png "title")
![blank title](/md.png "")

View file

@ -1,4 +1,6 @@
<p><a href="http://example.com" title="Title">single quotes</a></p>
<p><a href="http://example.com" title="Title">double quotes</a></p>
<p><a href="http://example.com" title="">single quotes blank</a></p>
<p><a href="http://example.com" title="">double quotes blank</a></p>
<p><a href="http://example.com" title="2 Words">space</a></p>
<p><a href="http://example.com/url-(parentheses)" title="Title">parentheses</a></p>

View file

@ -0,0 +1,11 @@
[single quotes](http://example.com 'Title')
[double quotes](http://example.com "Title")
[single quotes blank](http://example.com '')
[double quotes blank](http://example.com "")
[space](http://example.com "2 Words")
[parentheses](http://example.com/url-(parentheses) "Title")

Some files were not shown because too many files have changed in this diff Show more