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


PHP rex_path::base方法代码示例

本文整理汇总了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);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:37,代码来源:logger.php

示例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;
}
开发者ID:alsahh,项目名称:redaxo,代码行数:31,代码来源:setup.php

示例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;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:18,代码来源:release.php

示例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;
     }
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:40,代码来源:autoload.php

示例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;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:11,代码来源:path.php

示例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);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:6,代码来源:tests_result_printer.php


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