Mark Slee | 09f69e0 | 2007-11-17 00:32:36 +0000 | [diff] [blame] | 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Copyright (c) 2006- Facebook |
| 5 | * Distributed under the Thrift Software License |
| 6 | * |
| 7 | * See accompanying file LICENSE or visit the Thrift site at: |
| 8 | * http://developers.facebook.com/thrift/ |
| 9 | * |
| 10 | * @package thrift |
| 11 | * @author Mark Slee <mcslee@facebook.com> |
| 12 | */ |
| 13 | |
| 14 | /** |
| 15 | * Include this file if you wish to use autoload with your PHP generated Thrift |
| 16 | * code. The generated code will *not* include any defined Thrift classes by |
| 17 | * default, except for the service interfaces. The generated code will populate |
| 18 | * values into $GLOBALS['THRIFT_AUTOLOAD'] which can be used by the autoload |
| 19 | * method below. If you have your own autoload system already in place, you |
| 20 | * should merge the following functionality into your autoload system. |
| 21 | * |
| 22 | * Generate this code using the -phpa Thrift generator flag. |
| 23 | */ |
| 24 | |
| 25 | $GLOBALS['THRIFT_AUTOLOAD'] = array(); |
| 26 | |
| 27 | if (!function_exists('__autoload')) { |
| 28 | function __autoload($class) { |
| 29 | global $THRIFT_AUTOLOAD; |
| 30 | if (isset($THRIFT_AUTOLOAD[$class])) { |
| 31 | include_once $GLOBALS['THRIFT_ROOT'].'/lib/packages/'.$THRIFT_AUTOLOAD[$class]; |
| 32 | } |
| 33 | } |
| 34 | } |