diff options
Diffstat (limited to 'app/Helper/Text.php')
-rw-r--r-- | app/Helper/Text.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/app/Helper/Text.php b/app/Helper/Text.php index d2075fe4..83f1e3f9 100644 --- a/app/Helper/Text.php +++ b/app/Helper/Text.php @@ -3,14 +3,15 @@ namespace Kanboard\Helper; use Kanboard\Core\Markdown; +use Kanboard\Core\Base; /** - * Text helpers + * Text Helpers * * @package helper * @author Frederic Guillot */ -class Text extends \Kanboard\Core\Base +class Text extends Base { /** * Markdown transformation @@ -21,7 +22,7 @@ class Text extends \Kanboard\Core\Base */ public function markdown($text, array $link = array()) { - $parser = new Markdown($link, $this->helper->url); + $parser = new Markdown($this->container, $link); $parser->setMarkupEscaped(MARKDOWN_ESCAPE_HTML); return $parser->text($text); } @@ -42,6 +43,29 @@ class Text extends \Kanboard\Core\Base } /** + * Get the number of bytes from PHP size + * + * @param integer $val PHP size (example: 2M) + * @return integer + */ + public function phpToBytes($val) + { + $val = trim($val); + $last = strtolower($val[strlen($val)-1]); + + switch ($last) { + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; + } + + return $val; + } + + /** * Return true if needle is contained in the haystack * * @param string $haystack Haystack |