root/trunk/examples/patExampleGen/sections_filter.php

Revision 186, 2.6 kB (checked in by schst, 4 years ago)

added a flexible function filter

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * Definitions for the examples on the patForms Filters
4  *
5  * $Id$
6  *
7  * @package        patForms
8  * @subpackage    Examples
9  * @author        Sebastian Mordziol <argh@php-tools.net>
10  */
11
12     $sections['Filter'] = array(
13         'descr'        =>    'Filter allow you to modify the values that you get from the
14                         form automatically. A filter can be used in both directions:
15                         when passing data to an element and when fetching data from
16                         the element.<br>
17                         Filters may be applied in two streams:
18                         <ul>
19                             <li>1. The HTTP stream which is between the browser and the patForms object (PATFORMS_FILTER_TYPE_HTTP)</li>
20                             <li>2. The PHP stream which is between the patForms object and your PHP script (PATFORMS_FILTER_TYPE_PHP)</li>
21                         </ul>',
22         'basename'    =>    'example_filter_',
23         'pages'        =>    array(
24             'trim' => array(
25                 'title'    =>    'Trim',
26                 'descr'    =>    'This example shows how to use the \'Trim\' filter to
27                             remove leading and trailing whitespace from the value. It
28                             is applied in the HTTP stream, prior to validating the
29                             form element.'
30             ),
31             'multiplier' => array(
32                 'title'    =>    'Multiplier',
33                 'descr'    =>    'This example automatically transform hours that have been
34                             entered into the form into minutes and vice versa.
35                             This filter is applied on the PHP stream, i.e.
36                             after the element has been validated.'
37             ),
38             'xss' => array(
39                 'title'    =>    'XSS (Cross-site-scripting attacks)',
40                 'descr'    =>    'This example demonstrates the use of the XSS filter to
41                             avoid cross site scripting attacks.',
42                 'tabs'  =>  array(
43                     'hilights' => array(
44                         'title' => 'Relevant parts',
45                         'type'  => 'guide',
46                         'file'  => '$exampleId.php',
47                         'guide' => array(
48                             array(
49                                 'lines' => '35-51',
50                                 'text' => 'The element definition with script tag as default value',
51                             ),
52                             array(
53                                 'lines' => '65-72',
54                                 'text' => 'Creating and adding the filter',
55                             ),
56                         ),
57                     ),
58                 ),
59             ),
60             'function' => array(
61                 'title'    =>    'Function',
62                 'descr'    =>    'This shows how to apply a filter that uses any PHP funtion to filter the data.'
63             ),
64             'auto' => array(
65                 'title'    =>    'Automatic creation',
66                 'descr'    =>    'You can define filters for your elements and have them
67                             be added to your form elements automatically via the
68                             patForms factory.',
69                 'tabs'  =>  array(
70                     'hilights' => array(
71                         'title' => 'Relevant parts',
72                         'type'  => 'guide',
73                         'file'  => '$exampleId.php',
74                         'guide' => array(
75                             array(
76                                 'lines' => '36-61',
77                                 'text' => 'The element definition with filters',
78                             ),
79                         ),
80                     ),
81                 ),
82             ),
83         )
84     );
85 ?>
Note: See TracBrowser for help on using the browser.