function autoload($dir) { $files = scandir($dir); foreach ($files as $file) { if ($file == "." || $file == "..") { continue; } $tmp_dir = $dir . DIRECTORY_SEPARATOR . $file; if (is_dir($tmp_dir)) { autoload($tmp_dir); } elseif (is_readable($tmp_dir)) { require_once $tmp_dir; } } }
/** * @param $class * @param null|string $dir */ function autoload($class, $dir = null) { if (is_null($dir)) { $dir = __DIR__ . DIRECTORY_SEPARATOR; } $p = explode('\\', $class); if (count($p) > 1) { $class = array_pop($p); $nameSpaceDir = strtolower(implode(DIRECTORY_SEPARATOR, $p)); $dir = $dir . $nameSpaceDir . DIRECTORY_SEPARATOR; } foreach (scandir($dir) as $file) { if (is_dir($dir . $file) && substr($file, 0, 1) !== '.') { autoload($class, $dir . $file . '/'); } if (substr($file, 0, 2) !== '._' && preg_match("/.php\$/i", $file)) { if (str_replace('.php', '', $file) == $class || str_replace('.class.php', '', $file) == $class) { include $dir . $file; } } } }
function autoload( $class, $dir = null ) { if ( is_null( $dir ) ) $dir = APPLICATION_PATH . '/FRAMEWORK/PHP/CLASS'; foreach ( scandir( $dir ) as $file ) { // directory? if ( is_dir( $dir.'/'.$file ) && substr( $file, 0, 1 ) !== '.' ) { autoload( $class, $dir.'/'.$file.'/' ); } // is php & matches class? if ( preg_match( "/.php$/i" , $file ) && str_replace( '_class.php', '', $file ) == $class) { if($_GET['debug']) print '<!-- PHP: AutoLoad Class: '. $class .' -->' . "\n"; require_once($dir . $file); } } }
<?php $_SERVER['jemyrazem_start'] = microtime(true); $_SERVER['backend_start'] = microtime(true); include __DIR__ . '/../rest/library/backend/include/all.php'; function myshutdown() { @Bootstrap::$main->closeConn(); } mb_internal_encoding('utf8'); autoload([__DIR__ . '/../rest/class', __DIR__ . '/../rest/models', __DIR__ . '/../rest/controllers']); $config = json_config(__DIR__ . '/../rest/config/application.json'); register_shutdown_function('myshutdown'); $bootstrap = new Bootstrap($config); $bootstrap->admin = true; header('Content-type: text/html; charset=utf-8');
<?php session_start(); function autoload($class) { $classPath = str_replace('\\', '/', $class) . '.php'; $webosFile = realpath(dirname(__DIR__) . '/' . $classPath); if (file_exists($webosFile)) { return require $webosFile; } } spl_autoload_register('autoload'); // Loading FlatOS kernel... autoload('system/kernel/HTTPRequest'); autoload('system/kernel/HTTPResponse'); autoload('system/kernel/RawData'); autoload('system/kernel/Kernel'); autoload('system/kernel/BootLoader'); autoload('system/kernel/JSONQL'); autoload('system/kernel/FS'); autoload('system/kernel/File'); autoload('system/kernel/User'); autoload('system/kernel/UserInterface'); autoload('system/kernel/UserConfig'); // Loading API... autoload('system/api/Call');
<?php // default values $dir = __DIR__; $slashPos = strrpos($dir, '/'); $dir = substr($dir, 0, $slashPos + 1); $filename = $dir . 'your_project/db/mydb.mwb'; $outDir = $dir . 'your_project/src/AppBundle/Entity/'; $html = ""; // show errors error_reporting(E_ALL); ini_set('display_errors', 1); include 'util.php'; // enable autoloading of classes $html = autoload($html); use MwbExporter\Formatter\Doctrine1\Yaml\Formatter as D1Y; use MwbExporter\Formatter\Doctrine2\Annotation\Formatter as D2A; use MwbExporter\Formatter\Doctrine2\Yaml\Formatter as D2Y; use MwbExporter\Formatter\Doctrine2\ZF2InputFilterAnnotation\Formatter as D2Z; use MwbExporter\Formatter\Propel1\Xml\Formatter as P1X; use MwbExporter\Formatter\Propel1\Yaml\Formatter as P1Y; use MwbExporter\Formatter\Sencha\ExtJS3\Formatter as SE3; use MwbExporter\Formatter\Sencha\ExtJS4\Formatter as SE4; use MwbExporter\Formatter\Zend\DbTable\Formatter as ZD; use MwbExporter\Formatter\Zend\RestController\Formatter as ZR; // setup modes $mode = array('doctrine1.yaml' => 'doctrine1-yaml', 'doctrine2.annotation' => 'doctrine2-annotation', 'doctrine2.yaml' => 'doctrine2-yaml', 'doctrine2.zf2inputfilter' => 'doctrine2-zf2inputfilterannotation', 'propel.xml' => 'propel1-xml', 'propel.yaml' => 'propel1-yaml', 'sencha.extjs3' => 'sencha-extjs3', 'sencha.extjs4' => 'sencha-extjs4', 'zend.dbtable' => 'zend-dbtable', 'zend.restcontroller' => 'zend-restcontroller'); // IF POST if (isset($_POST['input']) && isset($_POST['output']) && isset($_POST['mode'])) { // set inputs $filename = $_POST['input'];
<?php /** * Drone - Rapid Development Framework for PHP 5.5.0+ * * @package Drone * @version 0.2.3 * @copyright 2015 Shay Anderson <http://www.shayanderson.com> * @license MIT License <http://www.opensource.org/licenses/mit-license.php> * @link <https://github.com/shayanderson/drone> */ ////////////////////////////////////////////////////////////////////////// // Load Drone Framework + run application ////////////////////////////////////////////////////////////////////////// // set root path define('PATH_ROOT', __DIR__ . '/'); // include Drone common functions require_once './_app/lib/Drone/com.php'; // set class autoloading paths autoload([PATH_ROOT . '_app/lib']); // include app/Drone bootstrap require_once './_app/com/app.bootstrap.php'; // run application (execute last) drone()->run();
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * This file is used to autoload the API library */ $classes = ['BBM\\Server\\Config\\SysConfig', 'BBM\\Server\\Connect', 'BBM\\Server\\Exception', 'BBM\\Server\\Request', 'BBM\\Download', 'BBM\\Catalog', 'BBM\\Purchase']; /** * Used to load the class passed by parameter. * @param $className */ function autoload($className) { $className = ltrim($className, '\\'); $fileName = ''; $namespace = ''; if ($lastNsPos = strrpos($className, '\\')) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; require $fileName; } foreach ($classes as $class) { autoload($class); }
<?php autoload('app\\', ROOT_PATH . 'application/src/'); autoload('framework\\', ROOT_PATH . 'framework/'); function autoload($prefix, $baseDir) { spl_autoload_register(function ($class) use($prefix, $baseDir) { // does the class use the namespace prefix? $len = strlen($prefix); if (strncmp($prefix, $class, $len) !== 0) { // no, move to the next registered autoloader return; } // get the relative class name $relativeClass = substr($class, $len); // replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append // with .php $file = $baseDir . str_replace('\\', '/', $relativeClass) . '.php'; // if the file exists, require it if (file_exists($file)) { require $file; } }); }
/** * Recursively loads all php files in all subdirectories of the given path * * @param $directory */ function autoload($directory) { // Get a listing of the current directory $scanned_dir = scandir($directory); if (empty($scanned_dir)) { return; } // Ignore these items from scandir $ignore = array('.', '..'); // Remove the ignored items $scanned_dir = array_diff($scanned_dir, $ignore); foreach ($scanned_dir as $item) { $filename = $directory . '/' . $item; $real_path = realpath($filename); if (false === $real_path) { continue; } $filetype = filetype($real_path); if (empty($filetype)) { continue; } // If it's a directory then recursively load it if ('dir' === $filetype) { autoload($real_path); } else { if ('file' === $filetype) { // Don't allow files that have been uploaded if (is_uploaded_file($real_path)) { continue; } // Don't load any files that are not the proper mime type if ('text/x-php' !== mime_content_type($real_path)) { continue; } $filesize = filesize($real_path); // Don't include empty or negative sized files if ($filesize <= 0) { continue; } // Don't include files that are greater than 100kb if ($filesize > 100000) { continue; } $pathinfo = pathinfo($real_path); // An empty filename wouldn't be a good idea if (empty($pathinfo['filename'])) { continue; } // Sorry, need an extension if (empty($pathinfo['extension'])) { continue; } // Actually, we want just a PHP extension! if ('php' !== $pathinfo['extension']) { continue; } // Only for files that really exist if (true !== file_exists($real_path)) { continue; } if (true !== is_readable($real_path)) { continue; } require_once $real_path; } } } }
include_once 'bootstrap.custom.php'; } /** * Include this file to bootstrap the library. Registers an SPL autoloader to * automatically detect and load library class files at runtime. * * @copyright Copyright (c) 2011, Box UK * @license http://opensource.org/licenses/mit-license.php MIT License and http://www.gnu.org/licenses/gpl.html GPL license * @link https://github.com/boxuk/describr * @since 1.0.0 */ /** * @param string $rootDir e.g. /opt/BoxUK/describr/lib * @param string $pathToPHPReaderLibrary e.g. /opt/vendor/php-reader/1.8.1/src */ function autoload($rootDir, $pathToPHPReaderLibrary) { spl_autoload_register(function ($className) use($rootDir, $pathToPHPReaderLibrary) { $file = sprintf('%s/%s.php', $rootDir, str_replace('\\', '/', $className)); if (file_exists($file)) { require $file; } else { $file = sprintf('%s/%s.php', $pathToPHPReaderLibrary, str_replace('_', '/', $className)); if (file_exists($file)) { require $file; } } }); } autoload(__DIR__, $describr_pathToPHPReaderLibrary);
<?php function autoload($className) { $className = ltrim($className, '\\'); $fileName = ''; $namespace = ''; if ($lastNsPos = strrpos($className, '\\')) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; require $fileName; } autoload('\\Simphplist\\Simphplist\\Request'); use Simphplist\Simphplist\Request; echo Request::get('test', 'use ?test=string');
<?php ini_set('display_errors', 'On'); ini_set('error_reporting', -1); require_once __DIR__ . '/../vendor/autoload.php'; function autoload($rootDir) { spl_autoload_register(function ($className) use($rootDir) { $file = sprintf('%s/%s.php', $rootDir, str_replace('\\', '/', $className)); if (file_exists($file)) { require $file; } }); } autoload('/usr/share/php'); autoload(__DIR__ . '/'); autoload(__DIR__ . '/Url'); autoload(__DIR__ . '/NormalisedUrl');
<?php ini_set('display_errors', 'On'); ini_set('error_reporting', -1); require_once __DIR__ . '/../vendor/autoload.php'; function autoload($rootDir) { spl_autoload_register(function ($className) use($rootDir) { $file = sprintf('%s/%s.php', $rootDir, str_replace('\\', '/', $className)); if (file_exists($file)) { require $file; } }); } autoload('/usr/share/php'); autoload(__DIR__ . '/'); autoload(__DIR__ . '/regular'); autoload(__DIR__ . '/normalisation');
along with this program. If not, see <http://www.gnu.org/licenses/>. Modified version of class done by David Marco Martinez */ // Permision to set for uploaded .torrent files (don't touch unless you know) define('PERM_TORRENTS', 0777); // Don't touch any of the data below unless you know what you are doing define('DIR_LANG', 'wt/lang/'); define('DIR_TPL', 'wt/tpl/'); define('DIR_TPL_COMPILE', 'tpl_c/'); define('DIR_TPL_HTML', 'wt/html/'); define('DIR_BACKUP', 'backup/'); define('DIR_UPLOAD', 'torrents/'); define('DIR_CSS', 'wt/css/'); define('DIR_JS', 'wt/js/'); define('DIR_IMG', 'wt/img/'); define('SRC_INDEX', 'index.php'); define('TITLE', 'wTorrent'); define('META_TITLE', 'rTorrent web interface'); define('META_KEYWORDS', 'rtorrent xmlrpc interface php web html'); define('META_DESCRIPTION', 'rtorrent web inrface using xmlrpc'); // Minimum execution time (due to scriptaculous effects duration) define('MIN_TIME', 0.6); define('SCRAMBLE', false); define('APP', 'wTorrent'); // General libs require_once 'lib/inc/includes.inc.php'; // Autoloading of classes autoload('lib/cls/', 'cls/', 'wt/cls/'); // UNIX path definition ini_set('include_path', DIR_EXEC);
function __autoload($class) { return autoload($class); }
/** * 提交订单 */ public function submit_order() { /* 检查购物车中是否有商品 */ if (count($_SESSION['wholesale_goods']) == 0) { show_message(L('no_goods_in_cart')); } /* 检查备注信息 */ if (empty($_POST['remark'])) { show_message(L('ws_remark')); } /* 计算商品总额 */ $goods_amount = 0; foreach ($_SESSION['wholesale_goods'] as $goods) { $goods_amount += $goods['subtotal']; } $order = array('postscript' => htmlspecialchars($_POST['remark']), 'user_id' => $_SESSION['user_id'], 'add_time' => gmtime(), 'order_status' => OS_UNCONFIRMED, 'shipping_status' => SS_UNSHIPPED, 'pay_status' => PS_UNPAYED, 'goods_amount' => $goods_amount, 'order_amount' => $goods_amount); /* 插入订单表 */ $error_no = 0; do { $order['order_sn'] = get_order_sn(); //获取新订单号 $this->model->table('order_info')->data($order)->insert(); $error_no = $this->model->errno(); if ($error_no > 0 && $error_no != 1062) { die($this->model->errorMsg()); } } while ($error_no == 1062); //如果是订单号重复则重新提交数据 $new_order_id = $this->model->insert_id(); $order['order_id'] = $new_order_id; /* 插入订单商品 */ foreach ($_SESSION['wholesale_goods'] as $goods) { //如果存在货品 $product_id = 0; if (!empty($goods['goods_attr_id'])) { $goods_attr_id = array(); foreach ($goods['goods_attr_id'] as $value) { $goods_attr_id[$value['attr_id']] = $value['attr_val_id']; } ksort($goods_attr_id); $goods_attr = implode('|', $goods_attr_id); $res = $this->model->table('products')->field('product_id')->where("goods_attr = '{$goods_attr}' AND goods_id = '" . $goods['goods_id'] . "'")->find(); $product_id = $res['product_id']; } $sql = "INSERT INTO " . $this->model->pre . "order_goods( " . "order_id, goods_id, goods_name, goods_sn, product_id, goods_number, market_price, " . "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift) " . " SELECT '{$new_order_id}', goods_id, goods_name, goods_sn, '{$product_id}','{$goods['goods_number']}', market_price, " . "'{$goods['goods_price']}', '{$goods['goods_attr']}', is_real, extension_code, 0, 0 " . " FROM " . $this->model->pre . "goods WHERE goods_id = '{$goods['goods_id']}'"; $this->model->query($sql); } /* 给商家发邮件 */ if (C('service_email') != '') { $tpl = get_mail_template('remind_of_new_order'); $this->assign('order', $order); $this->assign('shop_name', C('shop_name')); $this->assign('send_date', date(C('time_format'))); $content = ECTouch::view()->fetch('str:' . $tpl['template_content']); send_mail(C('shop_name'), C('service_email'), $tpl['template_subject'], $content, $tpl['is_html']); } /* 如果需要,发短信 */ if (C('sms_order_placed') == '1' && C('sms_shop_mobile') != '') { autoload('EcsSms'); $sms = new EcsSms(); $msg = L('order_placed_sms'); $sms->send(C('sms_shop_mobile'), sprintf($msg, $order['consignee'], $order['mobile']), '', 13, 1); } /* 清空购物车 */ unset($_SESSION['wholesale_goods']); /* 提示 */ show_message(sprintf(L('ws_order_submitted'), $order['order_sn']), L('ws_return_home'), url('index')); }
<?php $_SERVER['backend_start'] = microtime(true); include __DIR__ . '/backend/include/all.php'; autoload([__DIR__ . '/classes', __DIR__ . '/controllers']); $config = json_config(__DIR__ . '/config/application.json'); $bootstrap = new Bootstrap($config); $root = $bootstrap->getRoot(); $uri = $_SERVER['REQUEST_URI']; if ($pos = strpos($uri, '?')) { $uri = substr($uri, 0, $pos); } $uri = substr($uri, strlen($root)); $q = urldecode(trim(str_replace(['-', '/', "'"], ' ', $uri))); $google_part = ''; $description = $q ? str_replace('{q}', $q, $bootstrap->getConfig('page.description')) : $bootstrap->getConfig('page.description0'); if (isset($_GET['_google']) || isset($_SERVER['HTTP_USER_AGENT']) && strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'google')) { if ($q) { $google_part = '<h1>' . $q . '</h1>' . "\n"; $template = new templateController(); $template->init(); $holidays = new holidaysController(0, ['q' => $q]); $holidays->init(); $tmpl = $template->get(false); $tmpl = preg_replace('~\\[if:[^\\]]+\\]~', '', $tmpl); $tmpl = preg_replace('~\\[endif:[^\\]]+\\]~', '', $tmpl); $tmpl = preg_replace('~\\[loop:[^\\]]+\\]~', '', $tmpl); $tmpl = preg_replace('~\\[endloop:[^\\]]+\\]~', '', $tmpl); $tmpl = str_replace('style="display:none"', '', $tmpl); $result = $holidays->get(10); foreach ($result['data'] as $rec) {
<?php /** * Includes all libaries related to plugin loading * * This source file is subject to the MIT license that is bundled * with this package in the file LICENSE.txt. * * @author Christoph Hochstrasser <*****@*****.**> * @copyright Copyright (c) 2010 Christoph Hochstrasser * @license MIT License */ autoload('Core\\Plugin\\Exception', __DIR__ . '/Plugin/Exception.php'); autoload('Core\\Plugin\\ExceptionStack', __DIR__ . '/Plugin/ExceptionStack.php'); autoload('Core\\Plugin\\Controller', __DIR__ . '/Plugin/Controller.php'); autoload('Core\\Plugin\\AbstractPlugin', __DIR__ . '/Plugin/AbstractPlugin.php'); require_once 'Plugin/Plugin.php'; require_once 'Plugin/Loader.php'; require_once 'Plugin/Environment.php'; require_once 'Plugin/StandardLoader.php';
<?php ini_set('display_errors', 'On'); require_once __DIR__ . '/../vendor/autoload.php'; function autoload($rootDir) { spl_autoload_register(function ($className) use($rootDir) { $file = sprintf('%s/%s.php', $rootDir, str_replace('\\', '/', $className)); if (file_exists($file)) { require $file; } }); } autoload('/usr/share/php'); autoload(__DIR__ . '/');
/** * 删除收货人信息 */ public function drop_consignee() { autoload('lib_transaction'); $consignee_id = intval($_GET['id']); if (model('Users')->drop_consignee($consignee_id)) { ecs_header("Location: " . url('flow/consignee_list') . "\n"); exit; } else { show_message(L('not_fount_consignee')); } }
function __autoload($class) { autoload("", $class); }
<?php $_SERVER['jemyrazem_start'] = microtime(true); $_SERVER['backend_start'] = microtime(true); include __DIR__ . '/library/backend/include/all.php'; allow_origin('webkameleon.com'); autoload([__DIR__ . '/class', __DIR__ . '/models', __DIR__ . '/controllers']); $config = json_config(__DIR__ . '/config/application.json'); $method = http_method(); if (in_array(strtolower(ini_get('magic_quotes_gpc')), array('1', 'on'))) { $_POST = array_map('stripslashes', $_POST); $_GET = array_map('stripslashes', $_GET); $_COOKIE = array_map('stripslashes', $_COOKIE); ini_set('magic_quotes_gpc', 0); } function myshutdown() { @Bootstrap::$main->closeConn(); } register_shutdown_function('myshutdown'); ini_set('display_errors', 1); $bootstrap = new Bootstrap($config); $result = $bootstrap->run(strtolower($method));
public static function autoload($class) { autoload($class); }
<?php ini_set('display_errors', true); $_REQUEST['_site'] = 'pudel.webkameleon.com'; include __DIR__ . '/../backend/include/all.php'; autoload([__DIR__ . '/../models', __DIR__ . '/../controllers']); $config = json_config(__DIR__ . '/../config/application.json'); $bootstrap = new Bootstrap($config); include __DIR__ . '/../backend/include/migrate.php'; $ver = null; if (isset($argv[1]) && $argv[1] > 0) { $ver = $argv[1]; } $ver = backend_migrate(__DIR__ . '/../config/application.json', __DIR__ . '/classes', $ver);
* Copyright (c) 2010 Johannes Mueller <circus2(at)web.de> * Copyright (c) 2012-2014 Toha <*****@*****.**> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ // show errors error_reporting(E_ALL); include 'util.php'; // enable autoloading of classes autoload(); use MwbExporter\Formatter\Propel1\Xml\Formatter; // formatter setup $setup = array(Formatter::CFG_USE_LOGGED_STORAGE => true, Formatter::CFG_INDENTATION => 4, Formatter::CFG_ADD_VENDOR => false, Formatter::CFG_NAMESPACE => 'Acme\\Namespace'); // lets do it export('propel1-xml', $setup);
* Pages Plugin * * Renders requested pages and handles the layout * * This source file is subject to the MIT license that is bundled * with this package in the file LICENSE.txt. * * @package Plugin * @subpackage Pages * @author Christoph Hochstrasser <*****@*****.**> * @copyright Copyright (c) 2010 Christoph Hochstrasser * @license MIT License */ namespace Plugin; autoload("Plugin\\Pages\\ErrorHandler", __DIR__ . "/library/ErrorHandler.php"); require_once "library/Pragma.php"; require_once "library/Page.php"; require_once "library/PageRoute.php"; use StdClass, Plugin\Pages\Page, Plugin\Pages\PageRoute, Plugin\Pages\ErrorHandler, Phly\Mustache\Mustache, Spark\Event, Spark\Util; /** * @todo Allow rendering of pages from within pages * @todo Implement Page::findAll properly */ class Pages extends \Core\Plugin\AbstractPlugin { /** * Inits the route for page rendering, registers a layout renderer and * provides fancy error pages * * @return void