当前位置: 首页>>代码示例>>PHP>>正文


PHP require_once_dir函数代码示例

本文整理汇总了PHP中require_once_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP require_once_dir函数的具体用法?PHP require_once_dir怎么用?PHP require_once_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了require_once_dir函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: include_library

 private function include_library()
 {
     require_once Config::get('plugin_functions') . '/system.php';
     require_once_dir(Config::get('plugin_functions'));
     require_once_dir(Config::get('plugin_classes'));
     require_once_dir(Config::get('conf_dir'));
     if (file_exists(Config::get('ctrl_dir') . '/application_controller.class.php')) {
         require_once Config::get('ctrl_dir') . '/application_controller.class.php';
     }
     if (file_exists(Config::get('help_dir') . '/application.php')) {
         require_once Config::get('help_dir') . '/application.php';
     }
 }
开发者ID:utumdol,项目名称:codeseed,代码行数:13,代码来源:context.class.php

示例2: configure

/**
 * Configuration of the limonade framework. Automatically called by run()
 */
function configure()
{
    option('session', 'filez');
    // specific session name
    option('views_dir', option('root_dir') . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR);
    // Layout settings
    error_layout('layout' . DIRECTORY_SEPARATOR . 'error.html.php');
    layout('layout' . DIRECTORY_SEPARATOR . 'default.html.php');
    require_once_dir(option('lib_dir'));
    // error handling
    set_error_handler('fz_php_error_handler', E_ALL ^ E_NOTICE);
    // Log every error
    set_exception_handler('fz_exception_handler');
    // also handle uncatched excpeptions
}
开发者ID:romnvll,项目名称:FileZ,代码行数:18,代码来源:index.php

示例3: run

/**
 * Running application
 *
 * @param string $env
 * @return void
 */
function run($env = null)
{
    if (is_null($env)) {
        $env = env();
    }
    # 0. Set default configuration
    $root_dir = dirname(app_file());
    $base_path = dirname(file_path($env['SERVER']['SCRIPT_NAME']));
    $base_file = basename($env['SERVER']['SCRIPT_NAME']);
    $base_uri = file_path($base_path, $base_file == 'index.php' ? '?' : $base_file . '?');
    $lim_dir = dirname(__FILE__);
    option('root_dir', $root_dir);
    option('base_path', $base_path);
    option('base_uri', $base_uri);
    // set it manually if you use url_rewriting
    option('limonade_dir', file_path($lim_dir));
    option('limonade_views_dir', file_path($lim_dir, 'limonade', 'views'));
    option('limonade_public_dir', file_path($lim_dir, 'limonade', 'public'));
    option('public_dir', file_path($root_dir, 'public'));
    option('views_dir', file_path($root_dir, 'views'));
    option('controllers_dir', file_path($root_dir, 'controllers'));
    option('lib_dir', file_path($root_dir, 'lib'));
    option('error_views_dir', option('limonade_views_dir'));
    option('env', ENV_PRODUCTION);
    option('debug', true);
    option('session', LIM_SESSION_NAME);
    // true, false or the name of your session
    option('encoding', 'utf-8');
    option('x-sendfile', 0);
    // 0: disabled,
    // X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
    // X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5
    # 1. Set error handling
    ini_set('display_errors', 1);
    set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);
    # 2. Set user configuration
    call_if_exists('configure');
    # 3. Loading libs
    require_once_dir(option('lib_dir'));
    # 4. Starting session
    if (!defined('SID') && option('session')) {
        if (!is_bool(option('session'))) {
            session_name(option('session'));
        }
        if (!session_start()) {
            trigger_error("An error occured while trying to start the session", E_USER_WARNING);
        }
    }
    # 5. Set some default methods if needed
    if (!function_exists('after')) {
        function after($output)
        {
            return $output;
        }
    }
    if (!function_exists('route_missing')) {
        function route_missing($request_method, $request_uri)
        {
            halt(NOT_FOUND, "({$request_method}) {$request_uri}");
        }
    }
    # 6. Check request
    if ($rm = request_method()) {
        if (request_is_head()) {
            ob_start();
        }
        // then no output
        if (!request_method_is_allowed($rm)) {
            halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
        }
        # 6.1 Check matching route
        if ($route = route_find($rm, request_uri())) {
            params($route['params']);
            # 6.2 Load controllers dir
            require_once_dir(option('controllers_dir'));
            if (is_callable($route['function'])) {
                # 6.3 Call before function
                call_if_exists('before');
                # 6.4 Call matching controller function and output result
                if ($output = call_user_func($route['function'])) {
                    echo after(error_notices_render() . $output);
                }
                stop_and_exit();
            } else {
                halt(SERVER_ERROR, "Routing error: undefined function '{$route['function']}'", $route);
            }
        } else {
            route_missing($rm, request_uri());
        }
    } else {
        halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
    }
}
开发者ID:plus3network,项目名称:PHPHelpers,代码行数:99,代码来源:limonade.php

示例4: autoload_controller

 function autoload_controller($callback)
 {
     require_once_dir(option('controllers_dir'));
 }
