Skip to content

Commit

Permalink
#652 Support BB Code at feed news display
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichblock committed Nov 2, 2015
1 parent 0e91e50 commit 78d0bb8
Show file tree
Hide file tree
Showing 48 changed files with 4,850 additions and 1 deletion.
7 changes: 6 additions & 1 deletion THIRDPARTY
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,16 @@ http://morrisjs.github.io/morris.js/
Licensed under the BSD-2-Clause License
http://opensource.org/licenses/BSD-2-Clause

* Rapha�l
* Raphael
http://raphaeljs.com
Released under the MIT license
http://opensource.org/licenses/MIT

* Decoda
https://github.com/milesj/decoda
Released under the MIT license
http://opensource.org/licenses/MIT



Shipped with Easy-WI but modified and fitted to Easy-WI:
Expand Down
16 changes: 16 additions & 0 deletions web/stuff/admin/adminhome.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
die('No Access');
}

include(EASYWIDIR . '/third_party/Decoda/autoloader.php');
use Decoda\Decoda;

$sprache_bad = getlanguagefile('home', $user_language, $reseller_id);

$statsArray = array(
Expand Down Expand Up @@ -251,6 +254,19 @@
}
}

if (preg_match('/(\[\/img\]|\[\/url\]|\[\/b\]|\[\/h1\])/i', $text)) {
$code = new \Decoda\Decoda($text);
$code->addFilter(new \Decoda\Filter\DefaultFilter());
$code->addFilter(new \Decoda\Filter\ImageFilter());
$code->addFilter(new \Decoda\Filter\BlockFilter());
$code->addFilter(new \Decoda\Filter\EmailFilter());
$code->addFilter(new \Decoda\Filter\UrlFilter());
$code->addFilter(new \Decoda\Filter\VideoFilter());
$code->addFilter(new \Decoda\Filter\HeadLineFilter());
$code->addHook(new \Decoda\Hook\ClickableHook());
$text = $code->parse();
}

$title = $row2['newsTitle'];

if (strlen($row2['newsTitle']) <= 1) {
Expand Down
17 changes: 17 additions & 0 deletions web/stuff/user/userpanel_home.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
header('Location: login.php');
die('No Access');
}

include(EASYWIDIR . '/third_party/Decoda/autoloader.php');
use Decoda\Decoda;

$sprache_bad = getlanguagefile('home', $user_language, $reseller_id);

if (isset($admin_id) and $reseller_id != 0 and $admin_id != $reseller_id) {
Expand Down Expand Up @@ -198,6 +202,19 @@
}
}

if (preg_match('/(\[\/img\]|\[\/url\]|\[\/b\]|\[\/h1\])/i', $text)) {
$code = new \Decoda\Decoda($text);
$code->addFilter(new \Decoda\Filter\DefaultFilter());
$code->addFilter(new \Decoda\Filter\ImageFilter());
$code->addFilter(new \Decoda\Filter\BlockFilter());
$code->addFilter(new \Decoda\Filter\EmailFilter());
$code->addFilter(new \Decoda\Filter\UrlFilter());
$code->addFilter(new \Decoda\Filter\VideoFilter());
$code->addFilter(new \Decoda\Filter\HeadLineFilter());
$code->addHook(new \Decoda\Hook\ClickableHook());
$text = $code->parse();
}

$title = $row2['newsTitle'];

if (strlen($row2['newsTitle']) <= 1) {
Expand Down
77 changes: 77 additions & 0 deletions web/third_party/Decoda/Decoda/Component.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
/**
* @copyright 2006-2014, Miles Johnson - http://milesj.me
* @license https://github.com/milesj/decoda/blob/master/license.md
* @link http://milesj.me/code/php/decoda
*/

namespace Decoda;

/**
* Defines the methods for all Components to implement.
*/
interface Component {

/**
* Add a loader.
*
* @param \Decoda\Loader $loader
* @return \Decoda\Component
*/
public function addLoader(Loader $loader);

/**
* Method called immediately after the constructor.
*
* @return void
*/
public function construct();

/**
* Return a specific configuration key value.
*
* @param string $key
* @return mixed
*/
public function getConfig($key);

/**
* Return all the Loaders.
*
* @return \Decoda\Loader[]
*/
public function getLoaders();

/**
* Return the Decoda parser.
*
* @return \Decoda\Decoda
*/
public function getParser();

/**
* Return a message string from the parser.
*
* @param string $key
* @param array $vars
* @return string
*/
public function message($key, array $vars = array());

/**
* Modify configuration.
*
* @param array $config
* @return \Decoda\Component
*/
public function setConfig(array $config);

/**
* Set the Decoda parser.
*
* @param \Decoda\Decoda $parser
* @return \Decoda\Component
*/
public function setParser(Decoda $parser);

}
112 changes: 112 additions & 0 deletions web/third_party/Decoda/Decoda/Component/AbstractComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php
/**
* @copyright 2006-2014, Miles Johnson - http://milesj.me
* @license https://github.com/milesj/decoda/blob/master/license.md
* @link http://milesj.me/code/php/decoda
*/

namespace Decoda\Component;

use Decoda\Decoda;
use Decoda\Component;
use Decoda\Loader;

/**
* Provides default shared functionality for Filters, Hooks and Engines.
*/
abstract class AbstractComponent implements Component {

/**
* Configuration.
*
* @type array
*/
protected $_config = array();

/**
* List of Loaders.
*
* @type \Decoda\Loader[]
*/
protected $_loaders = array();

/**
* Decoda object.
*
* @type \Decoda\Decoda
*/
protected $_parser;

/**
* Apply configuration.
*
* @param array $config
*/
public function __construct(array $config = array()) {
$this->setConfig($config);
$this->construct();
}

/**
* {@inheritdoc}
*/
public function addLoader(Loader $loader) {
$this->_loaders[] = $loader;

return $this;
}

/**
* {@inheritdoc}
*/
public function construct() {
return;
}

/**
* {@inheritdoc}
*/
public function getConfig($key) {
return isset($this->_config[$key]) ? $this->_config[$key] : null;
}

/**
* {@inheritdoc}
*/
public function getLoaders() {
return $this->_loaders;
}

/**
* {@inheritdoc}
*/
public function getParser() {
return $this->_parser;
}

/**
* {@inheritdoc}
*/
public function message($key, array $vars = array()) {
return $this->getParser()->message($key, $vars);
}

/**
* {@inheritdoc}
*/
public function setConfig(array $config) {
$this->_config = $config + $this->_config;

return $this;
}

/**
* {@inheritdoc}
*/
public function setParser(Decoda $parser) {
$this->_parser = $parser;

return $this;
}

}
Loading

0 comments on commit 78d0bb8

Please sign in to comment.