本文整理汇总了PHP中rex_path::base方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_path::base方法的具体用法?PHP rex_path::base怎么用?PHP rex_path::base使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_path
的用法示例。
在下文中一共展示了rex_path::base方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
* @param string $file
* @param int $line
*
* @throws InvalidArgumentException
*/
public function log($level, $message, array $context = [], $file = null, $line = null)
{
if (static::hasFactoryClass()) {
static::callFactoryClass(__FUNCTION__, func_get_args());
return;
}
if (!is_string($message)) {
throw new InvalidArgumentException('Expecting $message to be string, but ' . gettype($message) . ' given!');
}
self::open();
// build a replacement array with braces around the context keys
$replace = [];
foreach ($context as $key => $val) {
$replace['{' . $key . '}'] = $val;
}
// interpolate replacement values into the message and return
$message = strtr($message, $replace);
$logData = [$level, $message];
if ($file && $line) {
$logData[] = str_replace(rex_path::base(), '', $file);
$logData[] = $line;
}
self::$file->add($logData);
// forward the error into phps' error log
error_log($message, 0);
}
示例2: foreach
echo $fragment->parse('core/page/section.php');
}
// ---------------------------------- Step 3 . Perms, Environment
$error_array = [];
$success_array = [];
$errors = rex_setup::checkEnvironment();
if (count($errors) > 0) {
foreach ($errors as $error) {
$error_array[] = rex_view::error($error);
}
} else {
$success_array[] = rex_i18n::msg('setup_308');
}
$res = rex_setup::checkFilesystem();
if (count($res) > 0) {
$base = rex_path::base();
foreach ($res as $key => $messages) {
if (count($messages) > 0) {
$li = [];
foreach ($messages as $message) {
$li[] = '<li>' . str_replace($base, '', $message) . '</li>';
}
$error_array[] = '<p>' . rex_i18n::msg($key) . '</p><ul>' . implode('', $li) . '</ul>';
}
}
} else {
$success_array[] = rex_i18n::msg('setup_309');
}
if ($step > 2 && count($error_array) > 0) {
$step = 3;
}
示例3: shouldIgnore
private function shouldIgnore($path)
{
static $ignore;
if (null === $ignore) {
$ignore = file(rex_path::base('.gitignore'), FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$ignore = array_filter($ignore, function ($path) {
return '#' !== $path[0];
});
$ignore = array_merge($ignore, ['/redaxo/src/addons/be_style/vendor/bootstrap/lib/', '/redaxo/src/addons/be_style/vendor/bootstrap/tasks/', '/redaxo/src/addons/be_style/vendor/bootstrap/templates/', '/redaxo/src/addons/be_style/vendor/bootstrap/test/', '/redaxo/src/addons/be_style/vendor/bootstrap-select/js/', '/redaxo/src/addons/be_style/vendor/bootstrap-select/less/', '/redaxo/src/addons/be_style/vendor/font-awesome/css/', '/redaxo/src/addons/be_style/vendor/font-awesome/less/', '/redaxo/src/addons/be_style/vendor/font-awesome/src/', '/redaxo/src/addons/be_style/vendor/scssphp/tests/']);
}
$subpath = substr($path, strlen(rex_path::base()) - 1);
foreach ($ignore as $pattern) {
if (0 === strpos($subpath, $pattern)) {
return true;
}
}
return false;
}
示例4: _addDirectory
/**
* @param string $dir
*/
private static function _addDirectory($dir)
{
$dirPath = rex_path::base($dir);
if (!is_dir($dirPath)) {
return;
}
if (!isset(self::$dirs[$dir])) {
self::$dirs[$dir] = [];
}
$files = self::$dirs[$dir];
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirPath, RecursiveDirectoryIterator::SKIP_DOTS));
foreach ($iterator as $path => $file) {
/** @var SplFileInfo $file */
if (!$file->isFile() || !in_array($file->getExtension(), ['php', 'inc'])) {
continue;
}
$file = self::normalizePath($path);
unset($files[$file]);
$checksum = md5_file($path);
if (isset(self::$dirs[$dir][$file]) && self::$dirs[$dir][$file] === $checksum) {
continue;
}
self::$dirs[$dir][$file] = $checksum;
self::$cacheChanged = true;
$classes = self::findClasses($path);
foreach ($classes as $class) {
$class = strtolower($class);
if (!isset(self::$classes[$class])) {
self::$classes[$class] = $file;
}
}
}
foreach ($files as $file) {
unset(self::$dirs[$file]);
self::$cacheChanged = true;
}
}
示例5: init
/**
* Initializes the class.
*
* @param string $htdocs Htdocs path
* @param string $backend Backend folder name
*/
public static function init($htdocs, $backend)
{
self::$base = realpath($htdocs) . '/';
self::$backend = $backend;
}
示例6: printDefectTrace
protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect)
{
$stacktrace = PHPUnit_Util_Filter::getFilteredStacktrace($defect->thrownException());
$stacktrace = str_replace([$this->backtrace, rex_path::base()], '', $stacktrace);
$this->write($defect->getExceptionAsString() . "\n" . $stacktrace);
}