WP YouTube Lyte - Version 0.9.4

Version Description

  • security: WP YouTube Lyte now works entirely in https if your blog is running in https
  • performance (js/ page rendering): initiate the javascript a little later (at "load" instead of "DOMContentLoaded") to speed up page load (might need further optimizations)
  • performance (php): have the plugin only include/ execute php when needed
  • updated donottrack.js to match the version used in my WP DoNotTrack-plugin. if want to tweak the way donottrack.js functions, you migth want to check that plugin out (and disable the option in WP YouTube Lyte)
  • bugfix: small tweak in css to force transparency of play-button
Download this release

Release Info

Developer futtta
Plugin Icon 128x128 WP YouTube Lyte
Version 0.9.4
Comparing to
See all releases

Code changes from version 0.9.3 to 0.9.4

external/donottrack-min.js CHANGED
@@ -1 +1 @@
1
- function sanitizer(a){a=a.toLowerCase();for(x in spy){if(a.indexOf(spy[x])!==-1){a=true;break}}return a}var spy=["quantserve.com","media6degrees.com"];(function(){var _after=1;var _afterThrow=2;var _afterFinally=3;var _before=4;var _around=5;var _intro=6;var _regexEnabled=true;var _arguments="arguments";var _undef="undefined";var getType=function(){var a=Object.prototype.toString,b={},c={1:"element",3:"textnode",9:"document",11:"fragment"},d="Arguments Array Boolean Date Document Element Error Fragment Function NodeList Null Number Object RegExp String TextNode Undefined Window".split(" ");for(var e=d.length;e--;){var f=d[e],g=window[f];if(g){try{b[a.call(new g)]=f.toLowerCase()}catch(h){}}}return function(d){return d==null&&(d===undefined?_undef:"null")||d.nodeType&&c[d.nodeType]||typeof d.length=="number"&&(d.callee&&_arguments||d.alert&&"window"||d.item&&"nodelist")||b[a.call(d)]}}();var isFunc=function(a){return getType(a)=="function"};var weaveOne=function(source,method,advice){var old=source[method];if(advice.type!=_intro&&!isFunc(old)){var oldObject=old;old=function(){var code=arguments.length>0?_arguments+"[0]":"";for(var i=1;i<arguments.length;i++){code+=","+_arguments+"["+i+"]"}return eval("oldObject("+code+");")}}var aspect;if(advice.type==_after||advice.type==_afterThrow||advice.type==_afterFinally)aspect=function(){var a,b=null;try{a=old.apply(this,arguments)}catch(c){b=c}if(advice.type==_after)if(b==null)a=advice.value.apply(this,[a,method]);else throw b;else if(advice.type==_afterThrow&&b!=null)a=advice.value.apply(this,[b,method]);else if(advice.type==_afterFinally)a=advice.value.apply(this,[a,b,method]);return a};else if(advice.type==_before)aspect=function(){advice.value.apply(this,[arguments,method]);return old.apply(this,arguments)};else if(advice.type==_intro)aspect=function(){return advice.value.apply(this,arguments)};else if(advice.type==_around){aspect=function(){var a={object:this,args:Array.prototype.slice.call(arguments)};return advice.value.apply(a.object,[{arguments:a.args,method:method,proceed:function(){return old.apply(a.object,a.args)}}])}}aspect.unweave=function(){source[method]=old;pointcut=source=aspect=old=null};source[method]=aspect;return aspect};var search=function(a,b,c){var d=[];for(var e in a){var f=null;try{f=a[e]}catch(g){}if(f!=null&&e.match(b.method)&&isFunc(f))d[d.length]={source:a,method:e,advice:c}}return d};var weave=function(a,b){var c=typeof a.target.prototype!=_undef?a.target.prototype:a.target;var d=[];if(b.type!=_intro&&typeof c[a.method]==_undef){var e=search(a.target,a,b);if(e.length==0)e=search(c,a,b);for(var f in e)d[d.length]=weaveOne(e[f].source,e[f].method,e[f].advice)}else{d[0]=weaveOne(c,a.method,b)}return _regexEnabled?d:d[0]};aop={after:function(a,b){return weave(a,{type:_after,value:b})},afterThrow:function(a,b){return weave(a,{type:_afterThrow,value:b})},afterFinally:function(a,b){return weave(a,{type:_afterFinally,value:b})},before:function(a,b){return weave(a,{type:_before,value:b})},around:function(a,b){return weave(a,{type:_around,value:b})},introduction:function(a,b){return weave(a,{type:_intro,value:b})},setup:function(a){_regexEnabled=a.regexMatch}}})();scriptParent=document.getElementsByTagName("script")[0].parentNode;aop.around({target:scriptParent,method:"insertBefore"},function(a){if(typeof a.arguments[0].src==="string"&&(a.arguments[0].tagName.toLowerCase()==="script"||a.arguments[0].tagName.toLowerCase()==="img")){if(sanitizer(a.arguments[0].src)===true){a.arguments[0].src="javascript:void(0)"}}return a.proceed()});aop.around({target:document,method:"write"},function(a){a.arguments[0]=a.arguments[0].toLowerCase();if(a.arguments[0].indexOf("img")!==-1||a.arguments[0].indexOf("script")!==-1){if(sanitizer(a.arguments[0])===true){a.arguments[0]=a.arguments[0].replace(/</g,"<!-- ").replace(/>/g," -->")}}return a.proceed()});var a2a_config=a2a_config||{};a2a_config.no_3p=1;var addthis_config={data_use_cookies:false};var _gaq=_gaq||[];_gaq.push(["_gat._anonymizeIp"])
1
+ function sanitizer(a){a=a.toLowerCase();if(mode==="blacklist"){for(x in list["black"]){if(a.indexOf(list["black"][x].toLowerCase())!==-1){a=true;break}}}else{for(x in list["white"]){if(a.indexOf(list["white"][x].toLowerCase())!==-1){tmpS=false;break}else{tmpS=true}}if(tmpS===true)a=tmpS}return a}function aop_around(a,b){aop.around({target:a,method:b},function(a){if(typeof a.arguments[0].src==="string"&&(a.arguments[0].tagName.toLowerCase()==="script"||a.arguments[0].tagName.toLowerCase()==="img")){if(sanitizer(a.arguments[0].src)===true){a.arguments[0].src="javascript:void(0)"}}return a.proceed()})}(function(){var _after=1;var _afterThrow=2;var _afterFinally=3;var _before=4;var _around=5;var _intro=6;var _regexEnabled=true;var _arguments="arguments";var _undef="undefined";var getType=function(){var a=Object.prototype.toString,b={},c={1:"element",3:"textnode",9:"document",11:"fragment"},d="Arguments Array Boolean Date Document Element Error Fragment Function NodeList Null Number Object RegExp String TextNode Undefined Window".split(" ");for(var e=d.length;e--;){var f=d[e],g=window[f];if(g){try{b[a.call(new g)]=f.toLowerCase()}catch(h){}}}return function(d){return d==null&&(d===undefined?_undef:"null")||d.nodeType&&c[d.nodeType]||typeof d.length=="number"&&(d.callee&&_arguments||d.alert&&"window"||d.item&&"nodelist")||b[a.call(d)]}}();var isFunc=function(a){return getType(a)=="function"};var weaveOne=function(source,method,advice){var old=source[method];if(advice.type!=_intro&&!isFunc(old)){var oldObject=old;old=function(){var code=arguments.length>0?_arguments+"[0]":"";for(var i=1;i<arguments.length;i++){code+=","+_arguments+"["+i+"]"}return eval("oldObject("+code+");")}}var aspect;if(advice.type==_after||advice.type==_afterThrow||advice.type==_afterFinally)aspect=function(){var a,b=null;try{a=old.apply(this,arguments)}catch(c){b=c}if(advice.type==_after)if(b==null)a=advice.value.apply(this,[a,method]);else throw b;else if(advice.type==_afterThrow&&b!=null)a=advice.value.apply(this,[b,method]);else if(advice.type==_afterFinally)a=advice.value.apply(this,[a,b,method]);return a};else if(advice.type==_before)aspect=function(){advice.value.apply(this,[arguments,method]);return old.apply(this,arguments)};else if(advice.type==_intro)aspect=function(){return advice.value.apply(this,arguments)};else if(advice.type==_around){aspect=function(){var a={object:this,args:Array.prototype.slice.call(arguments)};return advice.value.apply(a.object,[{arguments:a.args,method:method,proceed:function(){return old.apply(a.object,a.args)}}])}}aspect.unweave=function(){source[method]=old;pointcut=source=aspect=old=null};source[method]=aspect;return aspect};var search=function(a,b,c){var d=[];for(var e in a){var f=null;try{f=a[e]}catch(g){}if(f!=null&&e.match(b.method)&&isFunc(f))d[d.length]={source:a,method:e,advice:c}}return d};var weave=function(a,b){var c=typeof a.target.prototype!=_undef?a.target.prototype:a.target;var d=[];if(b.type!=_intro&&typeof c[a.method]==_undef){var e=search(a.target,a,b);if(e.length==0)e=search(c,a,b);for(var f in e)d[d.length]=weaveOne(e[f].source,e[f].method,e[f].advice)}else{d[0]=weaveOne(c,a.method,b)}return _regexEnabled?d:d[0]};aop={after:function(a,b){return weave(a,{type:_after,value:b})},afterThrow:function(a,b){return weave(a,{type:_afterThrow,value:b})},afterFinally:function(a,b){return weave(a,{type:_afterFinally,value:b})},before:function(a,b){return weave(a,{type:_before,value:b})},around:function(a,b){return weave(a,{type:_around,value:b})},introduction:function(a,b){return weave(a,{type:_intro,value:b})},setup:function(a){_regexEnabled=a.regexMatch}}})();if(dnt_config.ifdnt!=="1"||navigator.doNotTrack==="yes"){var mode=dnt_config.mode;var list=[];list["black"]=dnt_config.black;list["white"]=dnt_config.white;aop.around({target:document,method:"write"},function(a){if(a.arguments[0].search(/img|script/i)!==-1){if(sanitizer(a.arguments[0])===true){a.arguments[0]=a.arguments[0].replace(/</g,"<!-- ").replace(/>/g," -->")}}return a.proceed()});scriptParent=document.getElementsByTagName("script")[0].parentNode;if(scriptParent.tagName.toLowerCase!=="head"){head=document.getElementsByTagName("head")[0];aop_around(head,"insertBefore");aop_around(head,"appendChild")}aop_around(scriptParent,"insertBefore");aop_around(scriptParent,"appendChild");var a2a_config=a2a_config||{};a2a_config.no_3p=1;var addthis_config={data_use_cookies:false};var _gaq=_gaq||[];_gaq.push(["_gat._anonymizeIp"])}
external/donottrack.js CHANGED
@@ -1,5 +1,3 @@
1
- var spy=['quantserve.com','media6degrees.com'];
2
-
3
  /**
4
  * jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery.
5
  * http://jquery-aop.googlecode.com/
@@ -159,7 +157,6 @@ var spy=['quantserve.com','media6degrees.com'];
159
  * Private weaver and pointcut parser.
160
  */
