]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/php/src/autoload.php
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
24 * Include this file if you wish to use autoload with your PHP generated Thrift
25 * code. The generated code will *not* include any defined Thrift classes by
26 * default, except for the service interfaces. The generated code will populate
27 * values into $GLOBALS['THRIFT_AUTOLOAD'] which can be used by the autoload
28 * method below. If you have your own autoload system already in place, rename your
29 * __autoload function to something else and then do:
30 * $GLOBALS['AUTOLOAD_HOOKS'][] = 'my_autoload_func';
32 * Generate this code using the --gen php:autoload Thrift generator flag.
35 $GLOBALS['THRIFT_AUTOLOAD'] = array();
36 $GLOBALS['AUTOLOAD_HOOKS'] = array();
38 if (!function_exists('__autoload')) {
39 function __autoload($class)
41 global $THRIFT_AUTOLOAD;
42 $classl = strtolower($class);
43 if (isset($THRIFT_AUTOLOAD[$classl])) {
44 include_once $GLOBALS['THRIFT_ROOT'].'/packages/'.$THRIFT_AUTOLOAD[$classl];
45 } elseif (!empty($GLOBALS['AUTOLOAD_HOOKS'])) {
46 foreach ($GLOBALS['AUTOLOAD_HOOKS'] as $hook) {