本文整理汇总了PHP中RecursiveIteratorIterator::setMaxDepth方法的典型用法代码示例。如果您正苦于以下问题:PHP RecursiveIteratorIterator::setMaxDepth方法的具体用法?PHP RecursiveIteratorIterator::setMaxDepth怎么用?PHP RecursiveIteratorIterator::setMaxDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecursiveIteratorIterator
的用法示例。
在下文中一共展示了RecursiveIteratorIterator::setMaxDepth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readData
/**
* @see \wcf\page\IPage::readData()
*/
public function readData()
{
parent::readData();
// stats
if (LINKLIST_ENABLE_STATISTICS) {
$this->stats = array_merge(StatsCacheBuilder::getInstance()->getData(), UserStatsCacheBuilder::getInstance()->getData());
}
// get categories
$categoryTree = new LinklistCategoryNodeTree('de.incendium.linklist.category');
$this->categoryList = $categoryTree->getIterator();
$this->categoryList->setMaxDepth(0);
// get featured entries
$this->featuredEntryList = new AccessibleEntryList();
$this->featuredEntryList->getConditionBuilder()->add('entry.isFeatured = ?', array(1));
$this->featuredEntryList->sqlLimit = 10;
$this->featuredEntryList->sqlOrderBy = 'RAND()';
$this->featuredEntryList->readObjects();
// remove default breadcrumb entry and set current page as 'website'
if (WCF::isLandingPage()) {
MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('Linklist', array('application' => 'linklist')), true);
MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'website', true);
MetaTagHandler::getInstance()->addTag('og:title', 'og:title', WCF::getLanguage()->get(PAGE_TITLE), true);
MetaTagHandler::getInstance()->addTag('og:description', 'og:description', WCF::getLanguage()->get(PAGE_DESCRIPTION), true);
}
}
示例2: _createIterator
/**
* Creates an iterator with settings
* Resets class-wide results
*
* @param $items array
*
* @return object \RecursiveIteratorIterator
*/
protected function _createIterator(array $items)
{
$this->result = [];
$iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($items));
$iterator->setMaxDepth($this->max_depth);
return $iterator;
}
示例3: __construct
/**
* Constructor.
*
* @param \RecursiveIteratorIterator $iterator The Iterator to filter
* @param array $comparators An array of \NumberComparator instances
*/
public function __construct(\RecursiveIteratorIterator $iterator, array $comparators)
{
$minDepth = 0;
$maxDepth = INF;
foreach ($comparators as $comparator) {
switch ($comparator->getOperator()) {
case '>':
$minDepth = $comparator->getTarget() + 1;
break;
case '>=':
$minDepth = $comparator->getTarget();
break;
case '<':
$maxDepth = $comparator->getTarget() - 1;
break;
case '<=':
$maxDepth = $comparator->getTarget();
break;
default:
$minDepth = $maxDepth = $comparator->getTarget();
}
}
$this->minDepth = $minDepth;
$iterator->setMaxDepth(INF === $maxDepth ? -1 : $maxDepth);
parent::__construct($iterator);
}
示例4: __construct
/**
* Constructor.
*
* @param \RecursiveIteratorIterator $iterator The Iterator to filter
* @param int $minDepth The min depth
* @param int $maxDepth The max depth
*/
public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = INF)
{
$this->minDepth = $minDepth;
$iterator->setMaxDepth(INF === $maxDepth ? -1 : $maxDepth);
parent::__construct($iterator);
}
示例5: readData
/**
* @see \wcf\page\IPage::readData()
*/
public function readData()
{
parent::readData();
// get the accessible news categories
$categoryTree = new NewsCategoryNodeTree('de.voolia.news.category');
$this->categoryList = $categoryTree->getIterator();
$this->categoryList->setMaxDepth(0);
if (empty($_POST)) {
// multilingualism
if (!empty($this->availableContentLanguages)) {
if (!$this->languageID) {
$language = LanguageFactory::getInstance()->getUserLanguage();
$this->languageID = $language->languageID;
}
if (!isset($this->availableContentLanguages[$this->languageID])) {
$languageIDs = array_keys($this->availableContentLanguages);
$this->languageID = array_shift($languageIDs);
}
}
// set default publication and archivation date
$dateTime = DateUtil::getDateTimeByTimestamp(TIME_NOW);
$dateTime->setTimezone(WCF::getUser()->getTimeZone());
$this->publicationDate = $this->archivingDate = $dateTime->format('c');
}
// add breadcrumbs
NEWSCore::getInstance()->setBreadcrumbs();
}
示例6: __construct
/**
* @param IItem $root
* @param int $maxDepth
* @param array $filter
*/
public function __construct(IItem $root, $maxDepth = -1, $filter = array())
{
parent::__construct($root, parent::SELF_FIRST);
parent::setMaxDepth($maxDepth);
$this->filter = $filter;
$this->accessor = PropertyAccess::getPropertyAccessor();
$this->iterated = new \SplObjectStorage();
}
示例7: readData
/**
* @see \wcf\page\IPage::readData()
*/
public function readData()
{
parent::readData();
// get categories
$categoryTree = new FilebaseCategoryNodeTree('de.incendium.filebase.category');
$this->categoryList = $categoryTree->getIterator();
$this->categoryList->setMaxDepth(0);
// add breadcrumbs
FILEBASECore::getInstance()->setLocation($this->category->getParentCategories());
}
示例8: _get_rit
private function _get_rit()
{
$config = (array) Kohana::$config->load('finder');
$config = Arr::merge($config, $this->filter);
Finder_Filter_Iterator::$config = $config;
$this->dit = new Finder_Filter_Iterator($this->dit);
$rit = new RecursiveIteratorIterator($this->dit, RecursiveIteratorIterator::SELF_FIRST);
$rit->setMaxDepth($this->max_depth);
return $rit;
}
示例9: getFiles
function getFiles($path)
{
$dir = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
// Flatten the recursive iterator, folders come before their files
$it = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::SELF_FIRST);
// Maximum depth is 1 level deeper than the base folder
$it->setMaxDepth(1);
$res = "";
foreach ($it as $fileinfo) {
$res .= '<option >' . $fileinfo->getFilename() . '</option>';
}
return $res;
}
示例10: phpbb_load_extensions_autoloaders
/**
* Load the autoloaders added by the extensions.
*
* @param string $phpbb_root_path Path to the phpbb root directory.
*/
function phpbb_load_extensions_autoloaders($phpbb_root_path)
{
$iterator = new \RecursiveIteratorIterator(new \phpbb\recursive_dot_prefix_filter_iterator(new \RecursiveDirectoryIterator($phpbb_root_path . 'ext/', \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS)), \RecursiveIteratorIterator::SELF_FIRST);
$iterator->setMaxDepth(2);
foreach ($iterator as $file_info) {
if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2) {
$filename = $file_info->getRealPath() . '/autoload.php';
if (file_exists($filename)) {
require $filename;
}
}
}
}
示例11: countThemePages
protected function countThemePages($path)
{
$result = 0;
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
$it->setMaxDepth(1);
while ($it->valid()) {
if (!$it->isDot() && !$it->isDir() && $it->getExtension() == 'htm') {
$result++;
}
$it->next();
}
return $result;
}
示例12: discoverDirectory
private function discoverDirectory($path, $recursive = true)
{
if (false) {
Log::Warning('Not valid directory: %s', $path);
return;
}
$rdi = new \RecursiveDirectoryIterator(realpath($path));
$iterator = new \RecursiveIteratorIterator($rdi);
$iterator->setMaxDepth($recursive ? -1 : 0);
foreach ($iterator as $file) {
if ($file->isFile() && $file->getExtension() == 'php') {
$this->AddClassFile($file->getRealPath());
}
}
}
示例13: debug_dir_list
function debug_dir_list($dir_recurse_depth = 0, $dir_list_root = '.')
{
// Create a recursive file system directory iterator.
$dir_iter = new RecursiveDirectoryIterator($dir_list_root, RecursiveDirectoryIterator::SKIP_DOTS);
// Create a recursive iterator.
$iter = new RecursiveIteratorIterator($dir_iter, RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
// The maximum recursive path.
$iter->setMaxDepth($dir_recurse_depth);
// List of paths Include current paths
$path = array($dir_list_root);
foreach ($iter as $path => $dir) {
if ($dir_recurse_depth == 0 && $dir->isDir()) {
$path .= "/";
}
$paths[] = $path;
}
return $paths;
}
示例14: RecursiveDirectoryIterator
function dir_list($dir_recurse_depth = 0, $dir_list_root = '.') {
$dir_iter = new RecursiveDirectoryIterator(
$dir_list_root,
RecursiveDirectoryIterator::SKIP_DOTS);
$iter = new RecursiveIteratorIterator(
$dir_iter,
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD
);
$iter->setMaxDepth($dir_recurse_depth);
$path = array($dir_list_root);
foreach ($iter as $path => $dir) {
if ($dir_recurse_depth == 0 && $dir->isDir()) $path .= "/";
$paths[] = substr($path,2);
}
return $paths;
}
示例15: readData
/**
* @see \wcf\page\IPage::readData()
*/
public function readData()
{
parent::readData();
// get categories
$excludedCategoryIDs = array_diff(FilebaseCategory::getAccessibleCategoryIDs(), FilebaseCategory::getAccessibleCategoryIDs(array('canUseCategory')));
$categoryTree = new FilebaseCategoryNodeTree('de.incendium.filebase.category', 0, false, $excludedCategoryIDs);
$this->categoryList = $categoryTree->getIterator();
$this->categoryList->setMaxDepth(0);
if (empty($_POST)) {
// multilingualism
if (!empty($this->availableContentLanguages)) {
if (!$this->languageID) {
$language = LanguageFactory::getInstance()->getUserLanguage();
$this->languageID = $language->languageID;
}
if (!isset($this->availableContentLanguages[$this->languageID])) {
$languageIDs = array_keys($this->availableContentLanguages);
$this->languageID = array_shift($languageIDs);
}
}
}
}