开发者ID:soitun,项目名称:CRMx,代码行数:4,代码来源:limonade.php

示例5: require_once_dir

<?php

require_once_dir(dirname(__FILE__) . '/lemon_tree');
开发者ID:sofadesign,项目名称:vincent-helye.com,代码行数:3,代码来源:lemon_tree.php

示例6: dirname

<?php

// include system init
require_once dirname(__FILE__) . '/../config/init.php';
// include all migration files
require_once_dir(Config::get('migr_dir'));
// init default tables
require_once dirname(__FILE__) . '/install.php';
// init
$INTEND_VERSION = isset($argv[1]) ? $argv[1] : '99991231235959';
// functions
function print_migration_status($direction, $classname, $version)
{
    echonl('================================================================================');
    echonl($classname . '.' . strtolower($direction) . '() is executed.');
    echonl('Schema version is ' . $version . ' now.');
}
// connect db connection
$db = Context::get('db');
$db->connect();
$schema_version = new SchemaVersion();
if ($schema_version->count() == 0) {
    $schema_version->version = 0;
    $schema_version->save();
}
$schema_version = $schema_version->find();
// read migration files...
$files = get_files(Config::get('migr_dir'));
if ($INTEND_VERSION >= $schema_version->version) {
    sort($files);
    $direction = 'UP';
开发者ID:utumdol,项目名称:codeseed,代码行数:31,代码来源:migrate.php

示例7: run

/**
 * Running application
 *
 * @param string $env 
 * @return void
 */
function run($env = null)
{
    if (is_null($env)) {
        $env = env();
    }
    # 0. Set default configuration
    $root_dir = dirname(app_file());
    option('root_dir', $root_dir);
    option('limonade_dir', dirname(__FILE__) . '/');
    option('public_dir', $root_dir . '/public/');
    option('views_dir', $root_dir . '/views/');
    option('controllers_dir', $root_dir . '/controllers/');
    option('lib_dir', $root_dir . '/lib/');
    option('env', ENV_PRODUCTION);
    option('debug', true);
    option('encoding', 'utf-8');
    option('x-sendfile', 0);
    // 0: disabled,
    // X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
    // X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5
    # 1. Set error handling
    ini_set('display_errors', 1);
    set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);
    # 2. Loading libs
    require_once_dir(option('lib_dir'));
    # 3. Set some default methods if needed
    if (!function_exists('after')) {
        function after($output)
        {
            return $output;
        }
    }
    if (!function_exists('route_missing')) {
        function route_missing($request_method, $request_uri)
        {
            halt(NOT_FOUND, "({$request_method}) {$request_uri}");
        }
    }
    # 4. Set user configuration
    call_if_exists('configure');
    # 5. Check request
    if ($rm = request_method()) {
        # 5.1 Check matching route
        if ($route = route_find($rm, request_uri())) {
            params($route['params']);
            # 5.2 Load controllers dir
            require_once_dir(option('controllers_dir'));
            if (function_exists($route['function'])) {
                # 5.3 Call before function
                call_if_exists('before');
                # 5.4 Call matching controller function and output result
                if ($output = call_user_func($route['function'])) {
                    if (option('debug') && option('env') > ENV_PRODUCTION) {
                        $notices = error_notice();
                        if (!empty($notices)) {
                            foreach ($notices as $notice) {
                                echo $notice;
                            }
                            echo '<hr>';
                        }
                    }
                    echo after($output);
                }
                exit;
            } else {
                halt(SERVER_ERROR, "Routing error: undefined function '{$route['function']}'", $route);
            }
        } else {
            route_missing($rm, request_uri());
        }
    } else {
        halt(SERVER_ERROR, "Unknown request method <code>{$rm}</code>");
    }
}
开发者ID:sofadesign,项目名称:library.dev,代码行数:80,代码来源:limonade.php

示例8: test_main_require_once_dir

   function test_main_require_once_dir()
   {
     $root = dirname(dirname(__FILE__));
     
     ob_start();
     assert_empty(require_once_dir($root));
     $files = require_once_dir($root, "AUTHORS");
     assert_empty(ob_get_contents());
     ob_clean();
     
     assert_length_of($files, 1);
     assert_match('/AUTHORS$/', $files[0]);
     
     ob_start();
     $files = require_once_dir($root, "CHANGES", false);
     assert_not_empty(ob_get_contents());
     ob_clean();
    
     $lib = $root.'/lib';
     // pb because it loads abstract.php that conflict with tests that use abstracts
     // $limonade = $lib.'/limonade';
     // 
     // $files = require_once_dir($limonade);
     // assert_not_empty($files);
     
     $tests_lib = $root.'/tests/data/lib0';
     $libs = array('a', 'b', 'c');
     foreach($libs as $lib) assert_false(defined('TEST_LIB_'.strtoupper($lib)));

     $files = require_once_dir($tests_lib);
     assert_not_empty($files);
     assert_length_of($files, 3);
     
     foreach($libs as $lib) assert_true(defined('TEST_LIB_'.strtoupper($lib)));
     
     assert_empty(require_once_dir($root.'/tests/data/'));
     assert_true(is_array(require_once_dir($root.'/tests/data/')));
     
     assert_empty(require_once_dir($root.'/tests/data/unknown_dir'));
     assert_true(is_array(require_once_dir($root.'/tests/data/unknown_dir')));
   }
