Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Sep 14, 2015
0 parents commit 3a150d0
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
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.
5 changes: 5 additions & 0 deletions README.md
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.
44 changes: 44 additions & 0 deletions bootstrap.php
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';
23 changes: 23 additions & 0 deletions flarum.json
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"
}
}

0 comments on commit 3a150d0

Please sign in to comment.