本文整理汇总了PHP中Dir::normalize方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::normalize方法的具体用法?PHP Dir::normalize怎么用?PHP Dir::normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dir
的用法示例。
在下文中一共展示了Dir::normalize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compileDir
public static function compileDir($dir, $destFile)
{
$dh = opendir($dir);
if (!$dh) {
throw new Exception('Unknown dir: ' . $dir);
}
while ($file = readdir($dh)) {
if ($file[0] == '.') {
continue;
}
$absfile = Dir::normalize($dir) . $file;
if (is_file($absfile) && File::getExtension($file) == 'js') {
File::append($destFile, "//FILE: {$file}" . chr(10));
if (filesize($absfile) > 200000) {
File::append($destFile, file_get_contents($absfile));
} else {
File::append($destFile, self::minify($absfile));
}
File::append($destFile, chr(10) . chr(10));
} else {
if (is_dir($absfile)) {
self::compileDir($absfile, $destFile);
}
}
}
closedir($dh);
}
示例2: define
require_once 'lib/Controller.php';
require_once 'lib/controller/PimpleController.php';
//Handlers
require_once 'lib/handlers/MessageHandler.php';
require_once 'lib/handlers/SessionHandler.php';
require_once 'lib/handlers/AccessHandler.php';
//Main class
require_once 'lib/Pimple.php';
require_once 'lib/TagLib.php';
require_once 'lib/taglib/CoreTagLib.php';
require_once 'lib/taglib/ValueTagLib.php';
require_once 'lib/taglib/BasicTagLib.php';
require_once 'lib/taglib/FormTagLib.php';
require_once 'lib/taglib/WidgetTagLib.php';
require_once 'lib/taglib/JavascriptTagLib.php';
require_once 'lib/taglib/UserTagLib.php';
require_once 'lib/taglib/JSTemplateTagLib.php';
//Add pimple lib to include path
IncludePath::instance()->addPath(Pimple::instance()->getBaseDir() . '/lib');
//Add pimple ressources lib to include path
IncludePath::instance()->addPath(Pimple::instance()->getRessource('lib/'), 1);
define('CACHEDIR', Dir::normalize(BASEDIR) . 'cache');
Dir::ensure(CACHEDIR);
Pimple::instance()->registerTagLib('c', new CoreTagLib());
Pimple::instance()->registerTagLib('val', new ValueTagLib());
Pimple::instance()->registerTagLib('p', new BasicTagLib());
Pimple::instance()->registerTagLib('user', new UserTagLib());
Pimple::instance()->registerTagLib('f', new FormTagLib());
Pimple::instance()->registerTagLib('w', new WidgetTagLib());
Pimple::instance()->registerTagLib('js', new JavascriptTagLib());
Pimple::instance()->registerTagLib('jst', new JSTemplateTagLib());
示例3: getSiteDir
public static function getSiteDir()
{
return Dir::normalize(BASEDIR);
}
示例4: tagJavascript
/**
* Outputs script tag
* @param string path | if specified - outputs an include js script - else outputs a script tag with body
* @container both
* @deprecated
* @See JavascriptTagLib
*/
protected function tagJavascript($attrs)
{
if ($this->body()) {
return sprintf('<script type="text/javascript">%s</script>', $this->body());
} else {
return sprintf('<script type="text/javascript" src="%s"></script>', Dir::normalize(BASEURL) . $attrs->path);
}
}
示例5: basePath
public static function basePath()
{
$host = $_SERVER['HTTP_HOST'];
if (isset($_SERVER['HTTPS'])) {
$p = 'https';
} else {
$p = 'http';
}
return "{$p}://{$host}" . Dir::normalize(BASEURL);
}