From 82d40e32363c4e96996eca7ee44ade879589aa0e Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 26 Apr 2020 16:33:36 +0200 Subject: Expand tabs and remove trailing whitespace --- ratatoeskr/sys/textprocessors.php | 62 +++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'ratatoeskr/sys/textprocessors.php') diff --git a/ratatoeskr/sys/textprocessors.php b/ratatoeskr/sys/textprocessors.php index ea6fb82..f5281bf 100644 --- a/ratatoeskr/sys/textprocessors.php +++ b/ratatoeskr/sys/textprocessors.php @@ -2,7 +2,7 @@ /* * File: ratatoeskr/sys/textprocessors.php * Manage text processors (functions that transform text to HTML) and implement some default ones. - * + * * License: * This file is part of Ratatöskr. * Ratatöskr is licensed unter the MIT / X11 License. @@ -15,64 +15,64 @@ require_once(dirname(__FILE__) . "/utils.php"); /* * Function: textprocessor_register * Register a textprocessor. - * + * * Parameters: - * $name - The name of the textprocessor - * $fx - The textprocessor function (function($input), returns HTML) - * $visible_in_backend - Should this textprocessor be visible in the backend? Defaults to True. + * $name - The name of the textprocessor + * $fx - The textprocessor function (function($input), returns HTML) + * $visible_in_backend - Should this textprocessor be visible in the backend? Defaults to True. */ function textprocessor_register($name, $fx, $visible_in_backend=True) { - global $textprocessors; - $textprocessors[$name] = array($fx, $visible_in_backend); + global $textprocessors; + $textprocessors[$name] = array($fx, $visible_in_backend); } /* * Function: textprocessor_apply * Apply a textprocessor on a text. - * + * * Parameters: - * $text - The input text. - * $textprocessor - The name of the textprocessor. - * + * $text - The input text. + * $textprocessor - The name of the textprocessor. + * * Returns: - * HTML + * HTML */ function textprocessor_apply($text, $textprocessor) { - global $textprocessors; - if(!isset($textprocessors[$textprocessor])) - throw new Exception("Unknown Textprocessor: $textprocessor"); - - $fx = @$textprocessors[$textprocessor][0]; - if(!is_callable($fx)) - throw new Exception("Invalid Textprocessor: $textprocessor"); - - return call_user_func($fx, $text); + global $textprocessors; + if(!isset($textprocessors[$textprocessor])) + throw new Exception("Unknown Textprocessor: $textprocessor"); + + $fx = @$textprocessors[$textprocessor][0]; + if(!is_callable($fx)) + throw new Exception("Invalid Textprocessor: $textprocessor"); + + return call_user_func($fx, $text); } /* * Function: textprocessor_apply_translation * Applys a textprocessor automatically on a object. The used textprocessor is determined by the $texttype property. - * + * * Parameters: - * $translationobj - The object. - * + * $translationobj - The object. + * * Returns: - * HTML + * HTML */ function textprocessor_apply_translation($translationobj) { - return textprocessor_apply($translationobj->text, $translationobj->texttype); + return textprocessor_apply($translationobj->text, $translationobj->texttype); } if(!isset($textprocessors)) { - $textprocessors = array( - "Markdown" => array("Markdown", True), - "Plain Text" => array(function($text) { return str_replace(array("\r\n", "\n"), array("
", "
"), htmlesc($text)); }, True), - "HTML" => array(function($text) { return $text; }, True) - ); + $textprocessors = array( + "Markdown" => array("Markdown", True), + "Plain Text" => array(function($text) { return str_replace(array("\r\n", "\n"), array("
", "
"), htmlesc($text)); }, True), + "HTML" => array(function($text) { return $text; }, True) + ); } ?> -- cgit v1.2.3-70-g09d2