AJAX
[ class tree: AJAX ] [ index: AJAX ] [ all elements ]

Source for file Urlencoded.php

Documentation is available at Urlencoded.php

  1. <?php
  2. // $Id$
  3.  
  4. // {{{ http_build_query
  5. /**
  6.  * Replacement for http_build_query()
  7.  *
  8.  * @link   http://php.net/function.http-build-query
  9.  * @author vlad_mustafin@ukr.net
  10.  * @author Arpad Ray <arpad@php.net>
  11.  */
  12. if (!function_exists('http_build_query')) {
  13.     function http_build_query($formdata$numeric_prefix = null$key = null
  14.     {
  15.         $res = array();
  16.         foreach ((array)$formdata as $k => $v{
  17.             if (is_resource($v)) {
  18.                 return null;
  19.             }
  20.             $tmp_key urlencode(is_int($k$numeric_prefix $k $k);
  21.             if (!is_null($key)) {
  22.                 $tmp_key $key '[' $tmp_key ']';
  23.             }
  24.             $res[(is_scalar($v))
  25.                 ? $tmp_key '=' urlencode($v)
  26.                 : http_build_query($vnull $tmp_key);
  27.         }
  28.         $separator ini_get('arg_separator.output');
  29.         if (strlen($separator== 0{
  30.             $separator '&';
  31.         }
  32.         return implode($separator$res);
  33.     }
  34. }
  35. // }}}
  36. // {{{ class HTML_AJAX_Serialize_Urlencoded
  37. /**
  38.  * URL Encoding Serializer
  39.  *
  40.  * @category   HTML
  41.  * @package    AJAX
  42.  * @author     Arpad Ray <arpad@php.net>
  43.  * @author     David Coallier <davidc@php.net>
  44.  * @copyright  2005 Arpad Ray
  45.  * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
  46.  * @version    Release: 0.5.7
  47.  * @link       http://pear.php.net/package/HTML_AJAX
  48.  */
  49. {
  50.     // {{{ serialize
  51.     function serialize($input
  52.     {
  53.         return http_build_query(array('_HTML_AJAX' => $input));
  54.     }
  55.     // }}}
  56.     // {{{ unserialize
  57.     function unserialize($input
  58.     {
  59.         parse_str($input$ret);
  60.         return (isset($ret['_HTML_AJAX']$ret['_HTML_AJAX'$ret);
  61.     }
  62.     // }}}
  63. }
  64. // }}}
  65. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  66. ?>

Documentation generated on Mon, 11 Mar 2019 15:59:25 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.