-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3a150d0
Showing
4 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 The s9e Authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
s9e\autoimage is a Flarum extension that automatically turns image links into images. It only works on static links that ends with `.gif`, `.jpg`, `.jpeg` or `.png`. | ||
|
||
### How to install | ||
|
||
[Download the latest release](https://github.com/s9e/flarum-ext-autoimage/releases/latest). Unzip the archive into the `extensions` directory of your Flarum installation. Then go to the admin panel and enable the extension. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* @package s9e\autoimage | ||
* @copyright Copyright (c) 2015 The s9e Authors | ||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License | ||
*/ | ||
namespace s9e\Flarum\Autoimage; | ||
|
||
use Exception; | ||
use Flarum\Events\FormatterConfigurator; | ||
use Flarum\Support\Extension as BaseExtension; | ||
use Illuminate\Events\Dispatcher; | ||
|
||
class Extension extends BaseExtension | ||
{ | ||
public function listen(Dispatcher $events) | ||
{ | ||
$events->subscribe(__NAMESPACE__ . '\\Listener'); | ||
} | ||
} | ||
|
||
class Listener | ||
{ | ||
public function subscribe(Dispatcher $events) | ||
{ | ||
$events->listen('Flarum\\Events\\FormatterConfigurator', [$this, 'enableAutoimage']); | ||
} | ||
|
||
public function enableAutoimage(FormatterConfigurator $event) | ||
{ | ||
try | ||
{ | ||
$event->configurator->Autoimage; | ||
} | ||
catch (Exception $e) | ||
{ | ||
// Do nothing | ||
file_put_contents('/tmp/out',$e->getMessage()); | ||
} | ||
} | ||
} | ||
|
||
return __NAMESPACE__ . '\\Extension'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "s9e-autoimage", | ||
"title": "s9e/autoimage", | ||
"description": "Automatically turn image links into images.", | ||
"version": "0.1.0", | ||
"author": { | ||
"name": "JoshyPHP" | ||
}, | ||
"license": "MIT", | ||
"require": { | ||
"php": ">=5.4.0", | ||
"flarum": ">0.1.0" | ||
}, | ||
"support": { | ||
"source": "https://github.com/s9e/flarum-ext-autoimage", | ||
"issues": "https://github.com/s9e/flarum-ext-autoimage/issues" | ||
}, | ||
"icon": { | ||
"name": "image", | ||
"backgroundColor": "#18cd18", | ||
"color": "#fff" | ||
} | ||
} |