1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/app/Core/Helper.php
2015-08-16 17:04:57 +02:00

80 lines
1.6 KiB
PHP

<?php
namespace Core;
use Pimple\Container;
/**
* Helper base class
*
* @package core
* @author Frederic Guillot
*
* @property \Helper\App $app
* @property \Helper\Asset $asset
* @property \Helper\Dt $dt
* @property \Helper\File $file
* @property \Helper\Form $form
* @property \Helper\Subtask $subtask
* @property \Helper\Task $task
* @property \Helper\Text $text
* @property \Helper\Url $url
* @property \Helper\User $user
*/
class Helper
{
/**
* Helper instances
*
* @access private
* @var array
*/
private $helpers = array();
/**
* Container instance
*
* @access protected
* @var \Pimple\Container
*/
protected $container;
/**
* Constructor
*
* @access public
* @param \Pimple\Container $container
*/
public function __construct(Container $container)
{
$this->container = $container;
}
/**
* Load automatically helpers
*
* @access public
* @param string $name Helper name
* @return mixed
*/
public function __get($name)
{
if (! isset($this->helpers[$name])) {
$class = '\Helper\\'.ucfirst($name);
$this->helpers[$name] = new $class($this->container);
}
return $this->helpers[$name];
}
/**
* HTML escaping
*
* @param string $value Value to escape
* @return string
*/
public function e($value)
{
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
}
}