161
  var weave = function(pointcut, advice) {
162
-
163
  var source = typeof(pointcut.target.prototype) != _undef ? pointcut.target.prototype : pointcut.target;
164
  var advices = [];
165
 
@@ -402,46 +399,74 @@ var spy=['quantserve.com','media6degrees.com'];
402
  _regexEnabled = settings.regexMatch;
403
  }
404
  };
405
-
406
  })();
407
 
408
- scriptParent=document.getElementsByTagName('script')[0].parentNode;
409
-
410
- aop.around( {target: scriptParent, method: 'insertBefore' },
411
  function(invocation) {
412
- if ((typeof(invocation.arguments[0].src)==='string')&&((invocation.arguments[0].tagName.toLowerCase()==='script')||(invocation.arguments[0].tagName.toLowerCase()==='img'))) {
413
- if (sanitizer(invocation.arguments[0].src)===true){
414
- invocation.arguments[0].src='javascript:void(0)';
415
  }
416
- }
417
  return invocation.proceed();
418
- }
419
- );
420
-
421
- aop.around( {target: document, method: 'write' },
422
- function(invocation) {
423
- invocation.arguments[0]=invocation.arguments[0].toLowerCase();
424
- if ((invocation.arguments[0].indexOf('img')!==-1)||(invocation.arguments[0].indexOf('script')!==-1)) {
425
- if (sanitizer(invocation.arguments[0])===true) {
426
- invocation.arguments[0]=invocation.arguments[0].replace(/</g,'<!-- ').replace(/>/g,' -->');
427
- }
428
  }
429
- return invocation.proceed();
430
- }
431
- );
432
-
433
 
434
  function sanitizer(tS) {
435
  tS=tS.toLowerCase();
436
- for (x in spy) {
437
- if (tS.indexOf(spy[x]) !== -1) {
438
- tS=true;
439
- break;
440
- }
441
- }
442
- return tS;
 
 
 
 
 
 
 
 
 
 
 
 
443
  }
444
 
445
- var a2a_config = a2a_config || {};a2a_config.no_3p=1;
446
- var addthis_config = { data_use_cookies: false };
447
- var _gaq=_gaq || [];_gaq.push(['_gat._anonymizeIp']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /**
2
  * jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery.
3
  * http://jquery-aop.googlecode.com/
157
  * Private weaver and pointcut parser.
158
  */
159
  var weave = function(pointcut, advice) {
 
160
  var source = typeof(pointcut.target.prototype) != _undef ? pointcut.target.prototype : pointcut.target;
161
  var advices = [];
162
 
399
  _regexEnabled = settings.regexMatch;
400
  }
401
  };
 
