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


PHP lmb_env_get函数代码示例

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


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

示例1: getConf

 function getConf($name)
 {
     $name = $this->_normalizeConfName($name);
     if (isset($this->confs[$name])) {
         return $this->confs[$name];
     }
     $ext = substr($name, strpos($name, '.'));
     if ($ext == '.ini') {
         $file = $this->_locateConfFiles($name);
         if (lmb_env_has('LIMB_VAR_DIR')) {
             $this->confs[$name] = new lmbCachedIni($file, lmb_env_get('LIMB_VAR_DIR') . '/ini/');
         } else {
             $this->confs[$name] = new lmbIni($file);
         }
     } elseif ($ext == '.yml') {
         $file = $this->_locateConfFiles($name);
         $this->confs[$name] = $this->parseYamlFile(lmbFs::normalizePath($file));
     } elseif ($ext == '.conf.php') {
         $file = $this->_locateConfFiles($name);
         if (!count($file)) {
             throw new lmbFileNotFoundException($name);
         }
         $this->confs[$name] = new lmbConf(lmbFs::normalizePath($file));
     } else {
         throw new lmbException("'{$ext}' type configuration is not supported!");
     }
     return $this->confs[$name];
 }
开发者ID:knevcher,项目名称:limb,代码行数:28,代码来源:lmbConfTools.class.php

