PHP Classes

File: phpizer.define.php

Recommend this page to a friend!
  Classes of Asher Wolfstein   phpizer   phpizer.define.php   Download  
File: phpizer.define.php
Role: Configuration script
Content type: text/plain
Description: Required Constant Definitions
Class: phpizer
Load and adapt class to current PHP version (3.x+)
Author: By
Last change: Fixed regular expressions short-comings
Date: 17 years ago
Size: 2,592 bytes
 

Contents

Class file image Download
<?php

/* Advanced Versioning Class
 * Written by Asher Holley ( http://www.wolfoxinc.com/opensource/ )
 * Released under the GNU General Public License ( http://www.opensource.org/licenses/gpl-license.html )
 * Copyright © 2006 Asher Holley
 *
 * Definitions file for phpizer.class.php */

/* SYNTAX FOR VERSIONING:
 *
 * X-X-X makes the inclusion specific to that version only
 * X-X makes the inclusion specific to X-X-0 -> X-X+1-0 ( latter not included )
 * X makes the inclusion specific to X-0-0 -> X+1-0-0 (latter not included)
 *
 * If you want to make something for a particular version in general do this:
 *
 * X-X-X > makes the inclusion from that specific version up
 * X-X > makes the inclusion from X-X-0 and up
 * X > makes the inclusion from X and up
 *
 * X-X-X > Y-Y-Y makes the inclusion from x version to y version, y not included
 * X-X > Y-Y ...
 * X-X-X > Y ...
 * X > Y-Y ...
 * X > Y and so on. */

// The following definition identifies the 'tag' character denoting

define( 'V_TOKEN', preg_quote( '%', '/' ) );
define( 'V_VERS_SPLIT', preg_quote( '-', '/' ) );
define( 'V_VERS_RANGE', preg_quote( '>', '/' ) );

// The following regular expressions identify the end-of-line 'tags'

define( 'VL_FIND_PHP', '/\\/\\/(.*)' . V_TOKEN . 'PHP(\d)?' .
       
V_VERS_SPLIT . '?(\d)?' . V_VERS_SPLIT . '?(\d)?\s*(' .
       
V_VERS_RANGE . ')?\s*(\d)?' . V_VERS_SPLIT . '?(\d)?' .
       
V_VERS_SPLIT . '?(\d)?/' );

/* Example:
 *
 * // $c = is_a( $a, 'Class' ) %PHP4 > 5
 * // $c = $a instanceof Class %PHP5-0-5
 * // $c = $a instanceof Class %PHP5 >
 */

// The following regular expressions identify the tags used for 'blocks'

define( 'VB_FIND_PHP', '/\\/\\*' . V_TOKEN . '(.*?)' . V_TOKEN .
       
'PHP(\d)?' . V_VERS_SPLIT . '?(\d)?' . V_VERS_SPLIT .
       
'?(\d)?\s*(' . V_VERS_RANGE . ')?\s*(\d)?' .
       
V_VERS_SPLIT . '?(\d)?' . V_VERS_SPLIT .
       
'?(\d)?.*?\s*\\*\\//s' );

/* Example:
 *
 * /*% if ( is_a( $a, 'Class' ) ) {
 * echo 'a is Class';
 * } %PHP4 > 5 */
/*
 * /*% if ( $a instanceof 'Class' ) {
 * echo 'a is Class';
 * } %PHP5 */
/* */

// These are the regular expressions used to eliminate all superfluous comments.

define( 'VL_COMMENT', '/\/\/.*/');
define( 'VB_COMMENT', '/\/\*.*\*\//Us' );

// These are the definitions used for the options to include_file

define( 'V_FILEBASE', 1 );
define( 'V_INC_PATH', 2 );

// The following will NOT truncate the php tags, NOR execute the file.
define( 'V_NOT_TRUNC_PHP', 4 );

?>