[BUGFIX] cropHTML with dash in html element
authorJakub Cernek <development@cernek.cz>
Fri, 10 Jun 2011 20:52:00 +0000 (22:52 +0200)
committerTolleiv Nietsch <tolleiv.nietsch@typo3.org>
Sun, 22 Apr 2012 11:14:28 +0000 (13:14 +0200)
Allow dash in regular expression of cropHTML function. It is needed
for recognition of W3C non-standard TYPO3 'link' element syntax.
(e.g. <link email@example.org - mail "Open email window">
email@example.org</link>)

Change-Id: Id7274fdab0be96a9118341a95dab82386d01c903
Fixes: #26915
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/2641
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
typo3/sysext/cms/tests/tslib/class.tslib_contentTest.php
typo3/sysext/cms/tslib/class.tslib_content.php

index 3bdf3e2..cd1937d 100644 (file)
@@ -550,6 +550,9 @@ class tslib_contentTest extends tx_phpunit_testcase {
                                $charset . ' text with entities -59|...|1' => array(
                                        '-59|...|1', $textWithEntities, '...implemented the; original version of the crop function.', $charset
                                ),
+                               $charset . ' text with dash in html-element 28|...|1' => array(
+                                       '28|...|1', 'Some text with a link to <link email.address@example.org - mail "Open email window">my email.address@example.org</link> and text after it', 'Some text with a link to <link email.address@example.org - mail "Open email window">my...</link>', $charset
+                               ),
                        ));
                }
                return $data;
index d9b9560..d303da9 100644 (file)
@@ -3660,17 +3660,23 @@ class tslib_cObj {
                                </?(?:" . $tags . ")+                   # opening tag ('<tag') or closing tag ('</tag')
                                (?:
                                        (?:
-                                               \s+\w+                                  # EITHER spaces, followed by word characters (attribute names)
                                                (?:
-                                                       \s*=?\s*                        # equals
-                                                       (?>
-                                                               \".*?\"                 # attribute values in double-quotes
-                                                               |
-                                                               '.*?'                   # attribute values in single-quotes
-                                                               |
-                                                               [^'\">\s]+              # plain attribute values
-                                                       )
-                                               )?
+                                                       \s+\w+                          # EITHER spaces, followed by word characters (attribute names)
+                                                       (?:
+                                                               \s*=?\s*                # equals
+                                                               (?>
+                                                                       \".*?\"         # attribute values in double-quotes
+                                                                       |
+                                                                       '.*?'           # attribute values in single-quotes
+                                                                       |
+                                                                       [^'\">\s]+      # plain attribute values
+                                                               )
+                                                       )?
+                                               )
+                                               |                                               # OR a single dash (for TYPO3 link tag)
+                                               (?:
+                                                       \s+-
+                                               )
                                        )+\s*
                                        |                                                       # OR only spaces
                                        \s*