From fabfca8ee4eadaa8b01f4de9bb1775652ba01c5f Mon Sep 17 00:00:00 2001 From: David Vandemaele Date: Thu, 26 Nov 2015 16:18:00 +0100 Subject: [PATCH] Add hook 'media not found' --- lib/Skeleton/Core/Hook.php | 2 ++ lib/Skeleton/Core/Web/Media.php | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Skeleton/Core/Hook.php b/lib/Skeleton/Core/Hook.php index e232114..4917b7c 100644 --- a/lib/Skeleton/Core/Hook.php +++ b/lib/Skeleton/Core/Hook.php @@ -4,6 +4,7 @@ * * @author Gerry Demaret * @author Christophe Gosiau + * @author David Vandemaele */ namespace Skeleton\Core; @@ -18,6 +19,7 @@ class Hook { 'handle_error', 'module_access_denied', 'module_not_found', + 'media_not_found', ]; /** diff --git a/lib/Skeleton/Core/Web/Media.php b/lib/Skeleton/Core/Web/Media.php index 40e9bc5..895f296 100644 --- a/lib/Skeleton/Core/Web/Media.php +++ b/lib/Skeleton/Core/Web/Media.php @@ -34,7 +34,7 @@ class Media { ], 'font' => [ 'woff', - 'woff2', + 'woff2', 'ttf', 'otf', 'eot' @@ -147,7 +147,11 @@ public static function detect($request_uri) { * @access private */ private static function fail() { - HTTP\Status::code_404('media'); + if (\Skeleton\Core\Hook::exists('media_not_found')) { + \Skeleton\Core\Hook::call('media_not_found'); + } else { + HTTP\Status::code_404('media'); + } } /**