示例2: getRootDir

 function getRootDir()
 {
     if (!($root_dir = lmb_env_get('LIMB_DOCUMENT_ROOT', false))) {
         throw new lmbMacroException('Not set require env LIMB_DOCUMENT_ROOT!');
     }
     return $root_dir;
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:7,代码来源:file_version.tag.php

示例3: testRequirePackageClass

    function testRequirePackageClass()
    {
        $package_name = 'require_package_source';
        $package_source_dir = lmb_env_get('LIMB_PACKAGES_DIR') . '/' . $package_name . '/src/';
        $package_class = 'SourceFileForTests';
        $this->createPackageMainFile($package_name, lmb_env_get('LIMB_PACKAGES_DIR'));
        if (!file_exists($package_source_dir)) {
            mkdir($package_source_dir);
        }
        $source_file_content = <<<EOD
<?php
class {$package_class} {
  static function increase() {
    lmbPackagesFunctionsTest::\$counter++;
  }
}
EOD;
        file_put_contents($package_source_dir . '/' . $package_class . '.class.php', $source_file_content);
        $this->assertIdentical(0, lmbPackagesFunctionsTest::$counter);
        lmb_package_require($package_name);
        $this->assertIdentical(1, lmbPackagesFunctionsTest::$counter);
        lmb_require_package_class($package_name, 'SourceFileForTests');
        call_user_func(array($package_class, 'increase'));
        $this->assertIdentical(2, lmbPackagesFunctionsTest::$counter);
    }
开发者ID:knevcher,项目名称:limb,代码行数:25,代码来源:lmbPackagesTest.class.php

示例4: createLocaleObject

 function createLocaleObject($locale)
 {
     $file = $this->toolkit->findFileByAlias($locale . '.ini', lmb_env_get('LIMB_LOCALE_INCLUDE_PATH'), 'i18n_locale');
     if (lmb_env_has('LIMB_VAR_DIR')) {
         return new lmbLocale($locale, new lmbCachedIni($file, lmb_env_get('LIMB_VAR_DIR') . '/locale/'));
     } else {
         return new lmbLocale($locale, new lmbIni($file));
     }
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:9,代码来源:lmbI18NTools.class.php

示例5: __construct

 function __construct()
 {
     parent::__construct();
     $items = explode(';', lmb_env_get('LIMB_SUPPORTED_VIEW_TYPES'));
     foreach ($items as $item) {
         list($ext, $class) = explode('=', $item);
         $this->view_types[$ext] = $class;
     }
 }
开发者ID:knevcher,项目名称:korchasa_limb,代码行数:9,代码来源:lmbViewTools.class.php

示例6: getLogDSNes

 function getLogDSNes()
 {
     $default_dsn = 'file://' . lmbFs::normalizePath(lmb_env_get('LIMB_VAR_DIR') . '/log/error.log');
     if (!$this->toolkit->hasConf('common')) {
         return array($default_dsn);
     }
     $conf = $this->toolkit->getConf('common');
     if (!isset($conf['logs'])) {
         return array($default_dsn);
     }
     return $conf['logs'];
 }
开发者ID:knevcher,项目名称:limb,代码行数:12,代码来源:lmbLogTools.class.php

示例7: lmb_package_require

/**
 * @package core
 * @version $Id$
 */
function lmb_package_require($name, $packages_dir = '')
{
    if (!$packages_dir) {
        $packages_dir = lmb_env_get('LIMB_PACKAGES_DIR');
    }
    $main_file_path = $packages_dir . $name . '/common.inc.php';
    try {
        lmb_require($packages_dir . $name . '/common.inc.php');
    } catch (lmbPHPFileNotFoundException $e) {
        lmb_require('limb/core/src/exception/lmbNoSuchPackageException.class.php');
        throw new lmbNoSuchPackageException("Package '{$name}' not found", array('name' => $name, 'dir' => $packages_dir, 'main_file' => $main_file_path));
    }
}
开发者ID:knevcher,项目名称:korchasa_limb,代码行数:17,代码来源:package.inc.php

示例8: __construct

 function __construct($config = array())
 {
     $conf = lmbToolkit::instance()->getConf('mail');
     $this->use_phpmail = $conf['use_phpmail'];
     $this->smtp_host = $conf['smtp_host'];
     $this->smtp_port = $conf['smtp_port'];
     $this->smtp_auth = $conf['smtp_auth'];
     $this->smtp_user = $conf['smtp_user'];
     $this->smtp_password = $conf['smtp_password'];
     $this->setConfig($config);
     $php_mailer_version = lmb_env_get('PHPMAILER_VERSION_NAME', 'phpmailer-5.1');
     include_once 'limb/mail/lib/' . $php_mailer_version . '/class.phpmailer.php';
 }
开发者ID:r-kitaev,项目名称:limb,代码行数:13,代码来源:lmbMailer.class.php

示例9: testGetFilesLocator_CacheConditions

 function testGetFilesLocator_CacheConditions()
 {
     $old_mode = lmb_env_get('LIMB_APP_MODE');
     $old_var_dir = lmb_env_get('LIMB_VAR_DIR');
     lmb_env_set('LIMB_APP_MODE', 'devel');
     lmb_env_remove('LIMB_VAR_DIR');
     $this->assertIsA($this->tools->getFileLocator('foo', 'locator1'), 'lmbFileLocator');
     lmb_env_set('LIMB_VAR_DIR', $old_var_dir);
     $this->assertIsA($this->tools->getFileLocator('foo', 'locator2'), 'lmbFileLocator');
     lmb_env_set('LIMB_APP_MODE', 'production');
     $this->assertIsA($this->tools->getFileLocator('foo', 'locator3'), 'lmbCachingFileLocator');
     lmb_env_set('LIMB_APP_MODE', $old_mode);
 }
开发者ID:anykey84,项目名称:YaBackup,代码行数:13,代码来源:lmbFsToolsTest.class.php

示例10: testDispatchWithOffset

 function testDispatchWithOffset()
 {
     $old_offset = lmb_env_get('LIMB_HTTP_OFFSET_PATH');
     $config_array = array(array('path' => ':controller/:action'));
     $routes = new lmbRoutes($config_array);
     $this->toolkit->setRoutes($routes);
     $dispatcher = new lmbRoutesRequestDispatcher();
     lmb_env_set('LIMB_HTTP_OFFSET_PATH', 'app');
     $this->request->getUri()->reset('http://example.com/app/news/admin_display');
     $result = $dispatcher->dispatch($this->request);
     $this->assertEqual($result['controller'], 'news');
     $this->assertEqual($result['action'], 'admin_display');
     lmb_env_set('LIMB_HTTP_OFFSET_PATH', $old_offset);
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:14,代码来源:lmbRoutesRequestDispatcherTest.class.php

示例11: testOnceRender

 function testOnceRender()
 {
     $root = lmb_env_get('LIMB_VAR_DIR') . '/www/';
     lmb_env_set('LIMB_DOCUMENT_ROOT', $root);
     lmbFs::safeWrite($root . 'style/main.css', 'body {background-url: url("../images/one.jpg");}');
     lmbFs::safeWrite($root . 'images/one.jpg', 'simple content');
     $template = '{{css_compiled src="style/main.css" dir="media/css" /}}';
     $page = $this->_createMacroTemplate($template, 'tpl.html');
     $content = $page->render();
     $src = $this->toolkit->addVersionToUrl('media/css/style-main.css');
     $this->assertEqual('<link rel="stylesheet" type="text/css" href="' . $src . '" />', $content);
     $compiled_file = $root . 'media/css/style-main.css';
     $src = $this->toolkit->addVersionToUrl('images/one.jpg');
     $this->assertEqual('body {background-url: url(' . $src . ');}', file_get_contents($compiled_file));
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:15,代码来源:lmbCssCompiledTagTest.class.php

示例12: getTmpDir

 static function getTmpDir()
 {
     if (lmb_env_has('LIMB_VAR_DIR')) {
         return lmb_env_get('LIMB_VAR_DIR');
     }
     if ($path = session_save_path()) {
         if (($pos = strpos($path, ';')) !== false) {
             $path = substr($path, $pos + 1);
         }
         return $path;
     }
     if ($tmp = getenv('TMP') || ($tmp = getenv('TEMP') || ($tmp = getenv('TMPDIR')))) {
         return $tmp;
     }
     //gracefull falback?
     return '/tmp';
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:17,代码来源:lmbFs.class.php

示例13: testGzipStatic

 function testGzipStatic()
 {
     if (!function_exists('gzencode')) {
         return print "Skip: function gzencode not exists.\n";
     }
     lmb_env_set('LIMB_DOCUMENT_ROOT', lmb_env_get('LIMB_VAR_DIR') . '/www/');
     lmbFs::safeWrite(lmb_env_get('LIMB_VAR_DIR') . '/www/one.js', 'var window = {};');
     $doc_root = lmb_env_get('LIMB_DOCUMENT_ROOT');
     $template = '{{file:version src="one.js" gzip_static_dir="media/var/gz" gzip_level="9" }}';
     $page = $this->_createMacroTemplate($template, 'tpl.html');
     $content = $page->render();
     $file = 'media/var/gz/one.js';
     $this->assertEqual($content, $this->toolkit->addVersionToUrl($file, false));
     $this->assertEqual('var window = {};', file_get_contents($doc_root . $file));
     $gz_file = $doc_root . $file . '.gz';
     $this->assertTrue(file_exists($gz_file));
     $this->assertEqual(gzencode('var window = {};', 9, FORCE_DEFLATE), file_get_contents($gz_file));
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:18,代码来源:lmbFileVersionMacroTagTest.class.php

示例14: lmb_tests_init_db_dsn

function lmb_tests_init_db_dsn()
{
    lmb_env_set('LIMB_CACHE_DB_META_IN_FILE', false);
    if (lmbToolkit::instance()->isDefaultDbDSNAvailable()) {
        $dsn = lmbToolkit::instance()->getDefaultDbDSN();
        static $reported_about;
        if (is_null($reported_about) || $reported_about != $dsn) {
            $pass = $dsn->_getUri()->getPassword();
            $masked_dsn = str_replace($pass, str_pad('*', strlen($pass), '*'), $dsn->toString());
            echo "INFO: Using database '{$masked_dsn}'\n";
            $reported_about = $dsn;
        }
    } else {
        $default_value = 'sqlite://localhost/' . lmb_var_dir() . '/sqlite_tests.db';
        $dsn = lmb_env_get('LIMB_TEST_DB_DSN', $default_value);
        lmbToolkit::instance()->setDefaultDbDSN($dsn);
        echo "INFO: Using default test database '{$dsn}'\n";
    }
}
开发者ID:snowjobgit,项目名称:limb,代码行数:19,代码来源:init.inc.php

示例15: testNotFoundFile

 function testNotFoundFile()
 {
     lmb_env_set('LIMB_DOCUMENT_ROOT', lmb_env_get('LIMB_VAR_DIR'));
     $template = '{{js:require_once src="js/main.js" }}';
     $page = $this->_createMacroTemplate($template, 'tpl.html');
     try {
         $page->render();
         $this->assertTrue(false);
     } catch (lmbException $e) {
         $this->assertTrue(true);
     }
     $template = '{{js:require_once src="js/main.js" safe="true" }}';
     $page = $this->_createMacroTemplate($template, 'tpl.html');
     try {
         $page->render();
         $this->assertTrue(true);
     } catch (lmbException $e) {
         $this->assertTrue(false);
     }
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:20,代码来源:lmbJsRequireOnceMacroTagTest.class.php


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