402
  })();
403
 
404
+ function aop_around(myTarget, myMethod) {
405
+ aop.around( {target: myTarget, method: myMethod },
 
406
  function(invocation) {
407
+ if ((typeof(invocation.arguments[0].src)==='string')&&((invocation.arguments[0].tagName.toLowerCase()==='script')||(invocation.arguments[0].tagName.toLowerCase()==='img'))) {
408
+ if (sanitizer(invocation.arguments[0].src)===true) {
409
+ invocation.arguments[0].src='javascript:void(0)';
410
  }
411
+ }
412
  return invocation.proceed();
 
 
 
 
 
 
 
 
 
 
413
  }
414
+ );
415
+ }
 
 
416
 
417
  function sanitizer(tS) {
418
  tS=tS.toLowerCase();
419
+ if (mode==='blacklist') {
420
+ for (x in list['black']) {
421
+ if (tS.indexOf(list['black'][x].toLowerCase()) !== -1) {
422
+ tS=true;
423
+ break;
424
+ }
425
+ }
426
+ } else {
427
+ for (x in list['white']) {
428
+ if (tS.indexOf(list['white'][x].toLowerCase()) !== -1) {
429
+ tmpS=false;
430
+ break;
431
+ } else {
432
+ tmpS=true;
433
+ }
434
+ }
435
+ if (tmpS===true) tS=tmpS;
436
+ }
437
+ return tS;
438
  }
439
 
