*/ use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; function fancybox_install() { Hook::register('head', __FILE__, 'fancybox_head'); Hook::register('footer', __FILE__, 'fancybox_footer'); Hook::register('prepare_body_final', __FILE__, 'fancybox_render'); } function fancybox_head(App $a, string &$b) { DI::page()->registerStylesheet(__DIR__ . '/asset/fancybox/jquery.fancybox.min.css'); } function fancybox_footer(App $a, string &$str) { DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/jquery.fancybox.min.js'); DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/fancybox.config.js'); } function fancybox_render(App $a, array &$b){ $gallery = 'gallery-' . $b['item']['uri-id'] ?? random_int(1000000, 10000000); // performWithEscapedBlocks escapes block defined with 2nd par pattern that won't be processed. // We don't want to touch images in class="type-link": $b['html'] = \Friendica\Util\Strings::performWithEscapedBlocks( $b['html'], '#