replace calls for App::getBasePath() with AppHelper

This commit is contained in:
Art4 2024-11-10 10:57:13 +00:00
parent 79f9e78daf
commit ae75ffc31a
7 changed files with 26 additions and 23 deletions

View file

@ -81,7 +81,7 @@ class Hook
*/
public static function register(string $hook, string $file, string $function, int $priority = 0)
{
$file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
$file = str_replace(DI::apphelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
if (DBA::exists('hook', $condition)) {
@ -102,7 +102,7 @@ class Hook
*/
public static function unregister(string $hook, string $file, string $function): bool
{
$relative_file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
$relative_file = str_replace(DI::apphelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
// This here is only needed for fixing a problem that existed on the develop branch
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
@ -198,7 +198,7 @@ class Hook
public static function callSingle(string $name, array $hook, &$data = null)
{
// Don't run a theme's hook if the user isn't using the theme
if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . DI::app()->getCurrentTheme()) === false) {
if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . DI::apphelper()->getCurrentTheme()) === false) {
return;
}