cvs: presentations /slides/input-filter check-data.php filter-c-callback.xml filter-functions.xml filter-v-int.xml filter-v-regexp.xml
functions-and-common-flags-array.xml functions-and-common-flags.xml functions-filter-data.xml functions-get-args.xml

From: Date: Thu, 08 Mar 2007 13:11:17 +0000
Subject: cvs: presentations /slides/input-filter check-data.php filter-c-callback.xml filter-functions.xml filter-v-int.xml filter-v-regexp.xml
functions-and-common-flags-array.xml functions-and-common-flags.xml functions-filter-data.xml functions-get-args.xml
Groups: php.pres 
Request: Send a blank email to pres+get-1387@lists.php.net to get a copy of this message
derick Thu Mar 8 13:11:17 2007 UTC Modified files: /presentations/slides/input-filter check-data.php filter-c-callback.xml filter-functions.xml filter-v-int.xml filter-v-regexp.xml functions-and-common-flags-array.xml functions-and-common-flags.xml functions-filter-data.xml functions-get-args.xml Log: - Update to new API.

http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/check-data.php?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/check-data.php diff -u presentations/slides/input-filter/check-data.php:1.1 presentations/slides/input-filter/check-data.php:1.2 --- presentations/slides/input-filter/check-data.php:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/check-data.php Thu Mar 8 13:11:16 2007 @@ -4,7 +4,7 @@ foreach( $flags as $flagName ) if ( isset( $_GET[$flagName] ) ) $o |= constant( $flagName ); - $data = input_get( INPUT_GET, 'data', $filter, $o ); + $data = filter_input( INPUT_GET, 'data', $filter, $o ); var_dump( $data ); } ?> http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/filter-c-callback.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/filter-c-callback.xml diff -u presentations/slides/input-filter/filter-c-callback.xml:1.1 presentations/slides/input-filter/filter-c-callback.xml:1.2 --- presentations/slides/input-filter/filter-c-callback.xml:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/filter-c-callback.xml Thu Mar 8 13:11:16 2007 @@ -8,10 +8,10 @@ </form> <?php $filter = FILTER_CALLBACK; -$callback = array( 'Validate', 'My' ); +$callback = array( 'options' => array( 'Validate', 'My' ) ); if (isset($_GET['data'])) { - $data = input_get( INPUT_GET, 'data', $filter, $callback ); + $data = filter_input( INPUT_GET, 'data', $filter, $callback ); var_dump( $data ); } http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/filter-functions.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/filter-functions.xml diff -u presentations/slides/input-filter/filter-functions.xml:1.1 presentations/slides/input-filter/filter-functions.xml:1.2 --- presentations/slides/input-filter/filter-functions.xml:1.1 Wed Sep 14 16:39:05 2005 +++ presentations/slides/input-filter/filter-functions.xml Thu Mar 8 13:11:16 2007 @@ -3,7 +3,7 @@ <title>Input Filter</title> <subtitle>Data Accessing Functions</subtitle> - <example>mixed input_get (int source, string name, string filter + <example>mixed filter_input (int source, string name, string filter [, mixed filter_options, [ string characterset ] ]);</example> <list> <bullet>Returns the filtered variable $name from source $source. It @@ -12,7 +12,7 @@ </list> <break lines="2"/> - <example>bool filter_data (mixed variable, string filter + <example>bool filter_var (mixed variable, string filter [, mixed filter_options, [ string characterset ] ]);</example> <list> <bullet>Filters the user supplied variable $variable with the filter http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/filter-v-int.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/filter-v-int.xml diff -u presentations/slides/input-filter/filter-v-int.xml:1.1 presentations/slides/input-filter/filter-v-int.xml:1.2 --- presentations/slides/input-filter/filter-v-int.xml:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/filter-v-int.xml Thu Mar 8 13:11:16 2007 @@ -19,16 +19,16 @@ </form> <?php if (!empty($_GET['min'])) - $options['min_range'] = (int) $_GET['min']; + $options['options']['min_range'] = (int) $_GET['min']; if (!empty($_GET['max'])) - $options['max_range'] = (int) $_GET['max']; + $options['options']['max_range'] = (int) $_GET['max']; if (isset($_GET['data'])) { $o = 0; foreach( $flags as $flagName ) if ( isset( $_GET[$flagName] ) ) $o |= constant( $flagName ); $options['flags'] = $o; - $data = input_get( INPUT_GET, 'data', $filter, $options ); + $data = filter_input( INPUT_GET, 'data', $filter, $options ); var_dump( $data ); } ?>]]></example> http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/filter-v-regexp.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/filter-v-regexp.xml diff -u presentations/slides/input-filter/filter-v-regexp.xml:1.1 presentations/slides/input-filter/filter-v-regexp.xml:1.2 --- presentations/slides/input-filter/filter-v-regexp.xml:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/filter-v-regexp.xml Thu Mar 8 13:11:16 2007 @@ -11,10 +11,11 @@ <?php $filter = FILTER_VALIDATE_REGEXP; if (!empty($_GET['regexp'])) - $options['regexp'] = $_GET['regexp']; + $options = array( 'options' => + array( 'regexp' => $_GET['regexp'] ) ); if (isset($_GET['data'])) { - $data = input_get( INPUT_GET, 'data', $filter, $options ); + $data = filter_input( INPUT_GET, 'data', $filter, $options ); var_dump( $data ); } ?>]]></example> http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/functions-and-common-flags-array.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/functions-and-common-flags-array.xml diff -u presentations/slides/input-filter/functions-and-common-flags-array.xml:1.1 presentations/slides/input-filter/functions-and-common-flags-array.xml:1.2 --- presentations/slides/input-filter/functions-and-common-flags-array.xml:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/functions-and-common-flags-array.xml Thu Mar 8 13:11:16 2007 @@ -8,10 +8,10 @@ <input type="submit"/> </form> <?php -$options = FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_ARRAY; +$options = FILTER_FLAG_STRIP_HIGH | FILTER_REQUIRE_ARRAY; if (isset($_GET['data'])) { - $data = input_get( + $data = filter_input( INPUT_GET, // source 'data', // parameter name FILTER_SANITIZE_STRING, // filter http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/functions-and-common-flags.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/functions-and-common-flags.xml diff -u presentations/slides/input-filter/functions-and-common-flags.xml:1.1 presentations/slides/input-filter/functions-and-common-flags.xml:1.2 --- presentations/slides/input-filter/functions-and-common-flags.xml:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/functions-and-common-flags.xml Thu Mar 8 13:11:16 2007 @@ -10,7 +10,7 @@ $options = FILTER_FLAG_STRIP_HIGH; if (isset($_GET['data'])) { - $data = input_get( + $data = filter_input( INPUT_GET, // source 'data', // parameter name FILTER_SANITIZE_STRING, // filter http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/functions-filter-data.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/functions-filter-data.xml diff -u presentations/slides/input-filter/functions-filter-data.xml:1.1 presentations/slides/input-filter/functions-filter-data.xml:1.2 --- presentations/slides/input-filter/functions-filter-data.xml:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/functions-filter-data.xml Thu Mar 8 13:11:16 2007 @@ -4,9 +4,9 @@ <example result="1"><![CDATA[<?php $text = "This tekßt is göing\tto be changed\n"; -$data = filter_data( +$data = filter_var( $text, - input_name_to_filter( 'special_chars' ), + filter_id( 'special_chars' ), FILTER_FLAG_STRIP_HIGH ); var_dump( $data ); http://cvs.php.net/viewvc.cgi/presentations/slides/input-filter/functions-get-args.xml?r1=1.1&r2=1.2&diff_format=u Index: presentations/slides/input-filter/functions-get-args.xml diff -u presentations/slides/input-filter/functions-get-args.xml:1.1 presentations/slides/input-filter/functions-get-args.xml:1.2 --- presentations/slides/input-filter/functions-get-args.xml:1.1 Thu Sep 14 19:51:56 2006 +++ presentations/slides/input-filter/functions-get-args.xml Thu Mar 8 13:11:16 2007 @@ -11,13 +11,15 @@ $definition = array( 'int' => array( 'filter' => FILTER_VALIDATE_INT, - 'options' => array( "min_range" => 1, "max_range" => 10 ) + 'options' => array( + 'options' => array( "min_range" => 1, "max_range" => 10 ) + ), ), 'string' => FILTER_SANITIZE_SPECIAL_CHARS ); if (isset($_GET['int'])) { - $data = input_get_args( INPUT_GET, $definition ); + $data = filter_input_array( INPUT_GET, $definition ); var_dump( $data ); } ?>]]></example>
« previous php.pres (#1387) next »