From d18da2776ada73bdaed64339408bee344125082c Mon Sep 17 00:00:00 2001 From: Michael Oehlhof Date: Mon, 17 Apr 2017 12:14:36 +0200 Subject: [PATCH] Update format ViewHelper --- .../ViewHelper/Format/AbstractEncoding.rst | 7 ++ .../Fluid/ViewHelper/Format/Bytes.rst | 44 ++++++++++- .../Fluid/ViewHelper/Format/Case.rst | 77 +++++++++++++++++++ .../Fluid/ViewHelper/Format/Cdata.rst | 68 ---------------- .../Fluid/ViewHelper/Format/Crop.rst | 10 +++ .../Fluid/ViewHelper/Format/Currency.rst | 4 +- .../Fluid/ViewHelper/Format/Html.rst | 6 +- .../Fluid/ViewHelper/Format/Htmlentities.rst | 13 ++-- .../ViewHelper/Format/HtmlentitiesDecode.rst | 15 ++-- .../ViewHelper/Format/Htmlspecialchars.rst | 71 ----------------- .../Fluid/ViewHelper/Format/Index.rst | 8 +- .../Fluid/ViewHelper/Format/Json.rst | 67 ++++++++++++++++ .../Fluid/ViewHelper/Format/Nl2br.rst | 32 +++++--- .../Fluid/ViewHelper/Format/Number.rst | 31 ++++++-- .../Fluid/ViewHelper/Format/Padding.rst | 59 +++++++++----- .../Fluid/ViewHelper/Format/Printf.rst | 37 --------- Documentation/Fluid/ViewHelper/Format/Raw.rst | 30 -------- .../Fluid/ViewHelper/Format/StripTags.rst | 37 ++++++++- .../Fluid/ViewHelper/Format/Urlencode.rst | 23 ++++-- 19 files changed, 361 insertions(+), 278 deletions(-) create mode 100644 Documentation/Fluid/ViewHelper/Format/AbstractEncoding.rst create mode 100644 Documentation/Fluid/ViewHelper/Format/Case.rst delete mode 100644 Documentation/Fluid/ViewHelper/Format/Cdata.rst delete mode 100644 Documentation/Fluid/ViewHelper/Format/Htmlspecialchars.rst create mode 100644 Documentation/Fluid/ViewHelper/Format/Json.rst delete mode 100644 Documentation/Fluid/ViewHelper/Format/Printf.rst delete mode 100644 Documentation/Fluid/ViewHelper/Format/Raw.rst diff --git a/Documentation/Fluid/ViewHelper/Format/AbstractEncoding.rst b/Documentation/Fluid/ViewHelper/Format/AbstractEncoding.rst new file mode 100644 index 0000000..7b957aa --- /dev/null +++ b/Documentation/Fluid/ViewHelper/Format/AbstractEncoding.rst @@ -0,0 +1,7 @@ +.. include:: ../../../Includes.txt + +AbstractEncoding +================ + +This is the base class for ViewHelpers that work with encodings. +Currently that are format.htmlentities and format.htmlentitiesDecode. diff --git a/Documentation/Fluid/ViewHelper/Format/Bytes.rst b/Documentation/Fluid/ViewHelper/Format/Bytes.rst index a0e3614..0dacfad 100644 --- a/Documentation/Fluid/ViewHelper/Format/Bytes.rst +++ b/Documentation/Fluid/ViewHelper/Format/Bytes.rst @@ -51,7 +51,7 @@ decimalSeparator No thousandsSeparator -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~ :aspect:`Variable type` String @@ -64,8 +64,22 @@ thousandsSeparator :aspect:`Mandatory` No -Example -------- +units +~~~~~ +:aspect:`Variable type` + String + +:aspect:`Description` + Comma separated list of available units. + +:aspect:`Default value` + LocalizationUtility::translate('viewhelper.format.bytes.units', 'fluid') + +:aspect:`Mandatory` + No + +Examples +-------- With a value of 1024.33, using the code @@ -78,3 +92,27 @@ will output :: 1024 KB + +With decimal and thousands separator + +:: + + {fileSize -> f:format.bytes(decimals: 2, decimalSeparator: '.', thousandsSeparator: ',')} + +will output + +:: + + 1,023.00 B + +You may provide an own set of units, like this: B,KB,MB,GB,TB,PB,EB,ZB,YB + +:: + + {fileSize -> f:format.bytes(units: '{f:translate(\'viewhelper.format.bytes.units\', \'fluid\')}' + +will output + +:: + + 123 KB diff --git a/Documentation/Fluid/ViewHelper/Format/Case.rst b/Documentation/Fluid/ViewHelper/Format/Case.rst new file mode 100644 index 0000000..acecd39 --- /dev/null +++ b/Documentation/Fluid/ViewHelper/Format/Case.rst @@ -0,0 +1,77 @@ +.. include:: ../../../Includes.txt + +f:format.case +============= + +Modifies the case of an input string to upper- or lowercase or capitalization. + +The default transformation will be uppercase as in `mb_convert_case` [http://php.net/manual/function.mb-convert-case.php]. + +Note that the behavior will be the same as in the appropriate PHP function `mb_convert_case`; +especially regarding locale and multibyte behavior. + +Properties +---------- + +value +~~~~~ +:aspect:`Variable type` + String + +:aspect:`Description` + The input value. If not given, the evaluated child nodes will be used. + +:aspect:`Default value` + NULL + +:aspect:`Mandatory` + No + +mode +~~~~ +:aspect:`Variable type` + String + +:aspect:`Description` + The case to apply, must be one of this' CASE_* constants. Defaults to uppercase application. + Possible modes are: + + `CASE_LOWER = 'lower'` + Transforms the input string to its lowercase representation + + `CASE_UPPER = 'upper'` + Transforms the input string to its uppercase representation + + `CASE_CAPITAL = 'capital` + Transforms the input string to its first letter upper-cased, i.e. capitalization + + `CASE_UNCAPITAL = 'uncapital'` + Transforms the input string to its first letter lower-cased, i.e. uncapitalization + + `CASE_CAPITAL_WORDS = 'capitalWords'` + Not supported yet: Transforms the input string to each containing word being capitalized + +:aspect:`Default value` + self::CASE_UPPER + +:aspect:`Mandatory` + No + +Examples +-------- + +Some Text with mixed case + +:: + + Some Text with miXed case + + SOME TEXT WITH MIXED CASE + +Example with given mode + +:: + + someString + + SomeString diff --git a/Documentation/Fluid/ViewHelper/Format/Cdata.rst b/Documentation/Fluid/ViewHelper/Format/Cdata.rst deleted file mode 100644 index 52ba908..0000000 --- a/Documentation/Fluid/ViewHelper/Format/Cdata.rst +++ /dev/null @@ -1,68 +0,0 @@ -.. include:: ../../../Includes.txt - -.. _f-format-cdata: - -f:format.cdata -============== - -This ViewHelper wraps a text or variable output with CDATA tags. This is most useful for generating outputs like an RSS -feed via Fluid. Because these format is based on an XML structure, HTML content within its tags need to be appropriately -masked using CDATA tags. - -Properties ----------- - -value -~~~~~ -:aspect:`Variable type` - String - -:aspect:`Description` - The string to be wrapped with CDATA tags. - -:aspect:`Default value` - NULL - -:aspect:`Mandatory` - No - - -Examples --------- - -With text -~~~~~~~~~ - -.. code-block:: html - - Text to be wrapped - -**Output** - -:: - - - - -With variables -~~~~~~~~~~~~~~ - -We'll pass an unusual combination of HTML and text back from our Controller as an example:: - - $this->view->assign('variable', 'Stefan'); - -We'll wrap the variable with CDATA tags in our Fluid template: - -.. code-block:: html - - {variable} is his name - -which produces the result:: - - Stefan is his name]]> - - -.. warning:: - - As you can see, the variable in this example is output 1:1 instead of being parsed using htmlspecialchars and without - any kind of other masking. Be aware of this, especially taking care against cross site scripting attacks. \ No newline at end of file diff --git a/Documentation/Fluid/ViewHelper/Format/Crop.rst b/Documentation/Fluid/ViewHelper/Format/Crop.rst index 951eb96..aa870c3 100644 --- a/Documentation/Fluid/ViewHelper/Format/Crop.rst +++ b/Documentation/Fluid/ViewHelper/Format/Crop.rst @@ -26,6 +26,11 @@ append :aspect:`Description` A string to be appended to the cropped text. +:aspect:`Default` + ... + +:aspect:`Required` + No respectWordBoundaries --------------------- @@ -41,6 +46,8 @@ respectWordBoundaries :aspect:`Default` True +:aspect:`Required` + No respectHtml ----------- @@ -56,6 +63,9 @@ respectHtml :aspect:`Default` True +:aspect:`Required` + No + Examples -------- diff --git a/Documentation/Fluid/ViewHelper/Format/Currency.rst b/Documentation/Fluid/ViewHelper/Format/Currency.rst index ceb00dc..de933c1 100644 --- a/Documentation/Fluid/ViewHelper/Format/Currency.rst +++ b/Documentation/Fluid/ViewHelper/Format/Currency.rst @@ -113,7 +113,7 @@ Examples 1122334455.66 -produces: € 1,122,334,455.66 +produces: `€ 1,122,334,455.66 Non-float value ~~~~~~~~~~~~~~~ @@ -122,4 +122,4 @@ Non-float value 1122334455,66 -produces: `€ 1,122,334,455.00` \ No newline at end of file +produces: `€ 1,122,334,455.00` diff --git a/Documentation/Fluid/ViewHelper/Format/Html.rst b/Documentation/Fluid/ViewHelper/Format/Html.rst index 27aba75..01d6964 100644 --- a/Documentation/Fluid/ViewHelper/Format/Html.rst +++ b/Documentation/Fluid/ViewHelper/Format/Html.rst @@ -6,7 +6,9 @@ f:format.html When you've created a Model for the `tt_content` table, data that you receive for the front end is raw and unformatted: just as it's stored in the database. So that you can parse this data and output it as you would by using `styles.content.get` in TypoScript, you can use this ViewHelper. It takes the unformatted content and runs it -through the `lib.parseFunc_RTE` parser, providing you with the formatted output you need. +through a parser, providing you with the formatted output you need. +You can either specify a path to the TypoScript setting or set the parseFunc options directly. +By default `lib.parseFunc_RTE` is used to parse the string. Properties ---------- @@ -39,4 +41,4 @@ This specific alternative will format the text in the variable without passing i :: - {variable} \ No newline at end of file + {variable} diff --git a/Documentation/Fluid/ViewHelper/Format/Htmlentities.rst b/Documentation/Fluid/ViewHelper/Format/Htmlentities.rst index 60b9c3b..b4e37d5 100644 --- a/Documentation/Fluid/ViewHelper/Format/Htmlentities.rst +++ b/Documentation/Fluid/ViewHelper/Format/Htmlentities.rst @@ -3,7 +3,8 @@ f:format.htmlentities ===================== -Mit diesem ViewHelper könnt Ihr die htmlentities Funktion von PHP auf einen Text anwenden. +Escapes special characters with their escaped counterparts as needed using PHPs htmlentities() function. +http://www.php.net/manual/function.htmlentities.php Properties ---------- @@ -14,7 +15,7 @@ value String :aspect:`Description` - Der Text der dekodiert werden soll + String to format. :aspect:`Default value` NULL @@ -28,7 +29,7 @@ keepQuotes Boolean :aspect:`Description` - Sollen einfache und doppelte Anführungsstriche auch dekodiert werden? + If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag). :aspect:`Default value` FALSE @@ -42,7 +43,7 @@ encoding String :aspect:`Description` - Wir sind hier im Bereich TYPO3 und da sollte der Zeichensatz auf UTF-8 und nix anderes stehen. Sollte wiedererwartend ein anderer Zeichensatz gewünscht sein, kann dieser hier angegeben werden. Siehe auch Info auf php.net. + Generally TYPO3 uses the UTF-8 charset. But if you need an other charset for a special case, you can enter it here. :aspect:`Default value` NULL @@ -56,7 +57,7 @@ doubleEncode Boolean :aspect:`Description` - Bei TRUE (Standard) wird alles kodiert. Bei FALSE, werden bereits kodierte Werte nicht erneut kodiert. + If FALSE existing html entities won't be encoded, the default is to convert everything. :aspect:`Default value` TRUE @@ -73,4 +74,4 @@ Beispiel :: - Müller & Breuer \ No newline at end of file + Müller & Breuer diff --git a/Documentation/Fluid/ViewHelper/Format/HtmlentitiesDecode.rst b/Documentation/Fluid/ViewHelper/Format/HtmlentitiesDecode.rst index dd4c5a8..a6f951e 100644 --- a/Documentation/Fluid/ViewHelper/Format/HtmlentitiesDecode.rst +++ b/Documentation/Fluid/ViewHelper/Format/HtmlentitiesDecode.rst @@ -3,7 +3,8 @@ f:format.htmlentitiesDecode =========================== -htmlEntityDecode +Applies html_entity_decode() to a value. +http://www.php.net/html_entity_decode Properties ---------- @@ -14,7 +15,7 @@ value String :aspect:`Description` - Der Text der dekodiert werden soll + String to format. :aspect:`Default value` NULL @@ -28,7 +29,7 @@ keepQuotes Boolean :aspect:`Description` - Sollen einfache und doppelte Anführungsstriche auch dekodiert werden? + If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag). :aspect:`Default value` FALSE @@ -42,7 +43,7 @@ encoding String :aspect:`Description` - Wir sind hier im Bereich TYPO3 und da sollte der Zeichensatz auf UTF-8 und nix anderes stehen. Sollte wiedererwartend ein anderer Zeichensatz gewünscht sein, kann dieser hier angegeben werden. Siehe auch Info auf php.net. + Generally TYPO3 uses the UTF-8 charset. But if you need an other charset for a special case, you can enter it here. :aspect:`Default value` NULL @@ -50,11 +51,11 @@ encoding :aspect:`Mandatory` No -Beispiel --------- +Example +------- ::

Müller & Breuer -Im Quelltext sieht man wieder ein richtig sauberes: "Müller & Breuer". \ No newline at end of file +In the HTML source code you can see a clean: "Müller & Breuer". diff --git a/Documentation/Fluid/ViewHelper/Format/Htmlspecialchars.rst b/Documentation/Fluid/ViewHelper/Format/Htmlspecialchars.rst deleted file mode 100644 index 7c44be2..0000000 --- a/Documentation/Fluid/ViewHelper/Format/Htmlspecialchars.rst +++ /dev/null @@ -1,71 +0,0 @@ -.. include:: ../../../Includes.txt - -f:format.htmlspecialchars -========================= - -Wenn Ihr mit Userdaten (Formulardaten) arbeitet, dann sollte dieser Inhalt zuallererst durch diesen ViewHelper. -Denn dieser wandelt alle spitzen Klammern von HTML-Tags in ein nicht mehr interprtierbares Format um. Die HTML-Tags -können also keinen Schaden mehr verursachen und werden im FE angezeigt statt verarbeitet. - -Properties ----------- - -value -~~~~~ -:aspect:`Variable type` - String - -:aspect:`Description` - Der Text der formatiert werden soll - -:aspect:`Default value` - NULL - -:aspect:`Mandatory` - No - -keepQuotes -~~~~~~~~~~ -:aspect:`Variable type` - Boolean - -:aspect:`Description` - Sollen einfache und doppelte Anführungszeichen auch formatiert werden - -:aspect:`Default value` - FALSE - -:aspect:`Mandatory` - No - -encoding -~~~~~~~~ -:aspect:`Variable type` - String - -:aspect:`Default value` - NULL - -:aspect:`Mandatory` - No - -doubleEncode -~~~~~~~~~~~~ -:aspect:`Variable type` - Boolean - -:aspect:`Description` - Mit jedem Aufruf diesen ViewHelpers wird ein bereits htmlspecialchared Text immer und immer wieder gehtmlspecialchared. Auf & wird dann & dann &, dann & und so weiter. Um das zu verhindert, kann dieser Parameter auf FALSE gesetzt werden. - -:aspect:`Default value` - TRUE - -:aspect:`Mandatory` - No - -Beispiel --------- - -:: - -

fetter Text

diff --git a/Documentation/Fluid/ViewHelper/Format/Index.rst b/Documentation/Fluid/ViewHelper/Format/Index.rst index 3a2bed3..d23fe7e 100644 --- a/Documentation/Fluid/ViewHelper/Format/Index.rst +++ b/Documentation/Fluid/ViewHelper/Format/Index.rst @@ -11,18 +11,16 @@ ViewHelper: Format :glob: Bytes - Cdata + Case Crop Currency Date Html Htmlentities HtmlentitiesDecode - Htmlspecialchars + Json Nl2br Number Padding - Printf - Raw StripTags - Urlencode \ No newline at end of file + Urlencode diff --git a/Documentation/Fluid/ViewHelper/Format/Json.rst b/Documentation/Fluid/ViewHelper/Format/Json.rst new file mode 100644 index 0000000..8b0774e --- /dev/null +++ b/Documentation/Fluid/ViewHelper/Format/Json.rst @@ -0,0 +1,67 @@ +.. include:: ../../../Includes.txt + +f:format.json +============= + +This ViewHelper is a wrapper for PHPs json_encode function. + +Properties +---------- + +value +~~~~~ + +:aspect:`Variable type` + Mixed + +:aspect:`Description` + The incoming data to convert, or null if VH children should be used. + +:aspect:`Default value` + FALSE + +:aspect:`Mandatory` + No + +forceObject +~~~~~~~~~~~ + +:aspect:`Variable type` + Boolean + +:aspect:`Description` + Outputs an JSON object rather than an array. + +:aspect:`Default value` + FALSE + +:aspect:`Mandatory` + No + + +Examples +-------- + +Encoding a view variable + +:: + + {someArray -> f:format.json()} + + ["array","values"] + +Associative array + +:: + + {f:format.json(value: {foo: 'bar', bar: 'baz'})} + + {"foo":"bar","bar":"baz"} + +Non-associative array with forced object + +:: + + {f:format.json(value: {0: 'bar', 1: 'baz'}, forceObject: true)} + + {"0":"bar","1":"baz"} diff --git a/Documentation/Fluid/ViewHelper/Format/Nl2br.rst b/Documentation/Fluid/ViewHelper/Format/Nl2br.rst index 79167a4..3017d4e 100644 --- a/Documentation/Fluid/ViewHelper/Format/Nl2br.rst +++ b/Documentation/Fluid/ViewHelper/Format/Nl2br.rst @@ -3,28 +3,38 @@ f:format.nl2br ============== -Dieser ViewHelper besitzt keine Parameter. Den umzuwandelnden Inhalt bezieht er sich aus dem Text zwischen den Tags. -Sinnvoll wird dieser ViewHelper beim Anzeigen von Inhalten aus TEXTAREA-Tags. Denn hier wurden die Zeilenumbrüche mit -ENTER (CHR(10)) realisiert. HTML sind diese Umbrüche aber völlig egal und würde den Text einfach hintereinander weg -anzeigen. Um das zu verhindern könnt Ihr diesen ViewHelper verwender. Er konvertiert alle CHR(10)-Zeilenumbrüche in -
-Tags und so werden Zeilenumbrüche auch im Browser wieder richtig dargestellt. +This ViewHelper is a wrapper for PHPs nl2br function. +All CHR(10) linebreaks are translated in
tags. Properties ---------- -Dieser ViewHelper besitzt keine Eigenschaften +value +~~~~~ -Beispiel --------- +:aspect:`Variable type` + String + +:aspect:`Description` + The string to format. + +:aspect:`Default value` + FALSE + +:aspect:`Mandatory` + No + +Example +------- :: Text - mit - Zeilenumbrüchen + with + linebreaks ergibt :: - Text
mit
Zeilenumbrüchen \ No newline at end of file + Text
with
linebreaks diff --git a/Documentation/Fluid/ViewHelper/Format/Number.rst b/Documentation/Fluid/ViewHelper/Format/Number.rst index 5c4aeaf..014446b 100644 --- a/Documentation/Fluid/ViewHelper/Format/Number.rst +++ b/Documentation/Fluid/ViewHelper/Format/Number.rst @@ -3,7 +3,8 @@ f:format.number =============== -Mit diesem ViewHelper könnt Ihr Zahlen formatieren. Er arbeitet ähnlich dem `f:format.currency`-ViewHelper +Formats a number with custom precision, decimal point and grouped thousands. +http://www.php.net/manual/en/function.number-format.php Properties ---------- @@ -14,7 +15,7 @@ decimals Integer :aspect:`Description` - Wie viele Nachkommastellen dürfen angezeigt werden. + The number of digits after the decimal point. :aspect:`Default value` 2 @@ -28,7 +29,7 @@ decimalSeparator String :aspect:`Description` - Welcher Zeichen soll für die Trennung von Euro und Cent verwendet werden. Dezimaltrenner. + The decimal point character. :aspect:`Default value` . @@ -42,7 +43,7 @@ thousandsSeparator String :aspect:`Description` - Welches Zeichen soll als Tausendertrennzeichen verwendet werden. + The character for grouping the thousand digits. :aspect:`Default value` , @@ -50,11 +51,29 @@ thousandsSeparator :aspect:`Mandatory` No -Beispiel +Examples -------- +Defaults + +:: + + 423423.234 + + 423,423.23 + + +With all parameters + +:: + + 423423.234 + + 423.423,2 + + :: 1122334455.667788 -ergibt: 1,122,334,455.668. Wie Ihr seht wird sogar automatisch aufgerundet. + 1,122,334,455.668 diff --git a/Documentation/Fluid/ViewHelper/Format/Padding.rst b/Documentation/Fluid/ViewHelper/Format/Padding.rst index 56b68cb..c3f0604 100644 --- a/Documentation/Fluid/ViewHelper/Format/Padding.rst +++ b/Documentation/Fluid/ViewHelper/Format/Padding.rst @@ -3,20 +3,37 @@ f:format.padding ================ -Padding +Formats a string using PHPs str_pad function. +http://www.php.net/manual/en/function.str_pad.php Properties ---------- +value +~~~~~ +:aspect:`Variable type` + String + +:aspect:`Description` + String to format + +:aspect:`Default value` + NULL + +:aspect:`Mandatory` + No + padLength ~~~~~~~~~ :aspect:`Variable type` Integer :aspect:`Description` - Wie viel Zeichen lang darf der Text inkl. der hinzugefügten Abstandszeichen maximal werden + Length of the resulting string. If the value of pad_length is negative or less than the length of the input string, + no padding takes place. :aspect:`Default value` + NULL :aspect:`Mandatory` Yes @@ -27,10 +44,10 @@ padString String :aspect:`Description` - Welches Zeichen soll als Abstand dienen + The padding string. :aspect:`Default value` - Leerzeichen + Space :aspect:`Mandatory` No @@ -41,33 +58,37 @@ padType String :aspect:`Description` - Wo sollen die Abstandszeichen eingefügt werden. Zur Auswahl steht right, left und both + Append the padding at this site (Possible values: right, left, both). :aspect:`Default value` - right + 'right' :aspect:`Mandatory` No -Beispiel zur Funktionsweise ---------------------------- +Examples +-------- + +Defaults + +:: + + TYPO3 + + TYPO3 (note the trailing whitespace) + +Specify padding string :: -

TYPO3ist cool

-

Stefanist cool

-

Ichbin cool

+ TYPO3 -In diesem Beispiel wird das angegebene Zeichen oder die Zeichen solange wiederholt, bis das Maximum an Zeichen erfüllt ist. Je nach Zeichensatz macht diese Darstellung wenig Sinn. Denn wie Ihr seht beginnen die letzten beiden Wörter je Zeile immer an einer unterschiedlichen Stelle. + TYPO3-=-=- -Beispiel mit sinnvoller Einrückung ----------------------------------- +Specify padding type :: -
TYPO3ist cool
- Stefanist cool
- Ichbin cool
+ TYPO3 -Hier nahezu das gleiche Beispiel wie oben. Allerdings fangen die letzten beiden Wörter je Zeile nun immer an der -gleichen Position an. Mit Hilfe diesen ViewHelpers könnte man also so eine Art Tabulator erstellen. \ No newline at end of file + --TYPO3--- diff --git a/Documentation/Fluid/ViewHelper/Format/Printf.rst b/Documentation/Fluid/ViewHelper/Format/Printf.rst deleted file mode 100644 index 54d940a..0000000 --- a/Documentation/Fluid/ViewHelper/Format/Printf.rst +++ /dev/null @@ -1,37 +0,0 @@ -.. include:: ../../../Includes.txt - -f:format.printf -=============== - -Mit diesem ViewHelper können Platzhalter in einem Text mit den Werten auf dem Array ersetzt werden. - -Properties ----------- - -arguments -~~~~~~~~~ -:aspect:`Variable type` - Array - -:aspect:`Description` - Gib hier Werte in Arraynotation ein, die die Platzhalter in dem Text, der sich zwischen den Tags befindet, ersetzt. - -:aspect:`Default value` - -:aspect:`Mandatory` - Yes - -Beispiel --------- - -:: - - %1$s hat eine %3$d-seitige Dokumentation geschrieben und %2$d Tage dafür gebraucht. - -Mit %1, %2 und %3 wird der jeweilige Wert aus dem Array geholt. Da es unterschiedliche Datentypen gibt, müssen wir -jedem Wert noch mitteilen, um was für einen Datentyp es sich handelt. Dabei steht $s für string also Text. $d für -einen Zahlenwert, der auch ein Vorzeichen enthalten darf und wie Ihr evtl. schon gesehen habt, habe ich die Zahl 4 -als Text deklariert, gebe sie aber als Typ Integer an den Text weiter. Weitere Infos auf php.net - -Wenn dieser ViewHelper überhaupt nicht angezeigt wird, dann habt Ihr entweder einen Fehler in Eurem Array oder Ihr -habe die Typdefinition der Variablen wie $s oder $d vergessen mit anzugeben.Parameter \ No newline at end of file diff --git a/Documentation/Fluid/ViewHelper/Format/Raw.rst b/Documentation/Fluid/ViewHelper/Format/Raw.rst deleted file mode 100644 index 998f82d..0000000 --- a/Documentation/Fluid/ViewHelper/Format/Raw.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. include:: ../../../Includes.txt - -f:format.raw -============ - -By default, variable contents are escaped when emitted within a fluid template. This prevents dangerous HTML/JavaScript ("XSS") within user-specified content. If you are certain that contents of a variable can be shown as-is, you can use the `f:format.raw` ViewHelper. - -Properties ----------- - -value -~~~~~ -:aspect:`Variable type` - Mixed - -:aspect:`Description` - Text that shall not be escaped. Most useful when you reference a variable here. - -:aspect:`Default value` - NULL - -:aspect:`Mandatory` - No - -Example --------- - -:: - - diff --git a/Documentation/Fluid/ViewHelper/Format/StripTags.rst b/Documentation/Fluid/ViewHelper/Format/StripTags.rst index 4446cd4..e0a8a62 100644 --- a/Documentation/Fluid/ViewHelper/Format/StripTags.rst +++ b/Documentation/Fluid/ViewHelper/Format/StripTags.rst @@ -3,7 +3,8 @@ f:format.stripTags ================== -Dieser ViewHelper entfernt sämtliche HTML-Tags aus einem Text. +Removes tags from the given string (applying PHPs strip_tags() function). +http://www.php.net/manual/function.strip-tags.php Properties ---------- @@ -14,7 +15,7 @@ value String :aspect:`Description` - Der Text aus dem die HTML-Tags entfernt werden sollen + String to format. :aspect:`Default value` NULL @@ -22,9 +23,37 @@ value :aspect:`Mandatory` No -Beispiel +allowedTags +~~~~~~~~~~~ +:aspect:`Variable type` + String + +:aspect:`Description` + Optional string of allowed tags as required by PHPs strip_tags() function. + +:aspect:`Default value` + NULL + +:aspect:`Mandatory` + No + +Examples -------- +Default notation + :: - Ein fetter Text mit einigen bunten HTML-Tags. \ No newline at end of file + Some Text with Tags and an Ümlaut. + + Some Text with Tags and an Ümlaut. + (strip_tags() applied. Note: encoded entities are not decoded) + +Inline notation + +:: + + {text -> f:format.stripTags()} + + Text without tags + (strip_tags() applied) diff --git a/Documentation/Fluid/ViewHelper/Format/Urlencode.rst b/Documentation/Fluid/ViewHelper/Format/Urlencode.rst index dc71c27..d6fb9fa 100644 --- a/Documentation/Fluid/ViewHelper/Format/Urlencode.rst +++ b/Documentation/Fluid/ViewHelper/Format/Urlencode.rst @@ -3,8 +3,9 @@ f:format.urlencode ================== -In Texten und Firmennamen kommen immer wieder Sonderzeichen wie @ & oder % vor. Diese Zeichen sind nicht URL-sicher -und sollten vor der Übermittlung durch diesen ViewHelper geschleust werden. +Encodes the given string according to http://www.faqs.org/rfcs/rfc3986.html (applying PHPs rawurlencode() function). +http://www.php.net/manual/function.rawurlencode.php +Note: The output is not escaped. You may have to ensure proper escaping on your own. Properties ---------- @@ -15,7 +16,7 @@ value String :aspect:`Description` - Der Text, der für die Übergabe per Link vorbereitet werden soll + String to format. :aspect:`Default value` NULL @@ -23,15 +24,23 @@ value :aspect:`Mandatory` No -Beispiel +Examples -------- +Default notation + :: - Text mit ein npaar Sonderzeichen, die für die URL entsprechend maskiert werden müssen: @+%/ + foo @+%/ + + foo%20%40%2B%25%2F + (rawurlencode() applied) -Ergebnis: +Inline notation :: - Text%20mit%20ein%20npaar%20Sonderzeichen%2C%20die%20f%C3%BCr%20die%20URL%20entsprechend%20maskiert%20werden%20m%C3%BCssen%3A%20%40%2B%25%2F + {text -> f:format.urlencode()} + + Url encoded text + (rawurlencode() applied)