440
+ if ((dnt_config.ifdnt!=="1")||(navigator.doNotTrack==="yes")) {
441
+ var mode=dnt_config.mode;
442
+ var list = [];
443
+ list['black']=dnt_config.black;
444
+ list['white']=dnt_config.white;
445
+
446
+ // for document.write, has to be sanitized differently from others
447
+ aop.around( {target: document, method: 'write' },
448
+ function(invocation) {
449
+ if (invocation.arguments[0].search(/img|script/i)!==-1) {
450
+ if (sanitizer(invocation.arguments[0])===true) {
451
+ invocation.arguments[0]=invocation.arguments[0].replace(/</g,'<!-- ').replace(/>/g,' -->');
452
+ }
453
+ }
454
+ return invocation.proceed();
455
+ }
456
+ );
457
+
458
+ // for dom-methods insertBefore and appendChild on parent of first script and/or head
459
+ scriptParent=document.getElementsByTagName('script')[0].parentNode;
460
+ if (scriptParent.tagName.toLowerCase!=="head") {
461
+ head = document.getElementsByTagName('head')[0];
462
+ aop_around ( head, "insertBefore" );
463
+ aop_around ( head, "appendChild" );
464
+ }
465
+ aop_around ( scriptParent, "insertBefore" );
466
+ aop_around ( scriptParent, "appendChild" );
467
+
468
+ // some specific configs to have 3rd parties behave
469
+ var a2a_config = a2a_config || {};a2a_config.no_3p=1;
470
+ var addthis_config = { data_use_cookies: false };
471
+ var _gaq=_gaq || [];_gaq.push(['_gat._anonymizeIp']);
472
+ }
lyte/lyte-min.js CHANGED
@@ -1 +1 @@
1
- function loadScript(a){scr=doc.createElement("script");scr.src=a;scr.type="text/javascript";doc.getElementsByTagName("head")[0].appendChild(scr)}function setStyle(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function drawTitle(a,b){p=doc.getElementById(a);c=doc.createElement("div");c.className="tC";p.appendChild(c);setStyle(c,"margin:-"+(p.clientHeight/2+15)+"px 5px;");t=doc.createElement("div");t.className="tT";c.appendChild(t);t.innerHTML=b}function parsePL(a){thumb=a.feed.entry[0].media$group.media$thumbnail[1].url;idu=a.feed.id.$t;id="lyte_"+idu.substring(idu.length-16);title="Playlist: "+a.feed.title.$t;pl=doc.getElementById(id);pH=pl.style.height;pW=pl.style.width;setStyle(pl,"height:"+pH+";width:"+pW+';background:url("'+thumb+'") no-repeat scroll center -10px rgb(0, 0, 0); background-size:contain;');drawTitle(id,title)}function parseV(a){title=a.entry.title.$t;idu=a.entry.id.$t;id="lyte_"+idu.substring(idu.length-11);drawTitle(id,title)}function plaYT(){this.onclick="";vid=this.id.substring(4);if(this.className.indexOf("hidef")===-1){hidef=0}else{hidef=1}if(this.className.indexOf("playlist")===-1){eU="http://www.youtube.com/embed/"+vid}else{eU="http://www.youtube.com/embed/p/"+vid}this.innerHTML='<iframe class="youtube-player" type="text/html" width="'+this.clientWidth+'" height="'+this.clientHeight+'" src="'+eU+"?autoplay=1&rel=0&egm=0&iv_load_policy=3&probably_logged_in=false&hd="+hidef+'" frameborder="0"></iframe>'}function lyte(){lytes=getElementsByClassName("lyte","div");for(var a=0;a<lytes.length;a++){lyte_id=lytes[a].id;vid=lyte_id.substring(4);p=doc.getElementById(lyte_id);p.className+=" lP";pW=p.clientWidth;pH=p.clientHeight;pl=doc.createElement("div");p.appendChild(pl);p.onclick=plaYT;pl.id="lyte_"+vid;pl.className="pL";if(p.className.indexOf("audio")!==-1){setStyle(pl,"height:"+pH+"px;width:"+pW);pl.innerHTML='<img src="'+bU+"controls-"+pW+'.png" width="100%" id="ctrl" alt="" style="max-width:'+pW+'px;"/>'}else if(p.className.indexOf("playlist")!==-1){setStyle(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML='<img src="'+bU+'play.png" alt="Click to play this playlist" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/><img src="'+bU+"controls-"+pW+'.png" width="100%" id="ctrl" alt="" style="max-width:'+pW+'px;"/>';jsonUrl="http://gdata.youtube.com/feeds/api/playlists/"+vid+"?v=2&alt=json-in-script&callback=parsePL&fields=id,title,entry";loadScript(jsonUrl)}else{setStyle(pl,"height:"+pH+"px;width:"+pW+'px;background:url("http://img.youtube.com/vi/'+vid+'/0.jpg") no-repeat scroll center -10px rgb(0, 0, 0);background-size:contain;');pl.innerHTML='<img src="'+bU+'play.png" alt="Click to play this video" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/><img src="'+bU+"controls-"+pW+'.png" width="100%" id="ctrl" alt="" style="max-width:'+pW+'px;"/>';if(p.className.indexOf("widget")===-1){jsonUrl="http://gdata.youtube.com/feeds/api/videos/"+vid+"?fields=id,title&alt=json-in-script&callback=parseV";loadScript(jsonUrl)}}}}var doc=document;var cI="lytecss";var myUrl=doc.getElementById("lytescr").src;var bU=myUrl.substring(0,myUrl.lastIndexOf("/")+1);if(!doc.getElementById(cI)){lk=doc.createElement("link");lk.id=cI;lk.rel="stylesheet";lk.type="text/css";lk.href=bU+"lyte.css";doc.getElementsByTagName("head")[0].appendChild(lk)}var getElementsByClassName=function(a,b,c){if(doc.getElementsByClassName){getElementsByClassName=function(a,b,c){c=c||doc;var d=c.getElementsByClassName(a),e=b?new RegExp("\\b"+b+"\\b","i"):null,f=[],g;for(var h=0,i=d.length;h<i;h+=1){g=d[h];if(!e||e.test(g.nodeName)){f.push(g)}}return f}}else if(doc.evaluate){getElementsByClassName=function(a,b,c){b=b||"*";c=c||doc;var d=a.split(" "),e="",f="http://www.w3.org/1999/xhtml",g=doc.documentElement.namespaceURI===f?f:null,h=[],i,j;for(var k=0,l=d.length;k<l;k+=1){e+="[contains(concat(' ', @class, ' '), ' "+d[k]+" ')]"}try{i=doc.evaluate(".//"+b+e,c,g,0,null)}catch(m){i=doc.evaluate(".//"+b+e,c,null,0,null)}while(j=i.iterateNext()){h.push(j)}return h}}else{getElementsByClassName=function(a,b,c){b=b||"*";c=c||doc;var d=a.split(" "),e=[],f=b==="*"&&c.all?c.all:c.getElementsByTagName(b),g,h=[],i;for(var j=0,k=d.length;j<k;j+=1){e.push(new RegExp("(^|\\s)"+d[j]+"(\\s|$)"))}for(var l=0,m=f.length;l<m;l+=1){g=f[l];i=false;for(var n=0,o=e.length;n<o;n+=1){i=e[n].test(g.className);if(!i){break}}if(i){h.push(g)}}return h}}return getElementsByClassName(a,b,c)};lyte()
1
+ function loadScript(a){scr=doc.createElement("script");scr.src=a;scr.type="text/javascript";doc.getElementsByTagName("head")[0].appendChild(scr)}function setStyle(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function drawTitle(a,b){p=doc.getElementById(a);c=doc.createElement("div");c.className="tC";p.appendChild(c);setStyle(c,"margin:-"+(p.clientHeight/2+15)+"px 5px;");t=doc.createElement("div");t.className="tT";c.appendChild(t);t.innerHTML=b}function parsePL(a){thumb=a.feed.entry[0].media$group.media$thumbnail[1].url;idu=a.feed.id.$t;id="lyte_"+idu.substring(idu.length-16);title="Playlist: "+a.feed.title.$t;pl=doc.getElementById(id);pH=pl.style.height;pW=pl.style.width;if(scheme=="https"&&thumb.indexOf("https"==-1)){thumb=thumb.replace("http://","https://")}setStyle(pl,"height:"+pH+";width:"+pW+";background:url('"+thumb+"') no-repeat scroll center -10px rgb(0, 0, 0); background-size:contain;");drawTitle(id,title)}function parseV(a){title=a.entry.title.$t;idu=a.entry.id.$t;id="lyte_"+idu.substring(idu.length-11);drawTitle(id,title)}function plaYT(){this.onclick="";vid=this.id.substring(4);if(this.className.indexOf("hidef")===-1){hidef=0}else{hidef=1}if(this.className.indexOf("playlist")===-1){eU=scheme+"://www.youtube.com/embed/"+vid}else{eU=scheme+"://www.youtube.com/embed/p/"+vid}this.innerHTML='<iframe class="youtube-player" type="text/html" width="'+this.clientWidth+'" height="'+this.clientHeight+'" src="'+eU+"?autoplay=1&rel=0&egm=0&iv_load_policy=3&probably_logged_in=false&hd="+hidef+'" frameborder="0"></iframe>'}function lyte(){lytes=getElementsByClassName("lyte","div");for(var a=0;a<lytes.length;a++){lyte_id=lytes[a].id;vid=lyte_id.substring(4);p=doc.getElementById(lyte_id);p.className+=" lP";pW=p.clientWidth;pH=p.clientHeight;pl=doc.createElement("div");p.appendChild(pl);p.onclick=plaYT;pl.id="lyte_"+vid;pl.className="pL";if(p.className.indexOf("audio")!==-1){setStyle(pl,"height:"+pH+"px;width:"+pW);pl.innerHTML='<img src="'+bU+"controls-"+pW+'.png" width="100%" id="ctrl" alt="" style="max-width:'+pW+'px;"/>'}else if(p.className.indexOf("playlist")!==-1){setStyle(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML='<img src="'+bU+'play.png" alt="Click to play this playlist" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/><img src="'+bU+"controls-"+pW+'.png" width="100%" id="ctrl" alt="" style="max-width:'+pW+'px;"/>';jsonUrl=scheme+"://gdata.youtube.com/feeds/api/playlists/"+vid+"?v=2&alt=json-in-script&callback=parsePL&fields=id,title,entry";loadScript(jsonUrl)}else{setStyle(pl,"height:"+pH+"px;width:"+pW+"px;background:url('"+scheme+"://img.youtube.com/vi/"+vid+"/0.jpg') no-repeat scroll center -10px rgb(0, 0, 0);background-size:contain;");pl.innerHTML='<img src="'+bU+'play.png" alt="Click to play this video" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/><img src="'+bU+"controls-"+pW+'.png" width="100%" id="ctrl" alt="" style="max-width:'+pW+'px;"/>';if(p.className.indexOf("widget")===-1){jsonUrl=scheme+"://gdata.youtube.com/feeds/api/videos/"+vid+"?fields=id,title&alt=json-in-script&callback=parseV";loadScript(jsonUrl)}}}}var doc=document;var cI="lytecss";var myUrl=doc.getElementById("lytescr").src;var bU=myUrl.substring(0,myUrl.lastIndexOf("/")+1);scheme="http";if(myUrl.indexOf("https")!=-1){scheme+="s"}if(!doc.getElementById(cI)){lk=doc.createElement("link");lk.id=cI;lk.rel="stylesheet";lk.type="text/css";lk.href=bU+"lyte.css";doc.getElementsByTagName("head")[0].appendChild(lk)}var getElementsByClassName=function(a,b,c){if(doc.getElementsByClassName){getElementsByClassName=function(a,b,c){c=c||doc;var d=c.getElementsByClassName(a),e=b?new RegExp("\\b"+b+"\\b","i"):null,f=[],g;for(var h=0,i=d.length;h<i;h+=1){g=d[h];if(!e||e.test(g.nodeName)){f.push(g)}}return f}}else if(doc.evaluate){getElementsByClassName=function(a,b,c){b=b||"*";c=c||doc;var d=a.split(" "),e="",f="http://www.w3.org/1999/xhtml",g=doc.documentElement.namespaceURI===f?f:null,h=[],i,j;for(var k=0,l=d.length;k<l;k+=1){e+="[contains(concat(' ', @class, ' '), ' "+d[k]+" ')]"}try{i=doc.evaluate(".//"+b+e,c,g,0,null)}catch(m){i=doc.evaluate(".//"+b+e,c,null,0,null)}while(j=i.iterateNext()){h.push(j)}return h}}else{getElementsByClassName=function(a,b,c){b=b||"*";c=c||doc;var d=a.split(" "),e=[],f=b==="*"&&c.all?c.all:c.getElementsByTagName(b),g,h=[],i;for(var j=0,k=d.length;j<k;j+=1){e.push(new RegExp("(^|\\s)"+d[j]+"(\\s|$)"))}for(var l=0,m=f.length;l<m;l+=1){g=f[l];i=false;for(var n=0,o=e.length;n<o;n+=1){i=e[n].test(g.className);if(!i){break}}if(i){h.push(g)}}return h}}return getElementsByClassName(a,b,c)};lyte()
lyte/lyte.css CHANGED
@@ -1 +1 @@
1
- .lyte img {border:0px;padding:0px;spacing:0px;margin:0px;display:inline;} .lL {margin:0px 0px 10px 0px;} .lyte {margin:5px 0px;} .lP {background-color:#fff;} .pL {cursor:pointer;text-align:center;overflow:hidden;position:relative;margin:0px;} .tC {position:relative;padding:5px;background-color:rgba(0,0,0,0.3);-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;} .tT {font-weight:bold;font-size:16px;color:#ffffff;font-family:sans-serif;text-align:left;} #ctrl {position:absolute;left:0px;bottom:0px;}
1
+ .lyte img {border:0px;padding:0px;spacing:0px;margin:0px;display:inline;background-color:transparent;} .lL {margin:0px 0px 10px 0px;} .lyte {margin:5px 0px;} .lP {background-color:#fff;} .pL {cursor:pointer;text-align:center;overflow:hidden;position:relative;margin:0px;} .tC {position:relative;padding:5px;background-color:rgba(0,0,0,0.3);-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;} .tT {font-weight:bold;font-size:16px;color:#ffffff;font-family:sans-serif;text-align:left;} #ctrl {position:absolute;left:0px;bottom:0px;}
lyte/lyte.js CHANGED
@@ -4,6 +4,9 @@ var cI = 'lytecss';
4
  var myUrl = doc.getElementById('lytescr').src;
5
  var bU = myUrl.substring(0,myUrl.lastIndexOf('/')+1);
6
 
 
 
 
7
  if (!doc.getElementById(cI)) {
8
  lk = doc.createElement('link');
9
  lk.id = cI;
@@ -34,13 +37,13 @@ function lyte() {
34
  } else if (p.className.indexOf('playlist') !== -1){
35
  setStyle(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
36
  pl.innerHTML = "<img src=\"" + bU + "play.png\" alt=\"Click to play this playlist\" style=\"margin-top:" + ((pH / 2) - 30) + "px;opacity:0.7;\" onmouseover=\"this.style.opacity=1;\" onmouseout=\"this.style.opacity=0.8;\"/><img src=\"" + bU + "controls-" + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
37
- jsonUrl = "http://gdata.youtube.com/feeds/api/playlists/"+ vid +"?v=2&alt=json-in-script&callback=parsePL&fields=id,title,entry"
38
  loadScript(jsonUrl)
39
  } else {
40
- setStyle(pl, 'height:' + pH + 'px;width:' + pW + 'px;background:url("http://img.youtube.com/vi/' + vid + '/0.jpg") no-repeat scroll center -10px rgb(0, 0, 0);background-size:contain;');
41
  pl.innerHTML = "<img src=\"" + bU + "play.png\" alt=\"Click to play this video\" style=\"margin-top:" + ((pH / 2) - 30) + "px;opacity:0.7;\" onmouseover=\"this.style.opacity=1;\" onmouseout=\"this.style.opacity=0.8;\"/><img src=\"" + bU + "controls-" + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
42
  if (p.className.indexOf('widget') === -1) {
43
- jsonUrl = "http://gdata.youtube.com/feeds/api/videos/" + vid + "?fields=id,title&alt=json-in-script&callback=parseV";
44
  loadScript(jsonUrl)
45
  }
46
  }
@@ -58,9 +61,9 @@ function plaYT() {
58
  }
59
 
60
  if (this.className.indexOf("playlist") === -1) {
61
- eU="http://www.youtube.com/embed/" + vid
62
  } else {
63
- eU="http://www.youtube.com/embed/p/" + vid
64
  }
65
 
66
  this.innerHTML="<iframe class=\"youtube-player\" type=\"text/html\" width=\"" + this.clientWidth + "\" height=\"" + this.clientHeight + "\" src=\""+eU+"?autoplay=1&amp;rel=0&amp;egm=0&amp;iv_load_policy=3&amp;probably_logged_in=false&amp;hd="+hidef+"\" frameborder=\"0\"></iframe>"
@@ -82,7 +85,9 @@ function parsePL(r) {
82
  pH=pl.style.height;
83
  pW=pl.style.width;
84
 
85
- setStyle(pl, 'height:' + pH + ';width:' + pW + ';background:url("'+thumb+'") no-repeat scroll center -10px rgb(0, 0, 0); background-size:contain;')
 
 
86
  drawTitle(id,title)
87
  }
88
 
4
  var myUrl = doc.getElementById('lytescr').src;
5
  var bU = myUrl.substring(0,myUrl.lastIndexOf('/')+1);
6
 
7
+ scheme="http";
8
+ if (myUrl.indexOf('https')!=-1) {scheme+="s";}
9
+
10
  if (!doc.getElementById(cI)) {
11
  lk = doc.createElement('link');
12
  lk.id = cI;
37
  } else if (p.className.indexOf('playlist') !== -1){
38
  setStyle(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
39
  pl.innerHTML = "<img src=\"" + bU + "play.png\" alt=\"Click to play this playlist\" style=\"margin-top:" + ((pH / 2) - 30) + "px;opacity:0.7;\" onmouseover=\"this.style.opacity=1;\" onmouseout=\"this.style.opacity=0.8;\"/><img src=\"" + bU + "controls-" + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
40
+ jsonUrl = scheme+"://gdata.youtube.com/feeds/api/playlists/"+ vid +"?v=2&alt=json-in-script&callback=parsePL&fields=id,title,entry"
41
  loadScript(jsonUrl)
42
  } else {
43
+ setStyle(pl, "height:" + pH + "px;width:" + pW + "px;background:url('" + scheme + "://img.youtube.com/vi/" + vid + "/0.jpg') no-repeat scroll center -10px rgb(0, 0, 0);background-size:contain;");
44
  pl.innerHTML = "<img src=\"" + bU + "play.png\" alt=\"Click to play this video\" style=\"margin-top:" + ((pH / 2) - 30) + "px;opacity:0.7;\" onmouseover=\"this.style.opacity=1;\" onmouseout=\"this.style.opacity=0.8;\"/><img src=\"" + bU + "controls-" + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
45
  if (p.className.indexOf('widget') === -1) {
46
+ jsonUrl = scheme+"://gdata.youtube.com/feeds/api/videos/" + vid + "?fields=id,title&alt=json-in-script&callback=parseV";
47
  loadScript(jsonUrl)
48
  }
49
  }
61
  }
62
 
63
  if (this.className.indexOf("playlist") === -1) {
64
+ eU=scheme+"://www.youtube.com/embed/" + vid
65
  } else {
66
+ eU=scheme+"://www.youtube.com/embed/p/" + vid
67
  }
68
 
69
  this.innerHTML="<iframe class=\"youtube-player\" type=\"text/html\" width=\"" + this.clientWidth + "\" height=\"" + this.clientHeight + "\" src=\""+eU+"?autoplay=1&amp;rel=0&amp;egm=0&amp;iv_load_policy=3&amp;probably_logged_in=false&amp;hd="+hidef+"\" frameborder=\"0\"></iframe>"
85
  pH=pl.style.height;
86
  pW=pl.style.width;
87
 
88
+ if ((scheme=="https")&&(thumb.indexOf('https'==-1))) {thumb=thumb.replace("http://","https://");}
89
+
90
+ setStyle(pl, "height:" + pH + ";width:" + pW + ";background:url('" + thumb + "') no-repeat scroll center -10px rgb(0, 0, 0); background-size:contain;")
91
  drawTitle(id,title)
92
  }
93
 
options.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
- $plugin_dir = basename(dirname(__FILE__)).'/languages';
3
- load_plugin_textdomain( 'wp-youtube-lyte', false, $plugin_dir );
4
-
5
- $wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
6
 
7
  add_action('admin_menu', 'lyte_create_menu');
8
 
@@ -21,14 +19,12 @@ function register_lyte_settings() {
21
  }
22
 
23
  function lyte_admin_scripts() {
24
- global $wp_lyte_plugin_url;
25
- wp_enqueue_script('jqzrssfeed',$wp_lyte_plugin_url.'external/jquery.zrssfeed.min.js',array(jquery),null,true);
26
- wp_enqueue_script('jqcookie',$wp_lyte_plugin_url.'external/jquery.cookie.min.js',array(jquery),null,true);
27
  }
28
 
29
  function lyte_admin_styles() {
30
- global $wp_lyte_plugin_url;
31
- wp_enqueue_style('zrssfeed',$wp_lyte_plugin_url.'external/jquery.zrssfeed.css');
32
  }
33
 
34
  function lyte_settings_page() {
@@ -84,13 +80,14 @@ function lyte_settings_page() {
84
  </td>
85
  </tr>
86
  <tr valign="top">
87
- <th scope="row"><?php _e("Bonus feature: ","wp-youtube-lyte") ?><a href="http://blog.futtta.be/tag/donottrack" target="_blank">DoNotTrack (new version)</a></th>
88
  <td>
89
  <fieldset>
90
  <legend class="screen-reader-text"><span>Activate DoNotTrack</span></legend>
91
  <label title="Enable DoNotTrack"><input type="radio" name="donottrack" value="1" <?php if (get_option('donottrack')==="1") echo "checked" ?> /><?php _e("Disable 3rd party tracking.","wp-youtube-lyte") ?></label><br />
92
  <label title="Leave DoNotTrack disabled (default)"><input type="radio" name="donottrack" value="0" <?php if (get_option('donottrack')!=="1") echo "checked" ?> /><?php _e("I don't mind 3rd party tracking (default)","wp-youtube-lyte") ?></label>
93
  </fieldset>
 
94
  </td>
95
  </tr>
96
  </table>
1
  <?php
2
+ $plugin_dir = basename(dirname(__FILE__)).'/languages';
3
+ load_plugin_textdomain( 'wp-youtube-lyte', false, $plugin_dir );
 
 
4
 
5
  add_action('admin_menu', 'lyte_create_menu');
6
 
19
  }
20
 
21
  function lyte_admin_scripts() {
22
+ wp_enqueue_script('jqzrssfeed', plugins_url('/external/jquery.zrssfeed.min.js', __FILE__), array(jquery),null,true);
23
+ wp_enqueue_script('jqcookie', plugins_url('/external/jquery.cookie.min.js', __FILE__), array(jquery),null,true);
 
24
  }
25
 
26
  function lyte_admin_styles() {
27
+ wp_enqueue_style('zrssfeed', plugins_url('/external/jquery.zrssfeed.css', __FILE__));
 
28
  }
29
 
30
  function lyte_settings_page() {
80
  </td>
81
  </tr>
82
  <tr valign="top">
83
+ <th scope="row"><?php _e("Bonus feature: ","wp-youtube-lyte") ?><a href="http://wordpress.org/extend/plugins/wp-donottrack/" target="_blank">DoNotTrack</a></th>
84
  <td>
85
  <fieldset>
86
  <legend class="screen-reader-text"><span>Activate DoNotTrack</span></legend>
87
  <label title="Enable DoNotTrack"><input type="radio" name="donottrack" value="1" <?php if (get_option('donottrack')==="1") echo "checked" ?> /><?php _e("Disable 3rd party tracking.","wp-youtube-lyte") ?></label><br />
88
  <label title="Leave DoNotTrack disabled (default)"><input type="radio" name="donottrack" value="0" <?php if (get_option('donottrack')!=="1") echo "checked" ?> /><?php _e("I don't mind 3rd party tracking (default)","wp-youtube-lyte") ?></label>
89
  </fieldset>
90
+ <span class="description"><?php _e( "This stops tracking by Quantcast as initiated by some <a href=\"http://profiles.wordpress.org/users/automattic/profile/public/\" target=\"_blank\">Automattic plugins</a>. You can also <a href=\"http://wordpress.org/extend/plugins/wp-donottrack/\" target=\"_blank\">try out WP DoNotTrack</a>, a new plugin that provides these features and more (custom black- or whitelist, conditional DoNotTrack, ...)", "wp-donottrack" ) ?></span>
91
  </td>
92
  </tr>
93
  </table>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: futtta
3
  Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio, playlist, youtube playlist, hd, performance, accessibility, sidebar
4
  Requires at least: 2.9
5
  Tested up to: 3.3
6
- Stable tag: 0.9.3
7
 
8
  "Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
9
 
@@ -64,6 +64,13 @@ and you're good to go!
64
 
65
  == Changelog ==
66
 
 
 
 
 
 
 
 
67
  = 0.9.3 =
68
  * Bugfix: donottrack.js incorrectly handled document.write, causing javascript that depends on it to malfunction (reported by [S.K.](http://aimwa.in), thanks for helping out!)
69
  * Bugfix: moved inline javascript into a function expression to protect values (d=document) from other javascript that might use global variables (thanks to Eric McNiece of [emc2innovation.com](http://emc2innovation.com) for reporting & investigating)
3
  Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio, playlist, youtube playlist, hd, performance, accessibility, sidebar
4
  Requires at least: 2.9
5
  Tested up to: 3.3
6
+ Stable tag: 0.9.4
7
 
8
  "Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
9
 
64
 
65
  == Changelog ==
66
 
67
+ = 0.9.4 =
68
+ * security: WP YouTube Lyte now works entirely in https if your blog is running in https
69
+ * performance (js/ page rendering): initiate the javascript a little later (at "load" instead of "DOMContentLoaded") to speed up page load (might need further optimizations)
70
+ * performance (php): have the plugin [only include/ execute php when needed](http://w-shadow.com/blog/2009/02/22/make-your-plugin-faster-with-conditional-tags/)
71
+ * updated donottrack.js to match the version used in my [WP DoNotTrack-plugin](http://wordpress.org/extend/plugins/wp-donottrack/). if want to tweak the way donottrack.js functions, you migth want to [check that plugin out](http://wordpress.org/extend/plugins/wp-donottrack/) (and disable the option in WP YouTube Lyte)
72
+ * bugfix: small tweak in css to force transparency of play-button
73
+
74
  = 0.9.3 =
75
  * Bugfix: donottrack.js incorrectly handled document.write, causing javascript that depends on it to malfunction (reported by [S.K.](http://aimwa.in), thanks for helping out!)
76
  * Bugfix: moved inline javascript into a function expression to protect values (d=document) from other javascript that might use global variables (thanks to Eric McNiece of [emc2innovation.com](http://emc2innovation.com) for reporting & investigating)
widget.php CHANGED
@@ -8,7 +8,7 @@ class WYLWidget extends WP_Widget {
8
 
9
  function widget($args, $instance) {
10
  extract( $args );
11
- global $wSize, $wyl_version;
12
  $WYLtitle = apply_filters('widget_title', $instance['WYLtitle']);
13
  $WYLtext = apply_filters( 'widget_text', $instance['WYLtext'], $instance );
14
 
@@ -30,7 +30,6 @@ class WYLWidget extends WP_Widget {
30
 
31
  $WYLid="YLW_".$WYLid;
32
 
33
- $wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
34
  $lyteSettings['path']=$wp_lyte_plugin_url."lyte/";
35
  ?>
36
 
8
 
9
  function widget($args, $instance) {
10
  extract( $args );
11
+ global $wSize, $wyl_version, $wp_lyte_plugin_url;
12
  $WYLtitle = apply_filters('widget_title', $instance['WYLtitle']);
13
  $WYLtext = apply_filters( 'widget_text', $instance['WYLtext'], $instance );
14
 
30
 
31
  $WYLid="YLW_".$WYLid;
32
 
 
33
  $lyteSettings['path']=$wp_lyte_plugin_url."lyte/";
34
  ?>
35
 
wp-youtube-lyte.php CHANGED
@@ -4,20 +4,19 @@ Plugin Name: WP YouTube Lyte
4
  Plugin URI: http://blog.futtta.be/tag/lyte
5
  Description: Lite and accessible YouTube audio and video embedding.
6
  Author: Frank Goossens (futtta)
7
- Version: 0.9.3
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  Domain Path: /languages
11
  */
12
 
13
- $wyl_version="0.9.2";
14
 
15
  $plugin_dir = basename(dirname(__FILE__)).'/languages';
16
  load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
17
 
18
- $wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
19
 
20
- require_once(dirname(__FILE__).'/options.php');
21
  require_once(dirname(__FILE__).'/player_sizes.inc.php');
22
  require_once(dirname(__FILE__).'/widget.php');
23
 
@@ -53,6 +52,12 @@ function lyte_parse($the_content) {
53
  $hidefClass="";
54
  }
55
 
 
 
 
 
 
 
56
  preg_match_all("/http(a|v):\/\/([a-zA-Z0-9\-\_]+\.|)(youtube|youtu)(\.com|\.be)\/(((watch(\?v\=|\/v\/)|)([a-zA-Z0-9\-\_]{11}))|(playlist\?list\=PL([a-zA-Z0-9\-\_]{16})))([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
57
 
58
  foreach($matches as $match) {
@@ -86,12 +91,12 @@ function lyte_parse($the_content) {
86
  switch ($lyteSettings['links']) {
87
  case "0":
88
  $noscript_post="<br />".__("Watch this playlist on YouTube","wp-youtube-lyte")."&lyte;.";
89
- $noscript="<noscript><a href=\"http://youtube.com/playlist?list=PL".$vid."\">".$noscript_post."</a>.</noscript>";
90
  $lytelinks_txt="";
91
  break;
92
  default:
93
  $noscript="";
94
- $lytelinks_txt="<div class=\"lL\">".__("Watch this playlist","wp-youtube-lyte")." <a href=\"http://www.youtube.com/playlist?list=PL".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
95
  }
96
  } else if ($match[9]!="") {
97
  $plClass="";
@@ -103,37 +108,47 @@ function lyte_parse($the_content) {
103
  break;
104
  case "2":
105
  $noscript_post="";
106
- $lytelinks_txt="<div class=\"lL\">".__("Watch this video","wp-youtube-lyte")." <a href=\"http://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a> ".__("or on","wp-youtube-lyte")." <a href=\"http://icant.co.uk/easy-youtube/?http://www.youtube.com/watch?v=".$vid."\">Easy Youtube</a>.</div>";
107
  break;
108
  default:
109
  $noscript_post="";
110
- $lytelinks_txt="<div class=\"lL\">".__("Watch this video","wp-youtube-lyte")." <a href=\"http://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
111
  }
112
- $noscript="<noscript><a href=\"http://youtu.be/".$vid."\"><img src=\"http://img.youtube.com/vi/".$vid."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$divHeight."\" />".$noscript_post."</a></noscript>";
 
113
  }
114
 
115
- $lytetemplate = "<div class=\"lyte".$audioClass.$hidefClass.$plClass."\" id=\"WYL_".$vid."\" style=\"width:".$lyteSettings[2]."px;height:".$divHeight."px;\">".$noscript."<script type=\"text/javascript\"><!-- \n (function(){var d=document;if(d.addEventListener){d.addEventListener('DOMContentLoaded', insert, false)}else{window.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='".$lyteSettings['path']."lyte-min.js?wylver=".$lyteSettings['version']."';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};}()) \n --></script></div>".$lytelinks_txt;
116
  $the_content = preg_replace("/(<p>)?http(v|a):\/\/([a-zA-Z0-9\-\_]+\.|)(youtube|youtu)(\.com|\.be)\/(((watch(\?v\=|\/v\/)|)([a-zA-Z0-9\-\_]{11}))|(playlist\?list\=PL([a-zA-Z0-9\-\_]{16})))([^\s<]*)(<\/p>)?/", $lytetemplate, $the_content, 1);
117
  }
118
  }
119
  return $the_content;
120
  }
121
 
122
- add_filter('the_content', 'lyte_parse', 4);
 
 
 
 
123
 
124
  /* donottrack */
125
  $donottrack_js=$wp_lyte_plugin_url."external/donottrack-min.js";
126
 
127
  if ($_SERVER['HTTPS']) {
128
- $donottrack_js = str_replace( $donottrack_js, "http:","https:" );
129
- }
130
 
131
  function init_lyte_donottrack() {
132
  global $donottrack_js;
133
  wp_enqueue_script( 'donottrack',$donottrack_js );
134
  }
135
 
 
 
 
 
136
  if (get_option('donottrack')==="1") {
 
137
  add_action('init', 'init_lyte_donottrack');
138
  }
139
  ?>
4
  Plugin URI: http://blog.futtta.be/tag/lyte
5
  Description: Lite and accessible YouTube audio and video embedding.
6
  Author: Frank Goossens (futtta)
7
+ Version: 0.9.4
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  Domain Path: /languages
11
  */
12
 
13
+ $wyl_version="0.9.4";
14
 
15
  $plugin_dir = basename(dirname(__FILE__)).'/languages';
16
  load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
17
 
18
+ $wp_lyte_plugin_url = trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__)) . '/';
19
 
 
20
  require_once(dirname(__FILE__).'/player_sizes.inc.php');
21
  require_once(dirname(__FILE__).'/widget.php');
22
 
52
  $hidefClass="";
53
  }
54
 
55
+ if ($_SERVER['HTTPS']) {
56
+ $scheme="https";
57
+ } else {
58
+ $scheme="http";
59
+ }
60
+
61
  preg_match_all("/http(a|v):\/\/([a-zA-Z0-9\-\_]+\.|)(youtube|youtu)(\.com|\.be)\/(((watch(\?v\=|\/v\/)|)([a-zA-Z0-9\-\_]{11}))|(playlist\?list\=PL([a-zA-Z0-9\-\_]{16})))([^<\s]*)/", $the_content, $matches, PREG_SET_ORDER);
62
 
63
  foreach($matches as $match) {
91
  switch ($lyteSettings['links']) {
92
  case "0":
93
  $noscript_post="<br />".__("Watch this playlist on YouTube","wp-youtube-lyte")."&lyte;.";
94
+ $noscript="<noscript><a href=\"".$scheme."://youtube.com/playlist?list=PL".$vid."\">".$noscript_post."</a>.</noscript>";
95
  $lytelinks_txt="";
96
  break;
97
  default:
98
  $noscript="";
99
+ $lytelinks_txt="<div class=\"lL\">".__("Watch this playlist","wp-youtube-lyte")." <a href=\"".$scheme."://www.youtube.com/playlist?list=PL".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
100
  }
101
  } else if ($match[9]!="") {
102
  $plClass="";
108
  break;
109
  case "2":
110
  $noscript_post="";
111
+ $lytelinks_txt="<div class=\"lL\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$scheme."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a> ".__("or on","wp-youtube-lyte")." <a href=\"http://icant.co.uk/easy-youtube/?http://www.youtube.com/watch?v=".$vid."\">Easy Youtube</a>.</div>";
112
  break;
113
  default:
114
  $noscript_post="";
115
+ $lytelinks_txt="<div class=\"lL\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$scheme."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
116
  }
117
+
118
+ $noscript="<noscript><a href=\"".$scheme."://youtu.be/".$vid."\"><img src=\"".$scheme."//img.youtube.com/vi/".$vid."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$divHeight."\" />".$noscript_post."</a></noscript>";
119
  }
120
 
121
+ $lytetemplate = "<div class=\"lyte".$audioClass.$hidefClass.$plClass."\" id=\"WYL_".$vid."\" style=\"width:".$lyteSettings[2]."px;height:".$divHeight."px;\">".$noscript."<script type=\"text/javascript\"><!-- \n (function(){var d=document;var w=window;if(w.addEventListener){w.addEventListener('load', insert, false)}else{w.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='".$lyteSettings['path']."lyte-min.js?wylver=".$lyteSettings['version']."';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};}()) \n --></script></div>".$lytelinks_txt;
122
  $the_content = preg_replace("/(<p>)?http(v|a):\/\/([a-zA-Z0-9\-\_]+\.|)(youtube|youtu)(\.com|\.be)\/(((watch(\?v\=|\/v\/)|)([a-zA-Z0-9\-\_]{11}))|(playlist\?list\=PL([a-zA-Z0-9\-\_]{16})))([^\s<]*)(<\/p>)?/", $lytetemplate, $the_content, 1);
123
  }
124
  }
125
  return $the_content;
126
  }
127
 
128
+ if ( is_admin() ) {
129
+ require_once(dirname(__FILE__).'/options.php');
130
+ } else {
131
+ add_filter('the_content', 'lyte_parse', 4);
132
+ }
133
 
134
  /* donottrack */
135
  $donottrack_js=$wp_lyte_plugin_url."external/donottrack-min.js";
136
 
137
  if ($_SERVER['HTTPS']) {
138
+ $donottrack_js = str_replace( "http:","https:",$donottrack_js );
139
+ }
140
 
141
  function init_lyte_donottrack() {
142
  global $donottrack_js;
143
  wp_enqueue_script( 'donottrack',$donottrack_js );
144
  }
145
 
146
+ function lyte_donottrack_config() {
147
+ echo "<script type=\"text/javascript\">var dnt_config={ifdnt:\"\",mode:\"blacklist\",black:[\"media6degrees.com\",\"quantserve.com\"],white:[]};</script>\n";
148
+ }
149
+
150
  if (get_option('donottrack')==="1") {
151
+ add_action('wp_print_scripts', 'lyte_donottrack_config');
152
  add_action('init', 'init_lyte_donottrack');
153
  }
154
  ?>