diff --git a/app/config/app.php b/app/config/app.php index 9ccd9b63a..a182c155f 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -124,6 +124,7 @@ return [ 'Dingo\Api\Provider\ApiServiceProvider', 'GrahamCampbell\Throttle\ThrottleServiceProvider', + 'GrahamCampbell\Markdown\MarkdownServiceProvider', 'Thujohn\Rss\RssServiceProvider', 'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider', @@ -199,6 +200,7 @@ return [ 'API' => 'Dingo\Api\Facade\API', 'Throttle' => 'GrahamCampbell\Throttle\Facades\Throttle', + 'Markdown' => 'GrahamCampbell\Markdown\Facades\Markdown', 'RSS' => 'Thujohn\Rss\RssFacade', ], diff --git a/app/config/packages/graham-campbell/markdown/config.php b/app/config/packages/graham-campbell/markdown/config.php new file mode 100644 index 000000000..fda0e1fa8 --- /dev/null +++ b/app/config/packages/graham-campbell/markdown/config.php @@ -0,0 +1,35 @@ + false, + +]; diff --git a/app/models/Incident.php b/app/models/Incident.php index 64697ba90..86ffe0da5 100644 --- a/app/models/Incident.php +++ b/app/models/Incident.php @@ -1,11 +1,12 @@ 'required|integer', @@ -21,7 +22,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI /** * An incident belongs to a component. - * @return Illuminate\Database\Eloquent\Relations\BelongsTo + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function component() { @@ -30,6 +32,7 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI /** * Returns a human readable version of the status. + * * @return string */ public function getHumanStatusAttribute() @@ -41,6 +44,7 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI /** * Finds the icon to use for each status. + * * @return string */ public function getIconAttribute() @@ -55,18 +59,18 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI /** * Returns a Markdown formatted version of the status. + * * @return string */ public function getFormattedMessageAttribute() { - $parseDown = new ParsedownExtra(); - - return $parseDown->text($this->message); + return Markdown::render($this->message); } /** * Get the transformer instance. - * @return CachetHQ\Cachet\Transformers\IncidentTransformer + * + * @return \CachetHQ\Cachet\Transformers\IncidentTransformer */ public function getTransformer() { @@ -75,7 +79,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI /** * Check if Incident has message. - * @return boolean + * + * @return bool */ public function hasMessage() { diff --git a/composer.json b/composer.json index f484b87ff..4778398df 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,10 @@ "guzzlehttp/guzzle": "~5.0", "dingo/api": "0.8.*", "graham-campbell/throttle": "~2.0", + "graham-campbell/markdown": "~2.0", "watson/validating": "0.10.*", "thujohn/rss": "~1.0", - "doctrine/dbal": "2.5.*", - "erusev/parsedown-extra": "~0.1" + "doctrine/dbal": "2.5.*" }, "require-dev": { "phpunit/phpunit": "~4.3", diff --git a/composer.lock b/composer.lock index 0a6bdf66a..69305693a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "def3f0fcb615467e21e9eccf44a39a73", + "hash": "4cbce9aaf02d3c94bd12d972d20f00be", "packages": [ { "name": "classpreloader/classpreloader", @@ -768,6 +768,63 @@ ], "time": "2014-10-26 09:05:09" }, + { + "name": "graham-campbell/markdown", + "version": "v2.0.5", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Laravel-Markdown.git", + "reference": "d316f586fcaf59ecdf9d2f60f26da277cd6c8e8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Laravel-Markdown/zipball/d316f586fcaf59ecdf9d2f60f26da277cd6c8e8d", + "reference": "d316f586fcaf59ecdf9d2f60f26da277cd6c8e8d", + "shasum": "" + }, + "require": { + "erusev/parsedown": "~1.1", + "erusev/parsedown-extra": "~0.2.2", + "illuminate/support": "~4.1", + "illuminate/view": "~4.1", + "php": ">=5.4.7" + }, + "require-dev": { + "graham-campbell/testbench": "~1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\Markdown\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@mineuk.com" + } + ], + "description": "Markdown Is A Parsedown Extra Wrapper For Laravel 4.1/4.2", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Laravel Markdown", + "Laravel-Markdown", + "Parsedown Extra", + "framework", + "laravel", + "markdown", + "markdown wrapper", + "parsedown", + "parsedown extra wrapper", + "parsedown wrapper" + ], + "time": "2014-10-05 14:49:46" + }, { "name": "graham-campbell/throttle", "version": "v2.0.1",