From f1fa2335a43e69fe8dccd8afdb8d03831f6d8f0c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Aug 23 2013 23:10:07 +0000 Subject: patch mediaelement not to use flash or silverlight, update README.fedora --- diff --git a/README.fedora.wordpress b/README.fedora.wordpress index 8a4518d..20f8739 100644 --- a/README.fedora.wordpress +++ b/README.fedora.wordpress @@ -43,3 +43,24 @@ Once that's done and the database server and web server have been started, open a web browser to http://localhost/wordpress/wp-admin/install.php and follow the instructions given to you on the pages you see to set up the database tables and begin publishing your blog. + +Wordpress ships with Flash and Silverlight plugins for the 'plupload' file +uploader and the 'mediaelement' media player embedder. The idea is to try and +be able to provide a multi-file uploader and an embedded video player when +HTML5 is not available (or does not support the video format in question). +These plugins are provided as pre-built binaries and there is no mechanism +for building them from source during Wordpress compilation. As the inclusion +of pre-built binaries is against Fedora policy - see +https://fedoraproject.org/wiki/Packaging:Guidelines#No_inclusion_of_pre-built_binaries_or_libraries + - these plugins have been removed from the Fedora package. As a consequence: + +a) any Wordpress element or plugin that uses the 'plupload' will only present +an HTML5-based multi-file uploader if HTML5 is supported by the user's browser +or an HMTL4-based single-file uploader in HTML5 is not supported. No Flash +or Silverlight-based multi-file uploader will be provided. + +b) If you try to embed media into a Wordpress post using the [video] and +[audio] short tags, the media player will be visible if the reader is using +a browser that has HTML5 support for the media format in question; if not, the +'Download Media' link will be offered. No Flash or Silverlight-based player +element will be included. diff --git a/wordpress-3.6-mediaelement-noflash_silverlight.patch b/wordpress-3.6-mediaelement-noflash_silverlight.patch new file mode 100644 index 0000000..0e9f67b --- /dev/null +++ b/wordpress-3.6-mediaelement-noflash_silverlight.patch @@ -0,0 +1,11 @@ +--- wordpress/wp-includes/js/mediaelement/mediaelement-and-player.min.js 2013-08-01 06:47:23.000000000 -0700 ++++ wordpress/wp-includes/js/mediaelement/mediaelement-and-player.min.js.new 2013-08-23 16:02:01.491295485 -0700 +@@ -37,7 +37,7 @@ + this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id);mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id)}}; + mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b;this.htmlMediaElements[a]=c},unregisterPluginElement:function(a){delete this.pluginMediaElements[a];delete this.htmlMediaElements[a]},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];if(b){switch(b.pluginType){case "flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case "silverlight":b.pluginElement=document.getElementById(b.id); + b.pluginApi=b.pluginElement.Content.MediaElementJS}b.pluginApi!=null&&b.success&&b.success(b,c)}},fireEvent:function(a,b,c){var d,e;if(a=this.pluginMediaElements[a]){b={type:b,target:a};for(d in c){a[d]=c[d];b[d]=c[d]}e=c.bufferedTime||0;b.target.buffered=b.buffered={start:function(){return 0},end:function(){return e},length:1};a.dispatchEvent(b.type,b)}}}; +-mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:false,httpsBasicAuthSite:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,enablePseudoStreaming:false,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480, ++mejs.MediaElementDefaults={mode:"auto",plugins:["youtube","vimeo"],enablePluginDebug:false,httpsBasicAuthSite:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,enablePseudoStreaming:false,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480, + defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,success:function(){},error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)}; + mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),f=e==="audio"||e==="video",g=f?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];g=typeof g=="undefined"||g===null||g==""?null:g;e=typeof e=="undefined"||e===null?"":e;l=typeof l=="undefined"||l===null||l==="false"? + "none":l;h=!(typeof h=="undefined"||h===null||h==="false");j=!(typeof j=="undefined"||j===null||j==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,f,g);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,h,l)}else if(k.method!=="")return this.createPlugin(k,c,e,h,l,j);else{this.createErrorMessage(k,c,e);return this}}, diff --git a/wordpress.spec b/wordpress.spec index 78bbd35..82f6ae9 100644 --- a/wordpress.spec +++ b/wordpress.spec @@ -24,6 +24,8 @@ Patch1: wordpress-move-wp-content.patch Patch2: wordpress-3.6-no_swfupload.patch # Adjust tinymce's media plugin not to use its SWF plugin Patch3: wordpress-3.6-tinymce_noflash.patch +# Adjust mediaelement not to use its SWF and Silverlight plugins +Patch4: wordpress-3.6-mediaelement-noflash_silverlight.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -81,10 +83,21 @@ almost trivial, to get information out to people on the web. # uploaders, and swfupload are not available. # To re-introduce these they would have to be built from the # ActionScript source as part of this package build, they cannot be -# shipped pre-compiled. - AdamW, 2013/08 +# shipped pre-compiled. Removing plupload.flash.js and +# plupload.silverlight.js causes plupload only to try and use the html4 +# or html5 uploaders; if you just wipe the binaries but leave the +# .js files, it will try and use the Flash or Silverlight uploaders +# and draw a non-functional button. - AdamW, 2013/08 # https://fedoraproject.org/wiki/Packaging:Guidelines#No_inclusion_of_pre-built_binaries_or_libraries -rm -f wp-includes/js/mediaelement/silverlightmediaelement.xap ./wp-includes/js/plupload/plupload.silverlight.xap wp-includes/js/tinymce/plugins/media/moxieplayer.swf wp-includes/js/mediaelement/flashmediaelement.swf wp-includes/js/plupload/plupload.flash.swf +rm -f wp-includes/js/mediaelement/silverlightmediaelement.xap +rm -f wp-includes/js/mediaelement/flashmediaelement.sw +rm -f wp-includes/js/tinymce/plugins/media/moxieplayer.swf +rm -f wp-includes/js/plupload/plupload.silverlight.xap +rm -f wp-includes/js/plupload/plupload.silverlight.js +rm -f wp-includes/js/plupload/plupload.flash.swf +rm -f wp-includes/js/plupload/plupload.flash.js + # swfupload can just die in its entirety rm -rf wp-includes/js/swfupload @@ -92,6 +105,7 @@ rm -rf wp-includes/js/swfupload #%patch1 -p1 -b .rhbz522897 %patch2 -p1 %patch3 -p1 +%patch4 -p1 # disable wp_version_check, updates are always installed via rpm sed -i -e "s,\(.*\)'wp_version_check'\(.*\),#\1'wp_version_check'\2,g" \