开发者ID:reith2004,项目名称:limonade,代码行数:41,代码来源:main.php

示例9: test_main_require_once_dir

function test_main_require_once_dir()
{
    $root = dirname(dirname(__FILE__));
    ob_start();
    assert_empty(require_once_dir($root));
    $files = require_once_dir($root, "AUTHORS");
    ob_clean();
    assert_length_of($files, 1);
    assert_match('/AUTHORS$/', $files[0]);
    $lib = $root . '/lib';
    $limonade = $lib . '/limonade';
    $files = require_once_dir($limonade);
    assert_not_empty($files);
    $tests_lib = $root . '/tests/data/lib0';
    $libs = array('a', 'b', 'c');
    foreach ($libs as $lib) {
        assert_false(defined('TEST_LIB_' . strtoupper($lib)));
    }
    $files = require_once_dir($tests_lib);
    assert_not_empty($files);
    assert_length_of($files, 3);
    foreach ($libs as $lib) {
        assert_true(defined('TEST_LIB_' . strtoupper($lib)));
    }
    assert_empty(require_once_dir($root . '/tests/data/'));
    assert_true(is_array(require_once_dir($root . '/tests/data/')));
    assert_empty(require_once_dir($root . '/tests/data/unknown_dir'));
    assert_true(is_array(require_once_dir($root . '/tests/data/unknown_dir')));
}
开发者ID:sniemela,项目名称:limonade,代码行数:29,代码来源:main.php

示例10: run

/**
 * Running application
 *
 * @param string $env 
 * @return void
 */
function run($env = null)
{
    if (is_null($env)) {
        $env = env();
    }
    # 0. Set default configuration
    $root_dir = dirname(app_file());
    option('root_dir', $root_dir);
    option('limonade_dir', dirname(__FILE__) . '/');
    option('limonade_views_dir', dirname(__FILE__) . '/limonade/views/');
    option('limonade_public_dir', dirname(__FILE__) . '/limonade/public/');
    option('public_dir', $root_dir . '/public/');
    option('views_dir', $root_dir . '/views/');
    option('controllers_dir', $root_dir . '/controllers/');
    option('lib_dir', $root_dir . '/lib/');
    option('env', ENV_PRODUCTION);
    option('debug', true);
    option('session', LIM_SESSION_NAME);
    // true, false or the name of your session
    option('encoding', 'utf-8');
    option('x-sendfile', 0);
    // 0: disabled,
    // X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
    // X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5
    # 1. Set error handling
    ini_set('display_errors', 1);
    set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);
    # 2. Set user configuration
    call_if_exists('configure');
    # 3. Loading libs
    require_once_dir(option('lib_dir'));
    # 4. Starting session
    if (!defined('SID') && option('session')) {
        if (!is_bool(option('session'))) {
            session_name(option('session'));
        }
        if (!session_start()) {
            trigger_error("An error occured while trying to start the session", E_USER_WARNING);
        }
    }
    # 5. Set some default methods if needed
    if (!function_exists('after')) {
        function after($output)
        {
            return $output;
        }
    }
    if (!function_exists('route_missing')) {
        function route_missing($request_method, $request_uri)
        {
            halt(NOT_FOUND, "({$request_method}) {$request_uri}");
        }
    }
    # 6. Set default routes used for default views
    dispatch(array("/_lim_css/*.css", array('_lim_css_filename')), 'render_limonade_css');
    /**
     * Internal controller that responds to route /_lim_css/*.css
     *
     * @access private
     * @return string
     */
    function render_limonade_css()
    {
        option('views_dir', file_path(option('limonade_public_dir'), 'css'));
        $fpath = file_path(params('_lim_css_filename') . ".css");
        return css($fpath);
    }
    dispatch(array("/_lim_public/**", array('_lim_public_file')), 'render_limonade_file');
    /**
     * Internal controller that responds to route /_lim_public/**
     *
     * @access private
     * @return void
     */
    function render_limonade_file()
    {
        $fpath = file_path(option('limonade_public_dir'), params('_lim_public_file'));
        return render_file($fpath, true);
    }
    # 7. Check request
    if ($rm = request_method()) {
        if (!request_method_is_allowed($rm)) {
            halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
        }
        # 5.1 Check matching route
        if ($route = route_find($rm, request_uri())) {
            params($route['params']);
            # 5.2 Load controllers dir
            require_once_dir(option('controllers_dir'));
            if (function_exists($route['function'])) {
                # 5.3 Call before function
                call_if_exists('before');
                # 5.4 Call matching controller function and output result
                if ($output = call_user_func($route['function'])) {
//.........这里部分代码省略.........
开发者ID:sofadesign,项目名称:fizzy,代码行数:101,代码来源:limonade.php


注:本文中的require_once_dir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。