From 3a150d0b08cb1f22cfef7ed41110abdebaae423c Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 14 Sep 2015 18:05:58 +0200 Subject: [PATCH] Initial commit --- LICENSE | 20 ++++++++++++++++++++ README.md | 5 +++++ bootstrap.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ flarum.json | 23 +++++++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 bootstrap.php create mode 100644 flarum.json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d43c334 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ce54109 --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file diff --git a/bootstrap.php b/bootstrap.php new file mode 100644 index 0000000..0234d91 --- /dev/null +++ b/bootstrap.php @@ -0,0 +1,44 @@ +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'; \ No newline at end of file diff --git a/flarum.json b/flarum.json new file mode 100644 index 0000000..6b5b3d8 --- /dev/null +++ b/flarum.json @@ -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" + } +} \ No newline at end of file