root/trunk/examples/patExampleGen/fileUsage.php

Revision 117, 1.4 kB (checked in by argh, 4 years ago)

Massive update of the examples collection; added the patExampleGen examples framework; commented all examples; reworked all the templates...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * Helper file for the examples collection that displays a list of
4  * example files that may be missing or are not referenced to in the
5  * examples section definitions.
6  *
7  * $Id$
8  *
9  * @access        public
10  * @package        patForms
11  * @subpackage    Examples
12  * @version        0.1
13  * @author        Sebastian Mordziol <s.mordziol@metrix.de>
14  * @link        http://www.php-tools.net
15  */
16  
17    /**
18     * Main prepend file
19     */
20      require_once 'prepend.php';
21  
22     $knownExamples = array();
23     $notReferenced = array();
24     $missing = array();
25  
26     foreach( $sections as $sectionID => $sectionDef )
27     {
28         foreach( $sectionDef['pages'] as $pageID => $pageDef )
29         {
30             $file = $sectionDef['basename'].$pageID.'.php';
31             
32             array_push( $knownExamples, $file );
33             
34             if( !file_exists( '../'.$file ) )
35             {
36                 array_push( $missing, $file );
37             }
38         }
39     }
40  
41     $d = dir( '../' );
42     while( false !== ( $entry = $d->read() ) )
43     {
44         if( stristr( $entry, 'example_' ) && stristr( $entry, '.php' ) && !in_array( $entry, $knownExamples ) )
45         {
46             array_push( $notReferenced, $entry );
47         }
48     }
49     $d->close();
50
51     echo '<b>The following examples are not referenced to in the sections:</b><br/><br/>';
52     if( empty( $notReferenced ) )
53     {
54         echo '<i>none</i>';
55     }
56     else
57     {
58         echo implode( '<br>', $notReferenced );
59     }
60     
61     echo '<br/><br/><b>The following examples are missing:</b><br/><br/>';
62     if( empty( $missing ) )
63     {
64         echo '<i>none</i>';
65     }
66     else
67     {
68         echo implode( '<br>', $missing );
69     }
70     
71 ?>
Note: See TracBrowser for help on using the browser.