. * * @file * @ingroup extensions * @author Mark Holmquist * @copyright Copyright © 2013, Mark Holmquist */ class MultimediaViewerHooks { /* * Handler for BeforePageDisplay hook * Add JavaScript to the page when an image is on it * and the user has enabled the feature if BetaFeatures is installed * @param OutputPage $out * @param Skin $skin * @return bool */ static function getModules( &$out, &$skin ) { if ( class_exists( 'BetaFeatures') && !BetaFeatures::isFeatureEnabled( $out->getUser(), 'multimedia-viewer' ) ) { return true; } if ( count( $out->getFileSearchOptions() ) > 0 ) { $out->addModules( array( 'ext.multimediaViewer' ) ); } return true; } // Add a beta preference to gate the feature static function getBetaPreferences( $user, &$prefs ) { global $wgExtensionAssetsPath; $prefs['multimedia-viewer'] = array( 'label-message' => 'multimediaviewer-pref', 'desc-message' => 'multimediaviewer-pref-desc', 'info-link' => 'https://mediawiki.org/wiki/Multimedia/Media_Viewer', 'discussion-link' => 'https://mediawiki.org/wiki/Talk:Multimedia/Media_Viewer', 'screenshot' => $wgExtensionAssetsPath . '/MultimediaViewer/img/viewer.svg', ); return true; } }