Skip to content

Commit

Permalink
Add directory checking method to ContextUtils class
Browse files Browse the repository at this point in the history
A new method, 'siteIdDirs', has been added to the ContextUtils class. This method checks whether the current directory is in the list of directories for the current site, returning a boolean result. This change has been replicated across two different project directories, ensuring consistent functionality throughout the application.
  • Loading branch information
hipot committed Jan 11, 2024
1 parent a6e8e1b commit 6bece26
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/classes/Hipot/Utils/ContextUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,20 @@ public static function setStatusNotFound(bool $showPage = false): void
}
}
}

/**
* Проверяет, находится ли текущая директория в списке директорий для текущего сайта.
* @param array $dirs Массив директорий для проверки
* @return bool Возвращает true, если текущая директория находится в списке директорий, иначе возвращает false.
* @see \CSite::InDir()
*/
public static function siteIdDirs(array $dirs): bool
{
foreach ($dirs as $dir) {
if (\CSite::InDir($dir)) {
return true;
}
}
return false;
}
}

0 comments on commit 6bece26

Please sign in to comment.