diff --git a/composer.json b/composer.json
index 0e58273..fa9481a 100644
--- a/composer.json
+++ b/composer.json
@@ -1,22 +1,34 @@
{
- "name": "mybb/parser",
- "description": "The parser used by MyBB 2. Supports BBCode, Markdown and HTML",
- "keywords": [
- "mybb",
- "forum",
- "laravel"
- ],
- "license": "BSD-3",
- "require": {
- "illuminate/support": "5.0.*|5.1.*",
- "ezyang/htmlpurifier": "~4.6",
- "illuminate/database": "5.0.*|5.1.*",
- "league/commonmark": "0.6.*@dev"
- },
- "autoload": {
- "psr-4": {
- "MyBB\\Parser\\": "src/"
- }
- },
- "minimum-stability": "dev"
+ "name": "mybb/parser",
+ "description": "The parser used by MyBB 2. Supports BBCode, Markdown and HTML",
+ "keywords": [
+ "mybb",
+ "forum",
+ "laravel"
+ ],
+ "license": "BSD-3",
+ "require": {
+ "php": ">=5.5.9",
+ "illuminate/support": "5.1.*",
+ "ezyang/htmlpurifier": "~4.6",
+ "illuminate/database": "5.1.*",
+ "league/commonmark": "0.6.*@dev",
+ "illuminate/view": "5.1.*",
+ "rcrowe/twigbridge": "0.7.x"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0",
+ "mockery/mockery": "^1.0@dev"
+ },
+ "autoload": {
+ "psr-4": {
+ "MyBB\\Parser\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "MyBB\\Parser\\Tests\\": "tests/"
+ }
+ },
+ "minimum-stability": "dev"
}
diff --git a/composer.lock b/composer.lock
index fa7c7c1..3558bb7 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,20 +4,21 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "cd5c2558c036dc321db9ed38e43e1c70",
+ "hash": "b938912ba29c028cb44315aa0f3d9072",
+ "content-hash": "6a8c13acfa180fb802d5f449be8c302a",
"packages": [
{
"name": "danielstjules/stringy",
- "version": "1.9.0",
+ "version": "1.x-dev",
"source": {
"type": "git",
"url": "https://github.com/danielstjules/Stringy.git",
- "reference": "3cf18e9e424a6dedc38b7eb7ef580edb0929461b"
+ "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/3cf18e9e424a6dedc38b7eb7ef580edb0929461b",
- "reference": "3cf18e9e424a6dedc38b7eb7ef580edb0929461b",
+ "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/4749c205db47ee5b32e8d1adf6d9aff8db6caf3b",
+ "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b",
"shasum": ""
},
"require": {
@@ -60,7 +61,7 @@
"utility",
"utils"
],
- "time": "2015-02-10 06:19:18"
+ "time": "2015-07-23 00:54:12"
},
{
"name": "doctrine/inflector",
@@ -68,12 +69,12 @@
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
- "reference": "e5eaf8c7ded0877195b5d2848491e17b1c0a6c4d"
+ "reference": "097e7ba84f64a427e55008117ef2bb94096731dc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/inflector/zipball/e5eaf8c7ded0877195b5d2848491e17b1c0a6c4d",
- "reference": "e5eaf8c7ded0877195b5d2848491e17b1c0a6c4d",
+ "url": "https://api.github.com/repos/doctrine/inflector/zipball/097e7ba84f64a427e55008117ef2bb94096731dc",
+ "reference": "097e7ba84f64a427e55008117ef2bb94096731dc",
"shasum": ""
},
"require": {
@@ -127,20 +128,20 @@
"singularize",
"string"
],
- "time": "2015-01-01 18:34:57"
+ "time": "2015-10-07 18:00:26"
},
{
"name": "ezyang/htmlpurifier",
- "version": "v4.6.0",
+ "version": "v4.7.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
- "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd"
+ "reference": "ae1828d955112356f7677c465f94f7deb7d27a40"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/6f389f0f25b90d0b495308efcfa073981177f0fd",
- "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd",
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40",
+ "reference": "ae1828d955112356f7677c465f94f7deb7d27a40",
"shasum": ""
},
"require": {
@@ -171,25 +172,25 @@
"keywords": [
"html"
],
- "time": "2013-11-30 08:25:19"
+ "time": "2015-08-05 01:03:42"
},
{
"name": "illuminate/container",
- "version": "dev-master",
+ "version": "5.1.x-dev",
"source": {
"type": "git",
"url": "https://github.com/illuminate/container.git",
- "reference": "a31c198e297c652c00a3122bfccb4e43d53aa4de"
+ "reference": "f14ea33d9ffcab4ca3aaed0328a92301adbe6960"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/container/zipball/a31c198e297c652c00a3122bfccb4e43d53aa4de",
- "reference": "a31c198e297c652c00a3122bfccb4e43d53aa4de",
+ "url": "https://api.github.com/repos/illuminate/container/zipball/f14ea33d9ffcab4ca3aaed0328a92301adbe6960",
+ "reference": "f14ea33d9ffcab4ca3aaed0328a92301adbe6960",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.1.*",
- "php": ">=5.4.0"
+ "php": ">=5.5.9"
},
"type": "library",
"extra": {
@@ -214,24 +215,24 @@
],
"description": "The Illuminate Container package.",
"homepage": "http://laravel.com",
- "time": "2015-03-26 15:22:18"
+ "time": "2015-10-19 06:01:02"
},
{
"name": "illuminate/contracts",
- "version": "dev-master",
+ "version": "5.1.x-dev",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
- "reference": "80d2f5efe43cbee810e48c6c2c7249fc670bd5c6"
+ "reference": "6e828a355b7a467232efad3dbe76df17463178e3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/contracts/zipball/80d2f5efe43cbee810e48c6c2c7249fc670bd5c6",
- "reference": "80d2f5efe43cbee810e48c6c2c7249fc670bd5c6",
+ "url": "https://api.github.com/repos/illuminate/contracts/zipball/6e828a355b7a467232efad3dbe76df17463178e3",
+ "reference": "6e828a355b7a467232efad3dbe76df17463178e3",
"shasum": ""
},
"require": {
- "php": ">=5.4.0"
+ "php": ">=5.5.9"
},
"type": "library",
"extra": {
@@ -256,31 +257,32 @@
],
"description": "The Illuminate Contracts package.",
"homepage": "http://laravel.com",
- "time": "2015-04-28 19:05:58"
+ "time": "2015-09-24 11:16:48"
},
{
"name": "illuminate/database",
- "version": "dev-master",
+ "version": "5.1.x-dev",
"source": {
"type": "git",
"url": "https://github.com/illuminate/database.git",
- "reference": "5b6263c8618f9ac55893b345dbe958a768697764"
+ "reference": "2a06744211aa07182af5fc488e52251994b7cfd5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/database/zipball/5b6263c8618f9ac55893b345dbe958a768697764",
- "reference": "5b6263c8618f9ac55893b345dbe958a768697764",
+ "url": "https://api.github.com/repos/illuminate/database/zipball/2a06744211aa07182af5fc488e52251994b7cfd5",
+ "reference": "2a06744211aa07182af5fc488e52251994b7cfd5",
"shasum": ""
},
"require": {
"illuminate/container": "5.1.*",
"illuminate/contracts": "5.1.*",
"illuminate/support": "5.1.*",
- "nesbot/carbon": "~1.0",
- "php": ">=5.4.0"
+ "nesbot/carbon": "~1.19",
+ "php": ">=5.5.9"
},
"suggest": {
"doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).",
+ "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).",
"illuminate/console": "Required to use the database commands (5.1.*).",
"illuminate/events": "Required to use the observers with Eloquent (5.1.*).",
"illuminate/filesystem": "Required to use the migrations (5.1.*)."
@@ -314,20 +316,115 @@
"orm",
"sql"
],
- "time": "2015-05-18 10:07:24"
+ "time": "2015-10-25 18:28:50"
+ },
+ {
+ "name": "illuminate/events",
+ "version": "5.1.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/events.git",
+ "reference": "8ffe2b316c595477f621a78fee0f64d8fc175bfa"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/events/zipball/8ffe2b316c595477f621a78fee0f64d8fc175bfa",
+ "reference": "8ffe2b316c595477f621a78fee0f64d8fc175bfa",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
+ "php": ">=5.5.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Events\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylorotwell@gmail.com"
+ }
+ ],
+ "description": "The Illuminate Events package.",
+ "homepage": "http://laravel.com",
+ "time": "2015-09-23 13:19:23"
+ },
+ {
+ "name": "illuminate/filesystem",
+ "version": "5.1.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/filesystem.git",
+ "reference": "21e6f8286825ce5e1a0afb04de5defcbfcaee61b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/filesystem/zipball/21e6f8286825ce5e1a0afb04de5defcbfcaee61b",
+ "reference": "21e6f8286825ce5e1a0afb04de5defcbfcaee61b",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
+ "php": ">=5.5.9",
+ "symfony/finder": "2.7.*"
+ },
+ "suggest": {
+ "league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).",
+ "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).",
+ "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0)."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Filesystem\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylorotwell@gmail.com"
+ }
+ ],
+ "description": "The Illuminate Filesystem package.",
+ "homepage": "http://laravel.com",
+ "time": "2015-10-19 06:01:02"
},
{
"name": "illuminate/support",
- "version": "dev-master",
+ "version": "5.1.x-dev",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
- "reference": "a610e57ac204879ef582c4080faed9c75a0eea35"
+ "reference": "c8e9aad1e06cb159e5f082b16037366b7a0409c6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/support/zipball/a610e57ac204879ef582c4080faed9c75a0eea35",
- "reference": "a610e57ac204879ef582c4080faed9c75a0eea35",
+ "url": "https://api.github.com/repos/illuminate/support/zipball/c8e9aad1e06cb159e5f082b16037366b7a0409c6",
+ "reference": "c8e9aad1e06cb159e5f082b16037366b7a0409c6",
"shasum": ""
},
"require": {
@@ -335,10 +432,11 @@
"doctrine/inflector": "~1.0",
"ext-mbstring": "*",
"illuminate/contracts": "5.1.*",
- "php": ">=5.4.0"
+ "php": ">=5.5.9"
},
"suggest": {
"jeremeamia/superclosure": "Required to be able to serialize closures (~2.0).",
+ "paragonie/random_compat": "Provides a compatible interface like PHP7's random_bytes() in PHP 5 projects (^1.0.6).",
"symfony/var-dumper": "Required to use the dd function (2.7.*)."
},
"type": "library",
@@ -367,7 +465,54 @@
],
"description": "The Illuminate Support package.",
"homepage": "http://laravel.com",
- "time": "2015-05-19 02:06:21"
+ "time": "2015-10-19 06:01:02"
+ },
+ {
+ "name": "illuminate/view",
+ "version": "5.1.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/view.git",
+ "reference": "2ee7fa5cc61c998d043ed59e3a2a82fdf81d3f03"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/view/zipball/2ee7fa5cc61c998d043ed59e3a2a82fdf81d3f03",
+ "reference": "2ee7fa5cc61c998d043ed59e3a2a82fdf81d3f03",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/events": "5.1.*",
+ "illuminate/filesystem": "5.1.*",
+ "illuminate/support": "5.1.*",
+ "php": ">=5.5.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\View\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylorotwell@gmail.com"
+ }
+ ],
+ "description": "The Illuminate View package.",
+ "homepage": "http://laravel.com",
+ "time": "2015-10-19 06:01:02"
},
{
"name": "league/commonmark",
@@ -430,21 +575,21 @@
},
{
"name": "nesbot/carbon",
- "version": "1.19.0",
+ "version": "1.20.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
- "reference": "68868e0b02d2d803d0052a59d4e5003cccf87320"
+ "reference": "bfd3eaba109c9a2405c92174c8e17f20c2b9caf3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/68868e0b02d2d803d0052a59d4e5003cccf87320",
- "reference": "68868e0b02d2d803d0052a59d4e5003cccf87320",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bfd3eaba109c9a2405c92174c8e17f20c2b9caf3",
+ "reference": "bfd3eaba109c9a2405c92174c8e17f20c2b9caf3",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
- "symfony/translation": "~2.6"
+ "symfony/translation": "~2.6|~3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
@@ -473,34 +618,143 @@
"datetime",
"time"
],
- "time": "2015-05-09 03:23:44"
+ "time": "2015-06-25 04:19:39"
},
{
- "name": "symfony/translation",
- "version": "2.8.x-dev",
+ "name": "rcrowe/twigbridge",
+ "version": "v0.7.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/rcrowe/TwigBridge.git",
+ "reference": "838d9c4f1c2306dddf7609daeb6ad6429249b242"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/rcrowe/TwigBridge/zipball/838d9c4f1c2306dddf7609daeb6ad6429249b242",
+ "reference": "838d9c4f1c2306dddf7609daeb6ad6429249b242",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/support": "5.0.*|5.1.*",
+ "illuminate/view": "5.0.*|5.1.*",
+ "php": ">=5.4.0",
+ "twig/twig": "~1.15"
+ },
+ "require-dev": {
+ "laravel/framework": "5.0.*",
+ "mockery/mockery": "0.9.*",
+ "phpunit/phpunit": "~4.0",
+ "satooshi/php-coveralls": "~0.6",
+ "squizlabs/php_codesniffer": "~1.5"
+ },
+ "suggest": {
+ "laravelcollective/html": "For bringing back html/form in Laravel 5.x",
+ "twig/extensions": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "TwigBridge\\": "src",
+ "TwigBridge\\Tests\\": "tests"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Barry vd. Heuvel",
+ "email": "barryvdh@gmail.com"
+ },
+ {
+ "name": "Rob Crowe",
+ "email": "hello@vivalacrowe.com"
+ }
+ ],
+ "description": "Adds the power of Twig to Laravel",
+ "keywords": [
+ "laravel",
+ "twig"
+ ],
+ "time": "2015-05-17 16:02:25"
+ },
+ {
+ "name": "symfony/finder",
+ "version": "2.7.x-dev",
"source": {
"type": "git",
- "url": "https://github.com/symfony/Translation.git",
- "reference": "a0735db452c5e592cb742333a32c6634a6d1ece1"
+ "url": "https://github.com/symfony/finder.git",
+ "reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Translation/zipball/a0735db452c5e592cb742333a32c6634a6d1ece1",
- "reference": "a0735db452c5e592cb742333a32c6634a6d1ece1",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
+ "reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Finder\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Finder Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-10-11 09:39:48"
+ },
+ {
+ "name": "symfony/translation",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/translation.git",
+ "reference": "e7c5fcb19d991da3894858bb4d4775be57094eda"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/e7c5fcb19d991da3894858bb4d4775be57094eda",
+ "reference": "e7c5fcb19d991da3894858bb4d4775be57094eda",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
"conflict": {
- "symfony/config": "<2.7"
+ "symfony/config": "<2.8"
},
"require-dev": {
"psr/log": "~1.0",
- "symfony/config": "~2.7",
- "symfony/intl": "~2.3|~3.0.0",
- "symfony/phpunit-bridge": "~2.7|~3.0.0",
- "symfony/yaml": "~2.2|~3.0.0"
+ "symfony/config": "~2.8|~3.0",
+ "symfony/intl": "~2.8|~3.0",
+ "symfony/yaml": "~2.8|~3.0"
},
"suggest": {
"psr/log": "To use logging capability in translator",
@@ -510,7 +764,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.8-dev"
+ "dev-master": "3.0-dev"
}
},
"autoload": {
@@ -534,17 +788,1141 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
- "time": "2015-05-15 14:11:12"
+ "time": "2015-10-11 09:14:55"
+ },
+ {
+ "name": "twig/twig",
+ "version": "1.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/twigphp/Twig.git",
+ "reference": "7220fd2d887a427cd78604ad21e8b72005e91d09"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/7220fd2d887a427cd78604ad21e8b72005e91d09",
+ "reference": "7220fd2d887a427cd78604ad21e8b72005e91d09",
+ "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.23-dev"
+ }
+ },
+ "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"
+ ],
+ "time": "2015-10-28 05:39:34"
}
],
- "packages-dev": [],
- "aliases": [],
- "minimum-stability": "dev",
- "stability-flags": {
- "league/commonmark": 20
- },
- "prefer-stable": false,
- "prefer-lowest": false,
- "platform": [],
+ "packages-dev": [
+ {
+ "name": "doctrine/instantiator",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3,<8.0-DEV"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1.8",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://github.com/doctrine/instantiator",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2015-06-14 21:17:01"
+ },
+ {
+ "name": "hamcrest/hamcrest-php",
+ "version": "v1.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/hamcrest/hamcrest-php.git",
+ "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c",
+ "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "replace": {
+ "cordoval/hamcrest-php": "*",
+ "davedevelopment/hamcrest-php": "*",
+ "kodova/hamcrest-php": "*"
+ },
+ "require-dev": {
+ "phpunit/php-file-iterator": "1.3.3",
+ "satooshi/php-coveralls": "dev-master"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "hamcrest"
+ ],
+ "files": [
+ "hamcrest/Hamcrest.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD"
+ ],
+ "description": "This is the PHP port of Hamcrest Matchers",
+ "keywords": [
+ "test"
+ ],
+ "time": "2015-05-11 14:41:42"
+ },
+ {
+ "name": "mockery/mockery",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/padraic/mockery.git",
+ "reference": "ee88cd05073533b10678772fe954d042748393c3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/padraic/mockery/zipball/ee88cd05073533b10678772fe954d042748393c3",
+ "reference": "ee88cd05073533b10678772fe954d042748393c3",
+ "shasum": ""
+ },
+ "require": {
+ "hamcrest/hamcrest-php": "~1.1",
+ "lib-pcre": ">=7.0",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Mockery": "library/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Pádraic Brady",
+ "email": "padraic.brady@gmail.com",
+ "homepage": "http://blog.astrumfutura.com"
+ },
+ {
+ "name": "Dave Marshall",
+ "email": "dave.marshall@atstsolutions.co.uk",
+ "homepage": "http://davedevelopment.co.uk"
+ }
+ ],
+ "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.",
+ "homepage": "http://github.com/padraic/mockery",
+ "keywords": [
+ "BDD",
+ "TDD",
+ "library",
+ "mock",
+ "mock objects",
+ "mockery",
+ "stub",
+ "test",
+ "test double",
+ "testing"
+ ],
+ "time": "2015-10-12 06:21:09"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "dflydev/markdown": "~1.0",
+ "erusev/parsedown": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "time": "2015-02-03 12:10:50"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62",
+ "reference": "4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "sebastian/comparator": "~1.1"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.5.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Prophecy\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Konstantin Kudryashov",
+ "email": "ever.zet@gmail.com",
+ "homepage": "http://everzet.com"
+ },
+ {
+ "name": "Marcello Duarte",
+ "email": "marcello.duarte@gmail.com"
+ }
+ ],
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
+ "homepage": "https://github.com/phpspec/prophecy",
+ "keywords": [
+ "Double",
+ "Dummy",
+ "fake",
+ "mock",
+ "spy",
+ "stub"
+ ],
+ "time": "2015-09-22 14:49:23"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "2.2.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "phpunit/php-file-iterator": "~1.3",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-token-stream": "~1.3",
+ "sebastian/environment": "^1.3.2",
+ "sebastian/version": "~1.0"
+ },
+ "require-dev": {
+ "ext-xdebug": ">=2.1.4",
+ "phpunit/phpunit": "~4"
+ },
+ "suggest": {
+ "ext-dom": "*",
+ "ext-xdebug": ">=2.2.1",
+ "ext-xmlwriter": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-10-06 15:47:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "time": "2015-06-21 13:08:43"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "time": "2015-06-21 13:50:34"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "time": "2015-06-21 08:01:12"
+ },
+ {
+ "name": "phpunit/php-token-stream",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/cab6c6fefee93d7b7c3a01292a0fe0884ea66644",
+ "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Wrapper around PHP's tokenizer extension.",
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+ "keywords": [
+ "tokenizer"
+ ],
+ "time": "2015-09-23 14:46:55"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "4.8.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e",
+ "reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-pcre": "*",
+ "ext-reflection": "*",
+ "ext-spl": "*",
+ "php": ">=5.3.3",
+ "phpspec/prophecy": "^1.3.1",
+ "phpunit/php-code-coverage": "~2.1",
+ "phpunit/php-file-iterator": "~1.4",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-timer": ">=1.0.6",
+ "phpunit/phpunit-mock-objects": "~2.3",
+ "sebastian/comparator": "~1.1",
+ "sebastian/diff": "~1.2",
+ "sebastian/environment": "~1.3",
+ "sebastian/exporter": "~1.2",
+ "sebastian/global-state": "~1.0",
+ "sebastian/version": "~1.0",
+ "symfony/yaml": "~2.1|~3.0"
+ },
+ "suggest": {
+ "phpunit/php-invoker": "~1.1"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.8.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-10-23 06:48:33"
+ },
+ {
+ "name": "phpunit/phpunit-mock-objects",
+ "version": "2.3.x-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": ">=5.3.3",
+ "phpunit/php-text-template": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "suggest": {
+ "ext-soap": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Mock Object library for PHPUnit",
+ "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
+ "keywords": [
+ "mock",
+ "xunit"
+ ],
+ "time": "2015-10-02 06:51:40"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/diff": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "time": "2015-07-26 15:48:44"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6899b3e33bfbd386d88b5eea5f65f563e8793051",
+ "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "http://www.github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff"
+ ],
+ "time": "2015-06-22 14:15:55"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "time": "2015-08-03 06:14:51"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "f88f8936517d54ae6d589166810877fb2015d0a2"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f88f8936517d54ae6d589166810877fb2015d0a2",
+ "reference": "f88f8936517d54ae6d589166810877fb2015d0a2",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/recursion-context": "~1.0"
+ },
+ "require-dev": {
+ "ext-mbstring": "*",
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "time": "2015-08-09 04:23:41"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "suggest": {
+ "ext-uopz": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "time": "2015-10-12 03:26:01"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba",
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2015-06-21 08:04:50"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "1.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "time": "2015-06-21 13:59:46"
+ },
+ {
+ "name": "symfony/yaml",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/yaml.git",
+ "reference": "8d32eb597b531eb915b4fee3dc582ade5ae1fe6a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/8d32eb597b531eb915b4fee3dc582ade5ae1fe6a",
+ "reference": "8d32eb597b531eb915b4fee3dc582ade5ae1fe6a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Yaml Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-10-13 16:01:35"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "dev",
+ "stability-flags": {
+ "league/commonmark": 20,
+ "mockery/mockery": 20
+ },
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=5.5.9"
+ },
"platform-dev": []
}
diff --git a/phpcs.xml b/phpcs.xml
index 6d83faf..5324a0f 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -6,12 +6,13 @@
src
tests
-
+
*/resources/*
*/src/MessageFormatter.php
*/src/Parser/MyCode.php
+ */tests/*
diff --git a/phpunit.php b/phpunit.php
new file mode 100644
index 0000000..39a1434
--- /dev/null
+++ b/phpunit.php
@@ -0,0 +1,5 @@
+
+
+
+
+ ./tests
+
+
+
+
+ ./src
+
+ ./src/Illuminate/Foundation/start.php
+ ./src/Illuminate/Foundation/Console/Optimize/config.php
+ ./src/Illuminate/Pagination/views
+
+
+
+
diff --git a/resources/views/smiley.twig b/resources/views/smiley.twig
new file mode 100644
index 0000000..d012367
--- /dev/null
+++ b/resources/views/smiley.twig
@@ -0,0 +1 @@
+
diff --git a/src/Database/Models/BadWord.php b/src/Database/Models/BadWord.php
index c55582d..e98bce2 100644
--- a/src/Database/Models/BadWord.php
+++ b/src/Database/Models/BadWord.php
@@ -13,7 +13,7 @@
use Illuminate\Database\Eloquent\Model;
/**
- * @property int id
+ * @property int id
* @property string find
* @property string replace
*/
@@ -21,20 +21,18 @@ class BadWord extends Model
{
// @codingStandardsIgnoreStart
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'parser_badwords';
-
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
-
+ /**
+ * The table associated with the model.
+ *
+ * @var string
+ */
+ protected $table = 'parser_badwords';
/**
* The attributes that aren't mass assignable.
*
diff --git a/src/Database/Models/MyCode.php b/src/Database/Models/MyCode.php
index 9aea895..9280b85 100644
--- a/src/Database/Models/MyCode.php
+++ b/src/Database/Models/MyCode.php
@@ -13,29 +13,27 @@
use Illuminate\Database\Eloquent\Model;
/**
- * @property int id
+ * @property int id
* @property string regex
* @property string replacement
- * @property int parseorder
+ * @property int parseorder
*/
class MyCode extends Model
{
// @codingStandardsIgnoreStart
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'parser_mycode';
-
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
-
+ /**
+ * The table associated with the model.
+ *
+ * @var string
+ */
+ protected $table = 'parser_mycode';
/**
* The attributes that aren't mass assignable.
*
diff --git a/src/Database/Models/Smiley.php b/src/Database/Models/Smiley.php
index 886014f..91b7342 100644
--- a/src/Database/Models/Smiley.php
+++ b/src/Database/Models/Smiley.php
@@ -13,29 +13,27 @@
use Illuminate\Database\Eloquent\Model;
/**
- * @property int id
+ * @property int id
* @property string find
* @property string image
- * @property int disporder
+ * @property int disporder
*/
class Smiley extends Model
{
// @codingStandardsIgnoreStart
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'parser_smilies';
-
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
-
+ /**
+ * The table associated with the model.
+ *
+ * @var string
+ */
+ protected $table = 'parser_smilies';
/**
* The attributes that aren't mass assignable.
*
diff --git a/src/Database/Repositories/Decorators/BadWordCachingDecorator.php b/src/Database/Repositories/Decorators/BadWordCachingDecorator.php
index f3c5d78..4167d67 100644
--- a/src/Database/Repositories/Decorators/BadWordCachingDecorator.php
+++ b/src/Database/Repositories/Decorators/BadWordCachingDecorator.php
@@ -27,7 +27,7 @@ class BadWordCachingDecorator implements BadWordRepositoryInterface
/**
* @param BadWordRepositoryInterface $decorated
- * @param CacheRepository $cache
+ * @param CacheRepository $cache
*/
public function __construct(
BadWordRepositoryInterface $decorated,
diff --git a/src/Database/Repositories/Decorators/CustomMyCodeCachingDecorator.php b/src/Database/Repositories/Decorators/CustomMyCodeCachingDecorator.php
index 8884510..b060347 100644
--- a/src/Database/Repositories/Decorators/CustomMyCodeCachingDecorator.php
+++ b/src/Database/Repositories/Decorators/CustomMyCodeCachingDecorator.php
@@ -14,7 +14,7 @@
use Illuminate\Support\Collection;
use MyBB\Parser\Database\Repositories\CustomMyCodeRepositoryInterface;
-class CustomMyMyCodeCachingDecorator implements CustomMyCodeRepositoryInterface
+class CustomMyCodeCachingDecorator implements CustomMyCodeRepositoryInterface
{
/**
* @var CustomMyCodeRepositoryInterface
@@ -27,7 +27,7 @@ class CustomMyMyCodeCachingDecorator implements CustomMyCodeRepositoryInterface
/**
* @param CustomMyCodeRepositoryInterface $decorated
- * @param CacheRepository $cache
+ * @param CacheRepository $cache
*/
public function __construct(
CustomMyCodeRepositoryInterface $decorated,
diff --git a/src/Database/Repositories/Decorators/SmileysCachingDecorator.php b/src/Database/Repositories/Decorators/SmileysCachingDecorator.php
index 2d61e7d..13c1840 100644
--- a/src/Database/Repositories/Decorators/SmileysCachingDecorator.php
+++ b/src/Database/Repositories/Decorators/SmileysCachingDecorator.php
@@ -27,7 +27,7 @@ class SmileysCachingDecorator implements SmileyRepositoryInterface
/**
* @param SmileyRepositoryInterface $decorated
- * @param CacheRepository $cache
+ * @param CacheRepository $cache
*/
public function __construct(
SmileyRepositoryInterface $decorated,
diff --git a/src/Database/Repositories/Eloquent/CustomMyCodeRepository.php b/src/Database/Repositories/Eloquent/CustomMyCodeRepository.php
index 74524cb..7609cbc 100644
--- a/src/Database/Repositories/Eloquent/CustomMyCodeRepository.php
+++ b/src/Database/Repositories/Eloquent/CustomMyCodeRepository.php
@@ -14,7 +14,7 @@
use MyBB\Parser\Database\Models\MyCode;
use MyBB\Parser\Database\Repositories\CustomMyCodeRepositoryInterface;
-class CustomMyMyCodeRepository implements CustomMyCodeRepositoryInterface
+class CustomMyCodeRepository implements CustomMyCodeRepositoryInterface
{
/**
* @var MyCode $model
diff --git a/src/Database/Repositories/Eloquent/SmileyRepository.php b/src/Database/Repositories/Eloquent/SmileyRepository.php
index 73781c3..1d94992 100644
--- a/src/Database/Repositories/Eloquent/SmileyRepository.php
+++ b/src/Database/Repositories/Eloquent/SmileyRepository.php
@@ -11,8 +11,8 @@
namespace MyBB\Parser\Database\Repositories\Eloquent;
use Illuminate\Support\Collection;
-use Mybb\Parser\Database\Models\Smiley;
-use Mybb\Parser\Database\Repositories\SmileyRepositoryInterface;
+use MyBB\Parser\Database\Models\Smiley;
+use MyBB\Parser\Database\Repositories\SmileyRepositoryInterface;
class SmileyRepository implements SmileyRepositoryInterface
{
diff --git a/src/Exceptions/ParserInvalidClassException.php b/src/Exceptions/ParserInvalidClassException.php
index f8b97dd..d1f131e 100644
--- a/src/Exceptions/ParserInvalidClassException.php
+++ b/src/Exceptions/ParserInvalidClassException.php
@@ -20,8 +20,8 @@ class ParserInvalidClassException extends RuntimeException
protected $message = 'parser::exceptions.invalid_class';
/**
- * @param string $class
- * @param int $code
+ * @param string $class
+ * @param int $code
* @param \Exception $previous
*/
public function __construct($class, $code = 0, \Exception $previous = null)
diff --git a/src/Exceptions/ParserSearchWordMinimumException.php b/src/Exceptions/ParserSearchWordMinimumException.php
index c9e99b9..73d1ad8 100644
--- a/src/Exceptions/ParserSearchWordMinimumException.php
+++ b/src/Exceptions/ParserSearchWordMinimumException.php
@@ -20,8 +20,8 @@ class ParserSearchWordMinimumException extends RuntimeException
protected $message = 'parser::exceptions.search_word_minimum';
/**
- * @param null $message
- * @param int $code
+ * @param null $message
+ * @param int $code
* @param \Exception $previous
*/
public function __construct(
diff --git a/src/MessageFormatter.php b/src/MessageFormatter.php
index 3cd5300..521390a 100644
--- a/src/MessageFormatter.php
+++ b/src/MessageFormatter.php
@@ -36,25 +36,25 @@ class MessageFormatter
/**
* @var array
*/
- private $highlight_cache = array();
+ private $highlight_cache = [];
/**
* @var integer
*/
private $minSearchWord = 3;
- const ENABLE_SMILEYS = 'enable_smilies';
- const ENABLE_MYCODE = 'enable_mycode';
- const ALLOW_HTML = 'allow_html';
+ const ENABLE_SMILEYS = 'enable_smilies';
+ const ENABLE_MYCODE = 'enable_mycode';
+ const ALLOW_HTML = 'allow_html';
const FILTER_BAD_WORDS = 'filter_badwords';
- const FILTER_CDATA = 'filter_cdata';
- const ME_USERNAME = 'me_username';
- const HIGHLIGHT = 'highlight';
- const NL2BR = 'nl2br';
+ const FILTER_CDATA = 'filter_cdata';
+ const ME_USERNAME = 'me_username';
+ const HIGHLIGHT = 'highlight';
+ const NL2BR = 'nl2br';
/**
- * @param ParserInterface $parser
- * @param \HTMLPurifier $htmlPurifier
- * @param SmileyRepositoryInterface $smileys
+ * @param ParserInterface $parser
+ * @param \HTMLPurifier $htmlPurifier
+ * @param SmileyRepositoryInterface $smileys
* @param BadWordRepositoryInterface $badWords
*/
public function __construct(
@@ -73,7 +73,7 @@ public function __construct(
* Parse the message with the given options
*
* @param string $message
- * @param array $options
+ * @param array $options
*
* @return string
*/
@@ -262,7 +262,7 @@ private function filterHtml($message)
/**
* @param string $message
- * @param bool $stripTags
+ * @param bool $stripTags
*
* @return string
*/
@@ -321,7 +321,7 @@ private function filterCdata($message)
*/
private function fixJavascript($message)
{
- $js_array = array(
+ $js_array = [
"#(&\#(0*)106;?|&\#(0*)74;?|&\#x(0*)4a;?|&\#x(0*)6a;?|j)((&\#(0*)97;?|&\#(0*)65;?|a)(&\#(0*)118;?|&\#(0*)86;?|v)(&\#(0*)97;?|&\#(0*)65;?|a)(\s)?(&\#(0*)115;?|&\#(0*)83;?|s)(&\#(0*)99;?|&\#(0*)67;?|c)(&\#(0*)114;?|&\#(0*)82;?|r)(&\#(0*)105;?|&\#(0*)73;?|i)(&\#112;?|&\#(0*)80;?|p)(&\#(0*)116;?|&\#(0*)84;?|t)(&\#(0*)58;?|\:))#i",
"#(o)(nmouseover\s?=)#i",
"#(o)(nmouseout\s?=)#i",
@@ -340,8 +340,8 @@ private function fixJavascript($message)
"#(o)(nkeypress\s?=)#i",
"#(o)(nerror\s?=)#i",
"#(o)(nreset\s?=)#i",
- "#(o)(nabort\s?=)#i"
- );
+ "#(o)(nabort\s?=)#i",
+ ];
$message = preg_replace($js_array, "$1$2$6", $message);
@@ -384,19 +384,19 @@ private function buildHighlightArray($terms)
$terms = implode(' ', $terms);
}
// Strip out any characters that shouldn't be included
- $bad_characters = array(
+ $bad_characters = [
"(",
")",
"+",
"-",
- "~"
- );
+ "~",
+ ];
$terms = str_replace($bad_characters, '', $terms);
// Check if this is a "series of words" - should be treated as an EXACT match
if (strpos($terms, "\"") !== false) {
$inquote = false;
$terms = explode("\"", $terms);
- $words = array();
+ $words = [];
foreach ($terms as $phrase) {
$phrase = e($phrase);
if ($phrase != "") {
@@ -437,7 +437,7 @@ private function buildHighlightArray($terms)
return false;
}
- $highlight_cache = array();
+ $highlight_cache = [];
// Sort the word array by length. Largest terms go first and work their way down to the smallest term.
// This resolves problems like "test tes" where "tes" will be highlighted first,
@@ -472,7 +472,7 @@ private function buildHighlightArray($terms)
*/
public function setMinSearchWord($min = 1)
{
- $min = (int) $min;
+ $min = (int)$min;
if ($min < 1) {
throw new ParserSearchWordMinimumException;
diff --git a/src/Parser/MyCode.php b/src/Parser/MyCode.php
index c5724dc..9df9c51 100644
--- a/src/Parser/MyCode.php
+++ b/src/Parser/MyCode.php
@@ -123,8 +123,8 @@ public function __construct(
/**
* Parse a message into a HTML string ready for display.
*
- * @param string $message The message to parse.
- * @param bool $allowHtml Whether to allow HTML in the message.
+ * @param string $message The message to parse.
+ * @param bool $allowHtml Whether to allow HTML in the message.
*
* @return string
*/
@@ -172,178 +172,6 @@ public function parse($message, $allowHtml)
return $message;
}
- /**
- * @param string $message
- * @param array $options
- *
- * @return string
- */
- public function parsePlain($message, $options = array())
- {
- // Parse quotes first
- $message = $this->parseQuotes($message, true);
- $message = preg_replace_callback(
- "#\[php\](.*?)\[/php\](\r\n?|\n?)#is",
- array($this, 'parsePhpCallback'),
- $message
- );
- $message = preg_replace_callback(
- "#\[code\](.*?)\[/code\](\r\n?|\n?)#is",
- array($this, 'parseCodeCallback'),
- $message
- );
- $find = array(
- "#\[(b|u|i|s|url|email|color|img)\](.*?)\[/\\1\]#is",
- "#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- "#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si",
- "#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#si",
- );
- $replace = array(
- "$2",
- "$4",
- "$3 ($1$2)",
- "$2 ($1)",
- );
- $message = preg_replace($find, $replace, $message);
-
- // Reset list cache
- $this->list_elements = array();
- $this->list_count = 0;
- // Find all lists
- $message = preg_replace_callback(
- "#(\[list(=(a|A|i|I|1))?\]|\[/list\])#si",
- array($this, 'prepareList'),
- $message
- );
- // Replace all lists
- for ($i = $this->list_count; $i > 0; $i--) {
- // Ignores missing end tags
- $message = preg_replace_callback(
- "#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si",
- array(
- $this,
- 'parseListCallback'
- ),
- $message,
- 1
- );
- }
-
- return $message;
- }
-
- /**
- * @param string|callable $format
- */
- public function setDateFormatting($format)
- {
- $this->dateFormat = $format;
- }
-
- /**
- * @param string|callable $url
- */
- public function setPostURL($url)
- {
- $this->postURL = $url;
- }
-
- /**
- * @param bool $allow
- */
- public function allowBasicCode($allow = true)
- {
- $this->allowbasicmycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowSymbolCode($allow = true)
- {
- $this->allowsymbolmycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowLinkCode($allow = true)
- {
- $this->allowlinkmycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowEmailCode($allow = true)
- {
- $this->allowemailmycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowColorCode($allow = true)
- {
- $this->allowcolormycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowSizeCode($allow = true)
- {
- $this->allowsizemycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowFontCode($allow = true)
- {
- $this->allowfontmycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowAlignCode($allow = true)
- {
- $this->allowalignmycode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowImgCode($allow = true)
- {
- $this->allowimgcode = $allow;
- }
-
- /**
- * @param bool $allow
- */
- public function allowVideoCode($allow = true)
- {
- $this->allowvideocode = $allow;
- }
-
- /**
- * @param bool $short
- */
- public function shortenURLs($short = true)
- {
- $this->shorten_urls = $short;
- }
-
- /**
- * @param bool $on
- */
- public function useNoFollow($on = true)
- {
- $this->nofollow_on = $on;
- }
-
/**
* @param string $message
*
@@ -391,12 +219,12 @@ private function parseMyCode($message)
}
// Reset list cache
if ($this->allowlistmycode) {
- $this->list_elements = array();
+ $this->list_elements = [];
$this->list_count = 0;
// Find all lists
$message = preg_replace_callback(
"#(\[list(=(a|A|i|I|1))?\]|\[/list\])#si",
- array($this, 'prepareList'),
+ [$this, 'prepareList'],
$message
);
// Replace all lists
@@ -404,10 +232,10 @@ private function parseMyCode($message)
// Ignores missing end tags
$message = preg_replace_callback(
"#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si",
- array(
+ [
$this,
- 'parseListCallback'
- ),
+ 'parseListCallback',
+ ],
$message,
1
);
@@ -417,67 +245,67 @@ private function parseMyCode($message)
if ($this->allowimgcode) {
$message = preg_replace_callback(
"#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageCallback'
- ),
+ 'parseImageCallback',
+ ],
$message
);
$message = preg_replace_callback(
"#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageCallback2'
- ),
+ 'parseImageCallback2',
+ ],
$message
);
$message = preg_replace_callback(
"#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageCallback3'
- ),
+ 'parseImageCallback3',
+ ],
$message
);
$message = preg_replace_callback(
"#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageCallback4'
- ),
+ 'parseImageCallback4',
+ ],
$message
);
} else {
$message = preg_replace_callback(
"#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageDisabledCallback'
- ),
+ 'parseImageDisabledCallback',
+ ],
$message
);
$message = preg_replace_callback(
"#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageDisabledCallback2'
- ),
+ 'parseImageDisabledCallback2',
+ ],
$message
);
$message = preg_replace_callback(
"#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageDisabledCallback3'
- ),
+ 'parseImageDisabledCallback3',
+ ],
$message
);
$message = preg_replace_callback(
"#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
- array(
+ [
$this,
- 'parseImageDisabledCallback4'
- ),
+ 'parseImageDisabledCallback4',
+ ],
$message
);
}
@@ -485,16 +313,16 @@ private function parseMyCode($message)
if ($this->allowvideocode) {
$message = preg_replace_callback(
"#\[video=(.*?)\](.*?)\[/video\]#i",
- array($this, 'parseVideoCallback'),
+ [$this, 'parseVideoCallback'],
$message
);
} else {
$message = preg_replace_callback(
"#\[video=(.*?)\](.*?)\[/video\]#i",
- array(
+ [
$this,
- 'parseVideoDisabledCallback'
- ),
+ 'parseVideoDisabledCallback',
+ ],
$message
);
}
@@ -507,8 +335,8 @@ private function parseMyCode($message)
*/
private function cacheMyCode()
{
- $this->mycode_cache = array();
- $standard_mycode = $callback_mycode = $nestable_mycode = array();
+ $this->mycode_cache = [];
+ $standard_mycode = $callback_mycode = $nestable_mycode = [];
$standard_count = $callback_count = $nestable_count = 0;
if ($this->allowbasicmycode) {
$standard_mycode['b']['regex'] = "#\[b\](.*?)\[/b\]#si";
@@ -534,38 +362,38 @@ private function cacheMyCode()
}
if ($this->allowlinkmycode) {
$callback_mycode['url_simple']['regex'] = "#\[url\]([a-z]+?://)([^\r\n\"<]+?)\[/url\]#si";
- $callback_mycode['url_simple']['replacement'] = array(
+ $callback_mycode['url_simple']['replacement'] = [
$this,
- 'parseUrlCallback1'
- );
+ 'parseUrlCallback1',
+ ];
$callback_mycode['url_simple2']['regex'] = "#\[url\]([^\r\n\"<]+?)\[/url\]#i";
- $callback_mycode['url_simple2']['replacement'] = array(
+ $callback_mycode['url_simple2']['replacement'] = [
$this,
- 'parseUrlCallback2'
- );
+ 'parseUrlCallback2',
+ ];
$callback_mycode['url_complex']['regex'] = "#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si";
- $callback_mycode['url_complex']['replacement'] = array(
+ $callback_mycode['url_complex']['replacement'] = [
$this,
- 'parseUrlCallback1'
- );
+ 'parseUrlCallback1',
+ ];
$callback_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#si";
- $callback_mycode['url_complex2']['replacement'] = array(
+ $callback_mycode['url_complex2']['replacement'] = [
$this,
- 'parseUrlCallback2'
- );
+ 'parseUrlCallback2',
+ ];
++$callback_count;
}
if ($this->allowemailmycode) {
$callback_mycode['email_simple']['regex'] = "#\[email\](.*?)\[/email\]#i";
- $callback_mycode['email_simple']['replacement'] = array(
+ $callback_mycode['email_simple']['replacement'] = [
$this,
- 'parseEmailCallback'
- );
+ 'parseEmailCallback',
+ ];
$callback_mycode['email_complex']['regex'] = "#\[email=(.*?)\](.*?)\[/email\]#i";
- $callback_mycode['email_complex']['replacement'] = array(
+ $callback_mycode['email_complex']['replacement'] = [
$this,
- 'parseEmailCallback'
- );
+ 'parseEmailCallback',
+ ];
++$callback_count;
}
if ($this->allowcolormycode) {
@@ -579,10 +407,10 @@ private function cacheMyCode()
"#\[size=(xx-small|x-small|small|medium|large|x-large|xx-large)\](.*?)\[/size\]#si";
$nestable_mycode['size']['replacement'] = "$2";
$callback_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";
- $callback_mycode['size_int']['replacement'] = array(
+ $callback_mycode['size_int']['replacement'] = [
$this,
- 'handleSizeCallback'
- );
+ 'handleSizeCallback',
+ ];
++$nestable_count;
++$callback_count;
}
@@ -616,17 +444,17 @@ private function cacheMyCode()
}
// Assign the nestable MyCode to the cache.
foreach ($nestable_mycode as $code) {
- $this->mycode_cache['nestable'][] = array(
+ $this->mycode_cache['nestable'][] = [
'find' => $code['regex'],
- 'replacement' => $code['replacement']
- );
+ 'replacement' => $code['replacement'],
+ ];
}
// Assign the nestable MyCode to the cache.
foreach ($callback_mycode as $code) {
- $this->mycode_cache['callback'][] = array(
+ $this->mycode_cache['callback'][] = [
'find' => $code['regex'],
- 'replacement' => $code['replacement']
- );
+ 'replacement' => $code['replacement'],
+ ];
}
$this->mycode_cache['standard_count'] = $standard_count;
$this->mycode_cache['callback_count'] = $callback_count;
@@ -635,7 +463,7 @@ private function cacheMyCode()
/**
* @param string $message
- * @param bool $text_only
+ * @param bool $text_only
*
* @return string
*/
@@ -647,10 +475,10 @@ private function parseQuotes($message, $text_only = false)
$quote = trans('parser::parser.quote');
if ($text_only == false) {
$replace = "$quote$1
\n";
- $replace_callback = array($this, 'parsePostQuotesCallback1');
+ $replace_callback = [$this, 'parsePostQuotesCallback1'];
} else {
$replace = "\n{$quote}\n--\n$1\n--\n";
- $replace_callback = array($this, 'parsePostQuotesCallback2');
+ $replace_callback = [$this, 'parsePostQuotesCallback2'];
}
do {
// preg_replace has erased the message? Restore it...
@@ -669,14 +497,14 @@ private function parseQuotes($message, $text_only = false)
}
} while ($count || $count_callback);
if ($text_only == false) {
- $find = array(
+ $find = [
"#(\r\n*|\n*)<\/cite>(\r\n*|\n*)#",
- "#(\r\n*|\n*)<\/blockquote>#"
- );
- $replace = array(
+ "#(\r\n*|\n*)<\/blockquote>#",
+ ];
+ $replace = [
"
",
- ""
- );
+ "",
+ ];
$message = preg_replace($find, $replace, $message);
}
@@ -694,18 +522,18 @@ private function autoUrl($message)
// Links should end with slashes, numbers, characters and braces but not with dots, commas or question marks
$message = preg_replace_callback(
"#([\>\s\(\)])(http|https|ftp|news|irc|ircs|irc6){1}://([^\/\"\s\<\[\.]+\.([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#iu",
- array(
+ [
$this,
- 'autoUrlCallback'
- ),
+ 'autoUrlCallback',
+ ],
$message
);
$message = preg_replace_callback(
"#([\>\s\(\)])(www|ftp)\.(([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#iu",
- array(
+ [
$this,
- 'autoUrlCallback'
- ),
+ 'autoUrlCallback',
+ ],
$message
);
$message = substr($message, 1);
@@ -733,7 +561,7 @@ private function fixHtml($message)
/**
* @param string $code
- * @param bool $text_only
+ * @param bool $text_only
*
* @return string
*/
@@ -763,8 +591,8 @@ private function parseCode($code, $text_only = false)
/**
* @param string $str
- * @param bool $bare_return
- * @param bool $text_only
+ * @param bool $bare_return
+ * @param bool $text_only
*
* @return string
*/
@@ -841,6 +669,178 @@ private function parsePhp($str, $bare_return = false, $text_only = false)
$code . "\n";
}
+ /**
+ * @param string $message
+ * @param array $options
+ *
+ * @return string
+ */
+ public function parsePlain($message, $options = [])
+ {
+ // Parse quotes first
+ $message = $this->parseQuotes($message, true);
+ $message = preg_replace_callback(
+ "#\[php\](.*?)\[/php\](\r\n?|\n?)#is",
+ [$this, 'parsePhpCallback'],
+ $message
+ );
+ $message = preg_replace_callback(
+ "#\[code\](.*?)\[/code\](\r\n?|\n?)#is",
+ [$this, 'parseCodeCallback'],
+ $message
+ );
+ $find = [
+ "#\[(b|u|i|s|url|email|color|img)\](.*?)\[/\\1\]#is",
+ "#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
+ "#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si",
+ "#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#si",
+ ];
+ $replace = [
+ "$2",
+ "$4",
+ "$3 ($1$2)",
+ "$2 ($1)",
+ ];
+ $message = preg_replace($find, $replace, $message);
+
+ // Reset list cache
+ $this->list_elements = [];
+ $this->list_count = 0;
+ // Find all lists
+ $message = preg_replace_callback(
+ "#(\[list(=(a|A|i|I|1))?\]|\[/list\])#si",
+ [$this, 'prepareList'],
+ $message
+ );
+ // Replace all lists
+ for ($i = $this->list_count; $i > 0; $i--) {
+ // Ignores missing end tags
+ $message = preg_replace_callback(
+ "#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si",
+ [
+ $this,
+ 'parseListCallback',
+ ],
+ $message,
+ 1
+ );
+ }
+
+ return $message;
+ }
+
+ /**
+ * @param string|callable $format
+ */
+ public function setDateFormatting($format)
+ {
+ $this->dateFormat = $format;
+ }
+
+ /**
+ * @param string|callable $url
+ */
+ public function setPostURL($url)
+ {
+ $this->postURL = $url;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowBasicCode($allow = true)
+ {
+ $this->allowbasicmycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowSymbolCode($allow = true)
+ {
+ $this->allowsymbolmycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowLinkCode($allow = true)
+ {
+ $this->allowlinkmycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowEmailCode($allow = true)
+ {
+ $this->allowemailmycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowColorCode($allow = true)
+ {
+ $this->allowcolormycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowSizeCode($allow = true)
+ {
+ $this->allowsizemycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowFontCode($allow = true)
+ {
+ $this->allowfontmycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowAlignCode($allow = true)
+ {
+ $this->allowalignmycode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowImgCode($allow = true)
+ {
+ $this->allowimgcode = $allow;
+ }
+
+ /**
+ * @param bool $allow
+ */
+ public function allowVideoCode($allow = true)
+ {
+ $this->allowvideocode = $allow;
+ }
+
+ /**
+ * @param bool $short
+ */
+ public function shortenURLs($short = true)
+ {
+ $this->shorten_urls = $short;
+ }
+
+ /**
+ * @param bool $on
+ */
+ public function useNoFollow($on = true)
+ {
+ $this->nofollow_on = $on;
+ }
+
/**
* @param array $matches
*
@@ -852,14 +852,14 @@ private function handleSizeCallback($matches)
}
/**
- * @param int $size
+ * @param int $size
* @param string $text
*
* @return string
*/
private function myCodeHandleSize($size, $text)
{
- $size = (int) $size + 10;
+ $size = (int)$size + 10;
if ($size > 50) {
$size = 50;
}
@@ -882,24 +882,10 @@ private function parsePostQuotesCallback1($matches)
return $this->parsePostQuotes($matches[4], $matches[2] . $matches[3]);
}
- /**
- * @param array $matches
- *
- * @return string
- */
- private function parsePostQuotesCallback2($matches)
- {
- return $this->parsePostQuotes(
- $matches[4],
- $matches[2] . $matches[3],
- true
- );
- }
-
/**
* @param string $message
* @param string $username
- * @param bool $text_only
+ * @param bool $text_only
*
* @return string
*/
@@ -923,8 +909,8 @@ private function parsePostQuotes($message, $username, $text_only = false)
$username,
$match
);
- if (isset($match[1]) && (int) $match[1]) {
- $pid = (int) $match[1];
+ if (isset($match[1]) && (int)$match[1]) {
+ $pid = (int)$match[1];
$url = $this->getPostURL($pid);
$linkback = " [ -> ]";
$username = preg_replace(
@@ -941,9 +927,9 @@ private function parsePostQuotes($message, $username, $text_only = false)
$username,
$match
);
- if (isset($match[1]) && (int) $match[1]) {
+ if (isset($match[1]) && (int)$match[1]) {
if ($match[1] < time()) {
- $postdate = $this->parseDate((int) $match[1]);
+ $postdate = $this->parseDate((int)$match[1]);
$date = " ({$postdate})";
}
$username = preg_replace(
@@ -1001,6 +987,20 @@ private function parseDate($time)
return date($this->dateFormat, $time);
}
+ /**
+ * @param array $matches
+ *
+ * @return string
+ */
+ private function parsePostQuotesCallback2($matches)
+ {
+ return $this->parsePostQuotes(
+ $matches[4],
+ $matches[2] . $matches[3],
+ true
+ );
+ }
+
/**
* @param array $matches
*
@@ -1033,12 +1033,12 @@ private function parseImageCallback($matches)
/**
* @param string $url
- * @param array $dimensions
+ * @param array $dimensions
* @param string $align
*
* @return string
*/
- private function parseImage($url, $dimensions = array(), $align = '')
+ private function parseImage($url, $dimensions = [], $align = '')
{
$url = trim($url);
$url = str_replace("\n", "", $url);
@@ -1076,7 +1076,7 @@ private function parseImage($url, $dimensions = array(), $align = '')
*/
private function parseImageCallback2($matches)
{
- return $this->parseImage($matches[4], array($matches[1], $matches[2]));
+ return $this->parseImage($matches[4], [$matches[1], $matches[2]]);
}
/**
@@ -1086,7 +1086,7 @@ private function parseImageCallback2($matches)
*/
private function parseImageCallback3($matches)
{
- return $this->parseImage($matches[3], array(), $matches[1]);
+ return $this->parseImage($matches[3], [], $matches[1]);
}
/**
@@ -1098,7 +1098,7 @@ private function parseImageCallback4($matches)
{
return $this->parseImage(
$matches[5],
- array($matches[1], $matches[2]),
+ [$matches[1], $matches[2]],
$matches[3]
);
}
@@ -1132,34 +1132,6 @@ private function parseImageDisabled($url)
return $image;
}
- /**
- * @param array $matches
- *
- * @return string
- */
- private function parseUrlCallback1($matches)
- {
- if (!isset($matches[3])) {
- $matches[3] = '';
- }
-
- return $this->ParseUrl($matches[1] . $matches[2], $matches[3]);
- }
-
- /**
- * @param array $matches
- *
- * @return string
- */
- private function parseUrlCallback2($matches)
- {
- if (!isset($matches[2])) {
- $matches[2] = '';
- }
-
- return $this->ParseUrl($matches[1], $matches[2]);
- }
-
/**
* @param string $url
* @param string $name
@@ -1190,7 +1162,7 @@ private function parseUrl($url, $name = "")
$nofollow = " rel=\"nofollow\"";
}
// Fix some entities in URLs
- $entities = array(
+ $entities = [
'$' => '%24',
'$' => '%24',
'^' => '%5E',
@@ -1202,8 +1174,8 @@ private function parseUrl($url, $name = "")
'"' => '%22',
'<' => '%3C',
'>' => '%3E',
- ' ' => '%20'
- );
+ ' ' => '%20',
+ ];
$fullurl = str_replace(
array_keys($entities),
array_values($entities),
@@ -1219,6 +1191,34 @@ private function parseUrl($url, $name = "")
return $link;
}
+ /**
+ * @param array $matches
+ *
+ * @return string
+ */
+ private function parseUrlCallback1($matches)
+ {
+ if (!isset($matches[3])) {
+ $matches[3] = '';
+ }
+
+ return $this->ParseUrl($matches[1] . $matches[2], $matches[3]);
+ }
+
+ /**
+ * @param array $matches
+ *
+ * @return string
+ */
+ private function parseUrlCallback2($matches)
+ {
+ if (!isset($matches[2])) {
+ $matches[2] = '';
+ }
+
+ return $this->ParseUrl($matches[1], $matches[2]);
+ }
+
/**
* @param array $matches
*
@@ -1316,15 +1316,15 @@ private function parseVideo($video, $url)
if ($parsed_url == false) {
return "[video={$video}]{$url}[/video]";
}
- $fragments = array();
+ $fragments = [];
if (isset($parsed_url['fragment'])) {
$fragments = explode("&", $parsed_url['fragment']);
}
- $queries = array();
+ $queries = [];
if (isset($parsed_url['query'])) {
$queries = explode("&", $parsed_url['query']);
}
- $input = array();
+ $input = [];
foreach ($queries as $query) {
// $value isn't always defined, eg facebook uses "&theater" which would throw an error
@list($key, $value) = explode("=", $query);
diff --git a/src/Parser/ParserInterface.php b/src/Parser/ParserInterface.php
index ed4e905..9c6ce11 100644
--- a/src/Parser/ParserInterface.php
+++ b/src/Parser/ParserInterface.php
@@ -15,8 +15,8 @@ interface ParserInterface
/**
* Parse a message into a HTML string ready for display.
*
- * @param string $message The message to parse.
- * @param bool $allowHTML Whether to allow HTML in the message.
+ * @param string $message The message to parse.
+ * @param bool $allowHTML Whether to allow HTML in the message.
*
* @return string The parsed string.
*/
diff --git a/src/Parser/Renderers/SmileyRendererInterface.php b/src/Parser/Renderers/SmileyRendererInterface.php
new file mode 100644
index 0000000..0549492
--- /dev/null
+++ b/src/Parser/Renderers/SmileyRendererInterface.php
@@ -0,0 +1,24 @@
+viewFactory = $viewFactory;
+ }
+
+ /**
+ * Render a smiley.
+ *
+ * @param string $search The search for the smiley.
+ * @param string $replace The replacement for the smiley.
+ *
+ * @return string The rendered smiley.
+ */
+ public function render($search, $replace)
+ {
+ return $this->viewFactory->make(
+ static::VIEW_PATH,
+ compact(
+ 'search',
+ 'replace'
+ )
+ )->render();
+ }
+}
\ No newline at end of file
diff --git a/src/Parser/SmileyParser.php b/src/Parser/SmileyParser.php
new file mode 100644
index 0000000..82943bc
--- /dev/null
+++ b/src/Parser/SmileyParser.php
@@ -0,0 +1,126 @@
+
+ * replace].
+ *
+ * @var array $smileys
+ */
+ protected $smileys = null;
+
+ /**
+ * A repository to load smileys from.
+ *
+ * @var SmileyRepositoryInterface $smileyRepository ;
+ */
+ protected $smileyRepository;
+
+ /**
+ * Renderer to render smileys
+ *
+ * @var SmileyRendererInterface $smileyRenderer
+ */
+ protected $smileyRenderer;
+
+ /**
+ * Create a new smiley parser.
+ *
+ * @param SmileyRepositoryInterface $smileyRepository Repository to load
+ * smileys from.
+ * @param SmileyRendererInterface $smileyRenderer Render to render smileys.
+ */
+ public function __construct(
+ SmileyRepositoryInterface $smileyRepository,
+ SmileyRendererInterface $smileyRenderer
+ ) {
+ $this->smileyRepository = $smileyRepository;
+ $this->smileyRenderer = $smileyRenderer;
+ }
+
+ /**
+ * Parse a message, replacing all smiley codes with their images.
+ *
+ * @param string $message The message to parse.
+ *
+ * @return string The parsed message.
+ */
+ public function parse($message)
+ {
+ $this->assertSmileysLoaded();
+
+ if (!empty($this->smileys)) {
+ // TODO: This will need to handle Markdown URLs too...
+ // We do not want to parse smileys inside URLs or inside quote
+ $regex = "#\[(url(=[^\]]*)?\]|" . // URL MyCode
+ "quote=([^\]]*)?\])|" . // Quote MyCode
+ "(http|ftp)(s|):\/\/[^\s]*#i"; // Links
+
+ preg_match_all(
+ $regex,
+ $message,
+ $badMatches,
+ PREG_PATTERN_ORDER
+ );
+
+ if (count($badMatches[0]) > 0) {
+ $message = preg_replace(
+ $regex,
+ '',
+ $message
+ );
+ }
+
+ $message = str_ireplace(
+ array_keys($this->smileys),
+ array_values($this->smileys),
+ $message
+ );
+
+ // If we matched any tags previously, swap them back in
+ if (count($badMatches[0]) > 0) {
+ $message = explode('', $message);
+ $i = 0;
+
+ foreach ($badMatches[0] as $match) {
+ $message[$i] .= $match;
+ $i++;
+ }
+
+ $message = implode("", $message);
+ }
+ }
+
+ return $message;
+ }
+
+ /**
+ * Ensure that smiley replacements have been loaded.
+ */
+ protected function assertSmileysLoaded()
+ {
+ if ($this->smileys === null) {
+ $smileys = $this->smileyRepository->getParseableSmileys();
+ $this->smileys = [];
+
+ foreach ($smileys as $search => $replace) {
+ $replacement = $this->smileyRenderer->render($search, $replace);
+ $this->smileys[$search] = $replacement;
+ }
+ }
+ }
+}
diff --git a/src/Parser/markdown.php b/src/Parser/markdown.php
index 036ac3a..466025d 100644
--- a/src/Parser/markdown.php
+++ b/src/Parser/markdown.php
@@ -29,7 +29,7 @@ public function __construct(CommonMarkConverter $converter)
/**
* @param string $message
- * @param bool $allowHTML
+ * @param bool $allowHTML
*
* @return string
*/
diff --git a/src/ParserServiceProvider.php b/src/ParserServiceProvider.php
index f376b84..a461621 100644
--- a/src/ParserServiceProvider.php
+++ b/src/ParserServiceProvider.php
@@ -12,9 +12,18 @@
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
+use MyBB\Parser\Database\Repositories\BadWordRepositoryInterface;
+use MyBB\Parser\Database\Repositories\CustomMyCodeRepositoryInterface;
use MyBB\Parser\Database\Repositories\Decorators\BadWordCachingDecorator;
-use MyBB\Parser\Database\Repositories\Decorators\CustomMyMyCodeCachingDecorator;
+use MyBB\Parser\Database\Repositories\Decorators\CustomMyCodeCachingDecorator;
use MyBB\Parser\Database\Repositories\Decorators\SmileysCachingDecorator;
+use MyBB\Parser\Database\Repositories\Eloquent\BadWordRepository;
+use MyBB\Parser\Database\Repositories\Eloquent\CustomMyCodeRepository;
+use MyBB\Parser\Database\Repositories\Eloquent\SmileyRepository;
+use MyBB\Parser\Database\Repositories\SmileyRepositoryInterface;
+use MyBB\Parser\Parser\MyCode;
+use MyBB\Parser\Parser\Renderers\SmileyRendererInterface;
+use MyBB\Parser\Parser\Renderers\ViewSmileyRenderer;
class ParserServiceProvider extends ServiceProvider
{
@@ -37,6 +46,8 @@ public function register()
'parser'
);
+ $this->app->singleton('MyBB\Parser\Parser\SmileyParser');
+
// Bind a default instance of the HTMLPurifier and set the encoding to UTF-8
// which shouldn't be a problem in most cases
$this->app->bind(
@@ -50,10 +61,10 @@ function () {
);
$this->app->bind(
- 'MyBB\Parser\Database\Repositories\BadWordRepositoryInterface',
+ BadWordRepositoryInterface::class,
function (Application $app) {
$repository = $app->make(
- 'MyBB\Parser\Database\Repositories\Eloquent\BadWordRepository'
+ BadWordRepository::class
);
$cache = $app->make('Illuminate\Contracts\Cache\Repository');
@@ -62,10 +73,10 @@ function (Application $app) {
);
$this->app->bind(
- 'MyBB\Parser\Database\Repositories\SmileyRepositoryInterface',
+ SmileyRepositoryInterface::class,
function (Application $app) {
$repository = $app->make(
- 'MyBB\Parser\Database\Repositories\Eloquent\SmileyRepository'
+ SmileyRepository::class
);
$cache = $app->make('Illuminate\Contracts\Cache\Repository');
@@ -73,26 +84,31 @@ function (Application $app) {
}
);
+ $this->app->bind(
+ SmileyRendererInterface::class,
+ ViewSmileyRenderer::class
+ );
+
// Bind the CustomMyCode Repository to the BBCode Parser
- $this->app->when('MyBB\Parser\Parser\MyCode')
- ->needs(
- 'MyBB\Parser\Database\Repositories\CustomMyCodeRepositoryInterface'
- )
- ->give(
- function (Application $app) {
- $repository = $app->make(
- 'MyBB\Parser\Database\Repositories\Eloquent\CustomMyCodeRepository'
- );
- $cache = $app->make(
- 'Illuminate\Contracts\Cache\Repository'
- );
-
- return new CustomMyMyCodeCachingDecorator(
- $repository,
- $cache
- );
- }
- );
+ $this->app->when(MyCode::class)
+ ->needs(
+ CustomMyCodeRepositoryInterface::class
+ )
+ ->give(
+ function (Application $app) {
+ $repository = $app->make(
+ CustomMyCodeRepository::class
+ );
+ $cache = $app->make(
+ 'Illuminate\Contracts\Cache\Repository'
+ );
+
+ return new CustomMyCodeCachingDecorator(
+ $repository,
+ $cache
+ );
+ }
+ );
}
/**
@@ -103,21 +119,31 @@ function (Application $app) {
public function boot()
{
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'parser');
+ $this->loadViewsFrom(__DIR__ . '/../resources/views', 'parser');
$this->publishes(
[
__DIR__ . '/../resources/migrations/' => base_path(
'/database/migrations'
- )
+ ),
],
'migrations'
);
+ $this->publishes(
+ [
+ __DIR__ . '/../resources/views/' => base_path(
+ 'resources/views/vendor/parser'
+ ),
+ ],
+ 'views'
+ );
+
$this->publishes(
[
__DIR__ . '/../resources/config/parser.php' => config_path(
'parser.php'
- )
+ ),
],
'config'
);
diff --git a/tests/Parser/SmileyParserTest.php b/tests/Parser/SmileyParserTest.php
new file mode 100644
index 0000000..9b187b3
--- /dev/null
+++ b/tests/Parser/SmileyParserTest.php
@@ -0,0 +1,176 @@
+shouldReceive('render')->andReturn(
+ '
'
+ );
+
+ $this->viewFactoryMock = m::mock('Illuminate\Contracts\View\Factory');
+ $this->viewFactoryMock->shouldReceive('make')->andReturn($viewMock);
+
+ $this->viewRenderer = new ViewSmileyRenderer($this->viewFactoryMock);
+ }
+
+ public function tearDown()
+ {
+ m::close();
+ }
+
+ /**
+ * Simple test of a short message string.
+ */
+ public function testParseSimple()
+ {
+ $expected = 'Hello World
';
+ $message = 'Hello World :)';
+
+ $smileyRepo = m::mock(
+ 'MyBB\Parser\Database\Repositories\SmileyRepositoryInterface'
+ );
+ $smileyRepo->shouldReceive('getParseableSmileys')->andReturn(
+ [
+ ':)' => 'smile',
+ ':(' => 'sad',
+ ]
+ );
+
+
+ $smileyParser = new SmileyParser($smileyRepo, $this->viewRenderer);
+
+ $actual = $smileyParser->parse($message);
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * Slightly more complex tests with a URL in the message, to test the
+ * skipping of URLs.
+ */
+ public function testParseWithUrl()
+ {
+ $expected = 'Head to http://mybb.com
';
+ $message = 'Head to http://mybb.com :)';
+
+ $smileyRepo = m::mock(
+ 'MyBB\Parser\Database\Repositories\SmileyRepositoryInterface'
+ );
+ $smileyRepo->shouldReceive('getParseableSmileys')->andReturn(
+ [
+ ':)' => 'smile',
+ ':/' => 'awkward',
+ ]
+ );
+
+ $smileyParser = new SmileyParser($smileyRepo, $this->viewRenderer);
+
+ $actual = $smileyParser->parse($message);
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * Test against a longer message with several smileys.
+ */
+ public function testParseLongerContent()
+ {
+ $expected = <<.
+
+Mauris dapibus tellus in erat rutrum viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque id facilisis justo. Nunc sit amet lacus tellus. Ut ut pellentesque ex. Fusce quis ex ultrices, consectetur enim at, vulputate dolor. Nullam pharetra, elit ut ullamcorper suscipit, orci tellus suscipit nisi, vel luctus mi orci eget velit. Phasellus ornare ipsum ac elit maximus, sit amet suscipit odio imperdiet. Integer eget vehicula ante. Fusce porttitor aliquet molestie. Nullam pulvinar nisi odio, maximus efficitur libero sagittis a. Sed quis venenatis nunc
.
+
+Aliquam in sem est. Quisque faucibus condimentum dui, eget volutpat erat porttitor ut. Etiam quis magna odio. Ut sollicitudin rutrum urna ac fringilla. Quisque porta lorem magna, eu malesuada risus volutpat et. Morbi pellentesque a mauris at gravida. Aenean consequat bibendum tempus. Nunc laoreet nisl id sem venenatis hendrerit. Aliquam lacinia nec ante sed venenatis. Ut porttitor ipsum nec maximus faucibus. Quisque non purus vel lacus ultricies aliquet. Donec maximus viverra mi, quis accumsan diam dictum eget. Nam auctor ullamcorper varius. Vivamus libero odio, porttitor quis nisi et, convallis sagittis dui.
Aenean ante enim, mattis id ligula eleifend, fringilla euismod felis. Aliquam ac ipsum hendrerit, posuere augue vel, gravida turpis.
+
+In luctus dictum leo in pretium. Vestibulum nibh augue, pellentesque quis consectetur in, commodo et ex. Integer vitae mauris sem. Etiam odio libero, pretium ac pretium vel, commodo et quam. Sed ac sodales justo. Pellentesque nec justo non lectus volutpat mattis ut quis purus. Praesent tincidunt venenatis odio, et blandit ipsum congue eu. Nunc vitae luctus justo. Sed condimentum ligula sed dolor suscipit efficitur. Morbi mattis convallis justo quis laoreet. Donec id ex dapibus, euismod dui vel, eleifend massa. Sed dui nunc, vulputate sit amet rhoncus a, lacinia quis justo. Proin eu ornare lacus.
+EOT;
+
+
+ $message = <<shouldReceive('getParseableSmileys')->andReturn(
+ [
+ ':)' => '',
+ ':/' => '',
+ ':D' => '',
+ ]
+ );
+
+ $smileyParser = new SmileyParser($smileyRepo, $this->viewRenderer);
+
+ $actual = $smileyParser->parse($message);
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * Test parsing messages that contain special characters.
+ */
+ public function testWithSpecialCharacters()
+ {
+ $expected = 'Testing µ Ä Á ς:Ðφ
でした';
+ $message = 'Testing µ Ä Á ς:Ðφ :) でした';
+
+ $smileyRepo = m::mock(
+ 'MyBB\Parser\Database\Repositories\SmileyRepositoryInterface'
+ );
+ $smileyRepo->shouldReceive('getParseableSmileys')->andReturn(
+ [
+ ':)' => 'smile',
+ ':/' => 'awkward',
+ ]
+ );
+
+ $smileyParser = new SmileyParser($smileyRepo, $this->viewRenderer);
+
+ $actual = $smileyParser->parse($message);
+
+ $this->assertEquals($expected, $actual);
+ }
+}