diff --git a/UPLOAD/inc/languages/english/admin/mybbfancybox.lang.php b/UPLOAD/inc/languages/english/admin/mybbfancybox.lang.php index a065a07..ec8d483 100644 --- a/UPLOAD/inc/languages/english/admin/mybbfancybox.lang.php +++ b/UPLOAD/inc/languages/english/admin/mybbfancybox.lang.php @@ -28,6 +28,9 @@ $l['setting_mybbfancybox_use_separate_gallery_for_linked_images'] = 'Create a separate gallery for linked-to images?'; $l['setting_mybbfancybox_use_separate_gallery_for_linked_images_desc'] = 'YES for linked-to images (as URLs) to be placed into a separate gallery from other images (whether per-post or globally, depending on the below "Per-post gallery?" setting), NO (default) to put all images into the same gallery (again, whether per-post or global)'; +$l['setting_mybbfancybox_video_filetypes'] = 'Video (or other) MIME types'; +$l['setting_mybbfancybox_video_filetypes_desc'] = 'Provide, one per line, a list of attachment MIME types (as specified via MyBB\'s ACP "Attachment Types" configuration) which should be included in the FancyBox gallery as well as images. Typically, these will be video attachments.'; + $l['setting_mybbfancybox_protect_images'] = 'Protect images?'; $l['setting_mybbfancybox_protect_images_desc'] = 'YES to disable right-click and use simple image protection, NO (default) to enable right-click'; diff --git a/UPLOAD/inc/plugins/mybbfancybox.php b/UPLOAD/inc/plugins/mybbfancybox.php index f59d95a..f281db2 100644 --- a/UPLOAD/inc/plugins/mybbfancybox.php +++ b/UPLOAD/inc/plugins/mybbfancybox.php @@ -176,6 +176,10 @@ function mybbfancybox_install() 'optionscode' => 'yesno', 'value' => 0 ), + 'video_filetypes' => array( + 'optionscode' => 'textarea', + 'value' => '' + ), 'protect_images' => array( 'optionscode' => 'yesno', 'value' => 0 @@ -327,6 +331,8 @@ function mybbfancybox_init() $plugins->add_hook("parse_message_end","mybbfancybox_post"); } + $plugins->add_hook('postbit', 'mybbfancybox_postbit'); + if (defined('THIS_SCRIPT') && THIS_SCRIPT == 'showthread.php') { // Add hook $plugins->add_hook('showthread_start', 'mybbfancybox_start'); @@ -336,6 +342,10 @@ function mybbfancybox_init() // Add hook $plugins->add_hook('portal_start', 'mybbfancybox_start'); } + + if (defined('THIS_SCRIPT') && THIS_SCRIPT == 'attachment.php') { + $plugins->add_hook('attachment_end', 'mybbfancybox_attachment_end'); + } } /** @@ -360,6 +370,9 @@ function mybbfancybox_start() // Apply required changes in postbit_attachments_thumbnails_thumbnail template (replace all content) $templates->cache['postbit_attachments_thumbnails_thumbnail'] = '   '; + // Apply required changes to support videos in the gallery (replace all content) + $templates->cache['postbit_attachments_attachment'] = '
{$attachment[\'icon\']}  {$attachment[\'filename\']} ({$lang->postbit_attachment_size} {$attachment[\'filesize\']} / {$lang->postbit_attachment_downloads} {$attachment[\'downloads\']})'; + // Apply required changes in postbit_attachments_images_image template (replace all content) $templates->cache['postbit_attachments_images_image'] = '   '; @@ -442,6 +455,11 @@ function mybbfancybox_start() $buttons = "\n\t\tbuttons: [ {$buttons} ],"; + $filetypes_a = array_map('trim', explode("\n", $mybb->settings['mybbfancybox_video_filetypes'])); + if ($filetypes_a) { + $video_mimetypes = '["'.implode('", "', array_map('addslashes', $filetypes_a)).'"]'; + } else $video_mimetypes = '[]'; + $headerinclude .= <<