summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2011-07-11 15:18:46 (GMT)
committerChristian Stocker <chregu@php.net>2011-07-11 15:18:46 (GMT)
commit8806c371c8752eadcd646e33a5fad05057d29fc1 (patch)
treefadd41cf6d2a0638a07a59daf927631891b9ca05 /ext/dom
parenta0974f2d5946d96ef41281830ce614f64ab58408 (diff)
downloadphp-8806c371c8752eadcd646e33a5fad05057d29fc1.tar.gz
Added the ability to pass options to loadHTML (Chregu, fxmulder at gmail dot com)
(MFT - Merged from Trunk)
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/document.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c
index e01e2c3..2b11e7f 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -149,10 +149,12 @@ ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1)
ZEND_ARG_INFO(0, source)
+ ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1)
ZEND_ARG_INFO(0, source)
+ ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0)
@@ -2155,12 +2157,12 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
dom_object *intern;
dom_doc_propsptr doc_prop;
char *source;
- int source_len, refcount, ret;
+ int source_len, refcount, ret, options = 0;
htmlParserCtxtPtr ctxt;
id = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
return;
}
@@ -2180,6 +2182,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
RETURN_FALSE;
}
+ if (options) {
+ htmlCtxtUseOptions(ctxt, options);
+ }
+
ctxt->vctxt.error = php_libxml_ctx_error;
ctxt->vctxt.warning = php_libxml_ctx_warning;
if (ctxt->sax != NULL) {