本文整理汇总了PHP中CM_Util::rglob方法的典型用法代码示例。如果您正苦于以下问题:PHP CM_Util::rglob方法的具体用法?PHP CM_Util::rglob怎么用?PHP CM_Util::rglob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CM_Util
的用法示例。
在下文中一共展示了CM_Util::rglob方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param CM_Frontend_Render $render
* @param string $className
* @throws CM_Exception
*/
public function __construct(CM_Frontend_Render $render, $className)
{
parent::__construct($render);
if (!preg_match('#^([^_]+)_([^_]+)_?(.*)$#', $className, $matches)) {
throw new CM_Exception('Cannot detect all className parts from view\'s className', null, ['className' => $className]);
}
list($className, $namespace, $viewType, $viewName) = $matches;
$viewPath = $viewType . '/';
if ($viewName) {
$viewPath .= $viewName . '/';
}
$relativePaths = array();
foreach ($render->getSite()->getThemes() as $theme) {
$basePath = $render->getThemeDir(true, $theme, $namespace) . $viewPath;
foreach (CM_Util::rglob('*.less', $basePath) as $path) {
$relativePaths[] = preg_replace('#^' . $basePath . '#', '', $path);
}
}
foreach (array_unique($relativePaths) as $path) {
$prefix = '.' . $className;
if ($path !== 'default.less' && strpos($path, '/') === false) {
$prefix .= '.' . preg_replace('#.less$#', '', $path);
}
$file = $render->getLayoutFile($viewPath . $path, $namespace);
$this->add($file->read(), $prefix);
}
}
示例2: __construct
/**
* @param CM_Frontend_Render $render
* @throws CM_Exception
*/
public function __construct(CM_Frontend_Render $render)
{
parent::__construct($render);
$this->addVariables();
$file = new CM_File(DIR_PUBLIC . 'static/css/library/icon.less');
if ($file->exists()) {
$this->add($file->read());
}
foreach (array_reverse($render->getSite()->getModules()) as $moduleName) {
foreach (array_reverse($render->getSite()->getThemes()) as $theme) {
foreach (CM_Util::rglob('*.less', $render->getThemeDir(true, $theme, $moduleName) . 'css/') as $path) {
$file = new CM_File($path);
$this->add($file->read());
}
}
}
$viewClasses = CM_View_Abstract::getClassChildren(true);
foreach ($viewClasses as $viewClassName) {
$validModule = in_array(CM_Util::getNamespace($viewClassName), $render->getSite()->getModules());
$validViewClass = $this->_isValidViewClass($viewClassName);
if ($validModule && $validViewClass) {
$asset = new CM_Asset_Css_View($this->_render, $viewClassName);
$this->add($asset->_getContent());
}
}
}
示例3: __construct
public function __construct(CM_Site_Abstract $site)
{
$content = '';
foreach (array_reverse($site->getModules()) as $moduleName) {
$libraryPath = DIR_ROOT . CM_Bootloader::getInstance()->getModulePath($moduleName) . 'client-vendor/after-body/';
foreach (CM_Util::rglob('*.js', $libraryPath) as $path) {
$content .= (new CM_File($path))->read() . ';' . PHP_EOL;
}
}
$this->_content = $content;
}
示例4: _setInitialVersion
private function _setInitialVersion()
{
$app = CM_App::getInstance();
foreach (CM_App::getInstance()->getUpdateScriptPaths() as $namespace => $path) {
$updateFiles = CM_Util::rglob('*.php', $path);
$version = array_reduce($updateFiles, function ($initial, $path) {
$filename = basename($path);
return max($initial, (int) $filename);
}, 0);
$app->setVersion($version, $namespace);
}
}
示例5: __construct
public function __construct(CM_Frontend_Render $render)
{
parent::__construct($render);
$extensions = array('css', 'less');
foreach (array_reverse($render->getSite()->getModules()) as $moduleName) {
$libraryPath = DIR_ROOT . CM_Bootloader::getInstance()->getModulePath($moduleName) . 'client-vendor/';
foreach ($extensions as $extension) {
foreach (CM_Util::rglob('*.' . $extension, $libraryPath) as $path) {
$file = new CM_File($path);
$this->add($file->read());
}
}
}
}
示例6: _appendDirectoryGlob
/**
* @param string $path
*/
protected function _appendDirectoryGlob($path)
{
foreach (array_reverse($this->_site->getModules()) as $moduleName) {
$initPath = $this->_getPathInModule($moduleName, $path);
foreach (CM_Util::rglob('*.js', $initPath) as $filePath) {
$content = (new CM_File($filePath))->read();
$this->_js->append($content);
}
}
}
示例7: getClassChildren
/**
* @param string $className
* @param boolean|null $includeAbstracts
* @return string[]
*/
public static function getClassChildren($className, $includeAbstracts = null)
{
$key = CM_CacheConst::ClassChildren . '_className:' . $className . '_abstracts:' . (int) $includeAbstracts;
$cache = CM_Cache_Local::getInstance();
if (false === ($classNames = $cache->get($key))) {
$pathsFiltered = array();
$paths = array();
foreach (CM_Bootloader::getInstance()->getModules() as $modulePath) {
$namespacePaths = CM_Util::rglob('*.php', CM_Util::getModulePath($modulePath) . 'library/');
$paths = array_merge($paths, $namespacePaths);
}
$regexp = '#\\bclass\\s+(?<name>[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)\\s+#';
foreach ($paths as $path) {
$file = new CM_File($path);
$fileContents = $file->read();
if (preg_match($regexp, $fileContents, $matches)) {
if (class_exists($matches['name'], true)) {
$reflectionClass = new ReflectionClass($matches['name']);
if (($reflectionClass->isSubclassOf($className) || interface_exists($className) && $reflectionClass->implementsInterface($className)) && (!$reflectionClass->isAbstract() || $includeAbstracts)) {
$pathsFiltered[] = $path;
}
}
}
}
$classNames = self::getClasses($pathsFiltered);
$cache->set($key, $classNames);
}
return $classNames;
}