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


PHP base::basePath方法代码示例

本文整理汇总了PHP中base::basePath方法的典型用法代码示例。如果您正苦于以下问题:PHP base::basePath方法的具体用法?PHP base::basePath怎么用?PHP base::basePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在base的用法示例。


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

示例1: __construct

 function __construct($url)
 {
     if (config::has('lepton.services.thumbalizer.apikey')) {
         $this->apikey = config::get('lepton.services.thumbalizer.apikey');
     }
     $this->cachedir = config::get('lepton.services.thumbalizer.cachedir', base::basePath() . 'cache');
     if (!file_exists($this->cachedir)) {
         throw new ConfigurationException("Thumbalizer cache directory not found, define with lepton.services.thumbalizer.cachedir");
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:10,代码来源:thumbalizer.php

示例2: __construct

 /**
  * Constructor, attempts to load the font from the paths defined in the
  * lepton.graphics.fontpaths key or the default locations.
  *
  * @param string $fontname The font name
  * @param int $fontsize The size
  */
 function __construct($fontname, $fontsize)
 {
     $fullname = null;
     $p = config::get('lepton.graphics.fontpaths', array('./', base::appPath() . '/fonts', base::appPath(), '/usr/share/fonts/truetype/', base::basePath()));
     foreach ($p as $fp) {
         $ff = file_find($fp, $fontname);
         if ($ff != null) {
             $fullname = $ff;
             break;
         }
     }
     if ($fullname) {
         $this->font = array('fontname' => $fullname, 'fontsize' => $fontsize, 'angle' => 0);
     } else {
         throw new GraphicsException("Font " . $fontname . " not found", GraphicsException::ERR_BAD_FONT);
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:24,代码来源:font.php

示例3: php

 public function php()
 {
     $info = array('php_uname()' => php_uname('a'), 'phpversion()' => phpversion(), 'php_sapi_name()' => php_sapi_name(), 'PHP_OS' => PHP_OS, 'DIRECTORY_SEPARATOR' => DIRECTORY_SEPARATOR, 'PATH_SEPARATOR' => PATH_SEPARATOR, 'PHP_SHLIB_SUFFIX' => PHP_SHLIB_SUFFIX, 'sys_get_temp_dir()' => sys_get_temp_dir(), 'Platform' => LEPTON_PLATFORM_ID);
     $comp = array('COMPAT_GETOPT_LONGOPTS' => PHP_VERSION >= "5.3" ? 'Supported' : 'Emulated (PHP >= 5.3)', 'COMPAT_SOCKET_BACKLOG' => PHP_VERSION >= "5.3.3" ? 'Supported' : 'Missing (PHP >= 5.3.3)', 'COMPAT_HOST_VALIDATION' => PHP_VERSION >= "5.2.13" ? 'Supported' : 'Emulated (PHP >= 5.2.13)', 'COMPAT_NAMESPACES' => PHP_VERSION >= "5.3.0" ? 'Supported' : 'Missing (PHP >= 5.3.0)', 'COMPAT_INPUT_BROKEN' => PHP_VERSION >= "5" && PHP_VERSION < "5.3.1" ? 'php://input possibly broken (PHP >= 5, PHP < 5.3.1)' : 'Functional', 'COMPAT_CALLSTATIC' => PHP_VERSION >= "5.3.0" ? 'Supported' : 'Missing (PHP >= 5.3.0)', 'COMPAT_CRYPT_BLOWFISH' => PHP_VERSION >= "5.3.0" ? 'Supported' : 'Missing (PHP >= 5.3.0)', 'COMPAT_PHP_FNMATCH' => PHP_OS == "Linux" || PHP_OS == "Windows" && PHP_VERSION >= "5.3" ? 'Native' : 'Emulated (WIN + PHP >= 5.3.0)');
     $opts = array('base::basePath()' => base::basePath(), 'base::appPath()' => base::appPath(), 'base::sysPath()' => base::sysPath(), 'TMP_PATH' => TMP_PATH);
     Console::writeLn(__astr("\\b{Lepton Overview:}"));
     foreach ($opts as $key => $val) {
         Console::writeLn("  %-25s : %s", $key, $val);
     }
     Console::writeLn();
     Console::writeLn(__astr("\\b{PHP Overview:}"));
     foreach ($info as $key => $val) {
         Console::writeLn("  %-25s : %s", $key, $val);
     }
     Console::writeLn();
     Console::writeLn(__astr("\\b{Compatibility layer overview:}"));
     foreach ($comp as $key => $val) {
         Console::writeLn("  %-25s : %s", $key, $val);
     }
     Console::writeLn();
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:21,代码来源:info.php

示例4: initCache

 function initCache()
 {
     Console::write("Initializing database ... ");
     $files = array();
     $base = base::basePath();
     $iter = new RecursiveDirectoryIterator($base);
     foreach (new RecursiveIteratorIterator($iter) as $p) {
         $rfp = str_replace($base, '', $p->getRealpath());
         if (strpos($rfp, '/.')) {
             $rfp = null;
         }
         if ($rfp) {
             $files[] = array('file' => $rfp, 'package' => null);
         }
     }
     $this->cache['special:files'] = $files;
     $this->cache['special:installed'] = array();
     $this->cache['special:available'] = array();
     console::write("(%d files, %d packages) ", count($this->cache['special:files']), count($this->cache['special:installed']));
     Console::writeLn("Done");
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:21,代码来源:l2package.php

示例5: getDebugInformation

 static function getDebugInformation()
 {
     if (self::isSecure()) {
         $ssl = 'Yes (' . $_SERVER['SSL_TLS_SNI'] . ')';
     } else {
         $ssl = 'No';
     }
     return join("\n", array("Request time: " . date(DATE_RFC822, $_SERVER['REQUEST_TIME']), "Base path: " . base::basePath(), "App path: " . base::appPath(), "Sys path: " . base::sysPath(), "User-agent: " . $_SERVER['HTTP_USER_AGENT'], "Request URI: " . $_SERVER['REQUEST_URI'], "Request method: " . $_SERVER['REQUEST_METHOD'], "Authenticated user: " . (user::isAuthenticated() ? user::getActiveUser()->uuid : 'n/a'), "Remote IP: " . $_SERVER['REMOTE_ADDR'] . " (" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . ")", "Hostname: " . $_SERVER['HTTP_HOST'], "Secure: " . $ssl, "Referrer: " . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'null'), sprintf("Running as: %s (uid=%d, gid=%d) with pid %d", get_current_user(), getmyuid(), getmygid(), getmypid()), sprintf("Server: %s", $_SERVER['SERVER_SOFTWARE']) . " (" . php_sapi_name() . ")", sprintf("Memory allocated: %0.3f KB (Total used: %0.3f KB)", memory_get_usage() / 1024 / 1024, memory_get_usage(true) / 1024 / 1024), "Platform: " . LEPTON_PLATFORM_ID, sprintf("Runtime: PHP v%d.%d.%d (%s)", PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_OS)));
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:9,代码来源:request.php

示例6: handleError

 static function handleError($errno, $errstr, $errfile, $errline, $errcontext = null)
 {
     $args = func_get_args();
     if (self::$__errorhandler) {
         return call_user_func_array(self::$__errorhandler, $args) == true;
     } else {
         // Chain PHPs error handling
         switch ($errno) {
             case E_STRICT:
                 logger::debug('Warning: %s:%d %s', str_replace(base::basePath(), '', $errfile), $errline, $errstr);
                 break;
             case E_DEPRECATED:
                 // Disable showing deprecation warnings for now
                 break;
                 logger::warning('Deprecated: %s:%d %s', str_replace(base::basePath(), '', $errfile), $errline, $errstr);
                 break;
             default:
                 logger::warning('%s:%d %s', str_replace(base::basePath(), '', $errfile), $errline, $errstr);
                 break;
         }
         return true;
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:23,代码来源:base.php

示例7: __callee

function __callee()
{
    $stack = debug_backtrace(false);
    $ret = sprintf('%s:%d', str_replace(base::basePath(), '', $stack[1]['file']), $stack[1]['line']);
    return $ret;
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:6,代码来源:utils.php

示例8: filefind

 /**
  * @description file_find() to locate file with globbing
  */
 function filefind()
 {
     $this->assertEquals(file_find(base::basePath(), 'defaults.php'), base::basePath() . 'sys/defaults.php');
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:base.php

示例9: initialize

 public function initialize($rootuser = null)
 {
     console::writeLn(__astr('\\b{Initializing database}'));
     $db = config::get('lepton.db.default');
     $dbc = config::get('lepton.db.default');
     console::writeLn("  Database:  %s", $dbc['database']);
     console::writeLn("  User:      %s", $dbc['username']);
     console::writeLn("  Host:      %s", $dbc['hostname']);
     switch ($db['driver']) {
         case 'pdo/mysql':
         case 'mysql':
             console::writeLn("  Driver:    MySQL");
             break;
         default:
             console::fatal('This version of the script does not support anything else than MySQL');
             exit(1);
     }
     console::writeLn(__astr("\n\\b{Creating database and user}"));
     console::writeLn("  The script can create the database and the user. Hit enter to skip this step.");
     console::write("  Password for root user: ");
     $pass = console::readPass();
     if ($pass) {
         $db['database'] = null;
         $db['username'] = 'root';
         $db['password'] = $pass;
         config::set('lepton.db.default', $db);
         $conn = new DatabaseConnection();
         $dblist = $conn->getRows("SHOW DATABASES LIKE %s", $dbc['database']);
         if (count($dblist) == 0) {
             console::writeLn("Creating database...");
             try {
                 $conn->exec(sprintf("CREATE DATABASE %s;", $dbc['database']));
             } catch (Exception $e) {
                 console::writeLn("Not successful, does the database already exist?");
             }
         }
         console::writeLn("Creating user...");
         $conn->exec(sprintf("GRANT ALL ON %s.* TO %s@localhost IDENTIFIED BY '%s';", $dbc['database'], $dbc['username'], $dbc['password']));
         $conn->exec("USE " . $dbc['database']);
     } else {
         console::writeLn("No password specified, ignoring database and user creation.");
         $conn = new DatabaseConnection();
     }
     console::writeLn(__astr("\n\\b{Importing tables}"));
     $f = glob(base::basePath() . '/dist/sql/*.sql');
     foreach ($f as $fn) {
         $fc = file_get_contents($fn);
         console::writeLn("  [sys] %s", basename($fn));
         $conn->exec($fc);
     }
     $f = glob(base::appPath() . '/sql/*.sql');
     foreach ($f as $fn) {
         $fc = file_get_contents($fn);
         console::writeLn("  [app] %s", basename($fn));
         $conn->exec($fc);
     }
     console::writeLn("All done.");
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:58,代码来源:database.php

示例10: addComponentView

 public function addComponentView($controller, $view = "base")
 {
     $basepath = base::basePath();
     $filepath = $basepath . "/app/views/{$controller}/{$view}.php";
     include $filepath;
 }
开发者ID:mustafakarali,项目名称:orchidframework,代码行数:6,代码来源:view.php


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