From: Michael Wallner Date: Thu, 6 Jul 2006 18:19:23 +0000 (+0000) Subject: - add HttpQueryString::mod() X-Git-Tag: RELEASE_1_1_0~9 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=14bee6bccd8fbaf61786b6e3936d85a71bd97f82 - add HttpQueryString::mod() --- diff --git a/docs/functions.html b/docs/functions.html index b939e06..c3d2aad 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -644,6 +644,12 @@ Operates on and modifies $_GET and $_SERVER['QUERY_STRING'] if global is TRUE.

string HttpQueryString::set(mixed params)

Set query string entry/entries. NULL values will unset the variable.

+

HttpQueryString HttpQueryString::mod(mixed params)

+

Copies the query string object and sets provided params at the clone.
+This is basically shorthand for:


+<?php
$newQS 
= new HttpQueryString(false$oldQS);
$newQS->set($other_params);
?>
+

+

static HttpQueryString HttpQueryString::singleton([bool global = true])

Get a single instance (differentiates between the global setting).

bool HttpQueryString::xlate(string ie, string oe)

@@ -1322,6 +1328,7 @@ http.cache_log is set.

  • HttpQueryString::toArray()
  • HttpQueryString::get()
  • HttpQueryString::set()
  • +
  • HttpQueryString::mod()
  • HttpQueryString::singleton()
  • HttpQueryString::xlate()
  • HttpQueryString::serialize()
  • @@ -1442,7 +1449,7 @@ http.cache_log is set.

    -

    Generated at: Thu, 08 Jun 2006 23:59:56 +0200

    +

    Generated at: Thu, 06 Jul 2006 20:17:57 +0200

    diff --git a/http_querystring_object.c b/http_querystring_object.c index cdbabbb..3ae00fd 100644 --- a/http_querystring_object.c +++ b/http_querystring_object.c @@ -55,6 +55,10 @@ HTTP_BEGIN_ARGS(set, 1) HTTP_ARG_VAL(params, 0) HTTP_END_ARGS; +HTTP_BEGIN_ARGS(mod, 0) + HTTP_ARG_VAL(params, 0) +HTTP_END_ARGS; + HTTP_BEGIN_ARGS(__getter, 1) HTTP_ARG_VAL(name, 0) HTTP_ARG_VAL(defval, 0) @@ -84,6 +88,7 @@ zend_function_entry http_querystring_object_fe[] = { HTTP_QUERYSTRING_ME(get, ZEND_ACC_PUBLIC) HTTP_QUERYSTRING_ME(set, ZEND_ACC_PUBLIC) + HTTP_QUERYSTRING_ME(mod, ZEND_ACC_PUBLIC) HTTP_QUERYSTRING_GME(getBool, ZEND_ACC_PUBLIC) HTTP_QUERYSTRING_GME(getInt, ZEND_ACC_PUBLIC) @@ -177,7 +182,6 @@ void _http_querystring_object_free(zend_object *object TSRMLS_DC) } /* {{{ querystring helpers */ -#ifndef WONKY #define http_querystring_instantiate(g) _http_querystring_instantiate((g) TSRMLS_CC) static inline zval *_http_querystring_instantiate(zend_bool global TSRMLS_DC) { @@ -195,7 +199,6 @@ static inline zval *_http_querystring_instantiate(zend_bool global TSRMLS_DC) return zobj; } -#endif /* WONKY */ #define http_querystring_get(o, t, n, l, def, del, r) _http_querystring_get((o), (t), (n), (l), (def), (del), (r) TSRMLS_CC) static inline void _http_querystring_get(zval *this_ptr, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value TSRMLS_DC) @@ -372,6 +375,36 @@ PHP_METHOD(HttpQueryString, set) } /* }}} */ +/* {{{ proto HttpQueryString HttpQueryString::mod(mixed params) + * + * Copies the query string object and sets provided params at the clone. + * This is basically shorthand for: + *
    + * set($other_params);
    + * ?>
    + * 
    + */ +PHP_METHOD(HttpQueryString, mod) +{ + zval *orig, *zobj, *qarr, *qstr, *params; + + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶ms)) { + zobj = http_querystring_instantiate(0); + orig = GET_PROP(queryArray); + qarr = GET_PROP_EX(zobj, queryArray); + qstr = GET_PROP_EX(zobj, queryString); + + array_copy(orig, qarr); + http_querystring_modify(qarr, params); + http_querystring_update(qarr, qstr); + + RETURN_ZVAL(zobj, 1, 1); + } +} +/* }}} */ + #ifndef WONKY /* {{{ proto static HttpQueryString HttpQueryString::singleton([bool global = true]) * diff --git a/package2.xml b/package2.xml index 844d680..275c6db 100644 --- a/package2.xml +++ b/package2.xml @@ -30,8 +30,8 @@ support. Parallel requests are available for PHP 5 and greater. 2006-00-00 - 1.0.2dev - 1.0.0 + 1.1.0dev + 1.1.0 stable @@ -40,6 +40,7 @@ support. Parallel requests are available for PHP 5 and greater. BSD, revised diff --git a/php_http.h b/php_http.h index e3ccb63..86c8eca 100644 --- a/php_http.h +++ b/php_http.h @@ -15,7 +15,7 @@ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H -#define PHP_EXT_HTTP_VERSION "1.0.2dev" +#define PHP_EXT_HTTP_VERSION "1.1.0dev" #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/php_http_querystring_object.h b/php_http_querystring_object.h index 63a47d8..26b3070 100644 --- a/php_http_querystring_object.h +++ b/php_http_querystring_object.h @@ -44,6 +44,7 @@ PHP_METHOD(HttpQueryString, toString); PHP_METHOD(HttpQueryString, toArray); PHP_METHOD(HttpQueryString, get); PHP_METHOD(HttpQueryString, set); +PHP_METHOD(HttpQueryString, mod); PHP_METHOD(HttpQueryString, getBool); PHP_METHOD(HttpQueryString, getInt); PHP_METHOD(HttpQueryString, getFloat);