. inet_ntop() (Sara)
. fputcsv() (David Sklar)
. posix_access() (Magnus)
+ . htmlspecialchars_decode() (Ilia)
- Added DomDocument::$recover property for parsing not well-formed
XML Documents. (Christian)
- Added Cursor support for MySQL 5.0.x in mysqli (Georg)
PHP_FE(htmlspecialchars, NULL)
PHP_FE(htmlentities, NULL)
PHP_FE(html_entity_decode, NULL)
+ PHP_FE(htmlspecialchars_decode, NULL)
PHP_FE(get_html_translation_table, NULL)
PHP_FE(sha1, NULL)
PHP_FE(sha1_file, NULL)
}
/* }}} */
+/* {{{ proto string htmlspecialchars(string string [, int quote_style])
+ Convert special HTML entities back to characters */
+PHP_FUNCTION(htmlspecialchars_decode)
+{
+ char *str, *new_str, *e, *p;
+ int len, i, new_len;
+ long quote_style = ENT_COMPAT;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &len, "e_style) == FAILURE) {
+ return;
+ }
+
+ new_str = estrndup(str, len);
+ new_len = len;
+
+ for (i = 0; basic_entities[i].charcode != 0; i++) {
+ if (basic_entities[i].flags && !(quote_style & basic_entities[i].flags)) {
+ continue;
+ }
+
+ e = new_str + new_len;
+ p = new_str;
+
+ while ((p = php_memnstr(p, basic_entities[i].entity, basic_entities[i].entitylen, e))) {
+ int e_len = basic_entities[i].entitylen - 1;
+
+ *p++ = basic_entities[i].charcode;
+ memmove(p, p + e_len, (e - p - e_len));
+
+ new_len -= e_len;
+ e -= e_len;
+ }
+ }
+
+ e = new_str + new_len;
+ p = new_str;
+ while ((p = php_memnstr(p, "&", sizeof("&") - 1, e))) {
+ int e_len = sizeof("&") - 2;
+
+ p++;
+ memmove(p, p + e_len, (e - p - e_len));
+
+ new_len -= e_len;
+ e -= e_len;
+ }
+
+ new_str[new_len] = '\0';
+ RETURN_STRINGL(new_str, new_len, 0);
+}
+/* }}} */
+
/* {{{ proto string html_entity_decode(string string [, int quote_style][, string charset])
Convert all HTML entities to their applicable characters */
PHP_FUNCTION(html_entity_decode)