Logo Slider - Version 1.0

Version Description

Download this release

Release Info

Developer EnigmaWeb
Plugin Icon 128x128 Logo Slider
Version 1.0
Comparing to
See all releases

Version 1.0

assets/banner-772x250.jpg ADDED
Binary file
assets/screenshot-1.jpg ADDED
Binary file
assets/screenshot-2.jpg ADDED
Binary file
trunk/arrows/arrow1-prev.png ADDED
Binary file
trunk/arrows/arrow1.png ADDED
Binary file
trunk/arrows/arrow2-prev.png ADDED
Binary file
trunk/arrows/arrow2.png ADDED
Binary file
trunk/arrows/arrow3-prev.png ADDED
Binary file
trunk/arrows/arrow3.png ADDED
Binary file
trunk/arrows/arrow4-prev.png ADDED
Binary file
trunk/arrows/arrow4.png ADDED
Binary file
trunk/arrows/arrow5-prev.png ADDED
Binary file
trunk/arrows/arrow5.png ADDED
Binary file
trunk/arrows/arrow6-prev.png ADDED
Binary file
trunk/arrows/arrow6.png ADDED
Binary file
trunk/arrows/arrow7-prev.png ADDED
Binary file
trunk/arrows/arrow7.png ADDED
Binary file
trunk/icon.png ADDED
Binary file
trunk/jquery.cycle.all.min.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Logo Slider Plugin (with Transition Definitions)
3
+ * Examples and documentation at: http://jquery.malsup.com/cycle/
4
+ * Copyright (c) 2007-2010 M. Alsup
5
+ * Version: 2.99 (12-MAR-2011)
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://jquery.malsup.com/license.html
8
+ * Requires: jQuery v1.3.2 or later
9
+ */
10
+ (function($){var ver="2.99";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){$.fn.cycle.debug&&log(s);}function log(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "));}$.expr[":"].paused=function(el){return el.cyclePause;};$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.backwards);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts.backwards);},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,!options.backwards);}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,!opts.backwards);});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.cssAfter=opts.cssAfter||{};opts.cssFirst=opts.cssFirst||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);$($slides[first]).css(opts.cssFirst);if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="none"?0:opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length){opts.after[0].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$s.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=0;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){opts.busy=0;$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing("+fx+"); currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.backwards);},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while(opts.fx!="none"&&(t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,1);};$.fn.cycle.prev=function(opts){advance(opts,0);};function advance(opts,moveForward){var val=moveForward?1:-1;var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,moveForward);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v&&v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();if(typeof opts.cssBefore.opacity=="undefined"){opts.cssBefore.opacity=1;}opts.cssBefore.display="block";if(opts.slideResize&&w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(opts.slideResize&&h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,function(){cb();});};$l.animate(opts.animOut,speedOut,easeOut,function(){$l.css(opts.cssAfter);if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:false,animIn:null,animOut:null,autostop:0,autostopCount:0,backwards:false,before:null,cleartype:!$.support.opacity,cleartypeNoBg:false,containerResize:1,continuous:0,cssAfter:null,cssBefore:null,delay:0,easeIn:null,easeOut:null,easing:null,end:null,fastOnEvent:0,fit:0,fx:"fade",fxFn:null,height:"auto",manualTrump:true,next:null,nowrap:0,onPagerEvent:null,onPrevNextEvent:null,pager:null,pagerAnchorBuilder:null,pagerEvent:"click.cycle",pause:0,pauseOnPagerHover:0,prev:null,prevNextEvent:"click.cycle",random:0,randomizeEffects:1,requeueOnImageNotLoaded:true,requeueTimeout:250,rev:0,shuffle:null,slideExpr:null,slideResize:1,speed:1000,speedIn:null,speedOut:null,startingSlide:0,sync:1,timeout:4000,timeoutFn:null,updateActivePagerLink:null};})(jQuery);
11
+ /*
12
+ * jQuery Cycle Plugin Transition Definitions
13
+ * This script is a plugin for the jQuery Cycle Plugin
14
+ * Examples and documentation at: http://malsup.com/jquery/cycle/
15
+ * Copyright (c) 2007-2010 M. Alsup
16
+ * Version: 2.73
17
+ * Dual licensed under the MIT and GPL licenses:
18
+ * http://www.opensource.org/licenses/mit-license.php
19
+ * http://www.gnu.org/licenses/gpl.html
20
+ */
21
+ (function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.fadeout=function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css({display:"block",opacity:1});opts.before.push(function(curr,next,opts,w,h,rev){$(curr).css("zIndex",opts.slideCount+(!rev===true?1:0));$(next).css("zIndex",opts.slideCount+(!rev===true?0:1));});opts.animIn.opacity=1;opts.animOut.opacity=0;opts.cssBefore.opacity=1;opts.cssBefore.display="block";opts.cssAfter.zIndex=0;};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore.top=h;opts.cssBefore.left=0;opts.cssFirst.top=0;opts.animIn.top=0;opts.animOut.top=-h;};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst.top=0;opts.cssBefore.top=-h;opts.cssBefore.left=0;opts.animIn.top=0;opts.animOut.top=h;};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst.left=0;opts.cssBefore.left=w;opts.cssBefore.top=0;opts.animIn.left=0;opts.animOut.left=0-w;};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst.left=0;opts.cssBefore.left=-w;opts.cssBefore.top=0;opts.animIn.left=0;opts.animOut.left=w;};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){if(opts.rev){fwd=!fwd;}$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst.left=0;opts.cssBefore.top=0;opts.animIn.left=0;opts.animOut.top=0;};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){if(opts.rev){fwd=!fwd;}$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst.top=0;opts.cssBefore.left=0;opts.animIn.top=0;opts.animOut.left=0;};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore.left=0;opts.cssBefore.top=0;opts.cssBefore.width=0;opts.animIn.width="show";opts.animOut.width=0;};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore.left=0;opts.cssBefore.top=0;opts.cssBefore.height=0;opts.animIn.height="show";opts.animOut.height=0;};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){if(opts.rev){fwd=!fwd;}var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};$.extend(opts.cssBefore,{display:"block",opacity:1,top:0,left:0});};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;opts.animOut.width=next.cycleW;});opts.cssFirst.top=0;opts.cssBefore.left=0;opts.cssBefore.height=0;opts.animIn.top=0;opts.animOut.height=0;};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst.top=0;opts.cssBefore.left=0;opts.cssBefore.top=0;opts.cssBefore.height=0;opts.animOut.height=0;};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore.top=0;opts.cssBefore.width=0;opts.animIn.left=0;opts.animOut.width=0;};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});$.extend(opts.cssBefore,{top:0,left:0,width:0});opts.animIn.left=0;opts.animOut.width=0;};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;$.extend(opts.animIn,{top:0,left:0,width:next.cycleW,height:next.cycleH});$.extend(opts.animOut,{width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2});});opts.cssFirst.top=0;opts.cssFirst.left=0;opts.cssBefore.width=0;opts.cssBefore.height=0;};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;$.extend(opts.animIn,{top:0,left:0,width:next.cycleW,height:next.cycleH});});opts.cssBefore.width=0;opts.cssBefore.height=0;opts.animOut.opacity=0;};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore.left=w;opts.cssBefore.top=0;opts.animIn.left=0;opts.animOut.left=w;};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore.top=h;opts.cssBefore.left=0;opts.animIn.top=0;opts.animOut.top=h;};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore.top=h;opts.cssBefore.left=w;opts.animIn.top=0;opts.animIn.left=0;opts.animOut.top=h;opts.animOut.left=w;};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn.left=0;opts.animIn.width=this.cycleW;opts.animOut.left=0;});opts.cssBefore.top=0;opts.cssBefore.width=0;};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn.top=0;opts.animIn.height=this.cycleH;opts.animOut.top=0;});opts.cssBefore.height=0;opts.cssBefore.left=0;};$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn.left=0;opts.animIn.width=this.cycleW;opts.animOut.left=curr.cycleW/2;opts.animOut.width=0;});opts.cssBefore.top=0;opts.cssBefore.width=0;};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn.top=0;opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH/2;opts.animOut.height=0;});opts.cssBefore.height=0;opts.cssBefore.left=0;};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn.left=0;opts.animIn.top=0;opts.cssBefore.top=0;opts.cssBefore.left=0;};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn.left=0;opts.animIn.top=0;opts.cssBefore.top=0;opts.cssBefore.left=0;};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){$.extend(opts.animOut,{left:w*2,top:-h/2,opacity:0});}else{opts.animOut.opacity=0;}});opts.cssBefore.left=0;opts.cssBefore.top=0;opts.animIn.left=0;};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});$.extend(opts.cssBefore,{display:"block",opacity:1,top:0,left:0});opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);
trunk/logo-slider.php ADDED
@@ -0,0 +1,522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Logo Slider
4
+ Plugin URI: http://www.wordpress.org/extend/plugins/logo-slider
5
+ Description: Add a logo slideshow carousel to your site quicky and easily. Embedd in any post/page using shortcode <code>[logo-slider]</code> or to your theme with <code>logo_slider();</code>
6
+ Version: 1.0
7
+ Author: Enigma Digital
8
+ Author URI: http://www.enigmaweb.com.au/
9
+ */
10
+
11
+
12
+ /*
13
+ ///////////////////////////////////////////////
14
+ This section defines the variables that
15
+ will be used throughout the plugin
16
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
17
+ */
18
+ // define our defaults (filterable)
19
+ $wp_logo_defaults = apply_filters('wp_logo_defaults', array(
20
+
21
+ 'custom_css' => 'You can write your custom CSS here.',
22
+ 'arrow' => 1,
23
+ 'bgcolour' => '#FFFFFF',
24
+ 'slider_width' => 450,
25
+ 'slider_height' => 198,
26
+ 'num_img' => 2,
27
+
28
+ ));
29
+
30
+ // pull the settings from the db
31
+ $wp_logo_slider_settings = get_option('wp_logo_slider_settings');
32
+ $wp_logo_slider_images = get_option('wp_logo_slider_images');
33
+
34
+ // fallback
35
+ $wp_logo_slider_settings = wp_parse_args($wp_logo_slider_settings, $wp_logo_defaults);
36
+
37
+
38
+ /*
39
+ ///////////////////////////////////////////////
40
+ This section hooks the proper functions
41
+ to the proper actions in WordPress
42
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
43
+ */
44
+
45
+ // this function registers our settings in the db
46
+ add_action('admin_init', 'wp_logo_register_settings');
47
+ function wp_logo_register_settings() {
48
+ register_setting('wp_logo_slider_images', 'wp_logo_slider_images', 'wp_logo_images_validate');
49
+ register_setting('wp_logo_slider_settings', 'wp_logo_slider_settings', 'wp_logo_settings_validate');
50
+ }
51
+ // this function adds the settings page to the Appearance tab
52
+ add_action('admin_menu', 'wp_logo_slider_menu');
53
+ function wp_logo_slider_menu() {
54
+
55
+
56
+ $page_title = 'Logo Slider';
57
+ $menu_title = 'Logo Slider';
58
+ $capability = 'manage_options';
59
+ $menu_slug = 'wp_logo_slider';
60
+ $function = 'wp_logo_slider';
61
+ $icon = plugin_dir_url( __FILE__ ).'icon.png';
62
+ add_menu_page($page_title,$menu_title,$capability,$menu_slug,$function,$icon);
63
+
64
+ }
65
+
66
+ // add "Settings" link to plugin page
67
+ add_filter('plugin_action_links_' . plugin_basename(__FILE__) , 'wp_logo_plugin_action_links');
68
+ function wp_logo_plugin_action_links($links) {
69
+ $wp_logo_settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'upload.php?page=wp_logo_slider' ), __('Settings') );
70
+ array_unshift($links, $wp_logo_settings_link);
71
+ return $links;
72
+ }
73
+
74
+
75
+ /*
76
+ ///////////////////////////////////////////////
77
+ this function is the code that gets loaded when the
78
+ settings page gets loaded by the browser. It calls
79
+ functions that handle image uploads and image settings
80
+ changes, as well as producing the visible page output.
81
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
82
+ */
83
+ function wp_logo_slider() {
84
+ echo '<div class="wrap">';
85
+
86
+ // handle image upload, if necessary
87
+ if($_REQUEST['action'] == 'wp_handle_upload')
88
+ wp_logo_handle_upload();
89
+
90
+ // delete an image, if necessary
91
+ if(isset($_REQUEST['delete']))
92
+ wp_logo_delete_upload($_REQUEST['delete']);
93
+
94
+ // the image management form
95
+ wp_logo_images_admin();
96
+
97
+ // the settings management form
98
+ wp_logo_settings_admin();
99
+
100
+ echo '</div>';
101
+ }
102
+
103
+
104
+ /*
105
+ ///////////////////////////////////////////////
106
+ this section handles uploading images, adding
107
+ the image data to the database, deleting images,
108
+ and deleting image data from the database.
109
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
110
+ */
111
+ // this function handles the file upload,
112
+ // resize/crop, and adds the image data to the db
113
+ function wp_logo_handle_upload() {
114
+ global $wp_logo_slider_settings, $wp_logo_slider_images;
115
+
116
+ // upload the image
117
+ $upload = wp_handle_upload($_FILES['logo_images'], 0);
118
+
119
+ // extract the $upload array
120
+ extract($upload);
121
+
122
+ // the URL of the directory the file was loaded in
123
+ $upload_dir_url = str_replace(basename($file), '', $url);
124
+
125
+ // get the image dimensions
126
+ list($width, $height) = getimagesize($file);
127
+
128
+ // if the uploaded file is NOT an image
129
+ if(strpos($type, 'image') === FALSE) {
130
+ unlink($file); // delete the file
131
+ echo '<div class="error" id="message"><p>Sorry, but the file you uploaded does not seem to be a valid image. Please try again.</p></div>';
132
+ return;
133
+ }
134
+
135
+ /*// if the image doesn't meet the minimum width/height requirements ...
136
+ if($width < $wp_logo_slider_settings['slider_width'] || $height < $wp_logo_slider_settings['slider_height']) {
137
+ unlink($file); // delete the image
138
+ echo '<div class="error" id="message"><p>Sorry, but this image does not meet the minimum height/width requirements. Please upload another image</p></div>';
139
+ return;
140
+ }*/
141
+
142
+ // if the image is larger than the width/height requirements, then scale it down.
143
+ if($width > $wp_logo_slider_settings['slider_width'] || $height > $wp_logo_slider_settings['slider_height']) {
144
+ // resize the image
145
+ $resized = image_resize($file, $wp_logo_slider_settings['slider_width'], $wp_logo_slider_settings['slider_height'], true, 'resized');
146
+ $resized_url = $upload_dir_url . basename($resized);
147
+ // delete the original
148
+ unlink($file);
149
+ $file = $resized;
150
+ $url = $resized_url;
151
+ }
152
+
153
+ // make the thumbnail
154
+ $thumb_height = round((100 * $wp_logo_slider_settings['slider_height']) / $wp_logo_slider_settings['slider_width']);
155
+ if(isset($upload['file'])) {
156
+ $thumbnail = image_resize($file, 100, $thumb_height, true, 'thumb');
157
+ $thumbnail_url = $upload_dir_url . basename($thumbnail);
158
+ }
159
+
160
+ // use the timestamp as the array key and id
161
+ $time = date('YmdHis');
162
+
163
+ // add the image data to the array
164
+ $wp_logo_slider_images[$time] = array(
165
+ 'id' => $time,
166
+ 'file' => $file,
167
+ 'file_url' => $url,
168
+ 'thumbnail' => $thumbnail,
169
+ 'thumbnail_url' => $thumbnail_url,
170
+ 'slide_title' => '',
171
+ 'slide_desc' => '',
172
+ 'image_links_to' => ''
173
+ );
174
+
175
+ // add the image information to the database
176
+ $wp_logo_slider_images['update'] = 'Added';
177
+ update_option('wp_logo_slider_images', $wp_logo_slider_images);
178
+ }
179
+
180
+ // this function deletes the image,
181
+ // and removes the image data from the db
182
+ function wp_logo_delete_upload($id) {
183
+ global $wp_logo_slider_images;
184
+
185
+ // if the ID passed to this function is invalid,
186
+ // halt the process, and don't try to delete.
187
+ if(!isset($wp_logo_slider_images[$id])) return;
188
+
189
+ // delete the image and thumbnail
190
+ unlink($wp_logo_slider_images[$id]['file']);
191
+ unlink($wp_logo_slider_images[$id]['thumbnail']);
192
+
193
+ // indicate that the image was deleted
194
+ $wp_logo_slider_images['update'] = 'Deleted';
195
+
196
+ // remove the image data from the db
197
+ unset($wp_logo_slider_images[$id]);
198
+ update_option('wp_logo_slider_images', $wp_logo_slider_images);
199
+ }
200
+
201
+
202
+ /*
203
+ ///////////////////////////////////////////////
204
+ these two functions check to see if an update
205
+ to the data just occurred. if it did, then they
206
+ will display a notice, and reset the update option.
207
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
208
+ */
209
+ // this function checks to see if we just updated the settings
210
+ // if so, it displays the "updated" message.
211
+ function wp_logo_slider_settings_update_check() {
212
+ global $wp_logo_slider_settings;
213
+ if(isset($wp_logo_slider_settings['update'])) {
214
+ echo '<div class="updated fade" id="message"><p>Wordpress Logo Slider Settings <strong>'.$wp_logo_slider_settings['update'].'</strong></p></div>';
215
+ unset($wp_logo_slider_settings['update']);
216
+ update_option('wp_logo_slider_settings', $wp_logo_slider_settings);
217
+ }
218
+ }
219
+ // this function checks to see if we just added a new image
220
+ // if so, it displays the "updated" message.
221
+ function wp_logo_slider_images_update_check() {
222
+ global $wp_logo_slider_images;
223
+ if($wp_logo_slider_images['update'] == 'Added' || $wp_logo_slider_images['update'] == 'Deleted' || $wp_logo_slider_images['update'] == 'Updated') {
224
+ echo '<div class="updated fade" id="message"><p>Image(s) '.$wp_logo_slider_images['update'].' Successfully</p></div>';
225
+ unset($wp_logo_slider_images['update']);
226
+ update_option('wp_logo_slider_images', $wp_logo_slider_images);
227
+ }
228
+ }
229
+
230
+
231
+ /*
232
+ ///////////////////////////////////////////////
233
+ these two functions display the front-end code
234
+ on the admin page. it's mostly form markup.
235
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
236
+ */
237
+ // display the images administration code
238
+ function wp_logo_images_admin() { ?>
239
+ <?php global $wp_logo_slider_images; ?>
240
+ <?php wp_logo_slider_images_update_check(); ?>
241
+ <h2><?php _e('Wordpress LogoSlider Images', 'wp_LogoSlider'); ?></h2>
242
+
243
+ <table class="form-table">
244
+ <tr valign="top"><th scope="row">Upload New Image</th>
245
+ <td>
246
+ <form enctype="multipart/form-data" method="post" action="?page=wp_logo_slider">
247
+ <input type="hidden" name="post_id" id="post_id" value="0" />
248
+ <input type="hidden" name="action" id="action" value="wp_handle_upload" />
249
+
250
+ <label for="logo_images">Select a File: </label>
251
+ <input type="file" name="logo_images" id="logo_images" />
252
+ <input type="submit" class="button-primary" name="html-upload" value="Upload" />
253
+ </form>
254
+ </td>
255
+ </tr>
256
+ </table><br />
257
+
258
+ <?php if(!empty($wp_logo_slider_images)) : ?>
259
+ <table class="widefat fixed" cellspacing="0">
260
+ <thead>
261
+ <tr>
262
+ <th scope="col" class="column-slug">Image</th>
263
+ <th scope="col">Image Links To</th>
264
+ <th scope="col" class="column-slug">Actions</th>
265
+ </tr>
266
+ </thead>
267
+
268
+ <tfoot>
269
+ <tr>
270
+ <th scope="col" class="column-slug">Image</th>
271
+ <th scope="col">Image Links To</th>
272
+ <th scope="col" class="column-slug">Actions</th>
273
+ </tr>
274
+ </tfoot>
275
+
276
+ <tbody>
277
+
278
+ <form method="post" action="options.php">
279
+ <?php settings_fields('wp_logo_slider_images'); ?>
280
+ <?php foreach((array)$wp_logo_slider_images as $image => $data) : ?>
281
+ <tr>
282
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][id]" value="<?php echo $data['id']; ?>" />
283
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][file]" value="<?php echo $data['file']; ?>" />
284
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][file_url]" value="<?php echo $data['file_url']; ?>" />
285
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][thumbnail]" value="<?php echo $data['thumbnail']; ?>" />
286
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][thumbnail_url]" value="<?php echo $data['thumbnail_url']; ?>" />
287
+ <th scope="row" class="column-slug"><img src="<?php echo $data['thumbnail_url']; ?>" /></th>
288
+ <td><input type="text" name="wp_logo_slider_images[<?php echo $image; ?>][image_links_to]" value="<?php echo $data['image_links_to']; ?>" size="30" /></td>
289
+ <td class="column-slug"><input type="submit" class="button-primary" value="Update" /> <a href="?page=wp_logo_slider&amp;delete=<?php echo $image; ?>" class="button">Delete</a></td>
290
+ </tr>
291
+ <?php endforeach; ?>
292
+ <input type="hidden" name="wp_logo_slider_images[update]" value="Updated" />
293
+ </form>
294
+
295
+ </tbody>
296
+ </table>
297
+ <?php endif; ?>
298
+
299
+ <?php
300
+ }
301
+
302
+ // display the settings administration code
303
+ function wp_logo_settings_admin() { ?>
304
+
305
+ <?php wp_logo_slider_settings_update_check(); ?>
306
+ <h2><?php _e('Wordpress Logo Slider Settings', 'wp-LogoSlider'); ?></h2>
307
+ <form method="post" action="options.php">
308
+ <?php settings_fields('wp_logo_slider_settings'); ?>
309
+ <?php global $wp_logo_slider_settings; $options = $wp_logo_slider_settings; ?>
310
+ <table class="form-table">
311
+ <tr><th scope="row">Size</th>
312
+ <td>Width: <input type="text" name="wp_logo_slider_settings[slider_width]" value="<?php echo $options['slider_width'] ?>" size="4" /> Height: <input type="text" name="wp_logo_slider_settings[slider_height]" value="<?php echo $options['slider_height'] ?>" size="4" />
313
+
314
+ <tr><th scope="row">Images Per Slide</th>
315
+ <td><input type="text" name="wp_logo_slider_settings[num_img]" value="<?php echo $options['num_img'] ?>" size="4" /> <small>How many logos to slide through when user clicks an arrow</small></td>
316
+ </tr>
317
+ <tr><th scope="row">Background Colour</th>
318
+ <td><input type="text" name="wp_logo_slider_settings[bgcolour]" value="<?php echo $options['bgcolour'] ?>" /> <small>Format: #FFFFFF</small></td>
319
+ </tr>
320
+ <tr><th scope="row">Arrow Style</th>
321
+ <td id="arrow-style">
322
+
323
+ <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow1.png" width="28" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="1" <?php if($options['arrow']==1){echo 'checked="checked"';}?> /></p>
324
+ <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow2.png" width="31" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="2" <?php if($options['arrow']==2){echo 'checked="checked"';}?>/></p>
325
+ <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow3.png" width="34" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="3" <?php if($options['arrow']==3){echo 'checked="checked"';}?>/></p>
326
+ <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow4.png" width="34" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="4" <?php if($options['arrow']==4){echo 'checked="checked"';}?>/></p>
327
+ <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow5.png" width="24" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="5" <?php if($options['arrow']==5){echo 'checked="checked"';}?>/></p>
328
+ <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow6.png" width="36" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="6" <?php if($options['arrow']==6){echo 'checked="checked"';}?>/></p>
329
+ <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow7.png" width="38" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="7" <?php if($options['arrow']==7){echo 'checked="checked"';}?>/></p>
330
+
331
+ </td>
332
+ </tr>
333
+ <tr valign="top"><th scope="row">Custom CSS</th>
334
+ <td><textarea name="wp_logo_slider_settings[custom_css]" rows="6" cols="70"><?php echo $options['custom_css']; ?></textarea></td>
335
+ </tr>
336
+ <input type="hidden" name="wp_logo_slider_settings[update]" value="UPDATED" />
337
+
338
+ </table>
339
+ <p class="submit">
340
+ <input type="submit" class="button-primary" value="<?php _e('Save Settings') ?>" />
341
+ </form>
342
+
343
+ <!-- The Reset Option -->
344
+ <form method="post" action="options.php">
345
+ <?php settings_fields('wp_logo_slider_settings'); ?>
346
+ <?php global $wp_logo_defaults; // use the defaults ?>
347
+ <?php foreach((array)$wp_logo_defaults as $key => $value) : ?>
348
+ <input type="hidden" name="wp_logo_slider_settings[<?php echo $key; ?>]" value="<?php echo $value; ?>" />
349
+ <?php endforeach; ?>
350
+ <input type="hidden" name="wp_logo_slider_settings[update]" value="RESET" />
351
+ <input type="submit" class="button" value="<?php _e('Reset Settings') ?>" />
352
+ </form>
353
+ <!-- End Reset Option -->
354
+ </p>
355
+
356
+ <?php
357
+ }
358
+
359
+
360
+ /*
361
+ ///////////////////////////////////////////////
362
+ these two functions sanitize the data before it
363
+ gets stored in the database via options.php
364
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
365
+ */
366
+ // this function sanitizes our settings data for storage
367
+ function wp_logo_settings_validate($input) {
368
+ $input['slider_width'] = intval($input['slider_width']);
369
+ $input['slider_height'] = intval($input['slider_height']);
370
+ $input['num_img'] = intval($input['num_img']);
371
+ $input['arrow'] = intval($input['arrow']);
372
+ $input['custom_css'] = wp_filter_nohtml_kses($input['custom_css']);
373
+ $input['bgcolour'] = wp_filter_nohtml_kses($input['bgcolour']);
374
+
375
+ return $input;
376
+ }
377
+ // this function sanitizes our image data for storage
378
+ function wp_logo_images_validate($input) {
379
+ foreach((array)$input as $key => $value) {
380
+ if($key != 'update') {
381
+ $input[$key]['file_url'] = clean_url($value['file_url']);
382
+ $input[$key]['thumbnail_url'] = clean_url($value['thumbnail_url']);
383
+
384
+ if($value['image_links_to'])
385
+ $input[$key]['image_links_to'] = clean_url($value['image_links_to']);
386
+
387
+ }
388
+ }
389
+ return $input;
390
+ }
391
+
392
+ /*
393
+ ///////////////////////////////////////////////
394
+ this final section generates all the code that
395
+ is displayed on the front-end of the WP Theme
396
+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
397
+ */
398
+ function logo_slider($args = array(), $content = null) {
399
+ global $wp_logo_slider_settings, $wp_logo_slider_images;
400
+ // possible future use
401
+ $args = wp_parse_args($args, $wp_logo_slider_settings);
402
+ $newline = "\n"; // line break
403
+ echo '<div id="logo-slider-wraper">';
404
+
405
+
406
+ $data_chunks = array_chunk($wp_logo_slider_images, $wp_logo_slider_settings['num_img']);
407
+ echo '<ul id="logo-slider">';
408
+ foreach ($data_chunks as $data_chunk) {
409
+ echo '<li class="slide">';
410
+ foreach($data_chunk as $data) {
411
+ if($data['image_links_to'])
412
+ echo '<a href="'.$data['image_links_to'].'">';
413
+ echo '<img src="'.$data['file_url'].'" class="logo-img" alt="" />';
414
+
415
+ if($data['image_links_to'])
416
+ echo '</a>';
417
+ }
418
+ echo '</li>';
419
+ }
420
+ echo '</ul>';
421
+
422
+
423
+ echo '</div>';
424
+
425
+ }
426
+
427
+ // create the shortcode [wp_LogoSlider]
428
+ add_shortcode('logo-slider', 'wp_slider_shortcode');
429
+ function wp_slider_shortcode($atts) {
430
+
431
+ // Temp solution, output buffer the echo function.
432
+ ob_start();
433
+ logo_slider();
434
+ $output = ob_get_clean();
435
+
436
+ return $output;
437
+
438
+ }
439
+
440
+ add_action('wp_print_scripts', 'wp_LogoSlider_scripts');
441
+ function wp_LogoSlider_scripts() {
442
+ if(!is_admin())
443
+ wp_enqueue_script('cycle', WP_CONTENT_URL.'/plugins/logo-slider/jquery.cycle.all.min.js', array('jquery'), '', true);
444
+ }
445
+
446
+ add_action('wp_footer', 'wp_slider_args', 15);
447
+ function wp_slider_args() {
448
+ global $wp_logo_slider_settings; ?>
449
+
450
+
451
+ <script type="text/javascript">
452
+ jQuery(document).ready(function($) {
453
+ $('#logo-slider').before('<div class="slider-controls"><a href="#" id="prev">&lt;</a> <a href="#" id="next">&gt;</a></div>').cycle({
454
+ timeout: 0,
455
+ fx: 'scrollHorz',
456
+ next: '#prev',
457
+ prev: '#next',
458
+ });
459
+ });
460
+ </script>
461
+
462
+
463
+ <?php }
464
+
465
+ add_action( 'wp_head', 'wp_logo_slider_style' );
466
+ function wp_logo_slider_style() {
467
+ global $wp_logo_slider_settings;
468
+ global $options;
469
+ ?>
470
+
471
+ <style type="text/css" media="screen">
472
+ <?php
473
+ echo $wp_logo_slider_settings['custom_css'];
474
+ ?>
475
+ #logo-slider-wraper{
476
+ position:relative;
477
+
478
+ }
479
+ .slider-controls{
480
+ position:relative;
481
+ width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px;
482
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 20 ?>px;
483
+
484
+ }
485
+ #logo-slider {
486
+ position: relative;
487
+ width: <?php echo $wp_logo_slider_settings['slider_width']; ?>px;
488
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
489
+ margin: 0; padding: 0;
490
+ overflow: hidden;
491
+ list-style:none;
492
+ }
493
+ .slide{
494
+ list-style:none;
495
+ margin:0 !important;
496
+ width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px !important;
497
+ }
498
+ .slider-controls a{
499
+ height:40px;
500
+ width:40px;
501
+ display:inline-block;
502
+ text-indent:-9000px;
503
+ }
504
+ #prev{
505
+ background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'.png'; ?>) no-repeat center;
506
+ float:right;
507
+ margin-right:-50px;
508
+ }
509
+ #next{
510
+ background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'-prev.png'; ?>) no-repeat center;
511
+ float:left;
512
+ margin-left:-50px
513
+ }
514
+ </style>
515
+
516
+ <?php }
517
+ add_action( 'admin_enqueue_scripts', 'admin_styles' );
518
+ function admin_styles(){ ?>
519
+ <style type="text/css" media="screen">
520
+ #arrow-style p{ float:left; height:60px; width:40px; text-align:center; margin-right:16px;}
521
+ </style>
522
+ <?php }
trunk/readme.txt ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Logo Slider ===
2
+ Contributors: EnigmaWeb
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CEJ9HFWJ94BG4
4
+ Tags: logo slide, logo slideshow, logo slide show, logo carousel, image carousel, logo slider, sponsors, logo showcase
5
+ Requires at least: 3.1
6
+ Tested up to: 3.5.1
7
+ Stable tag: trunk
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Showcase logos in stylish slideshow carousel.
12
+
13
+ == Description ==
14
+
15
+ Add a logo slideshow carousel to your site quickly and easily. Embed in any post/page using shortcode `[logo-slider]` or in your theme with `logo_slider();`
16
+
17
+ Perfect for displaying a list of sponsor or client logos.
18
+
19
+ = Features =
20
+ * Simple and light weight
21
+ * Nice selection of arrow icons
22
+ * Easy to customise (height, width, number of images before slide etc)
23
+ * Easy image uploader
24
+ * Ability to add links to each logo if you want
25
+
26
+ = Demo =
27
+
28
+ [Click here](http://demo.enigmaweb.com.au/logo-slider/) to see Logo Slider in action.
29
+
30
+ == Installation ==
31
+
32
+ 1. Upload the `logo-slider` folder to the `/wp-content/plugins/` directory
33
+ 1. Activate Logo Slider plugin through the 'Plugins' menu in WordPress
34
+ 1. Configure the plugin by going to the `Logo Slider` tab that appears in your admin menu.
35
+ 1. Add to any page using shortcode `[logo-slider]` or to your theme using `logo_slider();`
36
+
37
+ == Frequently Asked Questions ==
38
+
39
+ = How can I customise the design? =
40
+
41
+ You can do some basic presentation adjustments via Logo Slider tab on the admin menu. Beyond this, you can completely customise the design using CSS in the Custom CSS field on settings screen.
42
+
43
+ = The layout is broken =
44
+
45
+ It's most likely just a matter of tweaking the css.
46
+
47
+ = Where can I get support for this plugin? =
48
+
49
+ If you've tried all the obvious stuff and it's still not working please request support via the forum.
50
+
51
+ == Screenshots ==
52
+
53
+ 1. An example of Logo Slider in action
54
+ 2. The settings screen in WP-Admin
55
+
56
+ == Changelog ==
57
+
58
+ = 1.0 =
59
+ * Initial release
60
+
61
+ == Upgrade Notice ==
62
+
63
+ = 1.0 =
64
+ * Initial release
65
+
66
+
trunk/screenshot-1.jpg ADDED
Binary file
trunk/screenshot-2.jpg ADDED
Binary file