Commit Graph

11 Commits

Author SHA1 Message Date
Hamish Friedlander
168f071499 API Make HTMLValue replace-able via DI
Extracted common code out to SS_HTMLValue and made abstract, then
put HTML 4 specific code in SS_HTML4Value. Its now possible to
replace HTMLValue with one designed for HTML 5 or XHTML

Requires a code change from new SS_HTMLValue to
Injector::inst()->create(HTMLValue)
2013-03-14 12:49:02 +13:00
Sean Harvey
a171c7e4b0 BUG Fixing regression in 26d70d6fca with formatted output in SS_HTMLValue
If formatOutput is set to TRUE, then the regexes in getContent()
will not match the newlines, and the output will include html, body
and meta tags. Introduce a few new tests to ensure the output is
correct, and fix the regex.
2012-10-16 11:59:30 +13:00
Sean Harvey
26d70d6fca BUG HtmlEditorField doesn't save HTML fragments in HTMLValue correctly
The issue was raised in #7628, where an anchor tag was being changed from
<a name="anchor"></a> to <a name="anchor"/> by SS_HTMLValue, when
HtmlEditorField::saveInto() parses the HTML fragments.

This is because SS_HTMLValue uses DOMDocument::saveXML(), which is fine
for saving an XML document, but not suitable for HTML. This fix changes
that to use DOMDocument::saveHTML() instead.
Note that we can't use the parameter to saveHTML() for selecting a single
node only, as that's only supported in PHP 5.3.6+, SilverStripe 3.0 supports
PHP 5.3.2 as a minimum. The workaround for this shortcoming is to replace
unncessary output by DOMDocument with a regular expression.
2012-09-19 11:39:01 +12:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Simon Welsh
f8082e4814 MINOR Add newline to end of files without one 2012-04-15 10:50:19 +12:00
Sean Harvey
3d8079c1b5 API CHANGE Removed GeoIP functionality from sapphire. This now belongs in a separate "silverstripe-geoip" GitHub repository: https://github.com/silverstripe-labs/silverstripe-geoip 2012-01-02 18:00:36 +01:00
Ingo Schommer
ce8e72cf0e MINOR Removing executable flag from all files (thanks miiihi) 2011-09-18 22:04:02 +02:00
Ingo Schommer
9b29616710 API CHANGE Rearranged files in sapphire to reflect core dependencies more accurately, and have the tests/ folder mirror its folder structure 2011-03-31 09:56:21 +13:00
Sam Minnee
f0dc6c65ca BUGFIX Ensure that \r carriage return characters get stripped out before setting content in HTMLValue::setContent(). DOMDocument will transform these into &#13 entities, which is apparently XML spec, but not necessary for us as we're using HTML (from r111949)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112946 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 05:07:27 +00:00
Sam Minnee
f51f5bc958 BUGFIX Ensure that windows-style newlines ("\r\n") don't get converted to their XML entity representation through DOMDocument in SS_HTMLValue->setContent() (from r111878)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112935 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 05:03:29 +00:00
Andrew Short
77dc826278 BUGFIX: Suppressed errors in SS_HTMLValue->setContent() so it can handle malformed HTML.
MINOR: Added tests for saving and managing invalid HTML with SS_HTMLValue.

From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88773 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-13 01:44:41 +00:00