Redirection - Version 2.2.2

Version Description

Download this release

Release Info

Developer johnny5
Plugin Icon 128x128 Redirection
Version 2.2.2
Comparing to
See all releases

Code changes from version 2.1.29 to 2.2.2

2.3/jquery.js DELETED
@@ -1,20 +0,0 @@
1
- /*
2
- * jQuery JavaScript Library v1.3.2
3
- * http://jquery.com/
4
- *
5
- * Copyright (c) 2009 John Resig
6
- * Dual licensed under the MIT and GPL licenses.
7
- * http://docs.jquery.com/License
8
- *
9
- * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
10
- * Revision: 6246
11
- */
12
- (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
13
- /*
14
- * Sizzle CSS Selector Engine - v0.9.3
15
- * Copyright 2009, The Dojo Foundation
16
- * Released under the MIT, BSD, and GPL Licenses.
17
- * More information: http://sizzlejs.com/
18
- */
19
- (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
20
- jQuery.noConflict();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2.3/ui.core.js DELETED
@@ -1,10 +0,0 @@
1
- /*
2
- * jQuery UI 1.7.1
3
- *
4
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT (MIT-LICENSE.txt)
6
- * and GPL (GPL-LICENSE.txt) licenses.
7
- *
8
- * http://docs.jquery.com/UI
9
- */
10
- jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
 
 
 
 
 
 
 
 
 
 
2.3/ui.sortable.js DELETED
@@ -1,13 +0,0 @@
1
- /*
2
- * jQuery UI Sortable 1.7.1
3
- *
4
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT (MIT-LICENSE.txt)
6
- * and GPL (GPL-LICENSE.txt) licenses.
7
- *
8
- * http://docs.jquery.com/UI/Sortables
9
- *
10
- * Depends:
11
- * ui.core.js
12
- */
13
- (function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.1",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
actions/random.php CHANGED
@@ -41,7 +41,7 @@ class Random_Action extends Red_Action
41
  global $wpdb;
42
  $id = $wpdb->get_var ("SELECT ID FROM {$wpdb->prefix}posts WHERE post_status='publish' AND post_password='' AND post_type='post' ORDER BY RAND() LIMIT 0,1");
43
 
44
- $target = str_replace (get_bloginfo ('home'), '', get_permalink ($id));
45
 
46
  wp_redirect ($target, $code);
47
  exit ();
41
  global $wpdb;
42
  $id = $wpdb->get_var ("SELECT ID FROM {$wpdb->prefix}posts WHERE post_status='publish' AND post_password='' AND post_type='post' ORDER BY RAND() LIMIT 0,1");
43
 
44
+ $target = str_replace (get_bloginfo ('url'), '', get_permalink ($id));
45
 
46
  wp_redirect ($target, $code);
47
  exit ();
actions/url.php CHANGED
@@ -1,23 +1,20 @@
1
  <?php
2
 
3
- class Url_Action extends Red_Action
4
- {
5
- function can_change_code () { return true; }
 
6
 
7
- function action_codes ()
8
- {
9
- return array
10
- (
11
- 301 => get_status_header_desc (301),
12
- 302 => get_status_header_desc (302),
13
- 307 => get_status_header_desc (307)
14
  );
15
  }
16
 
17
- function process_before ($code, $target)
18
- {
19
- wp_redirect ($target, $code);
20
- exit ();
21
  }
22
  }
23
- ?>
1
  <?php
2
 
3
+ class Url_Action extends Red_Action {
4
+ function can_change_code() {
5
+ return true;
6
+ }
7
 
8
+ function action_codes() {
9
+ return array(
10
+ 301 => get_status_header_desc( 301 ),
11
+ 302 => get_status_header_desc( 302 ),
12
+ 307 => get_status_header_desc( 307 )
 
 
13
  );
14
  }
15
 
16
+ function process_before( $code, $target ) {
17
+ wp_redirect( $target, $code );
18
+ die();
 
19
  }
20
  }
 
admin.css CHANGED
@@ -621,44 +621,6 @@ background-color: #FDD1D1;
621
  font-size: 0.9em;
622
  }
623
 
624
- #subsubmenu li {
625
- display: inline;
626
- line-height: 170%;
627
- list-style: none;
628
- text-align: center;
629
- }
630
-
631
- #subsubmenu {
632
- font-size: 0.9em;
633
- background: #CDD9E2;
634
- border-bottom: none;
635
- margin: 0;
636
- color: #4F5D69;
637
- padding: 2px 2em 0 5em;
638
- }
639
-
640
- #subsubmenu .current {
641
- background: #f9fcfe;
642
- border-top: 1px solid #045290;
643
- color: black;
644
- }
645
-
646
- #subsubmenu a {
647
- border: none;
648
- color: #4F5D69;
649
- font-size: 12px;
650
- padding: 3px 1em 2px 1em;
651
- }
652
-
653
- #subsubmenu a:hover {
654
- background: #89A5BB;
655
- color: #393939;
656
- }
657
-
658
- #subsubmenu li {
659
- line-height: 150%;
660
- }
661
-
662
  .edit_url input
663
  {
664
  width: 95%;
621
  font-size: 0.9em;
622
  }
623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  .edit_url input
625
  {
626
  width: 95%;
ajax.php CHANGED
@@ -140,6 +140,7 @@ class RedirectionAjax extends Redirection_Plugin {
140
  $module->update( $this->post );
141
 
142
  $this->render_admin( 'module_item', array( 'module' => $module, 'token' => $options['token'] ) );
 
143
  }
144
  }
145
  }
@@ -228,9 +229,6 @@ class RedirectionAjax extends Redirection_Plugin {
228
  foreach ( $items[1] AS $group ) {
229
  Red_Group::delete( intval( $group ) );
230
  }
231
-
232
- $group = Red_Group::get( $group );
233
- Red_Module::flush( $group->module_id );
234
  }
235
  }
236
  }
140
  $module->update( $this->post );
141
 
142
  $this->render_admin( 'module_item', array( 'module' => $module, 'token' => $options['token'] ) );
143
+ die();
144
  }
145
  }
146
  }
229
  foreach ( $items[1] AS $group ) {
230
  Red_Group::delete( intval( $group ) );
231
  }
 
 
 
232
  }
233
  }
234
  }
fileio/csv.php CHANGED
@@ -75,29 +75,28 @@ class Red_Csv_File extends Red_FileIO
75
  return $elements;
76
  }
77
 
78
- function load ($group, $data)
79
- {
80
- // Split it into lines
81
- $lines = array_filter (explode ("\r", $data));
82
- if (count ($lines) > 0)
83
- {
84
- $count = 0;
85
-
86
- foreach ($lines AS $line)
87
- {
88
- $csv = $this->parse_csv ($line);
89
-
90
- if ($csv[0] != 'source' && $csv[1] != 'target')
91
- {
92
- Red_Item::create (array ('source' => trim ($csv[0]), 'target' => $csv[1], 'regex' => $this->is_regex ($csv[0]), 'group' => $group, 'match' => 'url', 'red_action' => $csv[2] == 0 ? 'pass' : 'url'));
 
93
  $count++;
94
  }
95
  }
96
-
97
- return $count;
98
  }
99
 
100
- return 0;
101
  }
102
 
103
  function is_regex ($url)
75
  return $elements;
76
  }
77
 
78
+ function load( $group, $data, $filename ) {
79
+ $count = 0;
80
+ $file = fopen( $filename, 'r' );
81
+
82
+ if ( $file ) {
83
+ while ( ( $csv = fgetcsv( $file, 1000, ',' ) ) ) {
84
+ if ( $csv[0] != 'source' && $csv[1] != 'target') {
85
+ Red_Item::create( array(
86
+ 'source' => trim( $csv[0] ),
87
+ 'target' => trim( $csv[1] ),
88
+ 'regex' => $this->is_regex( $csv[0] ),
89
+ 'group' => $group,
90
+ 'match' => 'url',
91
+ 'red_action' => 'url'
92
+ ) );
93
+
94
  $count++;
95
  }
96
  }
 
 
97
  }
98
 
99
+ return $count;
100
  }
101
 
102
  function is_regex ($url)
js/redirection.js CHANGED
@@ -133,11 +133,13 @@ var Redirection;
133
  if ( href.indexOf( 'admin-ajax.php' ) == -1 )
134
  href = opts.ajaxurl + '?action=red_redirect_edit&id=' + item.attr( 'id' ).substr( 5 ) + '&_ajax_nonce=' + opts.nonce;
135
 
136
- $( item ).find( ':last' ).html( opts.progress );
 
137
  $( item ).load( href, function() {
138
  // Setup cancel handler
139
  $( item ).find( 'input[name=cancel]').click( function() {
140
- $( item ).find( 'td:last' ).html( opts.progress );
 
141
  $( item ).load( href.replace( '_edit', '_load' ), function () {
142
  reset_func( type );
143
  });
@@ -150,7 +152,7 @@ var Redirection;
150
  // Form handler
151
  $( item ).find( 'form' ).ajaxForm( {
152
  beforeSubmit: function( data, form ) {
153
- $( item ).find( 'td:last' ).html( opts.progress );
154
 
155
  if ( form.find( 'input[name=status]' ).length > 0 )
156
  changestatus = form.find( 'input[name=status]' ).attr( 'checked' );
@@ -175,14 +177,17 @@ var Redirection;
175
 
176
  function modules() {
177
  // Edit module
178
- $( 'a.edit' ).unbind( 'click' ).click( function() { return form_loader( this, 'tr', modules ); } );
 
 
179
 
180
  // Reset links
181
  $( 'a.reset' ).unbind( 'click' ).click( function() {
182
  var item = $( this ).parents( 'tr' )
183
  var href = this.href;
184
 
185
- $( item ).find( 'td:last' ).html( opts.progress );
 
186
  $( item ).load( this.href, function() {
187
  modules();
188
  });
@@ -190,11 +195,12 @@ var Redirection;
190
  return false;
191
  });
192
 
193
- // Reset links
194
  $( 'a.rdelete' ).unbind( 'click' ).click( function() {
195
  var item = $( this ).parents( 'tr' )
196
 
197
- $( item ).find( 'td:last' ).html( opts.progress );
 
198
  $.get( this.href, function() {
199
  $( item ).fadeOut();
200
  });
@@ -273,6 +279,11 @@ var Redirection;
273
 
274
  return api;
275
  }
 
 
 
 
 
276
  })(jQuery);
277
 
278
  function update_user_agent (item,box)
133
  if ( href.indexOf( 'admin-ajax.php' ) == -1 )
134
  href = opts.ajaxurl + '?action=red_redirect_edit&id=' + item.attr( 'id' ).substr( 5 ) + '&_ajax_nonce=' + opts.nonce;
135
 
136
+ $( item ).find( '.operations div' ).hide();
137
+ $( item ).find( '.loader' ).show();
138
  $( item ).load( href, function() {
139
  // Setup cancel handler
140
  $( item ).find( 'input[name=cancel]').click( function() {
141
+ $( item ).find( '.loader' ).show();
142
+
143
  $( item ).load( href.replace( '_edit', '_load' ), function () {
144
  reset_func( type );
145
  });
152
  // Form handler
153
  $( item ).find( 'form' ).ajaxForm( {
154
  beforeSubmit: function( data, form ) {
155
+ $( item ).find( '.loader' ).show();
156
 
157
  if ( form.find( 'input[name=status]' ).length > 0 )
158
  changestatus = form.find( 'input[name=status]' ).attr( 'checked' );
177
 
178
  function modules() {
179
  // Edit module
180
+ $( 'a.edit' ).unbind( 'click' ).click( function() {
181
+ return form_loader( this, 'tr', modules );
182
+ } );
183
 
184
  // Reset links
185
  $( 'a.reset' ).unbind( 'click' ).click( function() {
186
  var item = $( this ).parents( 'tr' )
187
  var href = this.href;
188
 
189
+ $( item ).find( '.operations div' ).hide();
190
+ $( item ).find( '.loader' ).show();
191
  $( item ).load( this.href, function() {
192
  modules();
193
  });
195
  return false;
196
  });
197
 
198
+ // Delete links
199
  $( 'a.rdelete' ).unbind( 'click' ).click( function() {
200
  var item = $( this ).parents( 'tr' )
201
 
202
+ $( item ).find( '.operations a' ).hide();
203
+ $( item ).find( '.loader' ).show();
204
  $.get( this.href, function() {
205
  $( item ).fadeOut();
206
  });
279
 
280
  return api;
281
  }
282
+
283
+ $( document ).ready( function() {
284
+ $( '#support-annoy' ).animate( { opacity: 0.2, backgroundColor: 'red' } ).animate( { opacity: 1, backgroundColor: 'yellow' } );
285
+ } );
286
+
287
  })(jQuery);
288
 
289
  function update_user_agent (item,box)
locale/nl_NL.mo ADDED
@@ -0,0 +1,979 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Manage all your 301 redirects and monitor 404 errors
2
+ # Copyright (C) 2009 John Godley
3
+ # This file is distributed under the same license as the Redirection package.
4
+ # John Godley, http://urbangiraffe.com, 2009.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Redirection 2.1.15\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2009-06-15 08:36+0100\n"
11
+ "PO-Revision-Date: 2010-11-20 16:15+0100\n"
12
+ "Last-Translator: Pieter <pieterc@gmail.com>\n"
13
+ "Language-Team: <marlon@innoverso.nl>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
+ "X-Poedit-Language: Dutch\n"
19
+ "X-Poedit-Country: NETHERLANDS\n"
20
+
21
+ #: modules/apache.php:179
22
+ #, php-format
23
+ msgid " for external site: <code>%s</code>"
24
+ msgstr " voor externe website: <code>%s</code>"
25
+
26
+ #: models/pager.php:463
27
+ #, php-format
28
+ msgid "%d per-page"
29
+ msgstr "%d per-pagina"
30
+
31
+ #: redirection.php:305
32
+ #, php-format
33
+ msgid "%d redirection was successfully imported"
34
+ msgid_plural "%d redirections were successfully imported"
35
+ msgstr[0] "%d verwijzing was succesvol geïmporteerd"
36
+ msgstr[1] "%d verwijzingen zijn succesvol geïmporteerd"
37
+
38
+ #: view/admin/item_edit.php:3
39
+ #, php-format
40
+ msgid "%s by matching %s"
41
+ msgstr "%s door passende %s"
42
+
43
+ #: fileio/xml.php:105
44
+ #, php-format
45
+ msgid "%s imported on %s at %s"
46
+ msgstr "%s geïmporteerd op %s om %s"
47
+
48
+ #: modules/wordpress.php:205
49
+ msgid "1 minute"
50
+ msgstr "1 minuut"
51
+
52
+ #: modules/wordpress.php:205
53
+ msgid "2 minutes"
54
+ msgstr "2 minuten"
55
+
56
+ #: modules/wordpress.php:205
57
+ msgid "30 seconds"
58
+ msgstr "30 seconden"
59
+
60
+ #: models/database.php:112
61
+ #: models/module.php:169
62
+ msgid "404 Errors"
63
+ msgstr "404 Fouten"
64
+
65
+ #: modules/wordpress.php:205
66
+ msgid "5 minutes"
67
+ msgstr "5 minuten"
68
+
69
+ #: modules/404.php:57
70
+ #: modules/wordpress.php:252
71
+ msgid "<small>No options have been set</small>"
72
+ msgstr "<small>Er zijn geen opties ingesteld</small>"
73
+
74
+ #: modules/apache.php:144
75
+ msgid "<strong>Could not write to configured <code>.htaccess</code> file - check file permissions</strong>"
76
+ msgstr "<strong>Kon niet schrijven naar geconfigureerde <code>.htaccess</code> bestand - controleer bestand autorisatie</strong>"
77
+
78
+ #: modules/404.php:46
79
+ #: modules/wordpress.php:228
80
+ msgid "<strong>Disabled: You must enable <a href=\"options-permalink.php\">permalinks</a> before using this</strong>"
81
+ msgstr "<strong>Uitgeschakeld: Je moet <a href=\"options-permalink.php\">permalinks</a> inschakelen voordat je deze optie kan gebruiken</strong>"
82
+
83
+ #: modules/apache.php:151
84
+ msgid "<strong>Disabled: enter the location of an <code>.htaccess</code> file for this to be valid</strong>"
85
+ msgstr "<strong>Uitgeschakeld: voer de locatie van een <code>.htaccess</code> bestand om deze geldig te maken</strong>"
86
+
87
+ #: modules/apache.php:138
88
+ msgid "<strong>Location is invalid - check that path exists</strong>"
89
+ msgstr "<strong>Locatie is ongeldig - controleer of het pad bestaat</strong>"
90
+
91
+ #: view/admin/module_list.php:34
92
+ msgid "A module is a controlling element that determines how redirections are handled. Elements in a WordPress module are handled by WordPress, elements in an Apache module are handled by <code>.htaccess</code>, and elements in a 404 module affect how 404 errors are logged."
93
+ msgstr "Een module is een beherende element dat bepaalt hoe verwijzingen behandeld worden. Elementen in een WordPress module worden door WordPress behandeld, elementen in een Apache module worden door <code>.htaccess</code> bestanden behandeld, en elementen in een 404 module beïnvloeden hoe 404-fouten worden gelogd."
94
+
95
+ #: view/admin/options.php:47
96
+ msgid "A unique token allowing feed readers access to Redirection RSS (leave blank to auto-generate)"
97
+ msgstr "Een unieke token waarmee feed lezers toegang verkrijgen tot Redirection RSS (leeg laten om automatisch te genereren)"
98
+
99
+ #: view/admin/add.php:22
100
+ msgid "Action"
101
+ msgstr "Actie"
102
+
103
+ #: view/admin/group_list.php:104
104
+ msgid "Add"
105
+ msgstr "Toevoegen"
106
+
107
+ #: view/admin/group_list.php:93
108
+ msgid "Add Group"
109
+ msgstr "Groep Toevoegen"
110
+
111
+ #: view/admin/module_list.php:33
112
+ msgid "Add Module"
113
+ msgstr "Module Toevoegen"
114
+
115
+ #: view/admin/add.php:43
116
+ msgid "Add Redirection"
117
+ msgstr "Verwijzing Toevoegen"
118
+
119
+ #: view/admin/add.php:3
120
+ msgid "Add new redirection"
121
+ msgstr "Nieuwe verwijzing toevoegen"
122
+
123
+ #: modules/apache.php:123
124
+ msgid "Advanced: For management of external sites"
125
+ msgstr "Geavanceerd: Voor het beheren van externe websites"
126
+
127
+ #: view/admin/support.php:70
128
+ msgid "All translators will have a link to their website placed on the plugin homepage at <a href=\"http://urbangiraffe.com/plugins/redirection/\">UrbanGiraffe</a> and <a href=\"http://wordpress.org/extend/plugins/redirection/\">WordPress.org</a>, in addition to being an individual supporter."
129
+ msgstr "Alle vertalers zullen een link naar hun website krijgen op de plugin homepage op <a href=\"http://urbangiraffe.com/plugins/redirection/\">UrbanGiraffe</a> en <a href=\"http://wordpress.org/extend/plugins/redirection/\">WordPress.org</a>, naast een individuele supporter te zijn."
130
+
131
+ #: modules/apache.php:108
132
+ msgid "Allow IPs"
133
+ msgstr "IP-adressen toestaan"
134
+
135
+ #: models/database.php:111
136
+ #: models/module.php:167
137
+ #: view/admin/module_item.php:28
138
+ msgid "Apache"
139
+ msgstr "Apache"
140
+
141
+ #: view/admin/log.php:33
142
+ msgid "Apply"
143
+ msgstr "Toepassen"
144
+
145
+ #: view/admin/group_list.php:117
146
+ #: view/admin/head.php:6
147
+ #: view/admin/item_list.php:105
148
+ #: view/admin/log.php:112
149
+ msgid "Are you sure?"
150
+ msgstr "Weet je het zeker?"
151
+
152
+ #: modules/wordpress.php:205
153
+ msgid "As long as possible"
154
+ msgstr "Zo lang mogelijk"
155
+
156
+ #: view/admin/options.php:15
157
+ msgid "Auto-generate URL"
158
+ msgstr "Auto-genereer URL"
159
+
160
+ #: modules/apache.php:102
161
+ msgid "Ban IPs"
162
+ msgstr "IP-adressen blokkeren"
163
+
164
+ #: view/admin/log.php:29
165
+ msgid "Bulk Actions"
166
+ msgstr "Bulk Acties"
167
+
168
+ #: view/admin/module_item.php:26
169
+ msgid "CSV"
170
+ msgstr "CSV"
171
+
172
+ #: view/admin/group_edit.php:21
173
+ #: view/admin/item_edit.php:28
174
+ #: view/admin/module_edit.php:28
175
+ msgid "Cancel"
176
+ msgstr "Annuleren"
177
+
178
+ #: modules/apache.php:75
179
+ #: modules/wordpress.php:189
180
+ msgid "Canonical"
181
+ msgstr "Canonical"
182
+
183
+ #: view/admin/options.php:69
184
+ msgid "Category URLs"
185
+ msgstr "Categorie URLs"
186
+
187
+ #: view/admin/support.php:56
188
+ msgid "Commercial<br/>Donation"
189
+ msgstr "Commerci&euml;le<br/>Donatie"
190
+
191
+ #: view/admin/module_list.php:54
192
+ msgid "Create"
193
+ msgstr "Aanmaken"
194
+
195
+ #: view/admin/log.php:67
196
+ msgid "Date"
197
+ msgstr "Datum"
198
+
199
+ #: view/admin/group_list.php:61
200
+ #: view/admin/item_list.php:62
201
+ #: view/admin/log.php:30
202
+ #: view/admin/options.php:110
203
+ msgid "Delete"
204
+ msgstr "Verwijderen"
205
+
206
+ #: view/admin/log.php:100
207
+ msgid "Delete Logs"
208
+ msgstr "Logs Verwijderen"
209
+
210
+ #: view/admin/options.php:104
211
+ msgid "Delete Redirection"
212
+ msgstr "Verwijder Redirection"
213
+
214
+ #: view/admin/module_list.php:13
215
+ msgid "Details"
216
+ msgstr "Details"
217
+
218
+ #: view/admin/group_edit.php:15
219
+ msgid "Disabling a group will disable all items contained within it"
220
+ msgstr "Het uitschakelen van een groep zal opgenomen onderdelen ook uitschakelen"
221
+
222
+ #: models/pager.php:472
223
+ #, php-format
224
+ msgid "Displaying %s&#8211;%s of %s"
225
+ msgstr "Toon %s&#8211;%s van %s"
226
+
227
+ #: models/redirect.php:407
228
+ msgid "Do nothing"
229
+ msgstr "Niets doen"
230
+
231
+ #: view/admin/options.php:60
232
+ #: view/admin/options.php:72
233
+ msgid "Don't monitor"
234
+ msgstr "Niet monitoren"
235
+
236
+ #: view/admin/group_edit.php:14
237
+ msgid "Enabled"
238
+ msgstr "Ingeschakeld"
239
+
240
+ #: models/redirect.php:406
241
+ msgid "Error (404)"
242
+ msgstr "Fout (404)"
243
+
244
+ #: modules/apache.php:95
245
+ #: modules/wordpress.php:208
246
+ msgid "Error Level"
247
+ msgstr "Fout Niveau"
248
+
249
+ #: view/admin/options.php:37
250
+ msgid "Expire Logs"
251
+ msgstr "Logs Vervallen"
252
+
253
+ #: view/admin/log.php:101
254
+ msgid "Export to CSV"
255
+ msgstr "Exporteer naar CSV"
256
+
257
+ #: matches/user_agent.php:33
258
+ msgid "FeedBurner"
259
+ msgstr "FeedBurner"
260
+
261
+ #: view/admin/log.php:49
262
+ msgid "Filter"
263
+ msgstr "Filter"
264
+
265
+ #: matches/user_agent.php:35
266
+ msgid "FireFox"
267
+ msgstr "FireFox"
268
+
269
+ #: models/module.php:192
270
+ msgid "Force WWW"
271
+ msgstr "Forceer WWW"
272
+
273
+ #: modules/apache.php:78
274
+ #: modules/wordpress.php:192
275
+ #, php-format
276
+ msgid "Force WWW (www.%s)"
277
+ msgstr "Forceer WWW (www.%s)"
278
+
279
+ #: view/admin/support.php:71
280
+ msgid "Full details of producing a translation can be found in this <a href=\"http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/\">guide to translating WordPress plugins</a>."
281
+ msgstr "Volledige details voor het maken van een vertaling kan gevonden worden in deze <a href=\"http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/\"> gids voor het vertalen van WordPress plugins</ a>."
282
+
283
+ #: view/admin/group_list.php:68
284
+ #: view/admin/item_list.php:26
285
+ #: view/admin/item_list.php:69
286
+ msgid "Go"
287
+ msgstr "Uitvoeren"
288
+
289
+ #: view/admin/add.php:36
290
+ #: view/admin/item_list.php:16
291
+ #: view/admin/log.php:43
292
+ msgid "Group"
293
+ msgstr "Groep"
294
+
295
+ #: view/admin/module_list.php:14
296
+ #: view/admin/submenu.php:5
297
+ msgid "Groups"
298
+ msgstr "Groepen"
299
+
300
+ #: view/admin/group_list.php:6
301
+ msgid "Groups for module"
302
+ msgstr "Groepen voor module"
303
+
304
+ #: matches/referrer.php:47
305
+ #: matches/url.php:40
306
+ #: matches/user_agent.php:56
307
+ msgid "HTTP Code"
308
+ msgstr "HTTP Code"
309
+
310
+ #: view/admin/options.php:87
311
+ msgid "Here you can import redirections from an existing .htaccess file, a CSV file, or a Redirection XML."
312
+ msgstr "Hier kan je verwijzingen importeren van een bestaande .htaccess-bestand, een CSV-bestand, of een Redirection XML."
313
+
314
+ #: view/admin/group_list.php:35
315
+ #: view/admin/item_list.php:34
316
+ #: view/admin/module_list.php:16
317
+ msgid "Hits"
318
+ msgstr "Hits"
319
+
320
+ #: view/admin/options.php:33
321
+ msgid "I'm a nice person and I have helped support the author of this plugin"
322
+ msgstr "Ik ben een aardig mens en heb de auteur van deze plugin geholpen door hem te ondersteunen."
323
+
324
+ #: view/admin/log.php:70
325
+ msgid "IP"
326
+ msgstr "IP"
327
+
328
+ #: view/admin/options.php:24
329
+ msgid "IP Lookup Service"
330
+ msgstr "IP Lookup Service"
331
+
332
+ #: modules/apache.php:171
333
+ msgid "IPs are allowed"
334
+ msgstr "IP-adressen zijn toegestaan"
335
+
336
+ #: modules/apache.php:168
337
+ msgid "IPs are banned"
338
+ msgstr "IP-adressen zijn verboden"
339
+
340
+ #: view/admin/support.php:13
341
+ msgid "If you are using this plugin in a commercial setup, or feel that it's been particularly useful, then you may want to consider a <strong>commercial donation</strong>."
342
+ msgstr "Als je deze plugin in een zakelijke omgeving gebruikt, of voelt dat het bijzonder nuttig is geweest, dan wil je misschien een <strong>zakelijke donatie</ strong> overwegen."
343
+
344
+ #: view/admin/support.php:62
345
+ msgid "If you're multi-lingual then you may want to consider donating a translation:"
346
+ msgstr "Als je meertalig bent zou je een schenking van een vertaling willen overwegen:"
347
+
348
+ #: view/admin/options.php:85
349
+ msgid "Import"
350
+ msgstr "Importeer"
351
+
352
+ #: view/admin/options.php:94
353
+ msgid "Import into"
354
+ msgstr "Importeer in"
355
+
356
+ #: view/admin/support.php:36
357
+ msgid "Individual<br/>Donation"
358
+ msgstr "Individuele<br/>Donatie"
359
+
360
+ #: matches/user_agent.php:34
361
+ msgid "Internet Explorer"
362
+ msgstr "Internet Explorer"
363
+
364
+ #: view/admin/module_list.php:15
365
+ msgid "Items"
366
+ msgstr "Items"
367
+
368
+ #: view/admin/item_list.php:33
369
+ msgid "Last Access"
370
+ msgstr "Laatste Toegang"
371
+
372
+ #: modules/apache.php:78
373
+ #: modules/apache.php:84
374
+ #: modules/wordpress.php:192
375
+ #: modules/wordpress.php:197
376
+ msgid "Leave as is"
377
+ msgstr "In de huidige toestand laten"
378
+
379
+ #: modules/apache.php:65
380
+ msgid "Location"
381
+ msgstr "Locatie"
382
+
383
+ #: view/admin/submenu.php:7
384
+ msgid "Log"
385
+ msgstr "Log"
386
+
387
+ #: modules/404.php:37
388
+ msgid "Log 404s"
389
+ msgstr "Log 404 Fouten"
390
+
391
+ #: matches/login.php:37
392
+ #: matches/login.php:39
393
+ msgid "Logged In"
394
+ msgstr "Ingelogd"
395
+
396
+ #: matches/login.php:47
397
+ #: matches/login.php:49
398
+ msgid "Logged Out"
399
+ msgstr "Uitgelogd"
400
+
401
+ #: view/admin/add.php:16
402
+ msgid "Match"
403
+ msgstr "Match op"
404
+
405
+ #: matches/referrer.php:63
406
+ #: matches/referrer.php:65
407
+ #: matches/user_agent.php:74
408
+ #: matches/user_agent.php:76
409
+ msgid "Matched"
410
+ msgstr "Gevonden"
411
+
412
+ #: modules/apache.php:89
413
+ msgid "Memory Limit"
414
+ msgstr "Geheugen Limiet"
415
+
416
+ #: models/database.php:119
417
+ msgid "Modified posts"
418
+ msgstr "Bijgewerkte berichten"
419
+
420
+ #: view/admin/group_list.php:15
421
+ #: view/admin/log.php:38
422
+ msgid "Module"
423
+ msgstr "Module"
424
+
425
+ #: view/admin/module_list.php:6
426
+ #: view/admin/submenu.php:6
427
+ msgid "Modules"
428
+ msgstr "Modules"
429
+
430
+ #: view/admin/options.php:64
431
+ msgid "Monitor new posts"
432
+ msgstr "Nieuwe berichten monitoren"
433
+
434
+ #: view/admin/group_list.php:63
435
+ #: view/admin/item_list.php:64
436
+ msgid "Move To"
437
+ msgstr "Verplaatsen Naar"
438
+
439
+ #: view/admin/group_edit.php:6
440
+ #: view/admin/group_list.php:36
441
+ #: view/admin/group_list.php:99
442
+ #: view/admin/module_edit.php:18
443
+ #: view/admin/module_list.php:41
444
+ msgid "Name"
445
+ msgstr "Naam"
446
+
447
+ #: models/pager.php:405
448
+ msgid "Next"
449
+ msgstr "Volgende"
450
+
451
+ #: matches/user_agent.php:39
452
+ msgid "Nintendo Wii"
453
+ msgstr "Nintendo Wii"
454
+
455
+ #: modules/apache.php:97
456
+ msgid "No errors"
457
+ msgstr "Geen fouten"
458
+
459
+ #: view/admin/group_list.php:116
460
+ #: view/admin/head.php:7
461
+ #: view/admin/item_list.php:104
462
+ #: view/admin/log.php:111
463
+ msgid "No items have been selected"
464
+ msgstr "Er zijn geen items geselecteerd"
465
+
466
+ #: redirection.php:307
467
+ msgid "No items were imported"
468
+ msgstr "Er zijn geen items geïmporteerd"
469
+
470
+ #: matches/referrer.php:73
471
+ #: matches/referrer.php:75
472
+ #: matches/user_agent.php:84
473
+ #: matches/user_agent.php:86
474
+ msgid "Not matched"
475
+ msgstr "Niet overeenkomend"
476
+
477
+ #: view/admin/options.php:100
478
+ msgid "Note that the group is ignored when uploading an XML file."
479
+ msgstr "Let op, de groep wordt bij het uploaden van een XML-bestand genegeerd."
480
+
481
+ #: view/admin/module_list.php:26
482
+ msgid "Note: Hits are dependant on log entries"
483
+ msgstr "Opmerking: Hits zijn afhankelijk van de log vermeldingen"
484
+
485
+ #: matches/user_agent.php:36
486
+ msgid "Opera"
487
+ msgstr "Opera"
488
+
489
+ #: view/admin/module_list.php:17
490
+ msgid "Operations"
491
+ msgstr "Operaties"
492
+
493
+ #: view/admin/options.php:6
494
+ #: view/admin/submenu.php:8
495
+ msgid "Options"
496
+ msgstr "Opties"
497
+
498
+ #: models/redirect.php:405
499
+ msgid "Pass-through"
500
+ msgstr "Pass-through"
501
+
502
+ #: redirection.php:116
503
+ msgid "Please read the documentation and FAQ, and check the bug tracker, before asking a question."
504
+ msgstr "Lees de documentatie en FAQ, en controleer de bug tracker, alvorens een vraag te stellen."
505
+
506
+ #: redirection.php:352
507
+ msgid "Please specify a group name"
508
+ msgstr "Stel aub een groepsnaam in"
509
+
510
+ #: view/admin/head.php:3
511
+ msgid "Please wait..."
512
+ msgstr "Even wachten aub..."
513
+
514
+ #: view/admin/options.php:30
515
+ msgid "Plugin Support"
516
+ msgstr "Plugin Ondersteuning"
517
+
518
+ #: view/admin/item_list.php:36
519
+ msgid "Position"
520
+ msgstr "Plaats"
521
+
522
+ #: view/admin/options.php:57
523
+ msgid "Post &amp; Page URLs"
524
+ msgstr "Bericht &amp; Pagina URLs"
525
+
526
+ #: models/pager.php:404
527
+ msgid "Previous"
528
+ msgstr "Vorige"
529
+
530
+ #: view/admin/log.php:94
531
+ msgid "Process Current Logs"
532
+ msgstr "Verwerk Huidige Logs"
533
+
534
+ #: view/admin/module_item.php:29
535
+ msgid "RSS"
536
+ msgstr "RSS"
537
+
538
+ #: view/admin/options.php:44
539
+ msgid "RSS Token"
540
+ msgstr "RSS Token"
541
+
542
+ #: modules/apache.php:114
543
+ msgid "Raw .htaccess"
544
+ msgstr "Raw .htaccess"
545
+
546
+ #: view/admin/log_item_details.php:9
547
+ msgid "Redirect to"
548
+ msgstr "Verwijzen naar"
549
+
550
+ #: models/redirect.php:403
551
+ msgid "Redirect to URL"
552
+ msgstr "Verwijzen naar URL"
553
+
554
+ #: models/redirect.php:404
555
+ msgid "Redirect to random post"
556
+ msgstr "Verwijzing naar een willekeurig bericht"
557
+
558
+ #: view/admin/log_item_details.php:15
559
+ msgid "Redirected by"
560
+ msgstr "Verwijsd door"
561
+
562
+ #: redirection.php:178
563
+ msgid "Redirection"
564
+ msgstr "Redirection"
565
+
566
+ #: redirection.php:114
567
+ msgid "Redirection Bug Tracker"
568
+ msgstr "Redirection Bug Tracker"
569
+
570
+ #: redirection.php:112
571
+ msgid "Redirection Documentation"
572
+ msgstr "Redirection Documentatie"
573
+
574
+ #: redirection.php:115
575
+ msgid "Redirection FAQ"
576
+ msgstr "Redirection FAQ"
577
+
578
+ #: redirection.php:111
579
+ msgid "Redirection Help"
580
+ msgstr "Redirection Hulp"
581
+
582
+ #: view/admin/log.php:6
583
+ msgid "Redirection Log"
584
+ msgstr "Redirection Log"
585
+
586
+ #: view/admin/support.php:5
587
+ msgid "Redirection Support"
588
+ msgstr "Redirection Ondersteuning"
589
+
590
+ #: redirection.php:113
591
+ msgid "Redirection Support Forum"
592
+ msgstr "Redirection Ondersteuningsforum"
593
+
594
+ #: redirection.php:295
595
+ msgid "Redirection data has been deleted and the plugin disabled"
596
+ msgstr "Redirection gegevens zijn verwijderd en de plugin uitgeschakeld"
597
+
598
+ #: view/admin/support.php:9
599
+ msgid "Redirection is free to use - life is wonderful and lovely! However, it has required a great deal of time and effort to develop and if it has been useful you can help support this development by <strong>making a small donation</strong>."
600
+ msgstr "Redirection is gratis te gebruiken - het leven is prachtig en mooi! Echter heeft het veel tijd en moeite gekost om te ontwikkelen en indien het handig voor je is geweest kan je deze ontwikkelingen ondersteunen door <strong>het maken van een kleine donatie</strong>."
601
+
602
+ #: models/database.php:118
603
+ msgid "Redirections"
604
+ msgstr "Verwijzingen"
605
+
606
+ #: view/admin/item_list.php:6
607
+ msgid "Redirections for group"
608
+ msgstr "Verwijzingen voor groepen"
609
+
610
+ #: view/admin/submenu.php:4
611
+ msgid "Redirects"
612
+ msgstr "Verwijzingen"
613
+
614
+ #: matches/referrer.php:40
615
+ #: view/admin/log.php:69
616
+ msgid "Referrer"
617
+ msgstr "Referrer"
618
+
619
+ #: matches/referrer.php:43
620
+ #: view/admin/item_edit.php:18
621
+ msgid "Regex"
622
+ msgstr "Regex"
623
+
624
+ #: view/admin/add.php:27
625
+ msgid "Regular expression"
626
+ msgstr "Reguliere expressie"
627
+
628
+ #: view/admin/group_list.php:60
629
+ #: view/admin/item_list.php:61
630
+ msgid "Reset Hits"
631
+ msgstr "Reset Hits"
632
+
633
+ #: matches/user_agent.php:37
634
+ msgid "Safari"
635
+ msgstr "Safari"
636
+
637
+ #: view/admin/group_edit.php:20
638
+ #: view/admin/item_edit.php:27
639
+ #: view/admin/module_edit.php:27
640
+ msgid "Save"
641
+ msgstr "Opslaan"
642
+
643
+ #: view/admin/group_list.php:20
644
+ #: view/admin/item_list.php:21
645
+ #: view/admin/log.php:16
646
+ #: view/admin/log.php:23
647
+ msgid "Search"
648
+ msgstr "Zoeken"
649
+
650
+ #: view/admin/group_list.php:58
651
+ #: view/admin/item_list.php:59
652
+ msgid "Select All"
653
+ msgstr "Doorzoek Alles"
654
+
655
+ #: view/admin/options.php:105
656
+ msgid "Selecting this option will delete all redirections, all logs, and any options associated with the Redirection plugin. Make sure this is what you want to do."
657
+ msgstr "Het selecteren van deze optie zal alle verwijzingen, alle logs, en alle opties geassocieerd met de Redirection plugin verwijderen. Zorg dat je zeker weet dat dit is wat je wilt doen."
658
+
659
+ #: modules/apache.php:92
660
+ #: modules/apache.php:97
661
+ #: modules/wordpress.php:205
662
+ #: modules/wordpress.php:210
663
+ msgid "Server default"
664
+ msgstr "Server standaard"
665
+
666
+ #: redirection.php:104
667
+ msgid "Settings"
668
+ msgstr "Instellingen"
669
+
670
+ #: modules/apache.php:97
671
+ msgid "Show errors"
672
+ msgstr "Toon fouten"
673
+
674
+ #: modules/apache.php:120
675
+ msgid "Site URL"
676
+ msgstr "Website URL"
677
+
678
+ #: ajax.php:368
679
+ msgid "Sorry, but your redirection was not created"
680
+ msgstr "Sorry, maar je verwijzing was niet aangemaakt"
681
+
682
+ #: view/admin/add.php:12
683
+ #: view/admin/item_edit.php:15
684
+ #: view/admin/log.php:68
685
+ #: view/admin/log_item_details.php:4
686
+ msgid "Source URL"
687
+ msgstr "Bron URL"
688
+
689
+ #: modules/apache.php:82
690
+ #: modules/wordpress.php:195
691
+ msgid "Strip Index"
692
+ msgstr "Index Afhalen"
693
+
694
+ #: models/module.php:192
695
+ msgid "Strip WWW"
696
+ msgstr "WWW Afhalen"
697
+
698
+ #: modules/apache.php:78
699
+ #: modules/wordpress.php:192
700
+ #, php-format
701
+ msgid "Strip WWW (%s)"
702
+ msgstr "WWW Afhalen (%s)"
703
+
704
+ #: modules/apache.php:84
705
+ msgid "Strip index files (html,php)"
706
+ msgstr "Afhalen index bestanden (html,php)"
707
+
708
+ #: modules/wordpress.php:197
709
+ msgid "Strip index files (html,php,asp)"
710
+ msgstr "Afhalen index bestanden (html,php,asp)"
711
+
712
+ #: models/module.php:198
713
+ msgid "Strip index.php"
714
+ msgstr "Afhalen index.php"
715
+
716
+ #: view/admin/submenu.php:9
717
+ msgid "Support"
718
+ msgstr "Ondersteuning"
719
+
720
+ #: matches/url.php:32
721
+ #: view/admin/add.php:31
722
+ msgid "Target URL"
723
+ msgstr "Doel URL"
724
+
725
+ #: matches/login.php:32
726
+ msgid "The target URL will be chosen from one of the following URLs, depending if the user is logged in or out. Leaving a URL blank means that the user is not redirected."
727
+ msgstr "De doel-URL zal worden gekozen uit een van de volgende URL's, afhankelijk of de gebruiker is ingelogd of niet. Een URL leeg te laten betekent dat de gebruiker niet doorgestuurd wordt."
728
+
729
+ #: matches/referrer.php:57
730
+ msgid "The visitor will be redirected from the source URL if the referrer matches. You can specify a <em>matched</em> target URL as the address to send visitors if they do match, and <em>not matched</em> if they don't match. Leaving a URL blank means that the visitor is not redirected."
731
+ msgstr "De bezoeker zal vanaf de bron-URL verwezen worden als de referrer overeenkomt.Je kan een <em>overeenkomend</em> doel-URL opgeven als het adres om bezoekers te sturen indien ze overeenkomen, en <em>niet overeenkomend</em> als ze niet voldoen. Het leeg laten van een URL betekent dat de bezoeker niet doorgestuurd wordt."
732
+
733
+ #: matches/user_agent.php:67
734
+ msgid "The visitor will be redirected from the source URL if the user agent matches. You can specify a <em>matched</em> target URL as the address to send visitors if they do match, and <em>not matched</em> if they don't match. Leaving a URL blank means that the visitor is not redirected. <strong>All matches are performed as regular expressions</strong>.\n"
735
+ msgstr "De bezoeker zal verwezen worden vanaf de bron-URL als de user agent overeenkomt. Je kan een <em>overeenkomend</em> doel-URL instellen als het adres om bezoekers heen te sturen voldoen, en <em>niet overeenkomend</em> als ze niet overeenkomen. Een lege URL betekent dat de bezoeker niet wordt doorverwezen. <strong>All keuzes worden als reguliere expressies uitgevoerd</strong>.\n"
736
+
737
+ #: view/admin/log.php:85
738
+ msgid "There are no logs to display!"
739
+ msgstr "Er zijn geen logs om te tonen!"
740
+
741
+ #: view/admin/log.php:95
742
+ msgid "These actions will affect all currently available logs (i.e. your search phrase will restrict the log items)."
743
+ msgstr "Deze acties zullen voor alle momenteel beschikbare logs gelden (dwz je zoekterm zal de log items beperken)."
744
+
745
+ #: view/admin/support.php:10
746
+ msgid "This will act as an incentive for me to carry on developing, providing countless hours of support, and including new features and suggestions. You get some useful software and I get to carry on making it. Everybody wins."
747
+ msgstr "Dit stimuleert mij om door te gaan met het ontwikkelen, het leveren van talloze uren ondersteuning en het toevoegen van nieuwe functies en suggesties. Je krijgt nuttige software en ik kan door met het ontwikkelen hiervan. Iedereen wint."
748
+
749
+ #: view/admin/options.php:19
750
+ msgid "This will be used to auto-generate a URL if no URL is given. You can use the special tags $dec$ or $hex$ to have a unique ID inserted (either decimal or hex)"
751
+ msgstr "Deze zal worden gebruikt voor het automatisch genereren van een URL als niets opgegeven is. Gebruik de speciale tags $dec$ of $hex$ om een unieke ID toe te voegen (decimaal of hex)"
752
+
753
+ #: modules/wordpress.php:202
754
+ msgid "Time Limit"
755
+ msgstr "Tijdslimiet"
756
+
757
+ #: view/admin/item_edit.php:7
758
+ msgid "Title"
759
+ msgstr "Titel"
760
+
761
+ #: view/admin/group_list.php:59
762
+ #: view/admin/item_list.php:60
763
+ msgid "Toggle"
764
+ msgstr "Schakel"
765
+
766
+ #: view/admin/group_edit.php:10
767
+ msgid "Tracked"
768
+ msgstr "Getraceerd"
769
+
770
+ #: view/admin/support.php:60
771
+ msgid "Translations"
772
+ msgstr "Vertalingen"
773
+
774
+ #: view/admin/item_list.php:35
775
+ #: view/admin/module_list.php:45
776
+ msgid "Type"
777
+ msgstr "Type"
778
+
779
+ #: view/admin/item_list.php:36
780
+ msgid "URL"
781
+ msgstr "URL"
782
+
783
+ #: view/admin/options.php:52
784
+ msgid "URL Monitoring"
785
+ msgstr "URL Monitoring"
786
+
787
+ #: matches/login.php:25
788
+ msgid "URL and login status"
789
+ msgstr "URL en login status"
790
+
791
+ #: matches/referrer.php:28
792
+ msgid "URL and referrer"
793
+ msgstr "URL en verwijzing"
794
+
795
+ #: matches/user_agent.php:27
796
+ msgid "URL and user agent"
797
+ msgstr "URL en user agent"
798
+
799
+ #: matches/url.php:25
800
+ msgid "URL only"
801
+ msgstr "Alleen URL"
802
+
803
+ #: view/admin/options.php:79
804
+ msgid "Update"
805
+ msgstr "Bijwerken"
806
+
807
+ #: view/admin/options.php:97
808
+ msgid "Upload"
809
+ msgstr "Uploaden"
810
+
811
+ #: matches/user_agent.php:44
812
+ #: view/admin/log_item_details.php:20
813
+ msgid "User Agent"
814
+ msgstr "User Agent"
815
+
816
+ #: view/admin/module_item.php:24
817
+ msgid "View as"
818
+ msgstr "Bekijken als"
819
+
820
+ #: view/admin/group_edit.php:11
821
+ msgid "Whether to track 'hits' to items"
822
+ msgstr "Of het volgen van 'hits' naar items"
823
+
824
+ #: models/database.php:110
825
+ #: models/module.php:168
826
+ msgid "WordPress"
827
+ msgstr "WordPress"
828
+
829
+ #: modules/apache.php:70
830
+ #, php-format
831
+ msgid "WordPress is installed in: <code>%s</code>"
832
+ msgstr "WordPress is geïnstalleerd in: <code>%s</code>"
833
+
834
+ #: view/admin/module_item.php:27
835
+ msgid "XML"
836
+ msgstr "XML"
837
+
838
+ #: fileio/xml.php:168
839
+ msgid "XML importing is only available with PHP5 - you have PHP4."
840
+ msgstr "XML importeren is alleen beschikbaar met PHP5 - je beschikt over PHP4."
841
+
842
+ #: view/admin/options.php:53
843
+ msgid "You can have Redirection detect changes in URLs and have an automatic redirection created in a specific group."
844
+ msgstr "Je kan Redirection veranderingen laten detecteren in de URL's en automatisch verwijzingen laten aanmaken in een specifieke groep."
845
+
846
+ #: view/admin/group_list.php:88
847
+ msgid "You have no groups in this module."
848
+ msgstr "Je hebt geen groepen in deze module."
849
+
850
+ #: view/admin/module_list.php:28
851
+ msgid "You have no modules defined yet"
852
+ msgstr "Je hebt nog geen modules gedefinieerd."
853
+
854
+ #: view/admin/item_list.php:80
855
+ msgid "You have no redirections."
856
+ msgstr "Je hebt geen verwijzingen."
857
+
858
+ #: redirection.php:348
859
+ msgid "Your group was added successfully"
860
+ msgstr "Jouw groep werd succesvol toegevoegd"
861
+
862
+ #: redirection.php:325
863
+ msgid "Your logs have been deleted"
864
+ msgstr "Jouw logs zijn verwijderd"
865
+
866
+ #: redirection.php:225
867
+ msgid "Your module was not created - did you provide a name?"
868
+ msgstr "Jouw module werd niet aangemaakt - heb je een naam opgegeven?"
869
+
870
+ #: redirection.php:221
871
+ msgid "Your module was successfully created"
872
+ msgstr "Jouw module is succesvol aangemaakt"
873
+
874
+ #: redirection.php:287
875
+ msgid "Your options were updated"
876
+ msgstr "Jouw opties zijn bijgewerkt"
877
+
878
+ #: view/admin/add.php:6
879
+ msgid "Your redirection has been added."
880
+ msgstr "Jouw verwijzing is toegevoegd."
881
+
882
+ #: view/admin/options.php:40
883
+ msgid "days (enter 0 for no expiry)"
884
+ msgstr "dagen (voer een 0 in voor geen vervaldatum)"
885
+
886
+ #: view/admin/module_item.php:45
887
+ msgid "delete"
888
+ msgstr "verwijder"
889
+
890
+ #: view/admin/group_item.php:20
891
+ #: view/admin/item.php:27
892
+ msgid "disabled"
893
+ msgstr "uitgeschakeld"
894
+
895
+ #: view/admin/module_item.php:42
896
+ msgid "edit"
897
+ msgstr "bewerken"
898
+
899
+ #: view/admin/group_item.php:4
900
+ msgid "edit group"
901
+ msgstr "groep bewerken"
902
+
903
+ #: view/admin/log_item_details.php:16
904
+ msgid "for"
905
+ msgstr "voor"
906
+
907
+ #: modules/apache.php:156
908
+ msgid "force WWW"
909
+ msgstr "forceer WWW"
910
+
911
+ #: view/admin/group_list.php:25
912
+ msgid "go"
913
+ msgstr "ga"
914
+
915
+ #: matches/user_agent.php:38
916
+ msgid "iPhone"
917
+ msgstr "iPhone"
918
+
919
+ #: modules/apache.php:162
920
+ #, php-format
921
+ msgid "memory limit at %dMB"
922
+ msgstr "geheugen limiet op %dMB"
923
+
924
+ #: fileio/csv.php:21
925
+ #, php-format
926
+ msgid "module_%d.csv"
927
+ msgstr "module_%d.csv"
928
+
929
+ #: fileio/xml.php:32
930
+ #, php-format
931
+ msgid "module_%d.xml"
932
+ msgstr "module_%d.xml"
933
+
934
+ #: modules/apache.php:165
935
+ #: modules/wordpress.php:247
936
+ msgid "no errors"
937
+ msgstr "geen fouten"
938
+
939
+ #: view/admin/item_edit.php:10
940
+ msgid "optional"
941
+ msgstr "optioneel"
942
+
943
+ #: view/admin/group_list.php:74
944
+ #: view/admin/item_list.php:75
945
+ msgid "re-order"
946
+ msgstr "herordenen"
947
+
948
+ #: view/admin/module_item.php:48
949
+ msgid "reset"
950
+ msgstr "resetten"
951
+
952
+ #: view/admin/group_list.php:75
953
+ #: view/admin/item_list.php:76
954
+ msgid "save order"
955
+ msgstr "order opslaan"
956
+
957
+ #: modules/apache.php:165
958
+ #: modules/wordpress.php:247
959
+ msgid "show errors"
960
+ msgstr "toon fouten"
961
+
962
+ #: modules/apache.php:156
963
+ msgid "strip WWW"
964
+ msgstr "WWW afhalen"
965
+
966
+ #: modules/apache.php:159
967
+ #: modules/wordpress.php:236
968
+ msgid "strip index"
969
+ msgstr "index afhalen"
970
+
971
+ #: modules/wordpress.php:243
972
+ #, php-format
973
+ msgid "time limit at %ss"
974
+ msgstr "tijdslimiet op %ss"
975
+
976
+ #: modules/wordpress.php:241
977
+ msgid "time limit set as long as possible"
978
+ msgstr "tijdslimiet ingesteld op zo lang mogelijk"
979
+
locale/nl_NL.po ADDED
Binary file
matches/login.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
- * @copyright Copyright (C) John Godley
8
  **/
9
 
10
  /*
@@ -12,87 +12,87 @@
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
- consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
16
- use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17
- contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
- class Login_Match extends Red_Match
24
- {
25
- function name () { return __ ('URL and login status', 'redirection');}
 
26
 
27
- function show ()
28
- {
29
  ?>
30
  </table>
31
 
32
- <p style="padding: 0.5em"><?php _e ('The target URL will be chosen from one of the following URLs, depending if the user is logged in or out. Leaving a URL blank means that the user is not redirected.', 'redirection'); ?></p>
 
 
33
  <table class="edit">
34
  <tr>
35
  <th width="100" valign="top">
36
- <?php if (strlen ($this->url_loggedin) > 0) : ?>
37
- <a target="_blank" href="<?php echo $this->url_loggedin ?>"><?php _e ('Logged In', 'redirection'); ?>:</a>
38
  <?php else : ?>
39
- <?php _e ('Logged In', 'redirection'); ?>:
40
  <?php endif; ?>
41
  </th>
42
- <td valign="top"><input style="width: 95%" type="text" name="url_loggedin" value="<?php echo htmlspecialchars ($this->url_loggedin); ?>" id="new"/></td>
 
 
43
  </tr>
44
  <tr>
45
  <th width="100" valign="top">
46
- <?php if (strlen ($this->url_loggedout) > 0) : ?>
47
- <a target="_blank" href="<?php echo $this->url_loggedout ?>"><?php _e ('Logged Out', 'redirection'); ?>:</a>
48
  <?php else : ?>
49
- <?php _e ('Logged Out', 'redirection'); ?>:
50
  <?php endif; ?>
51
  </th>
52
  <td valign="top">
53
- <input style="width: 95%" type="text" name="url_loggedout" value="<?php echo htmlspecialchars ($this->url_loggedout); ?>" id="new"/><br/>
54
  </td>
55
  </tr>
56
  <?php
57
  }
58
 
59
- function save ($details)
60
- {
61
- if (isset ($details['target']))
62
  $details['target'] = $details;
63
- return array ('url_loggedin' => $details['url_loggedin'], 'url_loggedout' => $details['url_loggedout']);
 
 
 
 
64
  }
65
 
66
- function initialize ($url)
67
- {
68
- $this->url = array ($url, '');
69
  }
70
 
71
- function get_target ($url, $matched_url, $regex)
72
- {
73
- if (is_user_logged_in () === false)
74
  $target = $this->url_loggedout;
75
  else
76
  $target = $this->url_loggedin;
77
 
78
- if ($regex)
79
- $target = preg_replace ('@'.str_replace ('@', '\\@', $matched_url).'@', $target, $url);
80
  return $target;
81
  }
82
 
83
- function wants_it ()
84
- {
85
- if (is_user_logged_in () && strlen ($this->url_loggedin) > 0)
86
  return true;
87
- if (!is_user_logged_in () && strlen ($this->url_loggedout) > 0)
88
  return true;
89
  }
90
 
91
- function match_name ()
92
- {
93
- return sprintf ('login status', $this->user_agent);
94
  }
95
  }
96
-
97
-
98
- ?>
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
+ * @copyright Copyright( C ) John Godley
8
  **/
9
 
10
  /*
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
+ consequential damages( including, but not limited to, procurement of substitute goods or services; loss of
16
+ use, data, or profits; or business interruption ) however caused and on any theory of liability, whether in
17
+ contract, strict liability, or tort( including negligence or otherwise ) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
+ class Login_Match extends Red_Match {
24
+ function name() {
25
+ return __( 'URL and login status', 'redirection' );
26
+ }
27
 
28
+ function show() {
 
29
  ?>
30
  </table>
31
 
32
+ <p style="padding: 0.5em">
33
+ <?php _e( 'The target URL will be chosen from one of the following URLs, depending if the user is logged in or out. Leaving a URL blank means that the user is not redirected.', 'redirection' ); ?>
34
+ </p>
35
  <table class="edit">
36
  <tr>
37
  <th width="100" valign="top">
38
+ <?php if ( strlen( $this->url_loggedin ) > 0 ) : ?>
39
+ <a target="_blank" href="<?php echo esc_url( $this->url_loggedin ) ?>"><?php _e( 'Logged In', 'redirection' ); ?>:</a>
40
  <?php else : ?>
41
+ <?php _e( 'Logged In', 'redirection' ); ?>:
42
  <?php endif; ?>
43
  </th>
44
+ <td valign="top">
45
+ <input style="width: 95%" type="text" name="url_loggedin" value="<?php echo esc_attr( $this->url_loggedin ); ?>"/>
46
+ </td>
47
  </tr>
48
  <tr>
49
  <th width="100" valign="top">
50
+ <?php if ( strlen( $this->url_loggedout ) > 0 ) : ?>
51
+ <a target="_blank" href="<?php echo $this->url_loggedout ?>"><?php _e( 'Logged Out', 'redirection' ); ?>:</a>
52
  <?php else : ?>
53
+ <?php _e( 'Logged Out', 'redirection' ); ?>:
54
  <?php endif; ?>
55
  </th>
56
  <td valign="top">
57
+ <input style="width: 95%" type="text" name="url_loggedout" value="<?php echo esc_attr( $this->url_loggedout ); ?>"/><br/>
58
  </td>
59
  </tr>
60
  <?php
61
  }
62
 
63
+ function save( $details ) {
64
+ if ( isset( $details['target'] ) )
 
65
  $details['target'] = $details;
66
+
67
+ return array(
68
+ 'url_loggedin' => $details['url_loggedin'],
69
+ 'url_loggedout' => $details['url_loggedout']
70
+ );
71
  }
72
 
73
+ function initialize( $url ) {
74
+ $this->url = array( $url, '' );
 
75
  }
76
 
77
+ function get_target( $url, $matched_url, $regex ) {
78
+ if ( is_user_logged_in() === false )
 
79
  $target = $this->url_loggedout;
80
  else
81
  $target = $this->url_loggedin;
82
 
83
+ if ( $regex )
84
+ $target = preg_replace( '@'.str_replace( '@', '\\@', $matched_url ).'@', $target, $url );
85
  return $target;
86
  }
87
 
88
+ function wants_it() {
89
+ if ( is_user_logged_in() && strlen( $this->url_loggedin ) > 0 )
 
90
  return true;
91
+ if ( !is_user_logged_in() && strlen( $this->url_loggedout ) > 0 )
92
  return true;
93
  }
94
 
95
+ function match_name() {
96
+ return sprintf( 'login status', $this->user_agent );
 
97
  }
98
  }
 
 
 
matches/referrer.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
- * @copyright Copyright (C) John Godley
8
  **/
9
 
10
  /*
@@ -12,115 +12,113 @@
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
- consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
16
- use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17
- contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
- class Referrer_Match extends Red_Match
24
- {
25
  var $referrer;
26
  var $regex;
27
 
28
- function name () { return __ ('URL and referrer', 'redirection'); }
 
 
29
 
30
- function show ()
31
- {
32
- $codes = array
33
- (
34
- 301 => get_status_header_desc (301),
35
- 302 => get_status_header_desc (302),
36
- 307 => get_status_header_desc (307)
37
- );
38
  ?>
39
  <tr>
40
- <th width="100"><?php _e ('Referrer', 'redirection'); ?>:</th>
41
  <td valign="top">
42
- <input style="width: 85%" type="text" name="referrer" value="<?php echo htmlspecialchars ($this->referrer); ?>"/>
43
- <label><?php _e ('Regex', 'redirection'); ?>: <input type="checkbox" name="regex" <?php if ($this->regex == true) echo ' checked="checked"' ?>/></label>
44
  </td>
45
  </tr>
46
  <tr>
47
- <th><?php _e ('HTTP Code', 'redirection'); ?>:</th>
48
  <td>
49
  <select name="action_code">
50
- <?php foreach ($codes AS $key => $code) : ?>
51
- <option value="<?php echo $key ?>"<?php if ($key == $this->action_code) echo ' selected="selected"' ?>><?php printf ('%s - %s', $key, $code) ?></option>
52
  <?php endforeach?>
53
  </select>
54
  </td>
55
  </tr>
56
  </table>
57
- <p style="padding: 0.5em"><?php _e ('The visitor will be redirected from the source URL if the referrer matches. You can specify a <em>matched</em> target URL as the address to send visitors if they do match, and <em>not matched</em> if they don\'t match. Leaving a URL blank means that the visitor is not redirected.', 'redirection'); ?></p>
58
  <table class="edit">
59
 
60
  <tr>
61
  <th width="100" valign="top">
62
- <?php if (strlen ($this->url_from) > 0) : ?>
63
- <a target="_blank" href="<?php echo $this->url_from ?>"><?php _e ('Matched', 'redirection'); ?>:</a>
64
  <?php else : ?>
65
- <?php _e ('Matched', 'redirection'); ?>:
66
  <?php endif; ?>
67
  </th>
68
- <td valign="top"><input style="width: 95%" type="text" name="url_from" value="<?php echo htmlspecialchars ($this->url_from); ?>" id="new"/></td>
69
  </tr>
70
  <tr>
71
  <th width="100" valign="top">
72
- <?php if (strlen ($this->url_notfrom) > 0) : ?>
73
- <a target="_blank" href="<?php echo $this->url_notfrom ?>"><?php _e ('Not matched', 'redirection'); ?>:</a>
74
  <?php else : ?>
75
- <?php _e ('Not matched', 'redirection'); ?>:
76
  <?php endif; ?>
77
  </th>
78
  <td valign="top">
79
- <input style="width: 95%" type="text" name="url_notfrom" value="<?php echo htmlspecialchars ($this->url_notfrom); ?>" id="new"/><br/>
80
  </td>
81
  </tr>
82
  <?php
83
  }
84
 
85
- function save ($details)
86
- {
87
- if (isset ($details['target']))
88
  $details['url_from'] = $details['target'];
89
 
90
- return array ('url_from' => $details['url_from'], 'url_notfrom' => $details['url_notfrom'], 'regex' => isset ($details['regex']) ? true : false, 'referrer' => $details['referrer']);
 
 
 
 
 
91
  }
92
 
93
- function initialize ($url)
94
- {
95
- $this->url = array ($url, '');
96
  }
97
 
98
- function wants_it ()
99
- {
100
  // Match referrer
101
  return true;
102
  }
103
 
104
- function get_target ($url, $matched_url, $regex)
105
- {
106
  $target = false;
107
 
108
  // Check if referrer matches
109
- if (($this->regex == false && $_SERVER['HTTP_REFERER'] == $this->referrer) || ($this->regex == true && preg_match ('@'.str_replace ('@', '\\@', $this->referrer).'@', $_SERVER['HTTP_REFERER'], $matches)))
110
- {
111
  $target = $this->url_from;
112
- if ($regex)
113
- $target = preg_replace ('@'.str_replace ('@', '\\@', $matched_url).'@', $target, $url);
 
114
  }
115
- else if ($this->url_notfrom != '')
116
  $target = $this->url_notfrom;
117
  return $target;
118
  }
119
 
120
- function match_name ()
121
- {
122
- return sprintf ('referrer - <code>%s</code>', $this->referrer);
123
  }
124
  }
125
-
126
- ?>
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
+ * @copyright Copyright( C ) John Godley
8
  **/
9
 
10
  /*
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
+ consequential damages( including, but not limited to, procurement of substitute goods or services; loss of
16
+ use, data, or profits; or business interruption ) however caused and on any theory of liability, whether in
17
+ contract, strict liability, or tort( including negligence or otherwise ) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
+ class Referrer_Match extends Red_Match {
 
24
  var $referrer;
25
  var $regex;
26
 
27
+ function name() {
28
+ return __( 'URL and referrer', 'redirection' );
29
+ }
30
 
31
+ function show() {
32
+ $codes = array(
33
+ 301 => get_status_header_desc( 301 ),
34
+ 302 => get_status_header_desc( 302 ),
35
+ 307 => get_status_header_desc( 307 )
36
+ );
37
+
 
38
  ?>
39
  <tr>
40
+ <th width="100"><?php _e( 'Referrer', 'redirection' ); ?>:</th>
41
  <td valign="top">
42
+ <input style="width: 85%" type="text" name="referrer" value="<?php echo esc_attr( $this->referrer ); ?>"/>
43
+ <label><?php _e( 'Regex', 'redirection' ); ?>: <input type="checkbox" name="regex" <?php if ( $this->regex == true ) echo ' checked="checked"' ?>/></label>
44
  </td>
45
  </tr>
46
  <tr>
47
+ <th><?php _e( 'HTTP Code', 'redirection' ); ?>:</th>
48
  <td>
49
  <select name="action_code">
50
+ <?php foreach ( $codes AS $key => $code ) : ?>
51
+ <option value="<?php echo $key ?>"<?php if ( $key == $this->action_code ) echo ' selected="selected"' ?>><?php printf( '%s - %s', $key, $code ) ?></option>
52
  <?php endforeach?>
53
  </select>
54
  </td>
55
  </tr>
56
  </table>
57
+ <p style="padding: 0.5em"><?php _e( 'The visitor will be redirected from the source URL if the referrer matches. You can specify a <em>matched</em> target URL as the address to send visitors if they do match, and <em>not matched</em> if they don\'t match. Leaving a URL blank means that the visitor is not redirected.', 'redirection' ); ?></p>
58
  <table class="edit">
59
 
60
  <tr>
61
  <th width="100" valign="top">
62
+ <?php if ( strlen( $this->url_from ) > 0 ) : ?>
63
+ <a target="_blank" href="<?php echo esc_url( $this->url_from ) ?>"><?php _e( 'Matched', 'redirection' ); ?>:</a>
64
  <?php else : ?>
65
+ <?php _e( 'Matched', 'redirection' ); ?>:
66
  <?php endif; ?>
67
  </th>
68
+ <td valign="top"><input style="width: 95%" type="text" name="url_from" value="<?php echo esc_attr( $this->url_from ); ?>" id="new"/></td>
69
  </tr>
70
  <tr>
71
  <th width="100" valign="top">
72
+ <?php if ( strlen( $this->url_notfrom ) > 0 ) : ?>
73
+ <a target="_blank" href="<?php echo $this->url_notfrom ?>"><?php _e( 'Not matched', 'redirection' ); ?>:</a>
74
  <?php else : ?>
75
+ <?php _e( 'Not matched', 'redirection' ); ?>:
76
  <?php endif; ?>
77
  </th>
78
  <td valign="top">
79
+ <input style="width: 95%" type="text" name="url_notfrom" value="<?php echo esc_attr( $this->url_notfrom ); ?>" id="new"/><br/>
80
  </td>
81
  </tr>
82
  <?php
83
  }
84
 
85
+ function save( $details ) {
86
+ if ( isset( $details['target'] ) )
 
87
  $details['url_from'] = $details['target'];
88
 
89
+ return array(
90
+ 'url_from' => $details['url_from'],
91
+ 'url_notfrom' => $details['url_notfrom'],
92
+ 'regex' => isset( $details['regex'] ) ? true : false,
93
+ 'referrer' => $details['referrer']
94
+ );
95
  }
96
 
97
+ function initialize( $url ) {
98
+ $this->url = array( $url, '' );
 
99
  }
100
 
101
+ function wants_it() {
 
102
  // Match referrer
103
  return true;
104
  }
105
 
106
+ function get_target( $url, $matched_url, $regex ) {
 
107
  $target = false;
108
 
109
  // Check if referrer matches
110
+ if ( ( $this->regex == false && $_SERVER['HTTP_REFERER'] == $this->referrer ) ||( $this->regex == true && preg_match( '@'.str_replace( '@', '\\@', $this->referrer ).'@', $_SERVER['HTTP_REFERER'], $matches ) ) ) {
 
111
  $target = $this->url_from;
112
+
113
+ if ( $regex )
114
+ $target = preg_replace( '@'.str_replace( '@', '\\@', $matched_url ).'@', $target, $url );
115
  }
116
+ elseif ( $this->url_notfrom != '' )
117
  $target = $this->url_notfrom;
118
  return $target;
119
  }
120
 
121
+ function match_name() {
122
+ return sprintf( 'referrer - <code>%s</code>', $this->referrer );
 
123
  }
124
  }
 
 
matches/url.php CHANGED
@@ -20,51 +20,47 @@ this software, even if advised of the possibility of such damage.
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
- class URL_Match extends Red_Match
24
- {
25
- function name () { return __ ('URL only', 'redirection'); }
 
26
 
27
- function show ()
28
- {
29
- ?>
30
- <?php if ($this->action->can_perform_action ()) : ?>
31
  <tr>
32
- <th><a target="_blank" href="<?php echo $this->url ?>"><?php _e ('Target URL', 'redirection'); ?>:</a></th>
33
  <td>
34
- <input style="width: 95%" type="text" name="target" value="<?php echo htmlspecialchars ($this->url); ?>"/>
35
  </td>
36
  </tr>
37
  <?php endif; ?>
38
- <?php if ($this->action->can_change_code ()) : ?>
39
  <tr>
40
- <th><?php _e ('HTTP Code', 'redirection'); ?>:</th>
41
  <td>
42
  <select name="action_code">
43
- <?php $this->action->display_actions (); ?>
44
  </select>
45
  </td>
46
  </tr>
47
  <?php endif;
48
  }
49
 
50
- function save ($details)
51
- {
52
- if (strlen ($details['target']) == 0)
53
  $details['target'] = '/';
54
 
55
- return array ('url' => $details['target']);
56
  }
57
 
58
- function get_target ($url, $matched_url, $regex)
59
- {
60
  $target = $this->url;
61
- if ($regex)
62
- $target = preg_replace ('@'.str_replace ('@', '\\@', $matched_url).'@', $this->url, $url);
63
 
64
- if ($target == '')
65
  return $matched_url;
66
  return $target;
67
  }
68
  }
69
-
70
- ?>
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
+ class URL_Match extends Red_Match {
24
+ function name () {
25
+ return __( 'URL only', 'redirection' );
26
+ }
27
 
28
+ function show() {
29
+ ?>
30
+ <?php if ( $this->action->can_perform_action() ) : ?>
 
31
  <tr>
32
+ <th><a target="_blank" href="<?php echo esc_url( $this->url ) ?>"><?php _e( 'Target URL', 'redirection' ); ?>:</a></th>
33
  <td>
34
+ <input style="width: 95%" type="text" name="target" value="<?php echo esc_attr( $this->url ); ?>"/>
35
  </td>
36
  </tr>
37
  <?php endif; ?>
38
+ <?php if ( $this->action->can_change_code() ) : ?>
39
  <tr>
40
+ <th><?php _e( 'HTTP Code', 'redirection' ); ?>:</th>
41
  <td>
42
  <select name="action_code">
43
+ <?php $this->action->display_actions(); ?>
44
  </select>
45
  </td>
46
  </tr>
47
  <?php endif;
48
  }
49
 
50
+ function save( $details ) {
51
+ if ( strlen( $details['target'] ) == 0 )
 
52
  $details['target'] = '/';
53
 
54
+ return array( 'url' => $details['target'] );
55
  }
56
 
57
+ function get_target( $url, $matched_url, $regex ) {
 
58
  $target = $this->url;
59
+ if ( $regex )
60
+ $target = preg_replace( '@'.str_replace( '@', '\\@', $matched_url ).'@', $this->url, $url );
61
 
62
+ if ( $target == '' )
63
  return $matched_url;
64
  return $target;
65
  }
66
  }
 
 
matches/user_agent.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
- * @copyright Copyright (C) John Godley
8
  **/
9
 
10
  /*
@@ -12,121 +12,117 @@
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
- consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
16
- use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17
- contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
- class Agent_Match extends Red_Match
24
- {
25
  var $user_agent;
26
 
27
- function name () { return __ ('URL and user agent', 'redirection'); }
 
 
28
 
29
- function show ()
30
- {
31
- $defined = array
32
- (
33
- 'feedburner|feedvalidator' => __ ('FeedBurner', 'redirection'),
34
- 'MSIE' => __ ('Internet Explorer', 'redirection'),
35
- 'Firefox' => __ ('FireFox', 'redirection'),
36
- 'Opera' => __ ('Opera', 'redirection'),
37
- 'Safari' => __ ('Safari', 'redirection'),
38
- 'iPhone' => __ ('iPhone', 'redirection'),
39
- 'Wii' => __ ('Nintendo Wii', 'redirection'),
40
- );
41
 
42
  ?>
43
  <tr>
44
- <th width="100"><?php _e ('User Agent', 'redirection'); ?>:</th>
45
  <td>
46
- <input id="user_agent_<?php echo $this->id ?>" style="width: 65%" type="text" name="user_agent" value="<?php echo htmlspecialchars ($this->user_agent); ?>"/>
47
- <select style="width: 30%" onchange="return update_user_agent(this,<?php echo $this->id ?>)">
48
- <?php foreach ($defined AS $key => $value) : ?>
49
- <option value="<?php echo $key ?>"<?php if ($key == $this->user_agent) echo ' selected="selected"' ?>><?php echo $value ?></option>
50
  <?php endforeach; ?>
51
  </select>
52
  </td>
53
  </tr>
54
- <?php if ($this->action->can_change_code ()) : ?>
55
  <tr>
56
- <th><?php _e ('HTTP Code', 'redirection'); ?>:</th>
57
  <td>
58
  <select name="action_code">
59
- <?php $this->action->display_actions (); ?>
60
  </select>
61
  </td>
62
  </tr>
63
  <?php endif; ?>
64
 
65
- <?php if ($this->action->can_perform_action ()) : ?>
66
  </table>
67
- <p style="padding: 0.5em"><?php _e ('The visitor will be redirected from the source URL if the user agent matches. You can specify a <em>matched</em> target URL as the address to send visitors if they do match, and <em>not matched</em> if they don\'t match. Leaving a URL blank means that the visitor is not redirected. <strong>All matches are performed as regular expressions</strong>.
68
- ', 'redirection'); ?></p>
69
  <table class="edit">
70
 
71
  <tr>
72
  <th width="100" valign="top">
73
- <?php if (strlen ($this->url_from) > 0) : ?>
74
- <a target="_blank" href="<?php echo $this->url_from ?>"><?php _e ('Matched', 'redirection'); ?>:</a>
75
  <?php else : ?>
76
- <?php _e ('Matched', 'redirection'); ?>:
77
  <?php endif; ?>
78
  </th>
79
- <td valign="top"><input style="width: 95%" type="text" name="url_from" value="<?php echo htmlspecialchars ($this->url_from); ?>" id="new"/></td>
80
  </tr>
81
  <tr>
82
  <th width="100" valign="top">
83
- <?php if (strlen ($this->url_notfrom) > 0) : ?>
84
- <a target="_blank" href="<?php echo $this->url_notfrom ?>"><?php _e ('Not matched', 'redirection'); ?>:</a>
85
  <?php else : ?>
86
- <?php _e ('Not matched', 'redirection'); ?>:
87
  <?php endif; ?>
88
  </th>
89
  <td valign="top">
90
- <input style="width: 95%" type="text" name="url_notfrom" value="<?php echo htmlspecialchars ($this->url_notfrom); ?>" id="new"/><br/>
91
  </td>
92
  </tr>
93
  <?php endif; ?>
94
  <?php
95
  }
96
 
97
- function save ($details)
98
- {
99
- if (isset ($details['target']))
100
  $details['url_from'] = $details['target'];
101
 
102
- return array ('url_from' => $details['url_from'], 'url_notfrom' => $details['url_notfrom'], 'user_agent' => $details['user_agent']);
 
 
 
 
103
  }
104
 
105
- function initialize ($url)
106
- {
107
- $this->url = array ($url, '');
108
  }
109
 
110
- function wants_it ()
111
- {
112
  // Match referrer
113
  return true;
114
  }
115
 
116
- function get_target ($url, $matched_url, $regex)
117
- {
118
  // Check if referrer matches
119
- if (preg_match ('@'.str_replace ('@', '\\@', $this->user_agent).'@i', $_SERVER['HTTP_USER_AGENT'], $matches) > 0)
120
- return preg_replace ('@'.str_replace ('@', '\\@', $matched_url).'@', $this->url_from, $url);
121
- else if ($this->url_notfrom != '')
122
  return $this->url_notfrom;
123
  return false;
124
  }
125
 
126
- function match_name ()
127
- {
128
- return sprintf ('user agent - <code>%s</code>', $this->user_agent);
129
  }
130
  }
131
-
132
- ?>
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
+ * @copyright Copyright( C ) John Godley
8
  **/
9
 
10
  /*
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
+ consequential damages( including, but not limited to, procurement of substitute goods or services; loss of
16
+ use, data, or profits; or business interruption ) however caused and on any theory of liability, whether in
17
+ contract, strict liability, or tort( including negligence or otherwise ) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
+ class Agent_Match extends Red_Match {
 
24
  var $user_agent;
25
 
26
+ function name() {
27
+ return __( 'URL and user agent', 'redirection' );
28
+ }
29
 
30
+ function show() {
31
+ $defined = array(
32
+ 'feedburner|feedvalidator' => __( 'FeedBurner', 'redirection' ),
33
+ 'MSIE' => __( 'Internet Explorer', 'redirection' ),
34
+ 'Firefox' => __( 'FireFox', 'redirection' ),
35
+ 'Opera' => __( 'Opera', 'redirection' ),
36
+ 'Safari' => __( 'Safari', 'redirection' ),
37
+ 'iPhone' => __( 'iPhone', 'redirection' ),
38
+ 'Wii' => __( 'Nintendo Wii', 'redirection' ),
39
+ );
 
 
40
 
41
  ?>
42
  <tr>
43
+ <th width="100"><?php _e( 'User Agent', 'redirection' ); ?>:</th>
44
  <td>
45
+ <input id="user_agent_<?php echo $this->id ?>" style="width: 65%" type="text" name="user_agent" value="<?php echo esc_attr( $this->user_agent ); ?>"/>
46
+ <select style="width: 30%" onchange="return update_user_agent( this,<?php echo $this->id ?> )">
47
+ <?php foreach ( $defined AS $key => $value ) : ?>
48
+ <option value="<?php echo $key ?>"<?php if ( $key == $this->user_agent ) echo ' selected="selected"' ?>><?php echo esc_html( $value ) ?></option>
49
  <?php endforeach; ?>
50
  </select>
51
  </td>
52
  </tr>
53
+ <?php if ( $this->action->can_change_code() ) : ?>
54
  <tr>
55
+ <th><?php _e( 'HTTP Code', 'redirection' ); ?>:</th>
56
  <td>
57
  <select name="action_code">
58
+ <?php $this->action->display_actions(); ?>
59
  </select>
60
  </td>
61
  </tr>
62
  <?php endif; ?>
63
 
64
+ <?php if ( $this->action->can_perform_action() ) : ?>
65
  </table>
66
+ <p style="padding: 0.5em"><?php _e( 'The visitor will be redirected from the source URL if the user agent matches. You can specify a <em>matched</em> target URL as the address to send visitors if they do match, and <em>not matched</em> if they don\'t match. Leaving a URL blank means that the visitor is not redirected. <strong>All matches are performed as regular expressions</strong>.
67
+ ', 'redirection' ); ?></p>
68
  <table class="edit">
69
 
70
  <tr>
71
  <th width="100" valign="top">
72
+ <?php if ( strlen( $this->url_from ) > 0 ) : ?>
73
+ <a target="_blank" href="<?php echo esc_url( $this->url_from ) ?>"><?php _e( 'Matched', 'redirection' ); ?>:</a>
74
  <?php else : ?>
75
+ <?php _e( 'Matched', 'redirection' ); ?>:
76
  <?php endif; ?>
77
  </th>
78
+ <td valign="top"><input style="width: 95%" type="text" name="url_from" value="<?php echo esc_attr( $this->url_from ); ?>" id="new"/></td>
79
  </tr>
80
  <tr>
81
  <th width="100" valign="top">
82
+ <?php if ( strlen( $this->url_notfrom ) > 0 ) : ?>
83
+ <a target="_blank" href="<?php echo esc_url( $this->url_notfrom ) ?>"><?php _e( 'Not matched', 'redirection' ); ?>:</a>
84
  <?php else : ?>
85
+ <?php _e( 'Not matched', 'redirection' ); ?>:
86
  <?php endif; ?>
87
  </th>
88
  <td valign="top">
89
+ <input style="width: 95%" type="text" name="url_notfrom" value="<?php echo esc_attr( $this->url_notfrom ); ?>" id="new"/><br/>
90
  </td>
91
  </tr>
92
  <?php endif; ?>
93
  <?php
94
  }
95
 
96
+ function save( $details ) {
97
+ if ( isset( $details['target'] ) )
 
98
  $details['url_from'] = $details['target'];
99
 
100
+ return array(
101
+ 'url_from' => $details['url_from'],
102
+ 'url_notfrom' => $details['url_notfrom'],
103
+ 'user_agent' => $details['user_agent']
104
+ );
105
  }
106
 
107
+ function initialize( $url ) {
108
+ $this->url = array( $url, '' );
 
109
  }
110
 
111
+ function wants_it() {
 
112
  // Match referrer
113
  return true;
114
  }
115
 
116
+ function get_target( $url, $matched_url, $regex ) {
 
117
  // Check if referrer matches
118
+ if ( preg_match( '@'.str_replace( '@', '\\@', $this->user_agent ).'@i', $_SERVER['HTTP_USER_AGENT'], $matches ) > 0 )
119
+ return preg_replace( '@'.str_replace( '@', '\\@', $matched_url ).'@', $this->url_from, $url );
120
+ elseif ( $this->url_notfrom != '' )
121
  return $this->url_notfrom;
122
  return false;
123
  }
124
 
125
+ function match_name() {
126
+ return sprintf( 'user agent - %s', $this->user_agent );
 
127
  }
128
  }
 
 
models/database.php CHANGED
@@ -1,385 +1,210 @@
1
  <?php
2
 
3
- if (!function_exists ('get_home_path'))
4
- {
5
- function get_home_path() {
6
- $home = get_option( 'home' );
7
- if ( $home != '' && $home != get_option( 'siteurl' ) ) {
8
- $home_path = parse_url( $home );
9
- $home_path = $home_path['path'];
10
- $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
11
- $home_path = trailingslashit( $root.$home_path );
12
- } else {
13
- $home_path = ABSPATH;
14
- }
15
-
16
- return $home_path;
17
- }
18
- }
19
-
20
- class A_Redirector_URL
21
- {
22
  }
23
 
24
- class Redirector_Login
25
- {
26
  }
27
 
28
- class Redirector_LuckyDip
29
- {
30
  }
31
 
32
- class Redirector_Random
33
- {
34
  }
35
 
36
- class Redirector_Referrer
37
- {
38
  }
39
 
40
- class RE_Database
41
- {
42
- function install ()
43
- {
44
- global $wpdb;
45
-
46
- // Create database
47
- $wpdb->query ("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}redirection_items` (
48
- `id` int(11) unsigned NOT NULL auto_increment,
49
- `url` mediumtext NOT NULL,
50
- `regex` int(11) unsigned NOT NULL default '0',
51
- `position` int(11) unsigned NOT NULL default '0',
52
- `last_count` int(10) unsigned NOT NULL default '0',
53
- `last_access` datetime NOT NULL,
54
- `group_id` int(11) NOT NULL default '0',
55
- `status` enum('enabled','disabled') NOT NULL default 'enabled',
56
- `action_type` varchar(20) NOT NULL,
57
- `action_code` int(11) unsigned NOT NULL,
58
- `action_data` mediumtext,
59
- `match_type` varchar(20) NOT NULL,
60
- `title` varchar(50) NULL,
61
- PRIMARY KEY (`id`)
62
- )");
63
-
64
- $wpdb->query ("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}redirection_groups` (
65
- `id` int(11) NOT NULL auto_increment,
66
- `name` varchar(50) NOT NULL,
67
- `tracking` int(11) NOT NULL default '1',
68
- `module_id` int(11) unsigned NOT NULL default '0',
69
- `status` enum('enabled','disabled') NOT NULL default 'enabled',
70
- `position` int(11) unsigned NOT NULL default '0',
71
- PRIMARY KEY (`id`)
72
- )");
73
-
74
- $wpdb->query ("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}redirection_logs` (
75
- `id` int(11) unsigned NOT NULL auto_increment,
76
- `created` datetime NOT NULL,
77
- `url` mediumtext NOT NULL,
78
- `sent_to` mediumtext,
79
- `agent` mediumtext NOT NULL,
80
- `referrer` mediumtext,
81
- `redirection_id` int(11) unsigned default NULL,
82
- `ip` varchar(17) NOT NULL default '',
83
- `module_id` int(11) unsigned NOT NULL,
84
- `group_id` int(11) unsigned default NULL,
85
- PRIMARY KEY (`id`)
86
- )");
87
-
88
- $wpdb->query ("CREATE TABLE `{$wpdb->prefix}redirection_modules` (
89
- `id` int(11) unsigned NOT NULL auto_increment,
90
- `type` varchar(20) NOT NULL default '',
91
- `name` varchar(50) NOT NULL default '',
92
- `options` mediumtext,
93
- PRIMARY KEY (`id`)
94
- )");
95
-
96
- $this->defaults ();
97
- }
98
-
99
- function defaults ()
100
- {
101
  global $wpdb;
102
 
103
- $optionswp = '';
104
- $options404 = '';
105
- $optionsaoache = '';
106
- // $optionsapache = $wpdb->escape (serialize (array ('location' => get_home_path ().'.htaccess')));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  // Modules
109
- if ($wpdb->get_var ("SELECT COUNT(*) FROM {$wpdb->prefix}redirection_modules") == 0)
110
- {
111
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_modules (id,type,name,options) VALUES (1,'wp','".__ ('WordPress', 'redirection')."','$optionswp')");
112
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_modules (id,type,name,options) VALUES (2,'apache','".__ ('Apache', 'redirection')."','$optionsapache')");
113
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_modules (id,type,name,options) VALUES (3,'404','".__ ('404 Errors', 'redirection')."','$options404')");
114
  }
115
 
116
  // Groups
117
- if ($wpdb->get_var ("SELECT COUNT(*) FROM {$wpdb->prefix}redirection_groups") == 0)
118
- {
119
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_groups (id,name,module_id,position) VALUES (1,'".__ ('Redirections', 'redirection')."',1,0)");
120
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_groups (id,name,module_id,position) VALUES (2,'".__ ('Modified posts', 'redirection')."',1,1)");
121
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET group_id='1', status='enabled'");
122
 
123
- $options = get_option ('redirection_options');
124
  $options['monitor_post'] = 2;
125
  $options['monitor_category'] = 2;
126
 
127
- update_option ('redirection_options', $options);
128
  }
129
  }
130
 
131
- function upgrade ($current, $target)
132
- {
133
  global $wpdb;
134
 
135
- if ($current === false)
136
- $this->install ();
137
- else if ($current == '1.2')
138
- $this->upgrade_from_0 ();
139
- else if ($current == '1.7')
140
- $this->upgrade_from_1 ();
141
- else if ($current == '1.9' || $current == 'DRAINHOLE_VERSION')
142
- $this->upgrade_from_2 ();
143
- else if ($current == '2.0')
144
- $this->upgrade_from_20 ();
145
- else if ($current == '2.0.1')
146
- $this->upgrade_from_21 ();
147
- else if ($current == '2.0.2')
148
- $this->upgrade_from_22 ();
149
-
150
- if ( version_compare( $current, '2.1.16' ) == -1 )
151
- $this->upgrade_to_216();
152
-
153
- // Check that the IP field exists - some users don't have this
154
- $test = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}redirection_logs LIMIT 0,1");
155
- if ( !empty( $test ) && !isset( $test[0]->ip ) ) {
156
- @$wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD `ip` varchar(17) NOT NULL");
157
- }
158
-
159
- update_option ('redirection_version', $target);
160
- }
161
-
162
- function upgrade_from_0 ()
163
- {
164
- // Convert to new format
165
- $items = get_option ('redirection_list');
166
- if (is_array ($items) && count ($items) > 0)
167
- {
168
- foreach ($items AS $item)
169
- {
170
- $data = array ('old' => $item->url_old, 'type' => $item->type, 'red_action' => 'A_Redirector_URL', 'new' => $item->url_new);
171
- if ($item->regex)
172
- $data['regex'] = 'on';
173
-
174
- Red_Item::create ($data);
175
- }
176
-
177
- delete_option ('redirection_list');
178
  }
179
 
180
- $this->upgrade_from_1 ();
181
- $this->upgrade_from_2 ();
182
- $this->upgrade_from_21 ();
183
- $this->upgrade_from_22 ();
 
184
  }
185
 
186
- function upgrade_from_1 ()
187
- {
188
  global $wpdb;
189
 
190
- $wpdb->query ("ALTER TABLE {$wpdb->prefix}redirection CHANGE `type` `type` enum('301','302','307','404','410','pass') NOT NULL DEFAULT '301' ;");
191
-
192
- $this->upgrade_from_2 ();
193
- $this->upgrade_from_21 ();
194
- $this->upgrade_from_22 ();
195
  }
196
 
197
- function upgrade_from_2 ()
198
- {
199
  global $wpdb;
200
-
201
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection` ADD `group_id` int NOT NULL DEFAULT 0;");
202
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection` ADD `status` enum('enabled','disabled') NOT NULL DEFAULT 'enabled'");
203
- $wpdb->query ("RENAME TABLE `{$wpdb->prefix}redirection` TO `{$wpdb->prefix}redirection_items`;");
204
- $wpdb->query ("RENAME TABLE `{$wpdb->prefix}redirection_log` TO `{$wpdb->prefix}redirection_logs`;");
205
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_logs` CHANGE `redirection_id` `redirection_id` int(11) UNSIGNED DEFAULT NULL ;");
206
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD `module_id` int(11) UNSIGNED DEFAULT NULL ;");
207
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD `group_id` int(11) UNSIGNED DEFAULT NULL ;");
208
-
209
- $this->install (); // Ensure new tables are created
210
 
211
- // Merge options together
212
- $options = get_option ('redirection_options');
213
- if ($options === false)
214
- $options = array ();
215
-
216
- $options['auto_target'] = get_option ('redirection_auto_target');
217
- $options['lookup'] = get_option ('redirection_lookup');
218
 
219
- delete_option ('redirection_root');
220
- delete_option ('redirection_index');
221
- delete_option ('redirection_post');
222
- delete_option ('redirection_404_log');
223
- delete_option ('redirection_global_404');
224
- delete_option ('redirection_auto_target');
225
- delete_option ('redirection_lookup');
226
- delete_option ('redirection_updates');
227
-
228
- // Update all the redirectors
229
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD `action_type` varchar(20) NOT NULL");
230
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD `action_data` mediumtext");
231
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD `match_type` varchar(20) NOT NULL");
232
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD `action_code` int(11) UNSIGNED DEFAULT NULL");
233
-
234
- $rows = $wpdb->get_results ("SELECT id,redirector,type FROM {$wpdb->prefix}redirection_items");
235
- if ($rows)
236
- {
237
- foreach ($rows AS $row)
238
- {
239
- $obj = unserialize ($row->redirector);
240
- $data = array ();
241
-
242
- foreach ($obj AS $key => $value)
243
- $data[$key] = $value;
244
-
245
- if (count ($data) == 1 && !is_array (current ($data)))
246
- $data = current ($data);
247
-
248
- $type = strtolower (get_class ($obj));
249
- if ($type == 'a_redirector_url')
250
- {
251
- $match = 'url';
252
-
253
- if ($row->type == 'pass')
254
- $action = 'pass';
255
- else if ($row->type == '404' || $row->type == '410')
256
- $action = 'error';
257
- else
258
- $action = 'url';
259
- }
260
- else if ($type == 'redirector_login')
261
- {
262
- $match = 'login';
263
- $data = array ('url_loggedin' => $data['url'][0], 'url_loggedout' => $data['url'][1]);
264
- $data = $wpdb->escape (serialize ($data));
265
-
266
- if ($row->type == 'pass')
267
- $action = 'pass';
268
- else if ($row->type == '404' || $row->type == '410')
269
- $action = 'error';
270
- else
271
- $action = 'url';
272
- }
273
- else if ($type == 'redirector_luckydip')
274
- {
275
- $match = 'url';
276
- $action = 'random';
277
- $data = '';
278
- }
279
- else if ($type == 'redirector_random')
280
- {
281
- $match = 'url';
282
- $action = 'random';
283
- $data = '';
284
- }
285
- else if ($type == 'redirector_referrer')
286
- {
287
- $match = 'referrer';
288
- $action = 'url';
289
- $data = array ('referrer' => $data['referrer'], 'regex' => $data['regex'], 'url_from' => $data['url'][0], 'url_notfrom' => $data['url'][1]);
290
- $data = $wpdb->escape (serialize ($data));
291
-
292
- if ($row->type == 'pass')
293
- $action = 'pass';
294
- else if ($row->type == '404' || $row->type == '410')
295
- $action = 'error';
296
- else
297
- $action = 'url';
298
- }
299
-
300
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET match_type='$match', action_type='$action', action_data='$data' WHERE id='{$row->id}'");
301
- }
302
- }
303
-
304
- // Action code
305
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET action_code=type");
306
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET action_code=301 WHERE type = '301'");
307
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET action_code=302 WHERE type = '302'");
308
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET action_code=307 WHERE type = '307'");
309
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET action_code=404 WHERE type = '404'");
310
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET action_code=410 WHERE type = '410'");
311
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET action_code=301 WHERE type = 'pass'");
312
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` DROP `type`;");
313
-
314
- // Drop the old column
315
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` DROP `redirector`");
316
-
317
- // Convert log format
318
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD `ip2` varchar(17) NOT NULL");
319
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_logs SET ip2=INET_NTOA(ip)");
320
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_logs` DROP `ip`");
321
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_logs` CHANGE `ip2` `ip` varchar(17) NOT NULL DEFAULT '' ");
322
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_logs SET group_id='1', module_id='1'");
323
-
324
- update_option ('redirection_options', $options);
325
-
326
- $this->upgrade_from_21 ();
327
- $this->upgrade_from_22 ();
328
  }
329
 
330
- function upgrade_from_20 ()
331
- {
332
  global $wpdb;
333
 
334
- $this->defaults ();
335
- $this->upgrade_from_21 ();
336
- $this->upgrade_from_22 ();
337
  }
338
 
339
- function upgrade_from_21 ()
340
- {
341
  global $wpdb;
342
 
343
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD `title` varchar(50) NULL");
344
-
345
- $this->upgrade_from_22 ();
 
 
346
  }
347
 
348
- function upgrade_from_22 () {
349
  global $wpdb;
350
 
351
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` CHANGE `title` `title` varchar(50) NULL");
352
- }
353
-
354
- function upgrade_to_216() {
355
- global $wpdb;
356
 
357
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_groups` ADD INDEX (module_id)");
358
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_groups` ADD INDEX (status)");
359
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX (url(200))");
360
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX (status)");
361
- $wpdb->query ("ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX (regex)");
 
 
 
 
362
  }
363
 
364
- function remove ($plugin)
365
- {
366
  global $wpdb;
367
 
368
- $wpdb->query ("DROP TABLE IF EXISTS {$wpdb->prefix}redirection;");
369
- $wpdb->query ("DROP TABLE IF EXISTS {$wpdb->prefix}redirection_items;");
370
- $wpdb->query ("DROP TABLE IF EXISTS {$wpdb->prefix}redirection_logs;");
371
- $wpdb->query ("DROP TABLE IF EXISTS {$wpdb->prefix}redirection_groups;");
372
- $wpdb->query ("DROP TABLE IF EXISTS {$wpdb->prefix}redirection_modules;");
373
-
374
- delete_option ('redirection_lookup');
375
- delete_option ('redirection_post');
376
- delete_option ('redirection_root');
377
- delete_option ('redirection_index');
378
- delete_option ('redirection_version');
379
-
380
- $current = get_option('active_plugins');
381
- array_splice ($current, array_search (basename (dirname ($plugin)).'/'.basename ($plugin), $current), 1 );
382
- update_option('active_plugins', $current);
383
  }
384
  }
385
- ?>
1
  <?php
2
 
3
+ class A_Redirector_URL {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
+ class Redirector_Login {
 
7
  }
8
 
9
+ class Redirector_LuckyDip {
 
10
  }
11
 
12
+ class Redirector_Random {
 
13
  }
14
 
15
+ class Redirector_Referrer {
 
16
  }
17
 
18
+ class RE_Database {
19
+ function install() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  global $wpdb;
21
 
22
+ $create = array(
23
+ "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}redirection_items`(
24
+ `id` int(11) unsigned NOT NULL auto_increment,
25
+ `url` mediumtext NOT NULL,
26
+ `regex` int(11) unsigned NOT NULL default '0',
27
+ `position` int(11) unsigned NOT NULL default '0',
28
+ `last_count` int(10) unsigned NOT NULL default '0',
29
+ `last_access` datetime NOT NULL,
30
+ `group_id` int(11) NOT NULL default '0',
31
+ `status` enum('enabled','disabled' ) NOT NULL default 'enabled',
32
+ `action_type` varchar(20) NOT NULL,
33
+ `action_code` int(11) unsigned NOT NULL,
34
+ `action_data` mediumtext,
35
+ `match_type` varchar(20) NOT NULL,
36
+ `title` varchar(50) NULL,
37
+ PRIMARY KEY ( `id`),
38
+ KEY `url` (`url`(200)),
39
+ KEY `status` (`status`),
40
+ KEY `regex` (`regex`),
41
+ KEY `group_idpos` (`group_id`,`position`),
42
+ KEY `group` (`group_id`)
43
+ )",
44
+
45
+ "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}redirection_groups`(
46
+ `id` int(11) NOT NULL auto_increment,
47
+ `name` varchar(50) NOT NULL,
48
+ `tracking` int(11) NOT NULL default '1',
49
+ `module_id` int(11) unsigned NOT NULL default '0',
50
+ `status` enum('enabled','disabled' ) NOT NULL default 'enabled',
51
+ `position` int(11) unsigned NOT NULL default '0',
52
+ PRIMARY KEY ( `id`),
53
+ KEY `module_id` (`module_id`),
54
+ KEY `status` (`status`)
55
+ )",
56
+
57
+ "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}redirection_logs`(
58
+ `id` int(11) unsigned NOT NULL auto_increment,
59
+ `created` datetime NOT NULL,
60
+ `url` mediumtext NOT NULL,
61
+ `sent_to` mediumtext,
62
+ `agent` mediumtext NOT NULL,
63
+ `referrer` mediumtext,
64
+ `redirection_id` int(11) unsigned default NULL,
65
+ `ip` varchar(17) NOT NULL default '',
66
+ `module_id` int(11) unsigned NOT NULL,
67
+ `group_id` int(11) unsigned default NULL,
68
+ PRIMARY KEY ( `id`),
69
+ KEY `created` (`created`),
70
+ KEY `redirection_id` (`redirection_id`),
71
+ KEY `ip` (`ip`),
72
+ KEY `group_id` (`group_id`),
73
+ KEY `module_id` (`module_id`)
74
+ )",
75
+
76
+ "CREATE TABLE `{$wpdb->prefix}redirection_modules`(
77
+ `id` int(11) unsigned NOT NULL auto_increment,
78
+ `type` varchar(20) NOT NULL default '',
79
+ `name` varchar(50) NOT NULL default '',
80
+ `options` mediumtext,
81
+ PRIMARY KEY ( `id`),
82
+ KEY `name` (`name`),
83
+ KEY `type` (`type`)
84
+ )",
85
+ );
86
+
87
+ foreach ( $create AS $sql ) {
88
+ if ( $wpdb->query( $sql ) === false )
89
+ return false;
90
+ }
91
 
92
  // Modules
93
+ if ( $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_modules" ) == 0 ) {
94
+ $wpdb->insert( $wpdb->prefix.'redirection_modules', array( 'type' => 'wp', 'name' => __( 'WordPress', 'redirection' ), 'options' => '' ) );
95
+ $wpdb->insert( $wpdb->prefix.'redirection_modules', array( 'type' => 'apache', 'name' => __( 'Apache', 'redirection' ), 'options' => '' ) );
96
+ $wpdb->insert( $wpdb->prefix.'redirection_modules', array( 'type' => '404', 'name' => __( '404', 'redirection' ), 'options' => '' ) );
 
97
  }
98
 
99
  // Groups
100
+ if ( $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_groups" ) == 0 ) {
101
+ $wpdb->insert( $wpdb->prefix.'redirection_groups', array( 'name' => __( 'Redirections' ), 'module_id' => 1, 'position' => 0 ) );
102
+ $wpdb->insert( $wpdb->prefix.'redirection_groups', array( 'name' => __( 'Modified Posts' ), 'module_id' => 1, 'position' => 1 ) );
 
 
103
 
104
+ $options = get_option( 'redirection_options' );
105
  $options['monitor_post'] = 2;
106
  $options['monitor_category'] = 2;
107
 
108
+ update_option( 'redirection_options', $options );
109
  }
110
  }
111
 
112
+ function upgrade( $current, $target ) {
 
113
  global $wpdb;
114
 
115
+ $wpdb->show_errors();
116
+
117
+ // No previous version? Install the DB tables
118
+ if ( $current === false )
119
+ $success = $this->install();
120
+ else {
121
+ // Try and upgrade from a previous version
122
+ if ( $current == '2.0' )
123
+ $this->upgrade_from_20();
124
+ elseif ( $current == '2.0.1' )
125
+ $this->upgrade_from_21();
126
+ elseif ( $current == '2.0.2' )
127
+ $this->upgrade_from_22();
128
+
129
+ if ( version_compare( $current, '2.1.16' ) == -1 )
130
+ $this->upgrade_to_216();
131
+
132
+ if ( version_compare( $current, '2.2' ) == -1 )
133
+ $this->upgrade_to_220();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
 
136
+ // Set our current version
137
+ update_option( 'redirection_version', $target );
138
+
139
+ $wpdb->hide_errors();
140
+ return $success;
141
  }
142
 
143
+ function upgrade_from_20() {
 
144
  global $wpdb;
145
 
146
+ $this->upgrade_from_21();
147
+ $this->upgrade_from_22();
 
 
 
148
  }
149
 
150
+ function upgrade_from_21() {
 
151
  global $wpdb;
 
 
 
 
 
 
 
 
 
 
152
 
153
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_items` ADD `title` varchar(50) NULL" );
 
 
 
 
 
 
154
 
155
+ $this->upgrade_from_22();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
 
158
+ function upgrade_from_22() {
 
159
  global $wpdb;
160
 
161
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_items` CHANGE `title` `title` varchar(50) NULL" );
 
 
162
  }
163
 
164
+ function upgrade_to_216() {
 
165
  global $wpdb;
166
 
167
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_groups` ADD INDEX(module_id)" );
168
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_groups` ADD INDEX(status)" );
169
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX(url(200))" );
170
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX(status)" );
171
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX(regex)" );
172
  }
173
 
174
+ function upgrade_to_220() {
175
  global $wpdb;
176
 
177
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX `group_idpos` (`group_id`,`position`)" );
178
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_items` ADD INDEX `group` (`group_id`)" );
 
 
 
179
 
180
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD INDEX `group` (`group_id`)" );
181
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD INDEX `redirection_id` (`redirection_id`)" );
182
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD INDEX `created` (`created`)" );
183
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD INDEX `ip` (`ip`)" );
184
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD INDEX `group_id` (`group_id`)" );
185
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_logs` ADD INDEX `module_id` (`module_id`)" );
186
+
187
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_modules` ADD INDEX `name` (`name`)" );
188
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}redirection_modules` ADD INDEX `type` (`type`)" );
189
  }
190
 
191
+ function remove( $plugin ) {
 
192
  global $wpdb;
193
 
194
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}redirection;" );
195
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}redirection_items;" );
196
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}redirection_logs;" );
197
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}redirection_groups;" );
198
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}redirection_modules;" );
199
+
200
+ delete_option( 'redirection_lookup' );
201
+ delete_option( 'redirection_post' );
202
+ delete_option( 'redirection_root' );
203
+ delete_option( 'redirection_index' );
204
+ delete_option( 'redirection_version' );
205
+
206
+ $current = get_option( 'active_plugins' );
207
+ array_splice( $current, array_search( basename( dirname( $plugin ) ).'/'.basename( $plugin ), $current ), 1 );
208
+ update_option( 'active_plugins', $current );
209
  }
210
  }
 
models/file_io.php CHANGED
@@ -30,31 +30,29 @@ class Red_FileIO
30
  return false;
31
  }
32
 
33
- function import ($group, $file)
34
- {
35
- if (is_uploaded_file ($file['tmp_name']))
36
- {
37
- $parts = pathinfo ($file['name']);
38
 
39
- if ($parts['extension'] == 'xml')
40
- {
41
- include (dirname (__FILE__).'/../fileio/xml.php');
42
- $importer = new Red_Xml_File ();
43
  }
44
- else if ($parts['extension'] == 'csv')
45
- {
46
- include (dirname (__FILE__).'/../fileio/csv.php');
47
- $importer = new Red_Csv_File ();
48
  }
49
- else
50
- {
51
- include (dirname (__FILE__).'/../fileio/apache.php');
52
- $importer = new Red_Apache_File ();
53
  }
54
 
55
- $data = @file_get_contents ($file['tmp_name']);
56
- return $importer->load ($group, $data);
57
  }
 
58
  return 0;
59
  }
60
 
30
  return false;
31
  }
32
 
33
+ function import( $group, $file ) {
34
+ if ( is_uploaded_file( $file['tmp_name'] ) ) {
35
+ $parts = pathinfo( $file['name'] );
 
 
36
 
37
+ if ( $parts['extension'] == 'xml') {
38
+ include dirname( __FILE__ ).'/../fileio/xml.php';
39
+ $importer = new Red_Xml_File();
40
+ $data = @file_get_contents ($file['tmp_name']);
41
  }
42
+ elseif ( $parts['extension'] == 'csv' ) {
43
+ include dirname( __FILE__ ).'/../fileio/csv.php';
44
+ $importer = new Red_Csv_File();
45
+ $data = '';
46
  }
47
+ else {
48
+ include dirname( __FILE__ ).'/../fileio/apache.php';
49
+ $importer = new Red_Apache_File();
50
+ $data = @file_get_contents ($file['tmp_name']);
51
  }
52
 
53
+ return $importer->load( $group, $data, $file['tmp_name'] );
 
54
  }
55
+
56
  return 0;
57
  }
58
 
models/group.php CHANGED
@@ -1,220 +1,214 @@
1
  <?php
2
 
3
- class Red_Group
4
- {
5
- function Red_Group ($values = '')
6
- {
7
- if (is_array ($values))
8
- {
9
- foreach ($values AS $key => $value)
10
  $this->$key = $value;
 
11
  }
12
  }
13
 
14
- function get ($id)
15
- {
 
 
16
  global $wpdb;
17
-
18
- $id = intval ($id);
19
- $row = $wpdb->get_row ("SELECT {$wpdb->prefix}redirection_groups.*,COUNT({$wpdb->prefix}redirection_items.id) AS items,SUM({$wpdb->prefix}redirection_items.last_count) AS redirects FROM {$wpdb->prefix}redirection_groups LEFT JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id={$wpdb->prefix}redirection_groups.id WHERE {$wpdb->prefix}redirection_groups.id='$id' GROUP BY {$wpdb->prefix}redirection_groups.id", ARRAY_A);
20
- if ($row)
21
- return new Red_Group ($row);
22
  return false;
23
  }
24
 
25
- function get_for_module ($module)
26
- {
27
  global $wpdb;
28
 
29
- $sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->prefix}redirection_groups.* FROM {$wpdb->prefix}redirection_groups WHERE {$wpdb->prefix}redirection_groups.module_id='$module'";
30
 
31
- $rows = $wpdb->get_results ($sql, ARRAY_A);
32
- $items = array ();
33
- if (count ($rows) > 0)
34
- {
35
- foreach ($rows AS $row)
36
- $items[] = new Red_Group ($row);
37
  }
38
 
39
  return $items;
40
  }
41
 
42
- function get_all ($module, $pager)
43
- {
 
 
 
44
  global $wpdb;
45
-
46
- $sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->prefix}redirection_groups.*,COUNT({$wpdb->prefix}redirection_items.id) AS items,SUM({$wpdb->prefix}redirection_items.last_count) AS redirects FROM {$wpdb->prefix}redirection_groups LEFT JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id={$wpdb->prefix}redirection_groups.id WHERE {$wpdb->prefix}redirection_groups.module_id='$module'";
47
-
48
- $pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
49
- $sql .= $pager->to_limits ('', array ('name'), '', "GROUP BY {$wpdb->prefix}redirection_groups.id");
50
 
51
- $rows = $wpdb->get_results ($sql, ARRAY_A);
52
- $items = array ();
53
- if (count ($rows) > 0)
54
- {
55
- foreach ($rows AS $row)
56
- $items[] = new Red_Group ($row);
 
57
  }
58
 
59
  return $items;
60
  }
61
 
62
- function get_for_select ()
63
- {
 
 
 
64
  global $wpdb;
65
 
66
- $data = array ();
67
- $rows = $wpdb->get_results ("SELECT {$wpdb->prefix}redirection_modules.name AS module_name,{$wpdb->prefix}redirection_groups.name AS group_name,{$wpdb->prefix}redirection_groups.id FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_modules ON {$wpdb->prefix}redirection_modules.id={$wpdb->prefix}redirection_groups.module_id ORDER BY {$wpdb->prefix}redirection_modules.name,{$wpdb->prefix}redirection_groups.position");
68
- if ($rows)
69
- {
70
- foreach ($rows AS $row)
71
  $data[$row->module_name][$row->id] = $row->group_name;
 
72
  }
73
 
74
  return $data;
75
  }
76
 
77
- function get_first_id ()
78
- {
 
 
79
  global $wpdb;
80
-
81
- return $wpdb->get_var ("SELECT id FROM {$wpdb->prefix}redirection_groups ORDER BY id LIMIT 0,1");
82
  }
83
 
84
- function create ($data)
85
- {
86
  global $wpdb;
87
 
88
- $name = $wpdb->escape (trim ($data['name']));
89
- $module = intval ($data['module_id']);
90
 
91
- if ($name != '' && $module > 0)
92
- {
93
- if (isset ($data['status']) && isset ($data['position']))
94
- {
95
- $extra = ',status';
96
- $extra2 = ",'".$data['status']."'";
97
- }
98
-
99
- $position = $wpdb->get_var ("SELECT COUNT(*) FROM {$wpdb->prefix}redirection_groups WHERE module_id='$module'");
100
- if (isset ($data['position']))
101
  $position = $data['position'];
102
-
103
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_groups (name,module_id,position$extra) VALUES ('$name','$module','$position'$extra2)");
 
 
 
 
 
 
 
 
 
104
 
105
- Red_Module::flush ($module);
106
  return $wpdb->insert_id;
107
  }
108
 
109
  return false;
110
  }
111
 
112
- function update ($data)
113
- {
114
  global $wpdb;
115
 
116
- $this->tracking = isset ($data['tracking']) ? true : false;
117
- $this->name = $data['name'];
118
- $this->status = isset ($data['status']) ? 'enabled' : 'disabled';
119
 
120
- $name = $wpdb->escape ($this->name);
121
 
122
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_groups SET name='$name', status='{$this->status}', tracking='{$this->tracking}' WHERE id='{$this->id}'");
123
-
124
- Red_Module::flush ($this->module_id);
125
  }
126
 
127
- function delete ($group)
128
- {
129
  global $wpdb;
130
 
131
- $obj = Red_Group::get ($group);
132
 
133
  // Delete all items in this group
134
- $wpdb->query ("DELETE FROM {$wpdb->prefix}redirection_items WHERE group_id='$group'");
135
 
136
  // Delete the group
137
- $wpdb->query ("DELETE FROM {$wpdb->prefix}redirection_groups WHERE id='$group'");
138
 
139
  // Update positions
140
- $rows = $wpdb->get_results ("SELECT id FROM {$wpdb->prefix}redirection_groups ORDER BY position");
141
- if (count ($rows) > 0)
142
- {
143
- foreach ($rows AS $pos => $row)
144
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_groups SET position='$pos' WHERE id='{$row->id}'");
145
  }
146
  }
147
 
148
- function save_order ($items, $start)
149
- {
150
  global $wpdb;
151
- foreach ($items AS $pos => $id)
152
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_groups SET position='".($pos + $start)."' WHERE id='{$id}'");
 
 
153
 
154
- $group = Red_Group::get ($items[0]);
155
- Red_Module::flush ($group->module_id);
156
  }
157
 
158
- function move_to ($module)
159
- {
160
  global $wpdb;
161
 
162
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_groups SET module_id='$module' WHERE id='{$this->id}'");
163
 
164
- Red_Module::flush ($module);
165
- Red_Module::flush ($this->id);
166
  }
167
 
168
- function reset ()
169
- {
170
  global $wpdb;
171
 
172
  $this->last_count = 0;
173
  $this->last_access = '0000-00-00 00:00:00';
174
 
175
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET last_count=0, last_access='{$this->last_access}' WHERE group_id='{$this->id}'");
176
 
177
- RE_Log::delete_for_group ($this->id);
178
  }
179
 
180
- function items ()
181
- {
182
- if ($this->items > 0)
183
- return sprintf (' (%d)', $this->items);
184
  return '';
185
  }
186
 
187
- function type ()
188
- {
189
- if ($this->apache)
190
  return '.ht';
191
  return 'WP';
192
  }
193
 
194
- function tracked ()
195
- {
196
- if ($this->tracking == 1)
197
- return 'Yes';
198
- return 'No';
199
  }
200
 
201
- function toggle_status ()
202
- {
203
  global $wpdb;
204
 
205
- $this->status = ($this->status == 'enabled') ? 'disabled' : 'enabled';
206
 
207
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_groups SET status='{$this->status}' WHERE id='{$this->id}'");
208
  }
209
 
210
- function hits ()
211
- {
212
  global $wpdb;
213
- // $count = $wpdb->get_var ("SELECT SUM(last_count) FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id=wp_redirection_groups.id WHERE wp_redirection_groups.module_id='{$this->id}'");
214
- $count = $wpdb->get_var ("SELECT COUNT(id) FROM {$wpdb->prefix}redirection_logs WHERE group_id='{$this->id}'");
215
- if ($count > 0)
216
  return $count;
217
  return 0;
218
  }
219
  }
220
- ?>
1
  <?php
2
 
3
+ class Red_Group {
4
+ function Red_Group( $values = '' ) {
5
+ if ( is_object( $values ) ) {
6
+ foreach ( $values AS $key => $value ) {
 
 
 
7
  $this->$key = $value;
8
+ }
9
  }
10
  }
11
 
12
+ /**
13
+ * Get list of groups
14
+ */
15
+ function get( $id ) {
16
  global $wpdb;
17
+
18
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT {$wpdb->prefix}redirection_groups.*,COUNT( {$wpdb->prefix}redirection_items.id ) AS items,SUM( {$wpdb->prefix}redirection_items.last_count ) AS redirects FROM {$wpdb->prefix}redirection_groups LEFT JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id={$wpdb->prefix}redirection_groups.id WHERE {$wpdb->prefix}redirection_groups.id=%d GROUP BY {$wpdb->prefix}redirection_groups.id", $id ) );
19
+ if ( $row )
20
+ return new Red_Group( $row );
 
21
  return false;
22
  }
23
 
24
+ function get_for_module( $module ) {
 
25
  global $wpdb;
26
 
27
+ $sql = $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS {$wpdb->prefix}redirection_groups.* FROM {$wpdb->prefix}redirection_groups WHERE {$wpdb->prefix}redirection_groups.module_id=%d", $module );
28
 
29
+ $rows = $wpdb->get_results( $sql );
30
+ $items = array();
31
+ if ( count( $rows ) > 0 ) {
32
+ foreach( $rows AS $row ) {
33
+ $items[] = new Red_Group( $row );
34
+ }
35
  }
36
 
37
  return $items;
38
  }
39
 
40
+ /**
41
+ * Get all groups with number of items in each group
42
+ * DBW
43
+ */
44
+ function get_all( $module, $pager ) {
45
  global $wpdb;
46
+
47
+ $sql = $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS {$wpdb->prefix}redirection_groups.*,COUNT( {$wpdb->prefix}redirection_items.id ) AS items,SUM( {$wpdb->prefix}redirection_items.last_count ) AS redirects FROM {$wpdb->prefix}redirection_groups LEFT JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id={$wpdb->prefix}redirection_groups.id WHERE {$wpdb->prefix}redirection_groups.module_id=%d", $module );
48
+ $sql .= str_replace( 'WHERE', 'AND', $pager->to_limits( '', array( 'name' ), '', "GROUP BY {$wpdb->prefix}redirection_groups.id" ) );
 
 
49
 
50
+ $rows = $wpdb->get_results( $sql );
51
+ $pager->set_total( $wpdb->get_var( "SELECT FOUND_ROWS()" ) );
52
+ $items = array();
53
+ if ( count( $rows ) > 0 ) {
54
+ foreach( $rows AS $row ) {
55
+ $items[] = new Red_Group( $row );
56
+ }
57
  }
58
 
59
  return $items;
60
  }
61
 
62
+ /**
63
+ * Get list of groups
64
+ * DBW
65
+ */
66
+ function get_for_select() {
67
  global $wpdb;
68
 
69
+ $data = array();
70
+ $rows = $wpdb->get_results( $wpdb->prepare( "SELECT {$wpdb->prefix}redirection_modules.name AS module_name,{$wpdb->prefix}redirection_groups.name AS group_name,{$wpdb->prefix}redirection_groups.id FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_modules ON {$wpdb->prefix}redirection_modules.id={$wpdb->prefix}redirection_groups.module_id ORDER BY {$wpdb->prefix}redirection_modules.name,{$wpdb->prefix}redirection_groups.position" ) );
71
+ if ( $rows ) {
72
+ foreach ( $rows AS $row ) {
 
73
  $data[$row->module_name][$row->id] = $row->group_name;
74
+ }
75
  }
76
 
77
  return $data;
78
  }
79
 
80
+ /**
81
+ * Get first group ID
82
+ */
83
+ function get_first_id() {
84
  global $wpdb;
85
+
86
+ return $wpdb->get_var( "SELECT id FROM {$wpdb->prefix}redirection_groups ORDER BY id LIMIT 0,1" );
87
  }
88
 
89
+ function create( $data ) {
 
90
  global $wpdb;
91
 
92
+ $name = trim( $data['name'] );
93
+ $module = intval( $data['module_id'] );
94
 
95
+ if ( $name != '' && $module > 0 ) {
96
+ $position = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM {$wpdb->prefix}redirection_groups WHERE module_id=%d", $module ) );
97
+ if ( isset( $data['position'] ) )
 
 
 
 
 
 
 
98
  $position = $data['position'];
99
+
100
+ $data = array(
101
+ 'name' => trim( $name ),
102
+ 'module_id' => $module,
103
+ 'position' => $position
104
+ );
105
+
106
+ if ( isset( $data['status'] ) && isset( $data['position'] ) )
107
+ $data['status'] = $data['status'];
108
+
109
+ $wpdb->insert( $wpdb->prefix.'redirection_groups', $data );
110
 
111
+ Red_Module::flush( $module );
112
  return $wpdb->insert_id;
113
  }
114
 
115
  return false;
116
  }
117
 
118
+ function update( $data ) {
 
119
  global $wpdb;
120
 
121
+ $this->tracking = isset( $data['tracking'] ) ? true : false;
122
+ $this->status = isset( $data['status'] ) ? 'enabled' : 'disabled';
 
123
 
124
+ $wpdb->update( $wpdb->prefix.'redirection_groups', array( 'name' => $data['name'], 'status' => $this->status, 'tracking' => $this->tracking ), array( 'id' => $this->id ) );
125
 
126
+ Red_Module::flush( $this->module_id );
 
 
127
  }
128
 
129
+ function delete( $group ) {
 
130
  global $wpdb;
131
 
132
+ $obj = Red_Group::get( $group );
133
 
134
  // Delete all items in this group
135
+ $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_items WHERE group_id=%d", $group ) );
136
 
137
  // Delete the group
138
+ $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_groups WHERE id=%d", $group ) );
139
 
140
  // Update positions
141
+ $rows = $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}redirection_groups ORDER BY position" );
142
+ if ( count( $rows ) > 0 ) {
143
+ foreach ( $rows AS $pos => $row ) {
144
+ $wpdb->update( $wpdb->prefix.'redirection_groups', array( 'position' => intval( $pos ) ), array( 'id' => intval( $row->id ) ) );
145
+ }
146
  }
147
  }
148
 
149
+ function save_order( $items, $start ) {
 
150
  global $wpdb;
151
+
152
+ foreach ( $items AS $pos => $id ) {
153
+ $wpdb->update( $wpdb->prefix.'redirection_groups', array( 'position' => $pos + $start ), array( 'id' => intval( $id ) ) );
154
+ }
155
 
156
+ $group = Red_Group::get( $items[0] );
157
+ Red_Module::flush( $group->module_id );
158
  }
159
 
160
+ function move_to( $module ) {
 
161
  global $wpdb;
162
 
163
+ $wpdb->update( $wpdb->prefix.'redirection_groups', array( 'module_id' => intval( $module ) ), array( 'id' => $this->id ) );
164
 
165
+ Red_Module::flush( $module );
166
+ Red_Module::flush( $this->id );
167
  }
168
 
169
+ function reset() {
 
170
  global $wpdb;
171
 
172
  $this->last_count = 0;
173
  $this->last_access = '0000-00-00 00:00:00';
174
 
175
+ $wpdb->update( $wpdb->prefix.'redirection_items', array( 'last_count' => 0, 'last_access' => $this->last_access ), array( 'group_id' => $this->id ) );
176
 
177
+ RE_Log::delete_for_group( $this->id );
178
  }
179
 
180
+ function items() {
181
+ if ( $this->items > 0 )
182
+ return sprintf( ' (%d)', $this->items );
 
183
  return '';
184
  }
185
 
186
+ function type() {
187
+ if ( $this->apache )
 
188
  return '.ht';
189
  return 'WP';
190
  }
191
 
192
+ function tracked() {
193
+ if ( $this->tracking == 1 )
194
+ return __( 'Yes', 'redirection' );
195
+ return __( 'No', 'redirection' );
 
196
  }
197
 
198
+ function toggle_status() {
 
199
  global $wpdb;
200
 
201
+ $this->status = ( $this->status == 'enabled' ) ? 'disabled' : 'enabled';
202
 
203
+ $wpdb->update( $wpdb->prefix.'redirection_groups', array( 'status' => $this->status ), array( 'id' => $this->id ) );
204
  }
205
 
206
+ function hits() {
 
207
  global $wpdb;
208
+
209
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$wpdb->prefix}redirection_logs WHERE group_id=%d", $this->id ) );
210
+ if ( $count > 0 )
211
  return $count;
212
  return 0;
213
  }
214
  }
 
models/log.php CHANGED
@@ -19,8 +19,8 @@ this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
- class RE_Log
23
- {
24
  var $id;
25
  var $created;
26
  var $url;
@@ -48,11 +48,10 @@ class RE_Log
48
  return false;
49
  }
50
 
51
- function get (&$pager)
52
- {
53
  global $wpdb;
54
 
55
- $rows = $wpdb->get_results ("SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}redirection_logs".$pager->to_limits ('redirection_id IS NOT NULL', array ('url', 'sent_to', 'ip')), ARRAY_A);
56
  $pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
57
 
58
  $items = array ();
@@ -197,7 +196,7 @@ class RE_Log
197
  function referrer ()
198
  {
199
  return preg_replace ('@https?://(.*?)/.*@', '$1', $this->referrer);
200
- $home = get_bloginfo ('home');
201
  if (substr ($this->referrer, 0, strlen ($home)) == $home)
202
  return substr ($this->referrer, strlen ($home));
203
  return $this->referrer;
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
+
23
+ class RE_Log {
24
  var $id;
25
  var $created;
26
  var $url;
48
  return false;
49
  }
50
 
51
+ function get( &$pager ) {
 
52
  global $wpdb;
53
 
54
+ $rows = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}redirection_logs FORCE INDEX(created) ".$pager->to_limits ('redirection_id IS NOT NULL', array ('url', 'sent_to', 'ip')), ARRAY_A );
55
  $pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
56
 
57
  $items = array ();
196
  function referrer ()
197
  {
198
  return preg_replace ('@https?://(.*?)/.*@', '$1', $this->referrer);
199
+ $home = get_bloginfo ('url');
200
  if (substr ($this->referrer, 0, strlen ($home)) == $home)
201
  return substr ($this->referrer, strlen ($home));
202
  return $this->referrer;
models/match.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
- * @copyright Copyright (C) John Godley
8
  **/
9
 
10
  /*
@@ -12,89 +12,93 @@
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
- consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
16
- use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17
- contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
- class Red_Match
24
- {
25
  var $url;
26
 
27
- function Red_Match ($values = '')
28
- {
29
- if ($values)
30
- {
31
- $obj = @unserialize ($values);
32
- if ($obj === false)
33
  $this->url = $values;
34
- else
35
- {
36
- foreach ($obj AS $key => $value)
37
  $this->$key = $value;
 
38
  }
39
  }
40
  }
41
 
42
- function data ($details)
43
- {
44
- $data = $this->save ($details);
45
- if (count ($data) == 1 && !is_array (current ($data)))
46
- $data = current ($data);
47
  else
48
- $data = serialize ($data);
49
  return $data;
50
  }
51
 
52
- function save ($details) { return array (); }
53
- function name () { return ''; }
54
- function show () { }
55
- function wants_it () { return true; }
56
- function get_target ($url, $matched_url, $regex) { return $false; }
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
- function create ($name, $data = '')
59
- {
60
- $avail = Red_Match::available ();
61
- if (isset ($avail[strtolower ($name)]))
62
- {
63
  $classname = $name.'_match';
64
 
65
- if (!class_exists (strtolower ($classname)))
66
- include (dirname (__FILE__).'/../matches/'.$avail[strtolower ($name)]);
67
- return new $classname ($data);
68
  }
 
69
  return false;
70
  }
71
 
72
- function all ()
73
- {
74
- $data = array ();
75
 
76
- $avail = Red_Match::available ();
77
- foreach ($avail AS $name => $file)
78
- {
79
- $obj = Red_Match::create ($name);
80
- $data[$name] = $obj->name ();
81
  }
82
 
83
  return $data;
84
  }
85
 
86
- function available ()
87
- {
88
- return array
89
- (
90
  'url' => 'url.php',
91
  'referrer' => 'referrer.php',
92
  'agent' => 'user_agent.php',
93
  'login' => 'login.php',
94
- );
95
  }
96
 
97
- function match_name () { return ''; }
 
 
98
  }
99
-
100
- ?>
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
+ * @copyright Copyright( C ) John Godley
8
  **/
9
 
10
  /*
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
+ consequential damages( including, but not limited to, procurement of substitute goods or services; loss of
16
+ use, data, or profits; or business interruption ) however caused and on any theory of liability, whether in
17
+ contract, strict liability, or tort( including negligence or otherwise ) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
 
23
+ class Red_Match {
 
24
  var $url;
25
 
26
+ function Red_Match( $values = '' ) {
27
+ if ( $values ) {
28
+ $obj = @unserialize( $values );
29
+ if ( $obj === false )
 
 
30
  $this->url = $values;
31
+ else {
32
+ foreach ( $obj AS $key => $value ) {
 
33
  $this->$key = $value;
34
+ }
35
  }
36
  }
37
  }
38
 
39
+ function data( $details ) {
40
+ $data = $this->save( $details );
41
+ if ( count( $data ) == 1 && !is_array( current( $data ) ) )
42
+ $data = current( $data );
 
43
  else
44
+ $data = serialize( $data );
45
  return $data;
46
  }
47
 
48
+ function save( $details ) {
49
+ return array();
50
+ }
51
+
52
+ function name() {
53
+ return '';
54
+ }
55
+
56
+ function show() {
57
+ }
58
+
59
+ function wants_it() {
60
+ return true;
61
+ }
62
+
63
+ function get_target( $url, $matched_url, $regex ) {
64
+ return $false;
65
+ }
66
 
67
+ function create( $name, $data = '' ) {
68
+ $avail = Red_Match::available();
69
+ if ( isset( $avail[strtolower( $name )] ) ) {
 
 
70
  $classname = $name.'_match';
71
 
72
+ if ( !class_exists( strtolower( $classname ) ) )
73
+ include( dirname( __FILE__ ).'/../matches/'.$avail[strtolower( $name )] );
74
+ return new $classname( $data );
75
  }
76
+
77
  return false;
78
  }
79
 
80
+ function all() {
81
+ $data = array();
 
82
 
83
+ $avail = Red_Match::available();
84
+ foreach ( $avail AS $name => $file ) {
85
+ $obj = Red_Match::create( $name );
86
+ $data[$name] = $obj->name();
 
87
  }
88
 
89
  return $data;
90
  }
91
 
92
+ function available() {
93
+ return array (
 
 
94
  'url' => 'url.php',
95
  'referrer' => 'referrer.php',
96
  'agent' => 'user_agent.php',
97
  'login' => 'login.php',
98
+ );
99
  }
100
 
101
+ function match_name() {
102
+ return '';
103
+ }
104
  }
 
 
models/module.php CHANGED
@@ -1,278 +1,268 @@
1
  <?php
2
 
3
- class Red_Module
4
- {
5
- function Red_Module ($values = '')
6
- {
7
- if (is_array ($values))
8
- {
9
- foreach ($values AS $key => $value)
10
  $this->$key = $value;
11
-
12
- if ($this->options)
13
- $this->load (unserialize ($this->options));
 
14
  }
15
  }
16
 
17
- function module_flush ($items) {}
18
- function module_flush_delete () {}
 
 
 
19
 
20
- function flush ($id)
21
- {
22
- $module = Red_Module::get ($id);
23
- if ($module && $module->is_valid ())
24
- $module->module_flush (Red_Item::get_all_for_module ($id));
25
  }
26
 
27
- function flush_delete ($id)
28
- {
29
- $module = Red_Module::get ($id);
30
- if ($module)
31
- $module->module_flush_delete ();
32
  }
33
 
34
- function update ($data)
35
- {
36
  global $wpdb;
37
 
38
  $this->name = $data['name'];
39
- $name = $wpdb->escape ($data['name']);
40
-
41
- $options = $this->save ($data);
42
- if (empty ($options))
43
- $options = 'NULL';
44
- else
45
- $options = "'".$wpdb->escape (serialize ($options))."'";
46
-
47
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_modules SET name='$name', options=$options WHERE id='{$this->id}'");
48
 
49
- Red_Module::clear_cache ($this->id);
50
  }
51
 
52
- function delete ()
53
- {
54
  global $wpdb;
55
 
56
- $groups = Red_Group::get_for_module ($this->id);
57
- if (count ($groups) > 0)
58
- {
59
- foreach ($groups AS $group)
60
- $group->delete ($group->id);
61
  }
62
 
63
- $wpdb->query ("DELETE FROM {$wpdb->prefix}redirection_modules WHERE id='{$this->id}'");
64
 
65
- RE_Log::delete_for_module ($this->id);
66
- Red_Module::clear_cache ($this->id);
67
- Red_Module::flush_delete ($this->id);
68
  }
69
 
70
- function clear_cache ($module)
71
- {
72
- delete_option ('redirection_module_cache');
73
- Red_Module::flush ($module);
74
  }
75
 
76
- function create ($data)
77
- {
78
  global $wpdb;
79
 
80
- $type = $data['type'];
81
- $name = $wpdb->escape ($data['name']);
82
- if (strlen ($name) > 0)
83
- {
84
- $extra2 = $extra = '';
85
- if (isset ($data['options']))
86
- {
87
- $extra = ',options';
88
- $extra2 = ",'".$wpdb->escape (serialize ($data['options']))."'";
89
- }
90
 
91
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_modules (name,type$extra) VALUES ('$name','$type'$extra2)");
 
 
 
92
 
93
- Red_Module::flush ($wpdb->insert_id);
94
  return $wpdb->insert_id;
95
  }
96
 
97
  return false;
98
  }
99
 
100
- function get ($id)
101
- {
102
  global $wpdb;
103
 
104
- $id = intval ($id);
105
- $row = $wpdb->get_row ("SELECT * FROM {$wpdb->prefix}redirection_modules WHERE id='$id'", ARRAY_A);
106
- if ($row)
107
- return Red_Module::new_item ($row);
108
  return false;
109
  }
110
 
111
- function get_by_type ($type)
112
- {
113
  global $wpdb;
114
 
115
- $cache = get_option ('redirection_module_cache');
116
- if ($cache && isset ($cache[$type]))
117
  return $cache[$type];
118
 
119
- $rows = $wpdb->get_results ("SELECT * FROM {$wpdb->prefix}redirection_modules WHERE type='$type' ORDER BY id", ARRAY_A);
120
- $items = array ();
121
- if (count ($rows) > 0)
122
- {
123
- foreach ($rows AS $row)
124
- $items[] = Red_Module::new_item ($row);
125
  }
126
 
127
  $cache[$type] = $items;
128
- update_option ('redirection_module_cache', $cache);
129
  return $items;
130
  }
131
 
132
- function get_all ()
133
- {
 
 
134
  global $wpdb;
135
 
136
- $sql =
137
-
138
- $rows = $wpdb->get_results ("SELECT * FROM {$wpdb->prefix}redirection_modules ORDER BY id", ARRAY_A);
139
- $items = array ();
140
- if (count ($rows) > 0)
141
- {
142
- foreach ($rows AS $row)
143
- $items[] = Red_Module::new_item ($row);
144
  }
145
 
146
  return $items;
147
  }
148
 
149
- function get_first_id ()
150
- {
 
 
151
  global $wpdb;
152
- return $wpdb->get_var ("SELECT id FROM {$wpdb->prefix}redirection_modules ORDER BY id LIMIT 0,1");
153
  }
154
 
155
- function get_for_select ()
156
- {
157
- $data = array ();
158
- $items = Red_Module::get_all ();
159
- foreach ($items AS $item)
 
 
 
 
160
  $data[$item->id] = $item->name;
 
 
161
  return $data;
162
  }
163
 
164
- function get_types ()
165
- {
166
- return array
167
- (
168
- 'apache' => __ ('Apache', 'redirection'),
169
- 'wp' => __ ('WordPress', 'redirection'),
170
- '404' => __ ('404 Errors', 'redirection'),
171
- );
 
172
  }
173
 
174
- function new_item ($data)
175
- {
176
- $map = array
177
- (
178
- 'apache' => array ('Apache_Module', 'apache.php'),
179
- 'wp' => array ('WordPress_Module', 'wordpress.php'),
180
- '404' => array ('Error404_Module', '404.php')
181
- );
182
 
183
- $obj = $map[$data['type']][0];
184
- $file = $map[$data['type']][1];
 
185
 
186
- if (!class_exists ($obj))
187
- include (dirname (__FILE__)."/../modules/$file");
188
- return new $obj ($data);
 
 
 
 
189
  }
190
 
191
- function canonical ()
192
- {
193
- $can = array ('none' => '&mdash;', 'nowww' => __ ('Strip WWW', 'redirection'), 'www' => __ ('Force WWW', 'redirection'));
194
  return $can[$this->canonical];
195
  }
196
 
197
- function index ()
198
- {
199
- $can = array ('ignore' => '&mdash;', 'remove' => __ ('Strip index.php', 'redirection'));
200
  return $can[$this->index];
201
  }
202
 
203
- function options () { }
 
204
 
205
- function type ()
206
- {
207
- $types = $this->get_types ();
208
  return $types[$this->type];
209
  }
210
 
211
- function checked ($item, $field = '')
212
- {
213
- if ($field && is_array ($item))
214
- {
215
- if (isset ($item[$field]) && $item[$field])
216
  echo ' checked="checked"';
217
  }
218
- else if (!empty ($item))
219
  echo ' checked="checked"';
220
  }
221
 
222
- function select ($items, $default = '')
223
- {
224
- if (count ($items) > 0)
225
- {
226
- foreach ($items AS $key => $value)
227
- echo '<option value="'.$key.'"'.($key == $default ? ' selected="selected"' : '').'>'.$value.'</option>';
228
  }
229
  }
230
 
231
- function groups ()
232
- {
233
  global $wpdb;
234
 
235
- return $wpdb->get_var ("SELECT COUNT(id) FROM {$wpdb->prefix}redirection_groups WHERE module_id='{$this->id}'");
236
  }
237
 
238
- function redirects ()
239
- {
240
  global $wpdb;
241
 
242
- $count = $wpdb->get_var ("SELECT COUNT({$wpdb->prefix}redirection_items.id) FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id={$wpdb->prefix}redirection_groups.id WHERE module_id='{$this->id}' GROUP BY {$wpdb->prefix}redirection_items.group_id");
243
- if ($count > 0)
244
  return $count;
245
  return 0;
246
  }
247
 
248
- function hits ()
249
- {
250
  global $wpdb;
251
- // $count = $wpdb->get_var ("SELECT SUM(last_count) FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id=wp_redirection_groups.id WHERE wp_redirection_groups.module_id='{$this->id}'");
252
- $count = $wpdb->get_var ("SELECT COUNT(id) FROM {$wpdb->prefix}redirection_logs WHERE module_id='{$this->id}'");
253
- if ($count > 0)
254
  return $count;
255
  return 0;
256
  }
257
 
258
- function reset ()
259
- {
260
- Red_Module::clear_cache ($this->id);
261
 
262
- $groups = Red_Group::get_for_module ($this->id);
263
- if (count ($groups) > 0)
264
- {
265
- foreach ($groups AS $group)
266
- $group->reset ();
267
  }
268
 
269
- RE_Log::delete_for_module ($this->id);
 
 
 
 
270
  }
271
 
272
- function name_extra () { return '';}
273
- function is_valid () { return true; }
274
- function load ($data) { }
275
- function config () { }
 
276
  }
277
 
278
- ?>
1
  <?php
2
 
3
+ class Red_Module {
4
+ function Red_Module( $values = '' ) {
5
+ if ( is_object( $values ) ) {
6
+ foreach ( $values AS $key => $value ) {
 
 
 
7
  $this->$key = $value;
8
+ }
9
+
10
+ if ( $this->options )
11
+ $this->load( unserialize( $this->options ) );
12
  }
13
  }
14
 
15
+ function module_flush( $items ) {
16
+ }
17
+
18
+ function module_flush_delete() {
19
+ }
20
 
21
+ function flush( $id ) {
22
+ $module = Red_Module::get( $id );
23
+ if ( $module && $module->is_valid() )
24
+ $module->module_flush( Red_Item::get_all_for_module( $id ) );
 
25
  }
26
 
27
+ function flush_delete( $id ) {
28
+ $module = Red_Module::get( $id );
29
+ if ( $module )
30
+ $module->module_flush_delete();
 
31
  }
32
 
33
+ function update( $data ) {
 
34
  global $wpdb;
35
 
36
  $this->name = $data['name'];
37
+ $options = $this->save( $data );
38
+ $wpdb->update( $wpdb->prefix.'redirection_modules', array( 'name' => trim( $data['name'] ), 'options' => empty( $options ) ? '' : serialize( $options ) ), array( 'id' => $this->id ) );
 
 
 
 
 
 
 
39
 
40
+ Red_Module::clear_cache( $this->id );
41
  }
42
 
43
+ function delete() {
 
44
  global $wpdb;
45
 
46
+ $groups = Red_Group::get_for_module( $this->id );
47
+ if ( count( $groups ) > 0 ) {
48
+ foreach ( $groups AS $group ) {
49
+ $group->delete( $group->id );
50
+ }
51
  }
52
 
53
+ $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_modules WHERE id=%d", $this->id ) );
54
 
55
+ RE_Log::delete_for_module( $this->id );
56
+ Red_Module::clear_cache( $this->id );
57
+ Red_Module::flush_delete( $this->id );
58
  }
59
 
60
+ function clear_cache( $module ) {
61
+ delete_option( 'redirection_module_cache' );
62
+ Red_Module::flush( $module );
 
63
  }
64
 
65
+ function create( $data ) {
 
66
  global $wpdb;
67
 
68
+ if ( strlen( $data['name'] ) > 0 ) {
69
+ $db = array(
70
+ 'name' => trim( $data['name'] ),
71
+ 'type' => $data['type'],
72
+ );
 
 
 
 
 
73
 
74
+ if ( isset( $data['options'] ) )
75
+ $db['options'] = serialize( $data['options'] );
76
+
77
+ $wpdb->insert( $wpdb->prefix.'redirection_modules', $db );
78
 
79
+ Red_Module::flush( $wpdb->insert_id );
80
  return $wpdb->insert_id;
81
  }
82
 
83
  return false;
84
  }
85
 
86
+ function get( $id ) {
 
87
  global $wpdb;
88
 
89
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}redirection_modules WHERE id=%d", $id ) );
90
+ if ( $row )
91
+ return Red_Module::new_item( $row );
 
92
  return false;
93
  }
94
 
95
+ function get_by_type( $type ) {
 
96
  global $wpdb;
97
 
98
+ $cache = get_option( 'redirection_module_cache' );
99
+ if ( $cache && isset( $cache[$type] ) )
100
  return $cache[$type];
101
 
102
+ $rows = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}redirection_modules WHERE type=%s ORDER BY id", $type ) );
103
+ $items = array();
104
+ if ( count( $rows ) > 0 ) {
105
+ foreach ( $rows AS $row ) {
106
+ $items[] = Red_Module::new_item( $row );
107
+ }
108
  }
109
 
110
  $cache[$type] = $items;
111
+ update_option( 'redirection_module_cache', $cache );
112
  return $items;
113
  }
114
 
115
+ /**
116
+ * Get all modules
117
+ */
118
+ function get_all() {
119
  global $wpdb;
120
 
121
+ $rows = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}redirection_modules WHERE id > 0 ORDER BY id" );
122
+ $items = array();
123
+ if ( count( $rows ) > 0 ) {
124
+ foreach ( $rows AS $row ) {
125
+ $items[] = Red_Module::new_item( $row );
126
+ }
 
 
127
  }
128
 
129
  return $items;
130
  }
131
 
132
+ /**
133
+ * Get first module
134
+ */
135
+ function get_first_id() {
136
  global $wpdb;
137
+ return $wpdb->get_var( "SELECT id FROM {$wpdb->prefix}redirection_modules ORDER BY id LIMIT 0,1" );
138
  }
139
 
140
+ /**
141
+ * Get all modules
142
+ */
143
+
144
+ function get_for_select() {
145
+ $data = array();
146
+ $items = Red_Module::get_all();
147
+
148
+ foreach ( $items AS $item ) {
149
  $data[$item->id] = $item->name;
150
+ }
151
+
152
  return $data;
153
  }
154
 
155
+ /**
156
+ * Get all module types
157
+ */
158
+ function get_types() {
159
+ return array (
160
+ 'apache' => __( 'Apache', 'redirection' ),
161
+ 'wp' => __( 'WordPress', 'redirection' ),
162
+ '404' => __( '404 Errors', 'redirection' ),
163
+ );
164
  }
165
 
166
+ function new_item( $data ) {
167
+ $map = array (
168
+ 'apache' => array( 'Apache_Module', 'apache.php' ),
169
+ 'wp' => array( 'WordPress_Module', 'wordpress.php' ),
170
+ '404' => array( 'Error404_Module', '404.php' )
171
+ );
 
 
172
 
173
+ if ( isset( $map[$data->type] ) ) {
174
+ $obj = $map[$data->type][0];
175
+ $file = $map[$data->type][1];
176
 
177
+ if ( !class_exists( $obj ) )
178
+ include dirname( __FILE__ )."/../modules/$file";
179
+
180
+ return new $obj( $data );
181
+ }
182
+
183
+ return false;
184
  }
185
 
186
+ function canonical() {
187
+ $can = array( 'none' => '&mdash;', 'nowww' => __( 'Strip WWW', 'redirection' ), 'www' => __( 'Force WWW', 'redirection' ) );
 
188
  return $can[$this->canonical];
189
  }
190
 
191
+ function index() {
192
+ $can = array( 'ignore' => '&mdash;', 'remove' => __( 'Strip index.php', 'redirection' ) );
 
193
  return $can[$this->index];
194
  }
195
 
196
+ function options() {
197
+ }
198
 
199
+ function type() {
200
+ $types = $this->get_types();
 
201
  return $types[$this->type];
202
  }
203
 
204
+ function checked( $item, $field = '' ) {
205
+ if ( $field && is_array( $item ) ) {
206
+ if ( isset( $item[$field] ) && $item[$field] )
 
 
207
  echo ' checked="checked"';
208
  }
209
+ elseif ( !empty( $item ) )
210
  echo ' checked="checked"';
211
  }
212
 
213
+ function select( $items, $default = '' ) {
214
+ if ( count( $items ) > 0 ) {
215
+ foreach ( $items AS $key => $value ) {
216
+ echo '<option value="'.$key.'"'.($key == $default ? ' selected="selected"' : '' ).'>'.$value.'</option>';
217
+ }
 
218
  }
219
  }
220
 
221
+ function groups() {
 
222
  global $wpdb;
223
 
224
+ return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id ) FROM {$wpdb->prefix}redirection_groups WHERE module_id=%d", $this->id ) );
225
  }
226
 
227
+ function redirects() {
 
228
  global $wpdb;
229
 
230
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT({$wpdb->prefix}redirection_items.id) FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_items ON {$wpdb->prefix}redirection_items.group_id={$wpdb->prefix}redirection_groups.id WHERE module_id=%d GROUP BY {$wpdb->prefix}redirection_items.group_id", $this->id ) );
231
+ if ( $count > 0 )
232
  return $count;
233
  return 0;
234
  }
235
 
236
+ function hits() {
 
237
  global $wpdb;
238
+
239
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id ) FROM {$wpdb->prefix}redirection_logs WHERE module_id=%d", $this->id ) );
240
+ if ( $count > 0 )
241
  return $count;
242
  return 0;
243
  }
244
 
245
+ function reset() {
246
+ Red_Module::clear_cache( $this->id );
 
247
 
248
+ $groups = Red_Group::get_for_module( $this->id );
249
+ if ( count( $groups ) > 0 ) {
250
+ foreach ( $groups AS $group ) {
251
+ $group->reset();
252
+ }
253
  }
254
 
255
+ RE_Log::delete_for_module( $this->id );
256
+ }
257
+
258
+ function is_valid() {
259
+ return true;
260
  }
261
 
262
+ function load( $data ) {
263
+ }
264
+
265
+ function config() {
266
+ }
267
  }
268
 
 
models/monitor.php CHANGED
@@ -1,113 +1,50 @@
1
  <?php
2
 
3
- class Red_Monitor
4
- {
5
  var $monitor_post;
6
- var $monitor_category;
7
 
8
- function Red_Monitor ($options)
9
- {
10
- if ($options['monitor_post'] > 0)
11
- {
12
  $this->monitor_post = $options['monitor_post'];
13
 
14
- add_action ('edit_form_advanced', array (&$this, 'insert_old_post'));
15
- add_action ('edit_page_form', array (&$this, 'insert_old_post'));
16
- add_action ('edit_post', array (&$this, 'post_changed'));
17
- add_action ('delete_post', array (&$this, 'post_deleted'));
18
-
19
- // if ($options['monitor_new_posts'])
20
- // add_action ('transition_post_status', array (&$this, 'transition_post_status'), 10, 3);
21
- }
22
-
23
- if ($options['monitor_category'] > 0)
24
- {
25
- /* $this->monitor_category = $options['monitor_category'];
26
-
27
- add_action ('edit_category_form', array (&$this, 'insert_old_category'));
28
- add_action ('edit_category', array (&$this, 'category_changed'));
29
- */
30
- }
31
- }
32
-
33
- function transition_post_status ($new_status, $old_status, $post)
34
- {
35
- if ($new_status == 'publish')
36
- {
37
- $redirect = array
38
- (
39
- 'source' => '',
40
- 'target' => substr (get_permalink ($post->ID), strlen (get_bloginfo ('home'))),
41
- 'match' => 'url',
42
- 'red_action' => 'url',
43
- 'regex' => false,
44
- 'group' => $this->monitor_post
45
- );
46
-
47
- Red_Item::create ($redirect);
48
  }
49
  }
50
 
51
- function insert_old_category ($category)
52
- {
53
- if (isset ($category->cat_ID))
54
- {
55
- $link = get_category_link ($category->cat_ID);
56
- $url = parse_url ($link);
57
- ?>
58
- <input type="hidden" name="redirection_slug" value="<?php echo attribute_escape ($url['path']) ?>"/>
59
- <?php
60
- }
61
  }
62
 
63
- function category_changed ($categoryid)
64
- {
65
- $new_url = parse_url (get_category_link ($categoryid));
66
- $new_url['path'] = dirname ($new_url['path']).'/'.$_POST['category_nicename'];
67
-
68
- if ($new_url['path'] != $_POST['redirection_slug'] && $_POST['redirection_slug'] != '')
69
- {
70
- $redirect = array
71
- (
72
- 'source' => '^'.$_POST['redirection_slug'].'/(.*)$',
73
- 'target' => $new_url['path'].'/$1',
74
- 'match' => 'url',
75
- 'red_action' => 'url',
76
- 'regex' => true,
77
- 'group' => $this->monitor_post
78
- );
79
 
80
- Red_Item::create ($redirect);
81
- }
82
- }
83
-
84
- function insert_old_post ()
85
- {
86
- global $post;
87
- ?>
88
- <input type="hidden" name="redirection_slug" value="<?php the_permalink () ?>"/>
89
- <input type="hidden" name="redirection_status" value="<?php echo $post->post_status ?>"/>
90
- <?php
91
- }
92
-
93
- function post_changed ($id)
94
- {
95
- if (isset($_POST['redirection_slug'])) {
96
- $post = get_post ($id);
97
- $newslug = get_permalink ($id);
98
- $oldslug = $_POST['redirection_slug'];
99
- $base = get_option ('home');
100
-
101
- if ( $newslug != $oldslug && strlen( $oldslug ) > 0 && ( strpos( $oldslug, '?p=' ) === false ) && ( $post->post_status == 'publish' || $post->post_status == 'static' ) && $_POST['redirection_status'] != 'draft' && ( $post->post_type == 'post' || $post->post_type == 'page' ) && $oldslug != '/' && rtrim( $oldslug, '/' ) != rtrim( get_option( 'home' ), '/' ) )
102
- {
103
- $old_url = parse_url ($oldslug);
104
- $new_url = parse_url ($newslug);
105
-
106
- Red_Item::create (array ('source' => $old_url['path'], 'target' => $new_url['path'], 'match' => 'url', 'red_action' => 'url', 'group' => $this->monitor_post));
107
  }
108
  }
109
  }
110
-
111
  function post_deleted ($id)
112
  {
113
  $post = get_post ($id);
1
  <?php
2
 
3
+ class Red_Monitor {
 
4
  var $monitor_post;
 
5
 
6
+ function Red_Monitor( $options ) {
7
+ if ( $options['monitor_post'] > 0 ) {
 
 
8
  $this->monitor_post = $options['monitor_post'];
9
 
10
+ // Only monitor if permalinks enabled
11
+ if ( get_option( 'permalink_structure' ) ) {
12
+ add_action( 'post_updated', array( &$this, 'post_updated' ), 11, 3 );
13
+ add_action( 'delete_post', array( &$this, 'post_deleted' ) );
14
+ add_action( 'edit_form_advanced', array( &$this, 'insert_old_post' ) );
15
+ add_action( 'edit_page_form', array( &$this, 'insert_old_post' ) );
16
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
  }
19
 
20
+ function insert_old_post() {
21
+ global $post;
22
+
23
+ $url = parse_url( get_permalink() );
24
+ $url = $url['path'];
25
+ ?>
26
+ <input type="hidden" name="redirection_slug" value="<?php echo esc_attr( $url ) ?>"/>
27
+ <?php
 
 
28
  }
29
 
30
+ function post_updated( $post_id, $post, $post_before ) {
31
+ if ( isset( $_POST['redirection_slug'] ) ) {
32
+ $after = parse_url( get_permalink( $post_id ) );
33
+ $after = $after['path'];
34
+ $before = esc_url( $_POST['redirection_slug'] );
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ if ( in_array( $post->post_status, array( 'publish', 'static' ) ) && $before != $after && $before != '/' ) {
37
+ Red_Item::create( array(
38
+ 'source' => $before,
39
+ 'target' => $after,
40
+ 'match' => 'url',
41
+ 'red_action' => 'url',
42
+ 'group' => $this->monitor_post
43
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
  }
46
  }
47
+
48
  function post_deleted ($id)
49
  {
50
  $post = get_post ($id);
models/pager.php CHANGED
@@ -82,17 +82,10 @@ class RE_Pager
82
 
83
  global $user_ID;
84
 
85
- if ( function_exists( 'get_user_meta' ) )
86
- $per_page = get_user_meta ($user_ID, 'ug_per_page');
87
- else
88
- $per_page = get_usermeta ($user_ID, 'ug_per_page');
89
-
90
  if (isset ($data['perpage']))
91
  {
92
  $this->per_page = intval ($data['perpage']);
93
  $per_page[get_class ($this)][$this->id] = $this->per_page;
94
-
95
- update_usermeta ($user_ID, 'ug_per_page', $per_page);
96
  }
97
  else if (isset ($per_page[get_class ($this)]) && isset ($per_page[get_class ($this)][$this->id]))
98
  $this->per_page = $per_page[get_class ($this)][$this->id];
82
 
83
  global $user_ID;
84
 
 
 
 
 
 
85
  if (isset ($data['perpage']))
86
  {
87
  $this->per_page = intval ($data['perpage']);
88
  $per_page[get_class ($this)][$this->id] = $this->per_page;
 
 
89
  }
90
  else if (isset ($per_page[get_class ($this)]) && isset ($per_page[get_class ($this)][$this->id]))
91
  $this->per_page = $per_page[get_class ($this)][$this->id];
models/redirect.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
- * @copyright Copyright (C) John Godley
8
  **/
9
 
10
  /*
@@ -12,15 +12,14 @@
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
- consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
16
  use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17
- contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
- class Red_Item
23
- {
24
  var $id = null;
25
  var $url = null;
26
  var $regex = false;
@@ -31,402 +30,380 @@ class Red_Item
31
 
32
  var $tracking = true;
33
 
34
- function Red_Item ($values, $type = '', $match = '')
35
- {
36
- if (is_array ($values))
37
- {
38
- foreach ($values AS $key => $value)
39
  $this->$key = $value;
 
40
 
41
- if ($this->match_type)
42
- {
43
- $this->match = Red_Match::create ($this->match_type, $this->action_data);
44
  $this->match->id = $this->id;
45
  $this->match->action_code = $this->action_code;
46
  }
47
 
48
- if ($this->action_type)
49
- {
50
- $this->action = Red_Action::create ($this->action_type, $this->action_code);
51
  $this->match->action = $this->action;
52
  }
53
  else
54
- $this->action = Red_Action::create ('nothing', 0);
55
 
56
- if ($this->last_access == '0000-00-00 00:00:00')
57
  $this->last_access = 0;
58
  else
59
- $this->last_access = mysql2date ('U', $this->last_access);
60
  }
61
- else
62
- {
63
  $this->url = $values;
64
  $this->type = $type;
65
  $this->match = $match;
66
  }
67
  }
68
 
69
- function get_all_for_module ($module)
70
- {
71
  global $wpdb;
72
-
73
  $sql = "SELECT @redirection_items.*,@redirection_groups.tracking FROM @redirection_items INNER JOIN @redirection_groups ON @redirection_groups.id=@redirection_items.group_id AND @redirection_groups.status='enabled' AND @redirection_groups.module_id='$module' WHERE @redirection_items.status='enabled' ORDER BY @redirection_groups.position,@redirection_items.position";
74
- $sql = str_replace ('@', $wpdb->prefix, $sql);
75
 
76
- $rows = $wpdb->get_results ($sql, ARRAY_A);
77
- $items = array ();
78
- if (count ($rows) > 0)
79
- {
80
- foreach ($rows AS $row)
81
- $items[] = new Red_Item ($row);
82
  }
83
 
84
- return $items;
85
-
86
  }
87
 
88
- function get_for_url ($url, $type)
89
- {
90
  global $wpdb;
91
-
92
- $sql = "SELECT @redirection_items.*,@redirection_groups.tracking,@redirection_modules.id AS module_id FROM @redirection_items INNER JOIN @redirection_groups ON @redirection_groups.id=@redirection_items.group_id AND @redirection_groups.status='enabled' INNER JOIN @redirection_modules ON @redirection_modules.id=@redirection_groups.module_id AND @redirection_modules.type='$type' WHERE (@redirection_items.regex=1 OR @redirection_items.url='".$wpdb->escape ($url)."' OR @redirection_items.url='".$wpdb->escape( urldecode( $url ) )."') ORDER BY @redirection_groups.position,@redirection_items.position";
93
- $sql = str_replace ('@', $wpdb->prefix, $sql);
94
 
95
- $rows = $wpdb->get_results ($sql, ARRAY_A);
96
- $items = array ();
97
- if (count ($rows) > 0)
98
- {
99
- foreach ($rows AS $row)
100
- $items[] = new Red_Item ($row);
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
-
 
 
 
103
  return $items;
104
  }
105
 
106
- function get_by_module (&$pager, $module)
107
- {
108
  global $wpdb;
109
 
110
  $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}redirection_items INNER JOIN {$wpdb->prefix}redirection_groups ON {$wpdb->prefix}redirection_groups.id={$wpdb->prefix}redirection_items.group_id";
111
- $sql .= $pager->to_limits ("{$wpdb->prefix}redirection_groups.module_id=".$module, array ('url', 'action_data'));
112
 
113
- $rows = $wpdb->get_results ($sql, ARRAY_A);
114
- $pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
115
- $items = array ();
116
- if (count ($rows) > 0)
117
  {
118
- foreach ($rows AS $row)
119
- $items[] = new Red_Item ($row);
120
  }
121
 
122
  return $items;
123
  }
124
 
125
- function get_by_group ($group, &$pager)
126
- {
 
 
127
  global $wpdb;
128
 
129
- $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}redirection_items ";
130
- $sql .= $pager->to_limits ('group_id='.$group, array ('url', 'action_data'));
131
-
132
- $rows = $wpdb->get_results ($sql, ARRAY_A);
133
- $pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
134
- $items = array ();
135
- if (count ($rows) > 0)
136
- {
137
- foreach ($rows AS $row)
138
- $items[] = new Red_Item ($row);
139
  }
140
 
141
  return $items;
142
  }
143
 
144
- function get_by_id ($id)
145
- {
146
  global $wpdb;
147
 
148
- $id = intval ($id);
149
- $row = $wpdb->get_row ("SELECT * FROM {$wpdb->prefix}redirection_items WHERE id='$id'", ARRAY_A);
150
- if ($row)
151
- return new Red_Item ($row);
152
  return false;
153
  }
154
 
155
- function auto_generate ()
156
- {
157
  global $redirection;
158
 
159
- $options = $redirection->get_options ();
160
- $id = time ();
161
 
162
  $url = $options['auto_target'];
163
- $url = str_replace ('$dec$', $id, $url);
164
- $url = str_replace ('$hex$', sprintf ('%x', $id), $url);
165
  return $url;
166
  }
167
 
168
- function create ($details)
169
- {
170
  global $wpdb;
171
 
172
  // Auto generate URLs
173
- if ($details['source'] == '')
174
- $details['source'] = Red_Item::auto_generate ();
175
 
176
- if ($details['target'] == '')
177
- $details['target'] = Red_Item::auto_generate ();
178
 
179
  // Make sure we don't redirect to ourself
180
- if ($details['source'] == $details['target'])
181
  $details['target'] .= '-1';
182
 
183
- $matcher = Red_Match::create ($details['match']);
184
- $group_id = intval ($details['group']);
185
 
186
- if ($group_id > 0 && $matcher)
187
- {
188
- $match = $wpdb->escape ($details['match']);
189
- $regex = (isset ($details['regex']) && $details['regex'] != false) ? true : false;
190
- $url = $wpdb->escape (Red_Item::sanitize_url ($details['source'], $regex));
191
- $action = $details['red_action'];
192
- $position = $wpdb->get_var ("SELECT COUNT(id) FROM {$wpdb->prefix}redirection_items WHERE group_id='{$group_id}'");
193
 
194
- $data = $wpdb->escape ($matcher->data ($details));
195
-
196
- if ($action == 'url' || $action == 'random')
197
  $action_code = 301;
198
- else if ($action == 'error')
199
  $action_code = 404;
200
- else
201
- $action_code = 0;
202
 
203
- if (isset ($details['action_code']))
204
- $action_code = intval ($details['action_code']);
205
 
206
- // Quick check for loop
207
- // if ($wpdb->get_var ("SELECT COUNT(id) FROM {$wpdb->prefix}redirection_items WHERE url='$url'") == 0)
208
- {
209
- $wpdb->query ("INSERT INTO {$wpdb->prefix}redirection_items (url,action_type,regex,position,match_type,action_data,action_code,last_access,group_id) VALUES ('$url','$action','".($regex ? 1 : 0)."','$position','$match','$data',$action_code,0,'$group_id')");
210
-
211
- $group = Red_Group::get ($group_id);
212
- Red_Module::flush ($group->module_id);
 
 
 
 
 
 
213
 
214
- return Red_Item::get_by_id ($wpdb->insert_id);
215
- }
 
 
216
  }
217
 
218
  return false;
219
  }
220
 
221
- function delete_by_group ($group)
222
- {
223
  global $wpdb;
224
 
225
- RE_Log::delete_for_group ($group);
226
 
227
- $wpdb->query ("DELETE FROM {$wpdb->prefix}redirection_items WHERE group_id='$group'");
228
 
229
- $group = Red_Group::get ($group_id);
230
- Red_Module::flush ($group->module_id);
231
  }
232
 
233
- function delete ($id)
234
- {
235
  global $wpdb;
236
 
237
- $id = intval ($id);
238
- $wpdb->query ("DELETE FROM {$wpdb->prefix}redirection_items WHERE id='$id'");
239
 
240
- RE_Log::delete_for_id ($id);
241
 
242
  // Reorder all elements
243
- $rows = $wpdb->get_results ("SELECT id FROM {$wpdb->prefix}redirection_items ORDER BY position");
244
- if (count ($rows) > 0)
245
- {
246
- foreach ($rows AS $pos => $row)
247
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET position='$pos' WHERE id='{$row->id}'");
248
  }
249
  }
250
 
251
 
252
- function sanitize_url ($url, $regex)
253
- {
254
  // Make sure that the old URL is relative
255
- $url = preg_replace ('@https?://(.*?)/@', '/', $url);
256
- $url = preg_replace ('@https?://(.*?)$@', '/', $url);
257
- $url = preg_replace ('@/{2,}@', '/', $url);
258
 
259
- if (substr ($url, 0, 1) != '/' && $regex == false)
260
  $url = '/'.$url;
261
  return $url;
262
  }
263
 
264
 
265
- function update ($details)
266
- {
267
- if (strlen ($details['old']) > 0)
268
- {
269
  global $wpdb;
270
 
271
- $this->url = $details['old'];
272
- $this->regex = isset ($details['regex']) ? true : false;
273
  $this->title = $details['title'];
274
 
275
- // Update the match
276
- $this->url = $this->sanitize_url ($this->url, $this->regex);
277
-
278
- $data = $wpdb->escape ($this->match->data ($details));
279
- $url = $wpdb->escape ($this->url);
280
- $title = $wpdb->escape ($this->title);
281
- $regex = isset ($details['regex']) ? 1 : 0;
282
 
283
- if (isset ($details['action_code']))
284
- $action_code = intval ($details['action_code']);
285
- else
286
- $action_code = 0;
287
 
288
- $this->action_code = $action_code;
289
- $group_id = $this->group_id;
290
- if (isset ($details['group_id']))
291
- $group_id = intval ($details['group_id']);
292
 
293
  // Save this
294
  global $wpdb;
295
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET url='$url', regex='{$regex}', action_code='$action_code', action_data='$data', group_id='$group_id', title='$title' WHERE id='{$this->id}'");
296
 
297
- $group = Red_Group::get ($group_id);
298
- Red_Module::flush ($group->module_id);
 
299
  }
300
  }
301
 
302
- function save_order ($items, $start)
303
- {
304
  global $wpdb;
305
 
306
- foreach ($items AS $pos => $id)
307
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET position='".($pos + $start)."' WHERE id='{$id}'");
 
308
 
309
- $item = Red_Item::get_by_id ($id);
310
- $group = Red_Group::get ($item->group_id);
311
- Red_Module::flush ($group->module_id);
 
312
  }
313
 
314
  function matches( $url ) {
315
- $this->url = str_replace (' ', '%20', $this->url);
316
- $matches = false;
317
 
318
  // Check if we match the URL
319
- if (($this->regex == false && ($this->url == $url || $this->url == rtrim ($url, '/') || $this->url == urldecode( $url ))) || ($this->regex == true && @preg_match ('@'.str_replace ('@', '\\@', $this->url).'@', $url, $matches) > 0) || ($this->regex == true && @preg_match ('@'.str_replace ('@', '\\@', $this->url).'@', urldecode( $url ), $matches) > 0))
320
- {
321
  // Check if our match wants this URL
322
- $target = $this->match->get_target ($url, $this->url, $this->regex);
323
- if ($target)
324
- {
325
- $target = $this->replaceSpecialTags ($target);
326
- $this->visit ($url, $target);
327
- if ($this->status == 'enabled')
328
- return $this->action->process_before ($this->action_code, $target);
 
 
329
  }
330
  }
331
 
332
  return false;
333
  }
334
 
335
- function replaceSpecialTags ($target)
336
- {
337
- if (is_numeric($target))
338
- $target = get_permalink($target);
339
  else {
340
- $user = wp_get_current_user ();
341
- if (!empty($user))
342
- {
343
- $target = str_replace ('%userid%', $user->ID, $target);
344
- $target = str_replace ('%userlogin%', isset($user->user_login) ? $user->user_login : '', $target);
345
- $target = str_replace ('%userurl%', isset($user->user_url) ? $user->user_url : '', $target);
346
  }
347
  }
348
 
349
  return $target;
350
  }
351
 
352
- function visit ($url, $target)
353
- {
354
- if ($this->tracking && $this->id)
355
- {
356
  global $wpdb, $redirection;
357
 
358
  // Update the counters
359
  $count = $this->last_count + 1;
360
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET last_count='$count', last_access=NOW() WHERE id='{$this->id}'");
361
 
362
- if (isset ($_SERVER['HTTP_X_FORWARDED_FOR']))
363
  $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
364
- elseif (isset ($_SERVER['REMOTE_ADDR']))
365
  $ip = $_SERVER['REMOTE_ADDR'];
366
 
367
- $options = $redirection->get_options ();
368
- if ($options['log_redirections'])
369
- $log = RE_Log::create ($url, $target, $_SERVER['HTTP_USER_AGENT'], $ip, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', $this->id, $this->module_id, $this->group_id);
370
  }
371
  }
372
 
373
- function reset ()
374
- {
375
  global $wpdb;
376
 
377
  $this->last_count = 0;
378
  $this->last_access = '0000-00-00 00:00:00';
379
 
380
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET last_count=0, last_access='{$this->last_access}' WHERE id='{$this->id}'");
381
 
382
- RE_Log::delete_for_id ($this->id);
383
  }
384
 
385
- function show_url ($url)
386
- {
387
- return implode ('&#8203;/', explode ('/', $url));
388
  }
389
 
390
- function move_to ($group)
391
- {
392
  global $wpdb;
393
 
394
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET group_id='$group' WHERE id='{$this->id}'");
395
  }
396
 
397
- function toggle_status ()
398
- {
399
  global $wpdb;
400
 
401
- $this->status = ($this->status == 'enabled') ? 'disabled' : 'enabled';
402
- $wpdb->query ("UPDATE {$wpdb->prefix}redirection_items SET status='{$this->status}' WHERE id='{$this->id}'");
403
  }
404
 
405
- function actions ($action = '')
406
- {
407
- $actions = array
408
- (
409
- 'url' => __ ('Redirect to URL', 'redirection'),
410
- 'random' => __ ('Redirect to random post', 'redirection'),
411
- 'pass' => __ ('Pass-through', 'redirection'),
412
- 'error' => __ ('Error (404)', 'redirection'),
413
- 'nothing' => __ ('Do nothing', 'redirection'),
414
  );
415
 
416
- if ($action)
417
  return $actions[$action];
418
  return $actions;
419
  }
420
 
421
- function match_name () { return $this->match->match_name (); }
 
 
422
 
423
- function type ()
424
- {
425
- if (($this->action_type == 'url' || $this->action_type == 'error' || $this->action_type == 'random') && $this->action_code > 0)
426
  return $this->action_code;
427
- else if ($this->action_type == 'pass')
428
  return 'pass';
429
  return '&mdash;';
430
  }
431
  }
432
- ?>
4
  *
5
  * @package Redirection
6
  * @author John Godley
7
+ * @copyright Copyright( C) John Godley
8
  **/
9
 
10
  /*
12
  This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13
  implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14
  the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15
+ consequential damages( including, but not limited to, procurement of substitute goods or services; loss of
16
  use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17
+ contract, strict liability, or tort( including negligence or otherwise) arising in any way out of the use of
18
  this software, even if advised of the possibility of such damage.
19
 
20
  For full license details see license.txt
21
  ============================================================================================================ */
22
+ class Red_Item {
 
23
  var $id = null;
24
  var $url = null;
25
  var $regex = false;
30
 
31
  var $tracking = true;
32
 
33
+ function Red_Item( $values, $type = '', $match = '' ) {
34
+ if ( is_object( $values ) ) {
35
+ foreach ( $values AS $key => $value ) {
 
 
36
  $this->$key = $value;
37
+ }
38
 
39
+ if ( $this->match_type ) {
40
+ $this->match = Red_Match::create( $this->match_type, $this->action_data);
 
41
  $this->match->id = $this->id;
42
  $this->match->action_code = $this->action_code;
43
  }
44
 
45
+ if ( $this->action_type ) {
46
+ $this->action = Red_Action::create( $this->action_type, $this->action_code);
 
47
  $this->match->action = $this->action;
48
  }
49
  else
50
+ $this->action = Red_Action::create( 'nothing', 0 );
51
 
52
+ if ( $this->last_access == '0000-00-00 00:00:00' )
53
  $this->last_access = 0;
54
  else
55
+ $this->last_access = mysql2date( 'U', $this->last_access);
56
  }
57
+ else {
 
58
  $this->url = $values;
59
  $this->type = $type;
60
  $this->match = $match;
61
  }
62
  }
63
 
64
+ function get_all_for_module( $module ) {
 
65
  global $wpdb;
66
+
67
  $sql = "SELECT @redirection_items.*,@redirection_groups.tracking FROM @redirection_items INNER JOIN @redirection_groups ON @redirection_groups.id=@redirection_items.group_id AND @redirection_groups.status='enabled' AND @redirection_groups.module_id='$module' WHERE @redirection_items.status='enabled' ORDER BY @redirection_groups.position,@redirection_items.position";
68
+ $sql = str_replace( '@', $wpdb->prefix, $sql );
69
 
70
+ $rows = $wpdb->get_results( $sql );
71
+ $items = array();
72
+ if ( count( $rows) > 0 ) {
73
+ foreach ( $rows AS $row ) {
74
+ $items[] = new Red_Item( $row );
75
+ }
76
  }
77
 
78
+ return $items;
 
79
  }
80
 
81
+ function exists( $url ) {
 
82
  global $wpdb;
 
 
 
83
 
84
+ if ( $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$wpdb->prefix}redirection_items WHERE url=%s", $url ) ) > 0 )
85
+ return true;
86
+ return false;
87
+ }
88
+
89
+ function get_for_url( $url, $type ) {
90
+ global $wpdb;
91
+
92
+ $sql = $wpdb->prepare( "SELECT @redirection_items.*,@redirection_groups.tracking,@redirection_groups.position AS group_pos,@redirection_modules.id AS module_id FROM @redirection_items INNER JOIN @redirection_groups ON @redirection_groups.id=@redirection_items.group_id AND @redirection_groups.status='enabled' INNER JOIN @redirection_modules ON @redirection_modules.id=@redirection_groups.module_id AND @redirection_modules.type=%s WHERE( @redirection_items.regex=1 OR @redirection_items.url=%s)", $type, $url );
93
+ $sql = str_replace( '@', $wpdb->prefix, $sql);
94
+
95
+ $rows = $wpdb->get_results( $sql ) ;
96
+ $items = array();
97
+ if ( count( $rows ) > 0 ) {
98
+ foreach ( $rows AS $row ) {
99
+ $items[$row->group_pos.'.'.$row->position] = new Red_Item( $row );
100
+ }
101
  }
102
+
103
+ // Sort it in PHP
104
+ ksort( $items );
105
+ $items = array_values( $items );
106
  return $items;
107
  }
108
 
109
+ function get_by_module( &$pager, $module ) {
 
110
  global $wpdb;
111
 
112
  $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}redirection_items INNER JOIN {$wpdb->prefix}redirection_groups ON {$wpdb->prefix}redirection_groups.id={$wpdb->prefix}redirection_items.group_id";
113
+ $sql .= $pager->to_limits( "{$wpdb->prefix}redirection_groups.module_id=".$module, array( 'url', 'action_data' ));
114
 
115
+ $rows = $wpdb->get_results( $sql );
116
+ $pager->set_total( $wpdb->get_var( "SELECT FOUND_ROWS()" ));
117
+ $items = array();
118
+ if ( count( $rows) > 0)
119
  {
120
+ foreach( $rows AS $row)
121
+ $items[] = new Red_Item( $row);
122
  }
123
 
124
  return $items;
125
  }
126
 
127
+ /**
128
+ * Get redirection items in a group
129
+ */
130
+ function get_by_group( $group, &$pager ) {
131
  global $wpdb;
132
 
133
+ $rows = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->prefix}redirection_items ".$pager->to_limits( 'group_id='.$group, array( 'url', 'action_data' ) ) ) );
134
+ $pager->set_total( $wpdb->get_var( "SELECT FOUND_ROWS()" ));
135
+
136
+ $items = array();
137
+ if ( count( $rows ) > 0 ) {
138
+ foreach ( $rows AS $row ) {
139
+ $items[] = new Red_Item( $row );
140
+ }
 
 
141
  }
142
 
143
  return $items;
144
  }
145
 
146
+ function get_by_id( $id ) {
 
147
  global $wpdb;
148
 
149
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}redirection_items WHERE id=%d", $id ) );
150
+ if ( $row )
151
+ return new Red_Item( $row );
 
152
  return false;
153
  }
154
 
155
+ function auto_generate() {
 
156
  global $redirection;
157
 
158
+ $options = $redirection->get_options();
159
+ $id = time();
160
 
161
  $url = $options['auto_target'];
162
+ $url = str_replace( '$dec$', $id, $url );
163
+ $url = str_replace( '$hex$', sprintf( '%x', $id), $url );
164
  return $url;
165
  }
166
 
167
+ function create( $details ) {
 
168
  global $wpdb;
169
 
170
  // Auto generate URLs
171
+ if ( $details['source'] == '' )
172
+ $details['source'] = Red_Item::auto_generate();
173
 
174
+ if ( $details['target'] == '' )
175
+ $details['target'] = Red_Item::auto_generate();
176
 
177
  // Make sure we don't redirect to ourself
178
+ if ( $details['source'] == $details['target'] )
179
  $details['target'] .= '-1';
180
 
181
+ $matcher = Red_Match::create( $details['match'] );
182
+ $group_id = intval( $details['group'] );
183
 
184
+ if ( $group_id > 0 && $matcher ) {
185
+ $regex = ( isset( $details['regex']) && $details['regex'] != false) ? true : false;
186
+ $position = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$wpdb->prefix}redirection_items WHERE group_id=%d", $group_id ) );
 
 
 
 
187
 
188
+ $action = $details['red_action'];
189
+ $action_code = 0;
190
+ if ( $action == 'url' || $action == 'random' )
191
  $action_code = 301;
192
+ elseif ( $action == 'error' )
193
  $action_code = 404;
 
 
194
 
195
+ if ( isset( $details['action_code'] ) )
196
+ $action_code = intval( $details['action_code'] );
197
 
198
+ $data = array(
199
+ 'url' => Red_Item::sanitize_url( $details['source'], $regex),
200
+ 'action_type' => $details['red_action'],
201
+ 'regex' => $regex,
202
+ 'position' => $position,
203
+ 'match_type' => $details['match'],
204
+ 'action_data' => $matcher->data( $details ),
205
+ 'action_code' => $action_code,
206
+ 'last_access' => 0,
207
+ 'group_id' => $group_id
208
+ );
209
+
210
+ $wpdb->insert( $wpdb->prefix.'redirection_items', $data );
211
 
212
+ $group = Red_Group::get( $group_id );
213
+ Red_Module::flush( $group->module_id );
214
+
215
+ return Red_Item::get_by_id( $wpdb->insert_id );
216
  }
217
 
218
  return false;
219
  }
220
 
221
+ function delete_by_group( $group ) {
 
222
  global $wpdb;
223
 
224
+ RE_Log::delete_for_group( $group);
225
 
226
+ $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_items WHERE group_id=%d", $group ) );
227
 
228
+ $group = Red_Group::get( $group_id );
229
+ Red_Module::flush( $group->module_id );
230
  }
231
 
232
+ function delete( $id ) {
 
233
  global $wpdb;
234
 
235
+ $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}redirection_items WHERE id=%d", $id ) );
 
236
 
237
+ RE_Log::delete_for_id( $id );
238
 
239
  // Reorder all elements
240
+ $rows = $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}redirection_items ORDER BY position" );
241
+ if ( count( $rows) > 0 ) {
242
+ foreach ( $rows AS $pos => $row ) {
243
+ $wpdb->update( $wpdb->prefix.'redirection_items', array( 'position' => $pos ), array( 'id' => $row->id ) );
244
+ }
245
  }
246
  }
247
 
248
 
249
+ function sanitize_url( $url, $regex ) {
 
250
  // Make sure that the old URL is relative
251
+ $url = preg_replace( '@^https?://(.*?)/@', '/', $url );
252
+ $url = preg_replace( '@^https?://(.*?)$@', '/', $url );
 
253
 
254
+ if ( substr( $url, 0, 1) != '/' && $regex == false )
255
  $url = '/'.$url;
256
  return $url;
257
  }
258
 
259
 
260
+ function update( $details ) {
261
+ if ( strlen( $details['old'] ) > 0 ) {
 
 
262
  global $wpdb;
263
 
264
+ $this->regex = isset( $details['regex'] ) ? true : false;
265
+ $this->url = $this->sanitize_url( $details['old'], $this->regex );
266
  $this->title = $details['title'];
267
 
268
+ $data = $this->match->data( $details );
 
 
 
 
 
 
269
 
270
+ $this->action_code = 0;
271
+ if ( isset( $details['action_code'] ) )
272
+ $this->action_code = intval( $details['action_code'] );
 
273
 
274
+ if ( isset( $details['group_id'] ) )
275
+ $this->group_id = intval( $details['group_id'] );
 
 
276
 
277
  // Save this
278
  global $wpdb;
279
+ $wpdb->update( $wpdb->prefix.'redirection_items', array( 'url' => $this->url, 'regex' => $this->regex, 'action_code' => $this->action_code, 'action_data' => $data, 'group_id' => $this->group_id, 'title' => $this->title ), array( 'id' => $this->id ) );
280
 
281
+ $group = Red_Group::get( $this->group_id );
282
+ if ( $group )
283
+ Red_Module::flush( $group->module_id );
284
  }
285
  }
286
 
287
+ function save_order( $items, $start ) {
 
288
  global $wpdb;
289
 
290
+ foreach ( $items AS $pos => $id ) {
291
+ $wpdb->update( $wpdb->prefix.'redirection_items', array( 'position' => $pos + $start ), array( 'id' => $id ) );
292
+ }
293
 
294
+ $item = Red_Item::get_by_id( $id );
295
+ $group = Red_Group::get( $item->group_id );
296
+ if ( $group )
297
+ Red_Module::flush( $group->module_id );
298
  }
299
 
300
  function matches( $url ) {
301
+ $this->url = str_replace( ' ', '%20', $this->url );
302
+ $matches = false;
303
 
304
  // Check if we match the URL
305
+ if ( ( $this->regex == false && ( $this->url == $url || $this->url == rtrim( $url, '/' ) || $this->url == urldecode( $url ) ) ) ||( $this->regex == true && @preg_match( '@'.str_replace( '@', '\\@', $this->url).'@', $url, $matches) > 0) ||( $this->regex == true && @preg_match( '@'.str_replace( '@', '\\@', $this->url).'@', urldecode( $url ), $matches) > 0) ) {
 
306
  // Check if our match wants this URL
307
+ $target = $this->match->get_target( $url, $this->url, $this->regex);
308
+
309
+ if ( $target ) {
310
+ $target = $this->replaceSpecialTags( $target );
311
+
312
+ $this->visit( $url, $target );
313
+
314
+ if ( $this->status == 'enabled' )
315
+ return $this->action->process_before( $this->action_code, $target );
316
  }
317
  }
318
 
319
  return false;
320
  }
321
 
322
+ function replaceSpecialTags( $target ) {
323
+ if ( is_numeric( $target ) )
324
+ $target = get_permalink( $target );
 
325
  else {
326
+ $user = wp_get_current_user();
327
+ if ( !empty( $user ) ) {
328
+ $target = str_replace( '%userid%', $user->ID, $target );
329
+ $target = str_replace( '%userlogin%', isset( $user->user_login ) ? $user->user_login : '', $target );
330
+ $target = str_replace( '%userurl%', isset( $user->user_url ) ? $user->user_url : '', $target );
 
331
  }
332
  }
333
 
334
  return $target;
335
  }
336
 
337
+ function visit( $url, $target ) {
338
+ if ( $this->tracking && $this->id ) {
 
 
339
  global $wpdb, $redirection;
340
 
341
  // Update the counters
342
  $count = $this->last_count + 1;
343
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}redirection_items SET last_count=%d, last_access=NOW() WHERE id=%d", $count, $this->id ) );
344
 
345
+ if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
346
  $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
347
+ elseif ( isset( $_SERVER['REMOTE_ADDR'] ) )
348
  $ip = $_SERVER['REMOTE_ADDR'];
349
 
350
+ $options = $redirection->get_options();
351
+ if ( $options['log_redirections'])
352
+ $log = RE_Log::create( $url, $target, $_SERVER['HTTP_USER_AGENT'], $ip, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', $this->id, $this->module_id, $this->group_id);
353
  }
354
  }
355
 
356
+ function reset() {
 
357
  global $wpdb;
358
 
359
  $this->last_count = 0;
360
  $this->last_access = '0000-00-00 00:00:00';
361
 
362
+ $wpdb->update( $wpdb->prefix.'redirection_items', array( 'last_count' => 0, 'last_access' => $this->last_access ), array( 'id' => $this->id ) );
363
 
364
+ RE_Log::delete_for_id( $this->id );
365
  }
366
 
367
+ function show_url( $url ) {
368
+ return implode( '&#8203;/', explode( '/', $url ) );
 
369
  }
370
 
371
+ function move_to( $group ) {
 
372
  global $wpdb;
373
 
374
+ $wpdb->update( $wpdb->prefix.'redirection_items', array( 'group_id' => $group ), array( 'id' => $this->id ) );
375
  }
376
 
377
+ function toggle_status() {
 
378
  global $wpdb;
379
 
380
+ $this->status = ( $this->status == 'enabled' ) ? 'disabled' : 'enabled';
381
+ $wpdb->update( $wpdb->prefix.'redirection_items', array( 'status' => $this->status ), array( 'id' => $this->id ) );
382
  }
383
 
384
+ function actions( $action = '' ) {
385
+ $actions = array(
386
+ 'url' => __( 'Redirect to URL', 'redirection' ),
387
+ 'random' => __( 'Redirect to random post', 'redirection' ),
388
+ 'pass' => __( 'Pass-through', 'redirection' ),
389
+ 'error' => __( 'Error (404)', 'redirection' ),
390
+ 'nothing' => __( 'Do nothing', 'redirection' ),
 
 
391
  );
392
 
393
+ if ( $action )
394
  return $actions[$action];
395
  return $actions;
396
  }
397
 
398
+ function match_name() {
399
+ return $this->match->match_name();
400
+ }
401
 
402
+ function type() {
403
+ if ( ( $this->action_type == 'url' || $this->action_type == 'error' || $this->action_type == 'random' ) && $this->action_code > 0 )
 
404
  return $this->action_code;
405
+ else if ( $this->action_type == 'pass' )
406
  return 'pass';
407
  return '&mdash;';
408
  }
409
  }
 
modules/apache.php CHANGED
@@ -2,6 +2,11 @@
2
 
3
  class Apache_Module extends Red_Module
4
  {
 
 
 
 
 
5
  var $site = '';
6
  var $location = '';
7
  var $canonical = '';
@@ -82,7 +87,7 @@ class Apache_Module extends Red_Module
82
  <th><?php _e ('Canonical', 'redirection'); ?>:</th>
83
  <td>
84
  <select name="canonical">
85
- <?php echo $this->select (array ('default' => __ ('Leave as is', 'redirection'), 'nowww' => sprintf (__ ('Strip WWW (%s)', 'redirection'), preg_replace ('@https?://(www)?@', '', get_bloginfo ('home'))), 'www' => sprintf (__ ('Force WWW (www.%s)', 'redirection'), preg_replace ('@https?://(www)?@', '', get_bloginfo ('home')))), $this->canonical); ?>
86
  </select>
87
 
88
  <br/>
@@ -178,13 +183,5 @@ class Apache_Module extends Red_Module
178
  $options[] = __ ('IPs are allowed', 'redirection');
179
 
180
  echo '<small>'.ucfirst (implode (', ', $options)).'</small>';
181
- }
182
-
183
- function name_extra ()
184
- {
185
- if ($this->site != '')
186
- return sprintf (__ (' for external site: <code>%s</code>', 'redirection'), $this->site);
187
- }
188
  }
189
-
190
- ?>
2
 
3
  class Apache_Module extends Red_Module
4
  {
5
+ var $name;
6
+ var $allow_ip = false;
7
+ var $raw;
8
+ var $ban_ip = false;
9
+
10
  var $site = '';
11
  var $location = '';
12
  var $canonical = '';
87
  <th><?php _e ('Canonical', 'redirection'); ?>:</th>
88
  <td>
89
  <select name="canonical">
90
+ <?php echo $this->select (array ('default' => __ ('Leave as is', 'redirection'), 'nowww' => sprintf (__ ('Strip WWW (%s)', 'redirection'), preg_replace ('@https?://(www)?@', '', get_bloginfo ('url'))), 'www' => sprintf (__ ('Force WWW (www.%s)', 'redirection'), preg_replace ('@https?://(www)?@', '', get_bloginfo ('url')))), $this->canonical); ?>
91
  </select>
92
 
93
  <br/>
183
  $options[] = __ ('IPs are allowed', 'redirection');
184
 
185
  echo '<small>'.ucfirst (implode (', ', $options)).'</small>';
186
+ }
 
 
 
 
 
 
187
  }
 
 
modules/wordpress.php CHANGED
@@ -1,126 +1,72 @@
1
  <?php
2
 
3
- class WordPress_Module extends Red_Module
4
- {
5
  var $canonical = 'default';
6
  var $strip_index = 'default';
7
- var $error_level = 'default';
8
  var $time_limit = 0;
9
  var $matched;
10
 
11
- function start ()
12
- {
13
  // Setup the various filters and actions that allow Redirection to h appen
14
- add_action ('template_redirect', array (&$this, 'template_redirect'));
15
- add_action ('init', array (&$this, 'init'));
16
- add_action ('send_headers', array (&$this, 'send_headers'));
17
- add_filter ('permalink_redirect_skip', array (&$this, 'permalink_redirect_skip'));
18
- add_filter ('wp_redirect', array (&$this, 'wp_redirect'), 1, 2);
19
 
20
  // Remove WordPress 2.3 redirection
21
- remove_action ('template_redirect', 'wp_old_slug_redirect');
22
- remove_action ('edit_form_advanced', 'wp_remember_old_slug');
23
-
24
- // A WP < 2.3 fix
25
- global $wp_db_version;
26
- if ($wp_db_version < 6000)
27
- add_filter ('status_header', array (&$this, 'status_header'));
28
  }
29
 
30
- function init ()
31
- {
32
  global $redirection;
33
 
34
  $url = $_SERVER['REQUEST_URI'];
35
 
36
  // Make sure we don't try and redirect something essential
37
- if (!$this->protected_url ($url) && !$redirection->hasMatched ()) {
38
- do_action ('redirection_first', $url, $this);
39
 
40
  $redirects = Red_Item::get_for_url( $url, 'wp' );
41
 
42
- if ( !empty( $redirects) ) {
43
- foreach ($redirects AS $key => $item) {
44
- if ( $item->matches( $url ) ) {
45
- global $redirection;
46
-
47
- $redirection->setMatched( true );
48
- $this->matched = $item;
49
- break;
50
- }
51
  }
52
  }
53
 
54
- do_action ('redirection_last', $url, $this);
55
  }
56
  }
57
 
58
- function protected_url ($url)
59
  {
60
  global $redirection;
61
- $part = explode ('?', $url);
62
 
63
- if ($part[0] == str_replace (get_bloginfo ('url'), '', $redirection->url ()).'/ajax.php' || strpos($url, 'wp-cron.php') !== false)
64
  return true;
65
  return false;
66
  }
67
-
68
- function template_redirect ()
69
- {
70
- // Load data
71
- $modules = Red_Module::get_by_type ('wp');
72
-
73
- if (count ($modules) > 0)
74
- {
75
- foreach ($modules AS $wp)
76
- {
77
- // Timeout
78
- if ($wp->time_limit != 'default')
79
- set_time_limit ($wp->time_limit);
80
-
81
- // Error level
82
- if ($wp->error_level == 'none')
83
- error_reporting (0);
84
- else if ($wp->error_level == 'show')
85
- error_reporting (E_ALL);
86
-
87
- // Mangle the URL, if needed
88
- $url = (isset ($_SERVER['HTTPS']) && strtolower ($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
89
- $url .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
90
- $original = $url;
91
-
92
- if ($wp->canonical == 'www')
93
- $url = preg_replace ('@(https?)://(www)?\.?@', '$1://www.', $url);
94
- else if ($wp->canonical == 'nowww')
95
- $url = preg_replace ('@(https?)://(www)?\.?@', '$1://', $url);
96
-
97
- if ($wp->strip_index == 'yes')
98
- $url = preg_replace ('@index.(htm|html|php|asp|aspx|jsp)@', '', $url);
99
-
100
- if ($url != $original)
101
- wp_redirect ($url, 301);
102
-
103
- if ($this->matched)
104
- $this->matched->action->process_after ($this->matched->action_code, $original);
105
- }
106
- }
107
- }
108
 
109
- function status_header ($status)
110
  {
111
  // Fix for incorrect headers sent when using FastCGI/IIS
112
- if (substr (php_sapi_name (), 0, 3) == 'cgi')
113
- return str_replace ('HTTP/1.1', 'Status:', $status);
114
  return $status;
115
  }
116
 
117
- function send_headers ($obj)
118
  {
119
- if ( !empty($this->matched) && $this->matched->type == '410')
120
- status_header (410);
121
  }
122
 
123
- function wp_redirect ($url, $status)
124
  {
125
  global $wp_version, $is_IIS;
126
  if ( $wp_version < '2.1' ) {
@@ -146,109 +92,28 @@ class WordPress_Module extends Red_Module
146
  }
147
  }
148
 
149
- // XXX
150
- function permalink_redirect_skip ($skip)
151
- {
 
 
152
  // only want this if we:ve matched using redirection
153
- if ($this->matched)
154
  $skip[] = $_SERVER['REQUEST_URI'];
155
  return $skip;
156
  }
157
-
158
-
159
- function load ($data)
160
- {
161
- $mine = array ('canonical', 'strip_index', 'error_level', 'time_limit');
162
- foreach ($mine AS $key)
163
- {
164
- if (isset ($data[$key]))
165
- $this->$key = $data[$key];
166
- }
167
- }
168
-
169
- function save ($data)
170
- {
171
- $save = array
172
- (
173
- 'canonical' => $data['canonical'],
174
- 'strip_index' => $data['strip_index'],
175
- 'error_level' => $data['error_level'],
176
- 'time_limit' => $data['time_limit'],
177
- );
178
-
179
- $this->load ($save);
180
- return $save;
181
- }
182
-
183
- function config ()
184
- {
185
- ?>
186
- <tr>
187
- <th><?php _e ('Canonical', 'redirection'); ?>:</th>
188
- <td>
189
- <select name="canonical">
190
- <?php echo $this->select (array ('default' => __ ('Leave as is', 'redirection'), 'nowww' => sprintf (__ ('Strip WWW (%s)', 'redirection'), preg_replace ('@https?://(www)?@', '', get_bloginfo ('home'))), 'www' => sprintf (__ ('Force WWW (www.%s)', 'redirection'), preg_replace ('@https?://(www)?@', '', get_bloginfo ('home')))), $this->canonical); ?>
191
- </select>
192
 
193
- <strong><?php _e ('Strip Index', 'redirection'); ?>:</strong>
194
- <select name="strip_index">
195
- <?php echo $this->select (array ('default' => __ ('Leave as is', 'redirection'), 'yes' => __ ('Strip index files (html,php,asp)', 'redirection')), $this->strip_index); ?>
196
- </select>
197
- </td>
198
- </tr>
199
- <tr>
200
- <th><?php _e ('Time Limit', 'redirection') ?>:</th>
201
- <td>
202
- <select name="time_limit">
203
- <?php echo $this->select (array ('default' => __ ('Server default', 'redirection'), '30' => __ ('30 seconds', 'redirection'), '60' => __ ('1 minute', 'redirection'), '120' => __ ('2 minutes', 'redirection'), (5 * 60) => __ ('5 minutes', 'redirection'), '0' => __ ('As long as possible', 'redirection')), $this->time_limit); ?>
204
- </select>
205
-
206
- <strong><?php _e ('Error Level', 'redirection'); ?>:</strong>
207
- <select name="error_level">
208
- <?php echo $this->select (array ('default' => __ ('Server default', 'redirection'), 'none' => 'No errors', 'error' => 'Show errors'), $this->error_level); ?>
209
- </select>
210
- </td>
211
- </tr>
212
- <?php
213
- }
214
-
215
- function is_valid ()
216
  {
217
- $perm = get_option ('permalink_structure');
218
- if ($perm === false || $perm == '')
219
  return false;
220
  return true;
221
  }
222
 
223
- function options ()
224
  {
225
- if (!$this->is_valid ())
226
- echo __ ('<strong>Disabled: You must enable <a href="options-permalink.php">permalinks</a> before using this</strong>', 'redirection');
227
- else
228
- {
229
- $options = array ();
230
- if ($this->canonical != 'default' && !empty ($this->canonical))
231
- $options[] = ($this->canonical == 'nowww') ? 'strip WWW' : 'force WWW';
232
-
233
- if ($this->strip_index != 'default' && !empty ($this->strip_index))
234
- $options[] = __ ('strip index', 'redirection');
235
-
236
- if ($this->time_limit != 'default')
237
- {
238
- if ($this->time_limit == 0)
239
- $options[] = __ ('time limit set as long as possible', 'redirection');
240
- else
241
- $options[] = sprintf (__ ('time limit at %ss', 'redirection'), $this->time_limit);
242
- }
243
-
244
- if ($this->error_level != 'default' && !empty ($this->error_level))
245
- $options[] = ($this->error_level == 'none') ? __ ('no errors', 'redirection') : __ ('show errors', 'redirection');
246
-
247
- if (count ($options) > 0)
248
- echo '<small>'.ucfirst (implode (', ', $options)).'</small>';
249
- else
250
- echo __ ('<small>No options have been set</small>', 'redirection');
251
- }
252
  }
253
  }
254
- ?>
1
  <?php
2
 
3
+ class WordPress_Module extends Red_Module {
 
4
  var $canonical = 'default';
5
  var $strip_index = 'default';
 
6
  var $time_limit = 0;
7
  var $matched;
8
 
9
+ function start() {
 
10
  // Setup the various filters and actions that allow Redirection to h appen
11
+ add_action( 'init', array( &$this, 'init' ) );
12
+ add_action( 'send_headers', array( &$this, 'send_headers' ) );
13
+ add_filter( 'permalink_redirect_skip', array( &$this, 'permalink_redirect_skip' ) );
14
+ add_filter( 'wp_redirect', array( &$this, 'wp_redirect' ), 1, 2 );
 
15
 
16
  // Remove WordPress 2.3 redirection
17
+ // XXX still needed?
18
+ remove_action( 'template_redirect', 'wp_old_slug_redirect' );
19
+ remove_action( 'edit_form_advanced', 'wp_remember_old_slug' );
 
 
 
 
20
  }
21
 
22
+ function init() {
 
23
  global $redirection;
24
 
25
  $url = $_SERVER['REQUEST_URI'];
26
 
27
  // Make sure we don't try and redirect something essential
28
+ if ( !$this->protected_url( $url ) && !$redirection->hasMatched() ) {
29
+ do_action( 'redirection_first', $url, $this );
30
 
31
  $redirects = Red_Item::get_for_url( $url, 'wp' );
32
 
33
+ foreach ( (array)$redirects AS $key => $item ) {
34
+ if ( $item->matches( $url ) ) {
35
+ $redirection->setMatched( true );
36
+ $this->matched = $item;
37
+ break;
 
 
 
 
38
  }
39
  }
40
 
41
+ do_action( 'redirection_last', $url, $this );
42
  }
43
  }
44
 
45
+ function protected_url( $url )
46
  {
47
  global $redirection;
48
+ $part = explode( '?', $url );
49
 
50
+ if ( $part[0] == str_replace( get_bloginfo( 'url' ), '', $redirection->url() ).'/ajax.php' || strpos($url, 'wp-cron.php' ) !== false )
51
  return true;
52
  return false;
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ function status_header( $status )
56
  {
57
  // Fix for incorrect headers sent when using FastCGI/IIS
58
+ if ( substr( php_sapi_name(), 0, 3 ) == 'cgi' )
59
+ return str_replace( 'HTTP/1.1', 'Status:', $status );
60
  return $status;
61
  }
62
 
63
+ function send_headers( $obj )
64
  {
65
+ if ( !empty($this->matched ) && $this->matched->type == '410' )
66
+ status_header( 410 );
67
  }
68
 
69
+ function wp_redirect( $url, $status )
70
  {
71
  global $wp_version, $is_IIS;
72
  if ( $wp_version < '2.1' ) {
92
  }
93
  }
94
 
95
+ function save( $data ) {
96
+ return array();
97
+ }
98
+
99
+ function permalink_redirect_skip( $skip ) {
100
  // only want this if we:ve matched using redirection
101
+ if ( $this->matched )
102
  $skip[] = $_SERVER['REQUEST_URI'];
103
  return $skip;
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
+ function is_valid()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  {
108
+ $perm = get_option( 'permalink_structure' );
109
+ if ( $perm === false || $perm == '' )
110
  return false;
111
  return true;
112
  }
113
 
114
+ function options()
115
  {
116
+ if ( !$this->is_valid() )
117
+ echo __( '<strong>Disabled: You must enable <a href="options-permalink.php">permalinks</a> before using this</strong>', 'redirection' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
  }
 
plugin.php CHANGED
@@ -137,117 +137,8 @@ class Redirection_Plugin {
137
  $this->plugin_name = $name;
138
 
139
  $this->add_action( 'init', 'load_locale' );
140
-
141
- global $wp_version;
142
-
143
- if ( version_compare( $wp_version, '2.8', '<' ) )
144
- $this->add_action( 'admin_menu', 'compatibility_28' );
145
-
146
- if ( version_compare( $wp_version, '2.7', '<' ) )
147
- $this->add_action( 'admin_menu', 'compatibility_27' );
148
-
149
- if ( version_compare( $wp_version, '2.6', '<' ) )
150
- $this->add_action( 'admin_menu', 'compatibility_26' );
151
-
152
- if ( version_compare( $wp_version, '2.5', '<' ) ) {
153
- $this->add_action( 'admin_menu', 'compatibility_25' );
154
-
155
- if ( !function_exists( 'is_front_page' ) ) {
156
- function is_front_page ( ) {
157
- return is_home ();
158
- }
159
- }
160
- }
161
- }
162
-
163
- function compatibility_28() {
164
- if ( !function_exists( 'esc_js' ) ) {
165
- function esc_js( $text ) {
166
- $safe_text = wp_specialchars( $safe_text, ENT_COMPAT );
167
- $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
168
- $safe_text = preg_replace( "/\r?\n/", "\\n", addslashes( $safe_text ) );
169
- return apply_filters( 'js_escape', $safe_text, $text );
170
- }
171
- }
172
- }
173
-
174
- function compatibility_25() {
175
- if ( !function_exists( 'check_ajax_referer' ) ) {
176
- function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
177
- if ( $query_arg )
178
- $nonce = $_REQUEST[$query_arg];
179
- else
180
- $nonce = $_REQUEST['_ajax_nonce'] ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce'];
181
-
182
- $result = wp_verify_nonce( $nonce, $action );
183
-
184
- if ( $die && false == $result )
185
- die('-1');
186
-
187
- do_action('check_ajax_referer', $action, $result);
188
-
189
- return $result;
190
- }
191
- }
192
- }
193
-
194
- function compatibility_26() {
195
- if ( !function_exists( 'admin_url' ) ) {
196
- function admin_url() {
197
- $url = site_url('wp-admin/', 'admin');
198
-
199
- if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
200
- $url .= ltrim($path, '/');
201
-
202
- return $url;
203
- }
204
- }
205
-
206
- if ( !function_exists( 'is_ssl' ) ) {
207
- function is_ssl() {
208
- if ( isset($_SERVER['HTTPS']) ) {
209
- if ( 'on' == strtolower($_SERVER['HTTPS']) )
210
- return true;
211
- if ( '1' == $_SERVER['HTTPS'] )
212
- return true;
213
- } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
214
- return true;
215
- }
216
- return false;
217
- }
218
- }
219
-
220
- if ( !function_exists( 'site_url' ) ) {
221
- function site_url($path = '', $scheme = null) {
222
- $scheme = ( is_ssl() ? 'https' : 'http' );
223
-
224
- $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
225
-
226
- if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
227
- $url .= '/' . ltrim($path, '/');
228
-
229
- return apply_filters('site_url', $url, $path, $orig_scheme);
230
- }
231
- }
232
  }
233
 
234
- /**
235
- * Backwards compatible admin functions
236
- * @return void
237
- **/
238
- function compatibility_27() {
239
- if ( !function_exists( 'screen_icon' ) ) {
240
- function screen_icon() {
241
- }
242
- }
243
-
244
- if ( !function_exists( 'add_meta_box' ) ) {
245
- function add_meta_box ( $id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args=null ) {
246
- add_action( 'dbx_post_advanced', $callback );
247
- }
248
- }
249
- }
250
-
251
  /**
252
  * Hook called to change the locale directory
253
  * @return void
@@ -546,16 +437,16 @@ class Redirection_Plugin {
546
  if ( count( $items ) > 0 ) {
547
  foreach ( $items AS $key => $value ) {
548
  if ( is_array( $value ) ) {
549
- echo '<optgroup label="'.$key.'">';
550
 
551
  foreach ( $value AS $sub => $subvalue ) {
552
- echo '<option value="'.$sub.'"'.( $sub == $default ? ' selected="selected"' : '' ).'>'.$subvalue.'</option>';
553
  }
554
 
555
  echo '</optgroup>';
556
  }
557
  else
558
- echo '<option value="'.$key.'"'.( $key == $default ? ' selected="selected"' : '' ).'>'.$value.'</option>';
559
  }
560
  }
561
  }
137
  $this->plugin_name = $name;
138
 
139
  $this->add_action( 'init', 'load_locale' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  /**
143
  * Hook called to change the locale directory
144
  * @return void
437
  if ( count( $items ) > 0 ) {
438
  foreach ( $items AS $key => $value ) {
439
  if ( is_array( $value ) ) {
440
+ echo '<optgroup label="'.esc_attr( $key ).'">';
441
 
442
  foreach ( $value AS $sub => $subvalue ) {
443
+ echo '<option value="'.esc_attr( $sub ).'"'.( $sub == $default ? ' selected="selected"' : '' ).'>'.esc_html( $subvalue ).'</option>';
444
  }
445
 
446
  echo '</optgroup>';
447
  }
448
  else
449
+ echo '<option value="'.esc_attr( $key ).'"'.( $key == $default ? ' selected="selected"' : '' ).'>'.esc_html( $value ).'</option>';
450
  }
451
  }
452
  }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: johnny5
3
  Donate link: http://urbangiraffe.com/about/
4
  Tags: post, admin, seo, pages, manage, 301, 404, redirect, permalink
5
- Requires at least: 2.3
6
- Tested up to: 3.0
7
- Stable tag: trunk
8
 
9
  Redirection is a WordPress plugin to manage 301 redirections and keep track of 404 errors without requiring knowledge of Apache .htaccess files.
10
 
@@ -26,7 +26,6 @@ Existing features include:
26
  * Manually add 301, 302, and 307 redirections for a WordPress post, or for any other file
27
  * Full regular expression support
28
  * Apache .htaccess is not required - works entirely inside WordPress
29
- * Strip or add www to all your WordPress pages
30
  * Redirect index.php, index.html, and index.htm access
31
  * Redirection statistics telling you how many times a redirection has occurred, when it last happened, who tried to do it, and where they found your URL
32
  * Fully localized
@@ -49,6 +48,7 @@ Redirection is available in:
49
  * Polish by Kuba Majerczyk
50
  * Arabic by Jerry John
51
  * Brazilian Portuguese by Pedro Padron
 
52
 
53
  == Installation ==
54
 
@@ -218,14 +218,30 @@ Full documentation can be found on the [Redirection](http://urbangiraffe.com/plu
218
  = 2.1.25 =
219
  * Fix deep slashes
220
 
221
- = 2.2.26 =
222
  * WP 3.0 compatibility
223
 
224
- = 2.2.27 =
225
  * Arabic translation
226
 
227
- = 2.2.28 =
228
  * Brazilian Portuguese translation
229
 
230
- = 2.2.29 =
231
  * Fix problem with custom post types auto-redirecting (click on 'groups' and then 'modified posts' and clear any entries for '/' from your list)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  Contributors: johnny5
3
  Donate link: http://urbangiraffe.com/about/
4
  Tags: post, admin, seo, pages, manage, 301, 404, redirect, permalink
5
+ Requires at least: 2.9
6
+ Tested up to: 3.1
7
+ Stable tag: 2.2.2
8
 
9
  Redirection is a WordPress plugin to manage 301 redirections and keep track of 404 errors without requiring knowledge of Apache .htaccess files.
10
 
26
  * Manually add 301, 302, and 307 redirections for a WordPress post, or for any other file
27
  * Full regular expression support
28
  * Apache .htaccess is not required - works entirely inside WordPress
 
29
  * Redirect index.php, index.html, and index.htm access
30
  * Redirection statistics telling you how many times a redirection has occurred, when it last happened, who tried to do it, and where they found your URL
31
  * Fully localized
48
  * Polish by Kuba Majerczyk
49
  * Arabic by Jerry John
50
  * Brazilian Portuguese by Pedro Padron
51
+ * Dutch by Marlon Navas & Pieter Carette
52
 
53
  == Installation ==
54
 
218
  = 2.1.25 =
219
  * Fix deep slashes
220
 
221
+ = 2.1.26 =
222
  * WP 3.0 compatibility
223
 
224
+ = 2.1.27 =
225
  * Arabic translation
226
 
227
+ = 2.1.28 =
228
  * Brazilian Portuguese translation
229
 
230
+ = 2.1.29 =
231
  * Fix problem with custom post types auto-redirecting (click on 'groups' and then 'modified posts' and clear any entries for '/' from your list)
232
+
233
+ = 2.2 =
234
+ * Add Dutch translation
235
+ * Props to Ben Noordhuis for a patch
236
+ * WordPress 2.9+ only - cleaned up all the old cruft
237
+ * Better new-install process
238
+ * Upgrades from 1.0 of Redirection no longer supported
239
+ * Optimized DB tables
240
+
241
+ = 2.2.1 =
242
+ * More Dutch translation
243
+ * Use fgetcsv for CSV importer - better handling
244
+ * Allow http as URL parameter
245
+
246
+ = 2.2.2 =
247
+ * Fix encoding of JS strings
redirection.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Redirection
4
  Plugin URI: http://urbangiraffe.com/plugins/redirection/
5
  Description: Manage all your 301 redirects and monitor 404 errors
6
- Version: 2.1.29
7
  Author: John Godley
8
  Author URI: http://urbangiraffe.com
9
  ============================================================================================================
@@ -30,25 +30,23 @@ include dirname( __FILE__ ).'/models/monitor.php';
30
  include dirname( __FILE__ ).'/modules/wordpress.php';
31
  include dirname( __FILE__ ).'/modules/404.php';
32
 
33
- define( 'REDIRECTION_VERSION', '2.1.16' );
 
 
 
34
 
35
  class Redirection extends Redirection_Plugin {
36
  var $hasMatched = false;
37
 
38
  function Redirection() {
39
- $this->register_plugin('redirection', __FILE__);
40
 
41
  if ( is_admin() ) {
42
  $this->add_action( 'admin_menu' );
43
- $this->add_action( 'admin_head' );
44
- $this->add_action( 'wp_print_scripts' );
45
- $this->add_action( 'wp_print_styles' );
46
- $this->add_action( 'admin_head', 'wp_print_styles' );
47
  $this->add_action( 'init', 'inject' );
48
- $this->add_filter( 'contextual_help', 'contextual_help', 10, 2 );
49
- $this->add_action( 'admin_footer' );
50
- $this->add_filter( 'print_scripts_array' );
51
 
 
52
  $this->register_plugin_settings( __FILE__ );
53
 
54
  // Ajax functions
@@ -68,57 +66,34 @@ class Redirection extends Redirection_Plugin {
68
  $this->error->start();
69
  }
70
 
71
- $this->monitor = new Red_Monitor($this->get_options());
72
  }
73
 
74
- function print_scripts_array( $scripts ) {
75
- $farb = array_search( 'farbtastic', $scripts );
76
 
77
- if ( $farb && isset( $_GET['page'] ) && $_GET['page'] == 'redirection.php' )
78
- unset( $scripts[$farb] );
79
 
80
- return $scripts;
81
- }
82
-
83
- function plugin_settings( $links ) {
84
- $settings_link = '<a href="tools.php?page='.basename( __FILE__ ).'">'.__('Settings', 'redirection').'</a>';
85
- array_unshift( $links, $settings_link );
86
- return $links;
87
- }
88
-
89
- function contextual_help( $help, $screen ) {
90
- if ( $screen == 'tools_page_redirection' ) {
91
- $help .= '<h5>' . __( 'Redirection Help' ) . '</h5><div class="metabox-prefs">';
92
- $help .= '<a href="http://urbangiraffe.com/plugins/redirection/">'.__( 'Redirection Documentation', 'redirection' ).'</a><br/>';
93
- $help .= '<a href="http://urbangiraffe.com/support/forum/redirection">'.__( 'Redirection Support Forum', 'redirection' ).'</a><br/>';
94
- $help .= '<a href="http://urbangiraffe.com/tracker/projects/redirection/issues?set_filter=1&amp;tracker_id=1">'.__( 'Redirection Bug Tracker', 'redirection' ).'</a><br/>';
95
- $help .= '<a href="http://urbangiraffe.com/plugins/redirection/faq/">'.__( 'Redirection FAQ', 'redirection' ).'</a><br/>';
96
- $help .= __( 'Please read the documentation and FAQ, and check the bug tracker, before asking a question.', 'redirection' );
97
- $help .= '</div>';
98
  }
99
 
100
- return $help;
101
  }
102
-
103
- function is_25() {
104
- global $wp_version;
105
- if ( version_compare( '2.5', $wp_version ) <= 0 )
106
- return true;
107
- return false;
 
108
  }
109
 
110
- function submenu( $inwrap = false ) {
111
- // Decide what to do
112
- $sub = isset( $_GET['sub'] ) ? $_GET['sub'] : '';
113
- $url = explode( '&', $_SERVER['REQUEST_URI'] );
114
- $url = $url[0];
115
-
116
- if ( !$this->is_25() && $inwrap == false )
117
- $this->render_admin( 'submenu', array( 'url' => $url, 'sub' => $sub, 'class' => 'id="subsubmenu"' ) );
118
- elseif ( $this->is_25() && $inwrap == true )
119
- $this->render_admin( 'submenu', array( 'url' => $url, 'sub' => $sub, 'class' => 'class="subsubsub"', 'trail' => ' | ' ) );
120
-
121
- return $sub;
122
  }
123
 
124
  function version() {
@@ -129,50 +104,29 @@ class Redirection extends Redirection_Plugin {
129
  return '';
130
  }
131
 
132
- function wp_print_scripts() {
133
- if ( strpos( $_SERVER['REQUEST_URI'], 'redirection.php' ) ) {
134
- if (!function_exists ('wp_print_styles')) {
135
- wp_deregister_script ('jquery');
136
- wp_enqueue_script( 'jquery', $this->url ().'/2.3/jquery.js', array(), $this->version () );
137
- wp_enqueue_script( 'jquery-ui-core', $this->url ().'/2.3/ui.core.js', array('jquery'), $this->version () );
138
- wp_enqueue_script( 'jquery-ui-sortable', $this->url ().'/2.3/ui.sortable.js', array('jquery-ui-core'), $this->version () );
139
- }
140
-
141
- wp_enqueue_script( 'redirection', $this->url().'/js/redirection.js', array('jquery-form', 'jquery-ui-sortable' ), $this->version() );
142
- }
143
- }
144
-
145
- function wp_print_styles() {
146
- if ( strpos( $_SERVER['REQUEST_URI'], 'redirection.php' ) )
147
- echo '<link rel="stylesheet" href="'.$this->url().'/admin.css" type="text/css" media="screen" title="no title" charset="utf-8"/>';
148
- }
149
-
150
- function admin_head() {
151
- $sub = isset($_GET['sub']) ? $_GET['sub'] : '';
152
 
153
- if ( isset($_GET['page']) && $_GET['page'] == 'redirection.php' )
154
- $this->render_admin( 'head', array( 'type' => $sub == '' ? '301' : $sub ) );
 
 
 
 
 
155
  }
156
-
157
  function admin_menu() {
158
  add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "administrator", basename( __FILE__ ), array( &$this, "admin_screen" ) );
159
  }
160
 
161
- function update() {
162
- $version = get_option( 'redirection_version' );
163
-
164
- if ( $version != REDIRECTION_VERSION ) {
165
- include_once dirname( __FILE__ ).'/models/database.php';
166
-
167
- $db = new RE_Database();
168
- $db->upgrade( $version, REDIRECTION_VERSION );
169
- }
170
- }
171
-
172
  function admin_screen() {
173
  $this->update();
174
-
175
- $sub = $this->submenu();
 
 
176
  $options = $this->get_options();
177
 
178
  if ( isset($_GET['sub']) ) {
@@ -183,14 +137,14 @@ class Redirection extends Redirection_Plugin {
183
  elseif ( $_GET['sub'] == 'process' )
184
  return $this->admin_screen_process();
185
  elseif ( $_GET['sub'] == 'groups' )
186
- return $this->admin_groups( isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0);
187
  elseif ( $_GET['sub'] == 'modules' )
188
  return $this->admin_screen_modules();
189
  elseif ( $_GET['sub'] == 'support' )
190
  return $this->render_admin('support');
191
  }
192
 
193
- return $this->admin_redirects(isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0);
194
  }
195
 
196
  function admin_screen_modules() {
@@ -199,7 +153,7 @@ class Redirection extends Redirection_Plugin {
199
 
200
  if ( ( $module = Red_Module::create( $data ) ) ) {
201
  $moduleid = 0;
202
- if ( isset($_POST['module']))
203
  $moduleid = intval( $_POST['module'] );
204
 
205
  $this->render_message( __( 'Your module was successfully created', 'redirection' ) );
@@ -226,15 +180,16 @@ class Redirection extends Redirection_Plugin {
226
  'expire' => 0,
227
  'token' => '',
228
  'monitor_new_posts' => false,
229
- 'monitor_post' => 0
 
230
  );
231
 
232
- foreach ( $defaults AS $key => $value ){
233
  if ( !isset( $options[$key] ) )
234
  $options[$key] = $value;
235
  }
236
 
237
- if ($options['lookup'] == 'http://geomaplookup.cinnamonthoughts.org/?ip=' || $options['lookup'] == 'http://geomaplookup.net/?ip=')
238
  $options['lookup'] = 'http://urbangiraffe.com/map/?from=redirection&amp;ip=';
239
 
240
  return $options;
@@ -288,7 +243,7 @@ class Redirection extends Redirection_Plugin {
288
 
289
  $count = $importer->import( $_POST['group'], $_FILES['upload'] );
290
  if ( $count > 0 )
291
- $this->render_message( sprintf( __ngettext( '%d redirection was successfully imported','%d redirections were successfully imported', $count, 'redirection' ), $count ) );
292
  else
293
  $this->render_message( __( 'No items were imported', 'redirection' ) );
294
  }
@@ -326,11 +281,11 @@ class Redirection extends Redirection_Plugin {
326
  $this->render_admin( 'log', array( 'logs' => $logs, 'pager' => $pager, 'lookup' => $options['lookup'] ) );
327
  }
328
 
329
- function admin_groups($module) {
330
  include dirname( __FILE__ ).'/models/pager.php';
331
 
332
- if (isset( $_POST['add'] ) && check_admin_referer( 'redirection-add_group' ) ) {
333
- if ( Red_Group::create(stripslashes_deep( $_POST ) ) ) {
334
  $this->render_message( __( 'Your group was added successfully', 'redirection' ) );
335
  Red_Module::flush( $module );
336
  }
@@ -356,30 +311,9 @@ class Redirection extends Redirection_Plugin {
356
  $pager = new RE_Pager( $_GET, $_SERVER['REQUEST_URI'], 'position', 'ASC' );
357
  $items = Red_Item::get_by_group( $group, $pager );
358
 
359
- $this->render_admin( 'item_list', array( 'items' => $items, 'modules' => Red_Group::get_for_select(), 'pager' => $pager, 'group' => Red_Group::get( $group ), 'groups' => Red_Group::get_for_select(), 'date_format' => get_option('date_format')) );
360
  }
361
-
362
- /**
363
- * Displays the nice animated support logo
364
- *
365
- * @return void
366
- **/
367
- function admin_footer() {
368
- if ( isset($_GET['page']) && $_GET['page'] == basename( __FILE__ ) ) {
369
- $options = $this->get_options();
370
 
371
- if ( !$options['support'] ) {
372
- ?>
373
- <script type="text/javascript" charset="utf-8">
374
- jQuery(function() {
375
- jQuery('#support-annoy').animate( { opacity: 0.2, backgroundColor: 'red' } ).animate( { opacity: 1, backgroundColor: 'yellow' });
376
- });
377
- </script>
378
- <?php
379
- }
380
- }
381
- }
382
-
383
  function setMatched( $match ) {
384
  $this->hasMatched = $match;
385
  }
@@ -390,16 +324,20 @@ class Redirection extends Redirection_Plugin {
390
 
391
  function locales() {
392
  $locales = array();
393
- $readme = @file_get_contents( dirname( __FILE__ ).'/readme.txt' );
394
- if ( $readme ) {
395
- if ( preg_match_all( '/^\* (.*?) by \[(.*?)\]\((.*?)\)/m', $readme, $matches ) ) {
396
- foreach ( $matches[1] AS $pos => $match ) {
397
- $locales[$match] = '<a href="'.$matches[3][$pos].'">'.$matches[2][$pos].'</a>';
 
 
 
398
  }
399
  }
 
 
400
  }
401
 
402
- ksort( $locales );
403
  return $locales;
404
  }
405
  }
3
  Plugin Name: Redirection
4
  Plugin URI: http://urbangiraffe.com/plugins/redirection/
5
  Description: Manage all your 301 redirects and monitor 404 errors
6
+ Version: 2.2.2
7
  Author: John Godley
8
  Author URI: http://urbangiraffe.com
9
  ============================================================================================================
30
  include dirname( __FILE__ ).'/modules/wordpress.php';
31
  include dirname( __FILE__ ).'/modules/404.php';
32
 
33
+ define( 'REDIRECTION_VERSION', '2.2' );
34
+
35
+ if ( class_exists( 'Redirection' ) )
36
+ return;
37
 
38
  class Redirection extends Redirection_Plugin {
39
  var $hasMatched = false;
40
 
41
  function Redirection() {
42
+ $this->register_plugin( 'redirection', __FILE__ );
43
 
44
  if ( is_admin() ) {
45
  $this->add_action( 'admin_menu' );
46
+ $this->add_action( 'load-tools_page_redirection', 'redirection_head' );
 
 
 
47
  $this->add_action( 'init', 'inject' );
 
 
 
48
 
49
+ $this->register_activation( __FILE__ );
50
  $this->register_plugin_settings( __FILE__ );
51
 
52
  // Ajax functions
66
  $this->error->start();
67
  }
68
 
69
+ $this->monitor = new Red_Monitor( $this->get_options() );
70
  }
71
 
72
+ function update() {
73
+ $version = get_option( 'redirection_version' );
74
 
75
+ if ( $version != REDIRECTION_VERSION ) {
76
+ include_once dirname( __FILE__ ).'/models/database.php';
77
 
78
+ $db = new RE_Database();
79
+ return $db->upgrade( $version, REDIRECTION_VERSION );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
+ return true;
83
  }
84
+
85
+ function activate() {
86
+ if ( $this->update() === false ) {
87
+ $db = new RE_Database();
88
+ $db->remove( $version, REDIRECTION_VERSION );
89
+ exit();
90
+ }
91
  }
92
 
93
+ function plugin_settings( $links ) {
94
+ $settings_link = '<a href="tools.php?page='.basename( __FILE__ ).'">'.__( 'Settings', 'redirection' ).'</a>';
95
+ array_unshift( $links, $settings_link );
96
+ return $links;
 
 
 
 
 
 
 
 
97
  }
98
 
99
  function version() {
104
  return '';
105
  }
106
 
107
+ function redirection_head() {
108
+ wp_enqueue_script( 'redirection', plugin_dir_url( __FILE__ ).'js/redirection.js', array( 'jquery-form', 'jquery-ui-sortable' ), $this->version() );
109
+ wp_enqueue_style( 'redirection', plugin_dir_url( __FILE__ ).'admin.css', $this->version() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
+ wp_localize_script( 'redirection', 'Redirectioni10n', array(
112
+ 'please_wait' => __( 'Please wait...', 'redirection' ),
113
+ 'type' => 1,
114
+ 'progress' => '<img src="'.plugin_dir_url( __FILE__ ).'/images/progress.gif" alt="loading" width="50" height="16"/>',
115
+ 'are_you_sure' => __( 'Are you sure?', 'redirection' ),
116
+ 'none_select' => __( 'No items have been selected', 'redirection' )
117
+ ) );
118
  }
119
+
120
  function admin_menu() {
121
  add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "administrator", basename( __FILE__ ), array( &$this, "admin_screen" ) );
122
  }
123
 
 
 
 
 
 
 
 
 
 
 
 
124
  function admin_screen() {
125
  $this->update();
126
+
127
+ // Decide what to do
128
+ $sub = isset( $_GET['sub'] ) ? $_GET['sub'] : '';
129
+
130
  $options = $this->get_options();
131
 
132
  if ( isset($_GET['sub']) ) {
137
  elseif ( $_GET['sub'] == 'process' )
138
  return $this->admin_screen_process();
139
  elseif ( $_GET['sub'] == 'groups' )
140
+ return $this->admin_groups( isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0 );
141
  elseif ( $_GET['sub'] == 'modules' )
142
  return $this->admin_screen_modules();
143
  elseif ( $_GET['sub'] == 'support' )
144
  return $this->render_admin('support');
145
  }
146
 
147
+ return $this->admin_redirects( isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0 );
148
  }
149
 
150
  function admin_screen_modules() {
153
 
154
  if ( ( $module = Red_Module::create( $data ) ) ) {
155
  $moduleid = 0;
156
+ if ( isset( $_POST['module'] ) )
157
  $moduleid = intval( $_POST['module'] );
158
 
159
  $this->render_message( __( 'Your module was successfully created', 'redirection' ) );
180
  'expire' => 0,
181
  'token' => '',
182
  'monitor_new_posts' => false,
183
+ 'monitor_post' => 0,
184
+ 'auto_target' => '',
185
  );
186
 
187
+ foreach ( $defaults AS $key => $value ) {
188
  if ( !isset( $options[$key] ) )
189
  $options[$key] = $value;
190
  }
191
 
192
+ if ( $options['lookup'] == 'http://geomaplookup.cinnamonthoughts.org/?ip=' || $options['lookup'] == 'http://geomaplookup.net/?ip=' )
193
  $options['lookup'] = 'http://urbangiraffe.com/map/?from=redirection&amp;ip=';
194
 
195
  return $options;
243
 
244
  $count = $importer->import( $_POST['group'], $_FILES['upload'] );
245
  if ( $count > 0 )
246
+ $this->render_message( sprintf( _n( '%d redirection was successfully imported','%d redirections were successfully imported', $count, 'redirection' ), $count ) );
247
  else
248
  $this->render_message( __( 'No items were imported', 'redirection' ) );
249
  }
281
  $this->render_admin( 'log', array( 'logs' => $logs, 'pager' => $pager, 'lookup' => $options['lookup'] ) );
282
  }
283
 
284
+ function admin_groups( $module ) {
285
  include dirname( __FILE__ ).'/models/pager.php';
286
 
287
+ if ( isset( $_POST['add'] ) && check_admin_referer( 'redirection-add_group' ) ) {
288
+ if ( Red_Group::create( stripslashes_deep( $_POST ) ) ) {
289
  $this->render_message( __( 'Your group was added successfully', 'redirection' ) );
290
  Red_Module::flush( $module );
291
  }
311
  $pager = new RE_Pager( $_GET, $_SERVER['REQUEST_URI'], 'position', 'ASC' );
312
  $items = Red_Item::get_by_group( $group, $pager );
313
 
314
+ $this->render_admin( 'item_list', array( 'items' => $items, 'pager' => $pager, 'group' => Red_Group::get( $group ), 'groups' => Red_Group::get_for_select(), 'date_format' => get_option( 'date_format' ) ) );
315
  }
 
 
 
 
 
 
 
 
 
316
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  function setMatched( $match ) {
318
  $this->hasMatched = $match;
319
  }
324
 
325
  function locales() {
326
  $locales = array();
327
+ if ( file_exists( dirname( __FILE__ ).'/readme.txt' ) ) {
328
+ $readme = file_get_contents( dirname( __FILE__ ).'/readme.txt' );
329
+
330
+ $start = strpos( $readme, __( 'Redirection is available in' ) );
331
+ $end = strpos( $readme, '==', $start );
332
+ if ( $start !== false && $end !== false ) {
333
+ if ( preg_match_all( '/^\* (.*?) by (.*?)/m', substr( $readme, $start, $end ), $matches ) > 0 ) {
334
+ $locales = $matches[1];
335
  }
336
  }
337
+
338
+ sort( $locales );
339
  }
340
 
 
341
  return $locales;
342
  }
343
  }
view/admin/group_edit.php CHANGED
@@ -19,6 +19,7 @@
19
  <td>
20
  <input class="button-primary" type="submit" name="save" value="<?php _e ('Save', 'redirection'); ?>"/>
21
  <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'redirection'); ?>"/>
 
22
 
23
  <input type="hidden" name="action" value="red_group_save"/>
24
  <input type="hidden" name="id" value="<?php echo $group->id; ?>"/>
19
  <td>
20
  <input class="button-primary" type="submit" name="save" value="<?php _e ('Save', 'redirection'); ?>"/>
21
  <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'redirection'); ?>"/>
22
+ <img class="loader" src="<?php echo $this->url(); ?>/images/progress.gif" alt="loading" width="50" height="16" style="display: none"/>
23
 
24
  <input type="hidden" name="action" value="red_group_save"/>
25
  <input type="hidden" name="id" value="<?php echo $group->id; ?>"/>
view/admin/group_item.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="date">
3
- <a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_group_edit&amp;id=<?php echo $group->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-group_'.$group->id ); ?>" class="redirection-edit"><img src="<?php echo $this->url () ?>/images/edit.png" width="16" height="16" alt="Edit"/></a>
4
  <a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_group_edit&amp;id=<?php echo $group->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-group_'.$group->id ); ?>" class="redirection-edit"><?php _e ('edit group', 'redirection'); ?></a>
5
  </div>
6
 
@@ -14,7 +13,11 @@
14
 
15
  <div class="item">
16
  <input class="check" type="checkbox" name="checkall[]" value="<?php echo $group->id ?>"/>
17
- <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=redirects&amp;id=<?php echo $group->id ?>"><?php echo esc_html( $group->name ); ?></a><?php echo $group->items () ?>
 
 
 
 
18
 
19
  <?php if ($group->status == 'disabled') : ?>
20
  &mdash; <?php _e ('disabled', 'redirection'); ?>
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="date">
 
3
  <a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_group_edit&amp;id=<?php echo $group->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-group_'.$group->id ); ?>" class="redirection-edit"><?php _e ('edit group', 'redirection'); ?></a>
4
  </div>
5
 
13
 
14
  <div class="item">
15
  <input class="check" type="checkbox" name="checkall[]" value="<?php echo $group->id ?>"/>
16
+ <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=redirects&amp;id=<?php echo $group->id ?>">
17
+ <?php echo esc_html( $group->name ); ?>
18
+ </a>
19
+
20
+ <?php echo $group->items () ?>
21
 
22
  <?php if ($group->status == 'disabled') : ?>
23
  &mdash; <?php _e ('disabled', 'redirection'); ?>
view/admin/group_list.php CHANGED
@@ -1,123 +1,124 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
- <?php $this->render_admin('annoy')?>
5
 
6
- <h2><?php _e ('Groups for module', 'redirection'); ?>: <a href="edit.php?page=redirection.php&amp;sub=modules"><?php echo esc_html( $module->name ) ?></a></h2>
7
 
8
- <?php $this->submenu (true); ?>
 
9
  <div id="pager" class="pager">
10
- <form method="get" action="<?php echo $this->url ($pager->url) ?>">
11
- <input type="hidden" name="page" value="<?php echo esc_attr( $_GET['page'] ) ?>"/>
12
- <input type="hidden" name="curpage" value="<?php echo $pager->current_page () ?>"/>
13
- <input type="hidden" name="sub" value="<?php echo esc_attr( $_GET['sub'] ) ?>"/>
14
 
15
- <?php _e ('Module', 'redirection'); ?>:
16
  <select name="id">
17
- <?php echo $this->select ($modules, isset($_GET['id']) ? $_GET['id'] : '')?>
18
  </select>
19
 
20
- <?php _e ('Search', 'redirection'); ?>:
21
- <input type="text" class="search-input" name="search" value="<?php echo isset($_GET['search']) ? esc_attr( $_GET['search'] ) : '' ?>" style="font-size: 0.8em"/>
22
 
23
- <?php $pager->per_page ('redirection'); ?>
24
 
25
- <input class="button-secondary" type="submit" name="go" value="<?php _e ('go', 'redirection') ?>"/>
26
  </form>
27
  </div>
28
 
29
  <br/>
30
 
31
- <?php if (count ($groups) > 0) : ?>
32
  <ul id="redirections_header" class="redirections_header">
33
  <li>
34
  <div class="tools" style="width: 6.5em">&nbsp;</div>
35
- <div class="count"><?php echo $pager->sortable ('redirects', __ ('Hits', 'redirection')) ?></div>
36
- <div class="item"><?php echo $pager->sortable ('name', __ ('Name', 'redirection')) ?></div>
37
  </li>
38
  </ul>
39
 
40
  <ul class="redirections" id="items">
41
- <?php if (count ($groups) > 0) : ?>
42
- <?php foreach ($groups AS $group) : ?>
43
- <li id="item_<?php echo $group->id ?>" class="<?php if ($group->status == 'disabled') echo 'disabled' ?>"><?php $this->render_admin ('group_item', array ('group' => $group)) ?></li>
44
  <?php endforeach; ?>
45
  <?php endif; ?>
46
  </ul>
47
 
48
- <?php if ($pager->total_pages () > 0) : ?>
49
  <div class="pagertools">
50
- <?php foreach ($pager->area_pages () AS $page) : ?>
51
  <?php echo $page ?>
52
  <?php endforeach; ?>
53
  </div>
54
  <?php endif; ?>
55
 
56
- <?php if (count ($groups) > 0) : ?>
57
  <div class="pager pagertools">
58
- <a class="select-all" href="#select-all"><?php _e ('Select All', 'redirection'); ?></a> |
59
- <a class="toggle-all" href="#toggle-all"><?php _e ('Toggle', 'redirection'); ?></a> |
60
- <a class="reset-all" href="#reset-all"><?php _e ('Reset Hits', 'redirection'); ?></a> |
61
- <a class="delete-all" href="#delete-all"><?php _e ('Delete', 'redirection'); ?></a> |
62
 
63
- <?php _e ('Move To', 'redirection'); ?>:
64
  <select name="move" id="move">
65
- <?php echo $this->select ($modules)?>
66
  </select>
67
 
68
- <input class="button-secondary move-all" type="submit" value="<?php _e( 'Go', 'redirection'); ?>"/>
69
  </div>
70
 
71
  <div class="sort" id="sort">
72
- <img src="<?php echo $this->url () ?>/images/sort.png" width="16" height="16" alt="Sort"/>
73
 
74
- <a class="sort-on" id="toggle_sort_on" href="#"><?php _e ('re-order', 'redirection'); ?></a>
75
- <a class="sort-save" id="toggle_sort_off" href="#" style="display: none"><?php _e ('save order', 'redirection'); ?></a>
76
  </div>
77
  <?php endif; ?>
78
 
79
  <div id="loading" style="display: none">
80
- <img src="<?php echo $this->url () ?>/images/loading.gif" alt="loading" width="32" height="32"/>
81
  </div>
82
 
83
- <?php global $is_IE; if (!$is_IE) : ?>
84
  <div style="clear: both"></div>
85
  <?php endif; ?>
86
 
87
  <?php else :?>
88
- <p id="none"><?php _e ('You have no groups in this module.', 'redirection') ?></p>
89
  <?php endif; ?>
90
  </div>
91
 
92
  <div class="wrap">
93
- <h2><?php _e ('Add Group', 'redirection'); ?></h2>
94
 
95
- <form action="<?php echo $this->url ($_SERVER['REQUEST_URI']) ?>" method="post" accept-charset="utf-8">
96
- <?php wp_nonce_field ('redirection-add_group'); ?>
97
  <table class="form-table">
98
  <tr>
99
- <th width="50"><?php _e ('Name', 'redirection'); ?>:</th>
100
  <td><input size="40" class="regular-text" type="text" name="name" value=""/></td>
101
  </tr>
102
  <tr>
103
  <th width="50"></th>
104
- <td><input class="button-primary" type="submit" name="add" value="<?php _e ('Add', 'redirection'); ?>"/><input type="hidden" name="module_id" value="<?php echo $module->id ?>"/></td>
105
  </tr>
106
  </table>
107
  </form>
108
  </div>
109
 
110
  <script type="text/javascript">
111
- jQuery(document).ready( function() {
112
  var redirection = new Redirection( {
113
- progress: '<?php echo esc_js( '<img src="'.$this->url().'/images/progress.gif" alt="loading" width="50" height="16"/>' ) ?>',
114
- ajaxurl: '<?php echo esc_js( admin_url( 'admin-ajax.php' ) ) ?>',
115
- nonce: '<?php echo esc_js( wp_create_nonce( 'redirection-items' ) ); ?>',
116
  none_select: '<?php echo esc_js( __( 'No items have been selected', 'redirection' ) ); ?>',
117
  are_you_sure: '<?php echo esc_js( __( 'Are you sure?', 'redirection') ); ?>',
118
- page: <?php echo ($pager->current_page - 1) * $pager->per_page ?>
119
- });
120
 
121
- redirection.edit_items( 'group' );
122
- });
123
  </script>
1
+ <?php if ( !defined( 'ABSPATH' ) ) die( 'No direct access allowed' ); ?>
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
+ <?php $this->render_admin( 'annoy' ); ?>
5
 
6
+ <h2><?php _e( 'Groups for module', 'redirection' ); ?>: <a href="edit.php?page=redirection.php&amp;sub=modules"><?php echo esc_html( $module->name ) ?></a></h2>
7
 
8
+ <?php $this->render_admin( 'submenu' ); ?>
9
+
10
  <div id="pager" class="pager">
11
+ <form method="get" action="<?php echo $this->url( $pager->url ) ?>">
12
+ <input type="hidden" name="page" value="<?php echo esc_attr( $_GET['page'] ) ?>"/>
13
+ <input type="hidden" name="curpage" value="<?php echo $pager->current_page() ?>"/>
14
+ <input type="hidden" name="sub" value="<?php echo esc_attr( $_GET['sub'] ) ?>"/>
15
 
16
+ <?php _e( 'Module', 'redirection' ); ?>:
17
  <select name="id">
18
+ <?php echo $this->select( $modules, isset($_GET['id'] ) ? $_GET['id'] : '' )?>
19
  </select>
20
 
21
+ <?php _e( 'Search', 'redirection' ); ?>:
22
+ <input type="text" class="search-input" name="search" value="<?php echo isset($_GET['search'] ) ? esc_attr( $_GET['search'] ) : '' ?>" style="font-size: 0.8em"/>
23
 
24
+ <?php $pager->per_page( 'redirection' ); ?>
25
 
26
+ <input class="button-secondary" type="submit" name="go" value="<?php _e( 'go', 'redirection' ) ?>"/>
27
  </form>
28
  </div>
29
 
30
  <br/>
31
 
32
+ <?php if ( count( $groups ) > 0 ) : ?>
33
  <ul id="redirections_header" class="redirections_header">
34
  <li>
35
  <div class="tools" style="width: 6.5em">&nbsp;</div>
36
+ <div class="count"><?php echo $pager->sortable( 'redirects', __( 'Hits', 'redirection' ) ) ?></div>
37
+ <div class="item"><?php echo $pager->sortable( 'name', __( 'Name', 'redirection' ) ) ?></div>
38
  </li>
39
  </ul>
40
 
41
  <ul class="redirections" id="items">
42
+ <?php if ( count( $groups ) > 0 ) : ?>
43
+ <?php foreach ( $groups AS $group ) : ?>
44
+ <li id="item_<?php echo $group->id ?>" class="<?php if ( $group->status == 'disabled' ) echo 'disabled' ?>"><?php $this->render_admin( 'group_item', array( 'group' => $group ) ) ?></li>
45
  <?php endforeach; ?>
46
  <?php endif; ?>
47
  </ul>
48
 
49
+ <?php if ( $pager->total_pages() > 0 ) : ?>
50
  <div class="pagertools">
51
+ <?php foreach ( $pager->area_pages() AS $page ) : ?>
52
  <?php echo $page ?>
53
  <?php endforeach; ?>
54
  </div>
55
  <?php endif; ?>
56
 
57
+ <?php if ( count( $groups ) > 0 ) : ?>
58
  <div class="pager pagertools">
59
+ <a class="select-all" href="#select-all"><?php _e( 'Select All', 'redirection' ); ?></a> |
60
+ <a class="toggle-all" href="#toggle-all"><?php _e( 'Toggle', 'redirection' ); ?></a> |
61
+ <a class="reset-all" href="#reset-all"><?php _e( 'Reset Hits', 'redirection' ); ?></a> |
62
+ <a class="delete-all" href="#delete-all"><?php _e( 'Delete', 'redirection' ); ?></a> |
63
 
64
+ <?php _e( 'Move To', 'redirection' ); ?>:
65
  <select name="move" id="move">
66
+ <?php echo $this->select( $modules )?>
67
  </select>
68
 
69
+ <input class="button-secondary move-all" type="submit" value="<?php _e( 'Go', 'redirection' ); ?>"/>
70
  </div>
71
 
72
  <div class="sort" id="sort">
73
+ <img src="<?php echo $this->url() ?>/images/sort.png" width="16" height="16" alt="Sort"/>
74
 
75
+ <a class="sort-on" id="toggle_sort_on" href="#"><?php _e( 're-order', 'redirection' ); ?></a>
76
+ <a class="sort-save" id="toggle_sort_off" href="#" style="display: none"><?php _e( 'save order', 'redirection' ); ?></a>
77
  </div>
78
  <?php endif; ?>
79
 
80
  <div id="loading" style="display: none">
81
+ <img src="<?php echo $this->url() ?>/images/loading.gif" alt="loading" width="32" height="32"/>
82
  </div>
83
 
84
+ <?php global $is_IE; if ( !$is_IE ) : ?>
85
  <div style="clear: both"></div>
86
  <?php endif; ?>
87
 
88
  <?php else :?>
89
+ <p id="none"><?php _e( 'You have no groups in this module.', 'redirection' ) ?></p>
90
  <?php endif; ?>
91
  </div>
92
 
93
  <div class="wrap">
94
+ <h2><?php _e( 'Add Group', 'redirection' ); ?></h2>
95
 
96
+ <form action="<?php echo $this->url( $_SERVER['REQUEST_URI'] ) ?>" method="post" accept-charset="utf-8">
97
+ <?php wp_nonce_field( 'redirection-add_group' ); ?>
98
  <table class="form-table">
99
  <tr>
100
+ <th width="50"><?php _e( 'Name', 'redirection' ); ?>:</th>
101
  <td><input size="40" class="regular-text" type="text" name="name" value=""/></td>
102
  </tr>
103
  <tr>
104
  <th width="50"></th>
105
+ <td><input class="button-primary" type="submit" name="add" value="<?php _e( 'Add', 'redirection' ); ?>"/><input type="hidden" name="module_id" value="<?php echo $module->id ?>"/></td>
106
  </tr>
107
  </table>
108
  </form>
109
  </div>
110
 
111
  <script type="text/javascript">
112
+ jQuery(document ).ready( function() {
113
  var redirection = new Redirection( {
114
+ progress: '<?php echo esc_js( '<img src="'.$this->url().'/images/progress.gif" alt="loading" width="50" height="16"/>' ) ?>',
115
+ ajaxurl: '<?php echo esc_js( admin_url( 'admin-ajax.php' ) ) ?>',
116
+ nonce: '<?php echo esc_js( wp_create_nonce( 'redirection-items' ) ); ?>',
117
  none_select: '<?php echo esc_js( __( 'No items have been selected', 'redirection' ) ); ?>',
118
  are_you_sure: '<?php echo esc_js( __( 'Are you sure?', 'redirection') ); ?>',
119
+ page: <?php echo( $pager->current_page - 1 ) * $pager->per_page ?>
120
+ } );
121
 
122
+ redirection.edit_items( 'group' );
123
+ } );
124
  </script>
view/admin/head.php CHANGED
@@ -1,11 +1,4 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
- <script type="text/javascript">
3
- wp_please_wait = '<?php echo esc_js( __( 'Please wait...', 'redirection' ) ) ?>';
4
- wp_type = '<?php echo esc_js( $type ) ?>';
5
- wp_progress = '<?php echo esc_js( '<img src="'.$this->url().'/images/progress.gif" alt="loading" width="50" height="16"/>' ) ?>';
6
- wp_are_you_sure = '<?php echo esc_js( __( 'Are you sure?', 'redirection' ) ); ?>';
7
- wp_none_select = '<?php echo esc_js( __( 'No items have been selected', 'redirection' ) ); ?>';
8
- </script>
9
 
10
  <?php global $is_IE;if ($is_IE) : ?>
11
  <style type="text/css" media="screen">
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
 
 
 
 
 
 
 
2
 
3
  <?php global $is_IE;if ($is_IE) : ?>
4
  <style type="text/css" media="screen">
view/admin/item_edit.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <form method="post" accept-charset="utf-8" action="<?php echo admin_url( 'admin-ajax.php' ) ?>" style="padding: 3px">
3
- <h3><?php printf (__ ('%s by matching %s', 'redirection'), esc_html( $redirect->actions ($redirect->action_type) ), esc_html( $redirect->match->name() ) ) ?></h3>
4
 
5
  <table class="edit">
6
  <tr>
7
- <th width="100"><a target="_blank" href="<?php echo $redirect->title ?>"><?php _e ('Title', 'redirection'); ?>:</a></th>
8
  <td>
9
  <input style="width: 85%" type="text" name="title" value="<?php echo esc_attr( $redirect->title ); ?>"/>
10
- <span class="sub">(<?php _e ("optional", 'redirection'); ?>)</span>
11
  </td>
12
  </tr>
13
 
14
  <tr>
15
- <th width="100"><a target="_blank" href="<?php echo $redirect->url ?>"><?php _e ('Source URL', 'redirection'); ?>:</a></th>
16
  <td>
17
  <input style="width: 85%" type="text" name="old" value="<?php echo esc_attr( $redirect->url ); ?>" id="original"/>
18
- <label><?php _e ('Regex', 'redirection'); ?>: <input type="checkbox" name="regex" <?php if ($redirect->regex == true) echo ' checked="checked"' ?>/></label>
19
  </td>
20
  </tr>
21
 
22
- <?php $redirect->match->show (); ?>
23
 
24
  <tr>
25
  <th></th>
26
  <td>
27
- <input class="button-primary" type="submit" name="save" value="<?php _e ('Save', 'redirection'); ?>"/>
28
- <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'redirection'); ?>"/>
29
 
30
  <input type="hidden" name="action" value="red_redirect_save"/>
31
- <input type="hidden" name="id" value="<?php echo $redirect->id; ?>"/>
32
  <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce( 'redirection-redirect_save_'.$redirect->id ); ?>"/>
33
 
34
- <span id="info_<?php echo $redirect->id ?>"></span>
35
  </td>
36
  </tr>
37
  </table>
1
+ <?php if ( !defined( 'ABSPATH' ) ) die( 'No direct access allowed' ); ?>
2
  <form method="post" accept-charset="utf-8" action="<?php echo admin_url( 'admin-ajax.php' ) ?>" style="padding: 3px">
3
+ <h3><?php printf( __( '%s by matching %s', 'redirection' ), esc_html( $redirect->actions( $redirect->action_type ) ), esc_html( $redirect->match->name() ) ) ?></h3>
4
 
5
  <table class="edit">
6
  <tr>
7
+ <th width="100"><?php _e ('Title', 'redirection'); ?>:</th>
8
  <td>
9
  <input style="width: 85%" type="text" name="title" value="<?php echo esc_attr( $redirect->title ); ?>"/>
10
+ <span class="sub">(<?php _e( "optional", 'redirection' ); ?>)</span>
11
  </td>
12
  </tr>
13
 
14
  <tr>
15
+ <th width="100"><a target="_blank" href="<?php echo esc_url( $redirect->url ) ?>"><?php _e( 'Source URL', 'redirection' ); ?>:</a></th>
16
  <td>
17
  <input style="width: 85%" type="text" name="old" value="<?php echo esc_attr( $redirect->url ); ?>" id="original"/>
18
+ <label><?php _e( 'Regex', 'redirection' ); ?>: <input type="checkbox" name="regex" <?php if ( $redirect->regex == true ) echo ' checked="checked"' ?>/></label>
19
  </td>
20
  </tr>
21
 
22
+ <?php $redirect->match->show(); ?>
23
 
24
  <tr>
25
  <th></th>
26
  <td>
27
+ <input class="button-primary" type="submit" name="save" value="<?php _e( 'Save', 'redirection' ); ?>"/>
28
+ <input class="button-secondary" type="submit" name="cancel" value="<?php _e( 'Cancel', 'redirection' ); ?>"/>
29
 
30
  <input type="hidden" name="action" value="red_redirect_save"/>
31
+ <input type="hidden" name="id" value="<?php echo esc_attr( $redirect->id ); ?>"/>
32
  <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce( 'redirection-redirect_save_'.$redirect->id ); ?>"/>
33
 
34
+ <span id="info_<?php echo esc_attr( $redirect->id ) ?>"></span>
35
  </td>
36
  </tr>
37
  </table>
view/admin/item_list.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
- <?php $this->render_admin('annoy')?>
5
 
6
  <h2><?php _e ('Redirections for group', 'redirection'); ?>: <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $group->module_id ?>"><?php echo htmlspecialchars ($group->name); ?></a></h2>
7
 
8
- <?php $this->submenu (true); ?>
9
-
10
  <div id="pager" class="pager">
11
  <form method="get" action="<?php echo $this->url ($pager->url) ?>">
12
  <input type="hidden" name="page" value="<?php echo $_GET['page'] ?>"/>
@@ -28,6 +28,9 @@
28
  </div>
29
  <br/>
30
 
 
 
 
31
  <ul id="redirections_header" class="redirections_header">
32
  <li>
33
  <div class="date" style="width: 8em"><?php echo $pager->sortable ('last_access', __ ('Last Access', 'redirection')) ?></div>
@@ -63,7 +66,7 @@
63
 
64
  <?php _e ('Move To', 'redirection'); ?>:
65
  <select name="move" id="move">
66
- <?php echo $this->select ($modules)?>
67
  </select>
68
 
69
  <input class="button-secondary move-all" type="submit" value="<?php _e( 'Go', 'redirection'); ?>"/>
@@ -102,7 +105,7 @@ jQuery(document).ready( function() {
102
  ajaxurl: '<?php echo esc_js( admin_url( 'admin-ajax.php' ) ) ?>',
103
  nonce: '<?php echo esc_js( wp_create_nonce( 'redirection-items' ) ); ?>',
104
  none_select: '<?php echo esc_js( __( 'No items have been selected', 'redirection' ) ); ?>',
105
- are_you_sure: '<?php echo esc_js( __( 'Are you sure?', 'redirection') ); ?>',
106
  page: <?php echo ($pager->current_page - 1) * $pager->per_page ?>
107
  });
108
 
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
+ <?php $this->render_admin( 'annoy' ); ?>
5
 
6
  <h2><?php _e ('Redirections for group', 'redirection'); ?>: <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $group->module_id ?>"><?php echo htmlspecialchars ($group->name); ?></a></h2>
7
 
8
+ <?php $this->render_admin( 'submenu' ); ?>
9
+
10
  <div id="pager" class="pager">
11
  <form method="get" action="<?php echo $this->url ($pager->url) ?>">
12
  <input type="hidden" name="page" value="<?php echo $_GET['page'] ?>"/>
28
  </div>
29
  <br/>
30
 
31
+ <a href="http://polldaddy.com/s/EE1960D4BC58B079">Take part in a survey about Redirection!</a>
32
+ <br/><br/>
33
+
34
  <ul id="redirections_header" class="redirections_header">
35
  <li>
36
  <div class="date" style="width: 8em"><?php echo $pager->sortable ('last_access', __ ('Last Access', 'redirection')) ?></div>
66
 
67
  <?php _e ('Move To', 'redirection'); ?>:
68
  <select name="move" id="move">
69
+ <?php echo $this->select( $groups )?>
70
  </select>
71
 
72
  <input class="button-secondary move-all" type="submit" value="<?php _e( 'Go', 'redirection'); ?>"/>
105
  ajaxurl: '<?php echo esc_js( admin_url( 'admin-ajax.php' ) ) ?>',
106
  nonce: '<?php echo esc_js( wp_create_nonce( 'redirection-items' ) ); ?>',
107
  none_select: '<?php echo esc_js( __( 'No items have been selected', 'redirection' ) ); ?>',
108
+ are_you_sure: '<?php echo esc_js( __( 'Are you sure?', 'redirection') ); ?>',
109
  page: <?php echo ($pager->current_page - 1) * $pager->per_page ?>
110
  });
111
 
view/admin/log.php CHANGED
@@ -5,7 +5,7 @@
5
 
6
  <h2><?php _e ('Redirection Log', 'redirection'); ?></h2>
7
 
8
- <?php $this->submenu (true); ?>
9
 
10
  <form method="get" action="<?php echo $this->url ($pager->url) ?>">
11
  <input type="hidden" name="page" value="<?php echo esc_attr( $_GET['page'] ) ?>"/>
@@ -109,8 +109,8 @@ jQuery(document).ready( function() {
109
  progress: '<img src="<?php echo $this->url () ?>/images/progress.gif" alt="loading" width="50" height="16"/>',
110
  ajaxurl: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
111
  nonce: '<?php echo wp_create_nonce( 'redirection-items' ); ?>',
112
- none_select: '<?php _e( 'No items have been selected', 'redirection' ); ?>',
113
- are_you_sure: '<?php _e( 'Are you sure?', 'redirection'); ?>',
114
  });
115
  redirection.logs();
116
  });
5
 
6
  <h2><?php _e ('Redirection Log', 'redirection'); ?></h2>
7
 
8
+ <?php $this->render_admin( 'submenu' ); ?>
9
 
10
  <form method="get" action="<?php echo $this->url ($pager->url) ?>">
11
  <input type="hidden" name="page" value="<?php echo esc_attr( $_GET['page'] ) ?>"/>
109
  progress: '<img src="<?php echo $this->url () ?>/images/progress.gif" alt="loading" width="50" height="16"/>',
110
  ajaxurl: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
111
  nonce: '<?php echo wp_create_nonce( 'redirection-items' ); ?>',
112
+ none_select: '<?php echo esc_js( __( 'No items have been selected', 'redirection' ) ); ?>',
113
+ are_you_sure: '<?php echo esc_js( __( 'Are you sure?', 'redirection') ); ?>',
114
  });
115
  redirection.logs();
116
  });
view/admin/module_edit.php CHANGED
@@ -1,12 +1,12 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <td class="logo">
3
  <a href="edit.php?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>">
4
- <?php if ($module->type == 'apache') : ?>
5
- <img src="<?php echo $this->url () ?>/images/modules/apache.png" width="55" height="56" alt="Apache"/>
6
- <?php elseif ($module->type == 'wp') : ?>
7
- <img src="<?php echo $this->url () ?>/images/modules/wordpress.png" width="64" height="64" alt="Wordpress"/>
8
- <?php elseif ($module->type == '404') : ?>
9
- <img src="<?php echo $this->url () ?>/images/modules/404.png" width="64" height="64" alt="Wordpress"/>
10
  <?php endif; ?>
11
  </a>
12
  </td>
@@ -15,21 +15,22 @@
15
  <form action="<?php echo admin_url( 'admin-ajax.php' ) ?>" method="post" accept-charset="utf-8">
16
  <table class="edit">
17
  <tr>
18
- <th><?php _e ('Name', 'redirection'); ?>:</th>
19
  <td><input type="text" name="name" value="<?php echo esc_attr( $module->name ) ?>" style="width: 95%"/></td>
20
  </tr>
21
 
22
- <?php $module->config (); ?>
23
 
24
  <tr>
25
  <th></th>
26
  <td>
27
- <input class="button-primary" type="submit" name="save" value="<?php _e ('Save', 'redirection'); ?>"/>
28
- <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'redirection'); ?>"/>
 
29
 
30
  <input type="hidden" name="action" value="red_module_save"/>
31
  <input type="hidden" name="id" value="<?php echo $module->id; ?>"/>
32
- <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce ('redirection-module_save_'.$module->id); ?>"/>
33
  </td>
34
  </tr>
35
  </table>
1
+ <?php if( !defined( 'ABSPATH' ) ) die( 'No direct access allowed' ); ?>
2
  <td class="logo">
3
  <a href="edit.php?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>">
4
+ <?php if( $module->type == 'apache' ) : ?>
5
+ <img src="<?php echo $this->url() ?>/images/modules/apache.png" width="55" height="56" alt="Apache"/>
6
+ <?php elseif( $module->type == 'wp' ) : ?>
7
+ <img src="<?php echo $this->url() ?>/images/modules/wordpress.png" width="64" height="64" alt="Wordpress"/>
8
+ <?php elseif( $module->type == '404' ) : ?>
9
+ <img src="<?php echo $this->url() ?>/images/modules/404.png" width="64" height="64" alt="Wordpress"/>
10
  <?php endif; ?>
11
  </a>
12
  </td>
15
  <form action="<?php echo admin_url( 'admin-ajax.php' ) ?>" method="post" accept-charset="utf-8">
16
  <table class="edit">
17
  <tr>
18
+ <th><?php _e( 'Name', 'redirection' ); ?>:</th>
19
  <td><input type="text" name="name" value="<?php echo esc_attr( $module->name ) ?>" style="width: 95%"/></td>
20
  </tr>
21
 
22
+ <?php $module->config(); ?>
23
 
24
  <tr>
25
  <th></th>
26
  <td>
27
+ <input class="button-primary" type="submit" name="save" value="<?php _e( 'Save', 'redirection' ); ?>"/>
28
+ <input class="button-secondary" type="submit" name="cancel" value="<?php _e( 'Cancel', 'redirection' ); ?>"/>
29
+ <img class="loader" src="<?php echo $this->url(); ?>/images/progress.gif" alt="loading" width="50" height="16" style="display: none"/>
30
 
31
  <input type="hidden" name="action" value="red_module_save"/>
32
  <input type="hidden" name="id" value="<?php echo $module->id; ?>"/>
33
+ <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce( 'redirection-module_save_'.$module->id ); ?>"/>
34
  </td>
35
  </tr>
36
  </table>
view/admin/module_item.php CHANGED
@@ -1,51 +1,51 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <td class="logo">
3
- <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>">
4
- <?php if ($module->type == 'apache') : ?>
5
- <img src="<?php echo $this->url () ?>/images/modules/apache.png" width="55" height="56" alt="Apache"/>
6
- <?php elseif ($module->type == 'wp') : ?>
7
- <img src="<?php echo $this->url () ?>/images/modules/wordpress.png" width="64" height="64" alt="Wordpress"/>
8
- <?php elseif ($module->type == '404') : ?>
9
- <img src="<?php echo $this->url () ?>/images/modules/404.png" width="64" height="64" alt="Wordpress"/>
10
  <?php endif; ?>
11
  </a>
12
  </td>
13
 
14
  <td valign="top">
15
  <h4>
16
- <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>"><?php echo esc_html( $module->name ); ?></a>
17
- <?php echo $module->name_extra (); ?>
18
  </h4>
19
 
20
- <?php $module->options (); ?>
21
 
22
- <?php if ($module->is_valid ()) : ?>
23
  <div class="toolbar">
24
- <strong><?php _e ('View as', 'redirection'); ?>:</strong>
25
 
26
- <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=csv&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e ('CSV', 'redirection'); ?></a>
27
- <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=xml&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e ('XML', 'redirection'); ?></a>
28
- <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=apache&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e ('Apache', 'redirection'); ?></a>
29
- <a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=rss&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e ('RSS', 'redirection'); ?></a>
30
  </div>
31
  <?php endif; ?>
32
  </td>
33
 
34
- <td class="center"><a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>"><?php echo $module->groups (); ?></a></td>
35
- <td class="center"><?php echo $module->redirects (); ?></td>
36
- <td class="center"><a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=log&amp;module=<?php echo $module->id ?>"><?php echo $module->hits (); ?></a></td>
37
 
38
- <?php $nonce = wp_create_nonce ('redirection-module_manage-'.$module->id); ?>
39
 
40
  <td id="info_<?php echo $module->id ?>" class="operations">
41
- <a class="edit" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_edit&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><img src="<?php echo $this->url () ?>/images/edit.png" width="16" height="16" alt="Edit"/></a>
42
- <a class="edit" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_edit&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><?php _e ('edit', 'redirection'); ?></a>
 
 
 
 
 
43
 
44
- <a class="rdelete" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_delete&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><img src="<?php echo $this->url () ?>/images/delete.png" width="16" height="16" alt="Delete"/></a>
45
- <a class="rdelete" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_delete&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><?php _e ('delete', 'redirection'); ?></a>
46
-
47
- <a class="reset" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_reset&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><img src="<?php echo $this->url () ?>/images/delete.png" width="16" height="16" alt="Delete"/></a>
48
- <a class="reset" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_reset&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><?php _e ('reset', 'redirection'); ?></a>
49
  </td>
50
 
51
 
1
+ <?php if( !defined( 'ABSPATH' ) ) die( 'No direct access allowed' ); ?>
2
  <td class="logo">
3
+ <a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>">
4
+ <?php if( $module->type == 'apache' ) : ?>
5
+ <img src="<?php echo $this->url() ?>/images/modules/apache.png" width="55" height="56" alt="Apache"/>
6
+ <?php elseif( $module->type == 'wp' ) : ?>
7
+ <img src="<?php echo $this->url() ?>/images/modules/wordpress.png" width="64" height="64" alt="Wordpress"/>
8
+ <?php elseif( $module->type == '404' ) : ?>
9
+ <img src="<?php echo $this->url() ?>/images/modules/404.png" width="64" height="64" alt="Wordpress"/>
10
  <?php endif; ?>
11
  </a>
12
  </td>
13
 
14
  <td valign="top">
15
  <h4>
16
+ <a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>"><?php echo esc_html( $module->name ); ?></a>
 
17
  </h4>
18
 
19
+ <?php $module->options(); ?>
20
 
21
+ <?php if ( $module->is_valid() ) : ?>
22
  <div class="toolbar">
23
+ <strong><?php _e( 'View as', 'redirection' ); ?>:</strong>
24
 
25
+ <a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=csv&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e( 'CSV', 'redirection' ); ?></a>
26
+ <a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=xml&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e( 'XML', 'redirection' ); ?></a>
27
+ <a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=apache&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e( 'Apache', 'redirection' ); ?></a>
28
+ <a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=rss&amp;module=<?php echo $module->id ?>&amp;token=<?php echo $token ?>"><?php _e( 'RSS', 'redirection' ); ?></a>
29
  </div>
30
  <?php endif; ?>
31
  </td>
32
 
33
+ <td class="center"><a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=groups&amp;id=<?php echo $module->id ?>"><?php echo $module->groups(); ?></a></td>
34
+ <td class="center"><?php echo $module->redirects(); ?></td>
35
+ <td class="center"><a href="<?php echo $this->base(); ?>?page=redirection.php&amp;sub=log&amp;module=<?php echo $module->id ?>"><?php echo number_format_i18n( $module->hits() ); ?></a></td>
36
 
37
+ <?php $nonce = wp_create_nonce( 'redirection-module_manage-'.$module->id ); ?>
38
 
39
  <td id="info_<?php echo $module->id ?>" class="operations">
40
+ <div>
41
+ <a class="edit" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_edit&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><?php _e( 'edit', 'redirection' ); ?></a>
42
+ |
43
+ <a class="rdelete" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_delete&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><?php _e( 'delete', 'redirection' ); ?></a>
44
+ |
45
+ <a class="reset" href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=red_module_reset&amp;id=<?php echo $module->id; ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'redirection-module_'.$module->id ); ?>"><?php _e( 'reset', 'redirection' ); ?></a>
46
+ </div>
47
 
48
+ <img class="loader" src="<?php echo $this->url(); ?>/images/progress.gif" alt="loading" width="50" height="16" style="display: none"/>
 
 
 
 
49
  </td>
50
 
51
 
view/admin/module_list.php CHANGED
@@ -1,65 +1,66 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
- <?php $this->render_admin('annoy')?>
5
 
6
- <h2><?php _e ('Modules', 'redirection'); ?></h2>
7
- <?php $this->submenu (true); ?>
8
 
9
- <?php if (count ($modules) > 0) : ?>
10
- <table class="modules" style="clear: both">
 
 
11
  <tr>
12
  <th></th>
13
- <th class="left"><?php _e ('Details', 'redirection'); ?></th>
14
- <th><?php _e ('Groups', 'redirection'); ?></th>
15
- <th><?php _e ('Items', 'redirection'); ?></th>
16
- <th><?php _e ('Hits', 'redirection'); ?></th>
17
- <th><?php _e ('Operations', 'redirection'); ?></th>
18
  </tr>
19
 
20
- <?php foreach ($modules AS $pos => $module): ?>
21
  <tr id="item_<?php echo $module->id ?>">
22
- <?php $this->render_admin ('module_item', array ('module' => $module, 'token' => $token)); ?>
23
  </tr>
24
  <?php endforeach ?>
25
  </table>
26
- <p><?php _e ('Note: Hits are dependant on log entries', 'redirection')?></p>
27
  <?php else : ?>
28
- <p><?php _e ('You have no modules defined yet', 'redirection'); ?>.</p>
29
  <?php endif; ?>
30
  </div>
31
 
32
  <div class="wrap">
33
- <h2><?php _e ('Add Module', 'redirection'); ?></h2>
34
- <p><?php _e ('A module is a controlling element that determines how redirections are handled. Elements in a WordPress module are handled by WordPress, elements in an Apache module are handled by <code>.htaccess</code>, and elements in a 404 module affect how 404 errors are logged.', 'redirection'); ?></p>
35
 
36
- <form action="<?php echo $this->url ($_SERVER['REQUEST_URI']) ?>" method="post" accept-charset="utf-8">
37
- <?php wp_nonce_field ('redirection-module_add'); ?>
38
 
39
- <table class="edit">
40
  <tr>
41
- <th width="100"><?php _e ('Name', 'redirection'); ?>:</th>
42
  <td><input size="40" type="text" name="name" value=""/></td>
43
  </tr>
44
  <tr>
45
- <th width="100"><?php _e ('Type', 'redirection'); ?>:</th>
46
  <td>
47
  <select name="type">
48
- <?php echo $this->select ($module_types); ?>
49
  </select>
50
  </td>
51
  </tr>
52
  <tr>
53
  <td></td>
54
- <td><input class="button-primary" type="submit" name="create" value="<?php _e ('Create', 'redirection'); ?>"/></td>
55
  </tr>
56
  </table>
57
  </form>
58
  </div>
59
 
60
  <script type="text/javascript">
61
- jQuery(document).ready( function() {
62
- var redirection = new Redirection( { progress: '<img src="<?php echo $this->url () ?>/images/progress.gif" alt="loading" width="50" height="16"/>' });
63
  redirection.modules();
64
- });
65
  </script>
1
+ <?php if ( !defined( 'ABSPATH' ) ) die( 'No direct access allowed' ); ?>
2
  <div class="wrap">
3
  <?php screen_icon(); ?>
4
+ <?php $this->render_admin('annoy' )?>
5
 
6
+ <h2><?php _e( 'Modules', 'redirection' ); ?></h2>
 
7
 
8
+ <?php $this->render_admin( 'submenu' ); ?>
9
+
10
+ <?php if ( count( $modules ) > 0 ) : ?>
11
+ <table class="modules" style="clear: both" summary="modules">
12
  <tr>
13
  <th></th>
14
+ <th class="left"><?php _e( 'Details', 'redirection' ); ?></th>
15
+ <th><?php _e( 'Groups', 'redirection' ); ?></th>
16
+ <th><?php _e( 'Items', 'redirection' ); ?></th>
17
+ <th><?php _e( 'Hits', 'redirection' ); ?></th>
18
+ <th><?php _e( 'Operations', 'redirection' ); ?></th>
19
  </tr>
20
 
21
+ <?php foreach ( $modules AS $pos => $module ): ?>
22
  <tr id="item_<?php echo $module->id ?>">
23
+ <?php $this->render_admin( 'module_item', array( 'module' => $module, 'token' => $token ) ); ?>
24
  </tr>
25
  <?php endforeach ?>
26
  </table>
27
+ <p><?php _e( 'Note: Hits are dependant on log entries', 'redirection' )?></p>
28
  <?php else : ?>
29
+ <p><?php _e( 'You have no modules defined yet', 'redirection' ); ?>.</p>
30
  <?php endif; ?>
31
  </div>
32
 
33
  <div class="wrap">
34
+ <h2><?php _e( 'Add Module', 'redirection' ); ?></h2>
35
+ <p><?php _e( 'A module is a controlling element that determines how redirections are handled. Elements in a WordPress module are handled by WordPress, elements in an Apache module are handled by <code>.htaccess</code>, and elements in a 404 module affect how 404 errors are logged.', 'redirection' ); ?></p>
36
 
37
+ <form action="<?php echo $this->url( $_SERVER['REQUEST_URI'] ) ?>" method="post" accept-charset="utf-8">
38
+ <?php wp_nonce_field( 'redirection-module_add' ); ?>
39
 
40
+ <table class="edit" summary="modules">
41
  <tr>
42
+ <th width="100"><?php _e( 'Name', 'redirection' ); ?>:</th>
43
  <td><input size="40" type="text" name="name" value=""/></td>
44
  </tr>
45
  <tr>
46
+ <th width="100"><?php _e( 'Type', 'redirection' ); ?>:</th>
47
  <td>
48
  <select name="type">
49
+ <?php echo $this->select( $module_types ); ?>
50
  </select>
51
  </td>
52
  </tr>
53
  <tr>
54
  <td></td>
55
+ <td><input class="button-primary" type="submit" name="create" value="<?php _e( 'Create', 'redirection' ); ?>"/></td>
56
  </tr>
57
  </table>
58
  </form>
59
  </div>
60
 
61
  <script type="text/javascript">
62
+ jQuery(document ).ready( function() {
63
+ var redirection = new Redirection( {} );
64
  redirection.modules();
65
+ } );
66
  </script>
view/admin/options.php CHANGED
@@ -1,122 +1,122 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="wrap">
3
- <?php screen_icon(); ?>
4
- <?php $this->render_admin('annoy')?>
5
 
6
- <h2><?php _e ('Options', 'redirection') ?></h2>
7
- <?php $this->submenu (true); ?>
8
 
9
- <form method="post" action="<?php echo $this->url ($_SERVER['REQUEST_URI']) ?>" style="clear: both">
10
 
11
- <?php wp_nonce_field ('redirection-update_options'); ?>
12
 
13
  <table cellpadding="3" width="100%" class="form-table">
14
  <tr>
15
- <th valign="top" align="right"><?php _e ('Auto-generate URL', 'redirection') ?>:</th>
16
  <td>
17
- <input type="text" name="auto_target" style="width: 95%" value="<?php echo esc_attr( $options['auto_target'] ) ?>"/>
18
  <br/>
19
- <span class="sub"><?php _e ('This will be used to auto-generate a URL if no URL is given. You can use the special tags $dec$ or $hex$ to have a unique ID inserted (either decimal or hex)', 'redirection'); ?></span>
20
 
21
  </td>
22
  </tr>
23
  <tr>
24
- <th align="right" valign="top"><?php _e ('IP Lookup Service', 'redirection'); ?>:</th>
25
  <td>
26
- <input type="text" style="width: 95%" name="lookup" value="<?php echo esc_attr( $options['lookup'] ) ?>" id="lookup"/><br/>
27
  </td>
28
  </tr>
29
  <tr>
30
- <th align="right"><?php _e ('Plugin Support', 'redirection'); ?>:</th>
31
  <td>
32
- <input type="checkbox" name="support" <?php echo $this->checked ($options['support']) ?> id="support"/>
33
- <label for="support"><span class="sub"><?php _e ('I\'m a nice person and I have helped support the author of this plugin', 'redirection'); ?></span></label>
34
  </td>
35
  </tr>
36
  <tr>
37
- <th align="right"><?php _e ('Logging', 'redirection'); ?>:</th>
38
  <td>
39
- <input type="checkbox" name="log_redirections" <?php echo $this->checked ($options['log_redirections']) ?> id="log_redirections"/>
40
- <label for="log_redirections"><span class="sub"><?php _e ('log redirected requests', 'redirection'); ?></span></label><br />
41
- <input type="checkbox" name="log_404s" <?php echo $this->checked ($options['log_404s']) ?> id="log_404s"/>
42
- <label for="log_404s"><span class="sub"><?php _e ('log 404 Not Found requests', 'redirection'); ?></span></label><br />
43
- <?php _e( 'Uncheck one or both of these to turn off logging and reduce database load if your redirected URLs are hit very frequently, and/or your site is very busy and pages are often not found.', 'redirection' ); ?>
44
  </td>
45
  </tr>
46
  <tr>
47
- <th align="right"><?php _e ('Expire Logs', 'redirection'); ?>:</th>
48
  <td>
49
- <input size="5" type="text" name="expire" value="<?php echo esc_attr( $options['expire'] ) ?>"/>
50
- <?php _e ('days (enter 0 for no expiry)', 'redirection'); ?>
51
  </td>
52
  </tr>
53
  <tr>
54
- <th align="right"><?php _e ('RSS Token', 'redirection'); ?>:</th>
55
  <td>
56
- <input class="regular-text" size="5" type="text" name="token" value="<?php echo esc_attr( $options['token'] ) ?>"/><br/>
57
- <?php _e ('A unique token allowing feed readers access to Redirection RSS (leave blank to auto-generate)', 'redirection'); ?>
58
  </td>
59
  </tr>
60
  </table>
61
 
62
- <h3><?php _e ('URL Monitoring', 'redirection'); ?></h3>
63
- <p><?php _e ('You can have Redirection detect changes in URLs and have an automatic redirection created in a specific group.', 'redirection'); ?></p>
64
 
65
  <table class="form-table">
66
  <tr>
67
- <th><?php _e ('Post &amp; Page URLs', 'redirection'); ?>:</th>
68
  <td>
69
  <select name="monitor_post">
70
- <option value="0"><?php _e ('Don\'t monitor', 'redirection'); ?></option>
71
- <?php echo $this->select ($groups, $options['monitor_post']);?>
72
  </select>
73
  &mdash;
74
- <label for="create_url_for_new_posts"><?php _e ('Monitor new posts', 'redirection'); ?></label> <input type="checkbox" name="monitor_new_posts" <?php echo $this->checked ($options['monitor_new_posts']); ?> id="create_url_for_new_posts"/>
75
  </td>
76
  </tr>
77
  <!--
78
  <tr>
79
- <th><?php _e ('Category URLs', 'redirection'); ?>:</th>
80
  <td>
81
  <select name="monitor_category">
82
- <option value="0"><?php _e ('Don\'t monitor', 'redirection'); ?></option>
83
- <?php echo $this->select ($groups, $options['monitor_category']);?>
84
  </select>
85
  </td>
86
  </tr>-->
87
  </table>
88
 
89
- <input class="button-primary" type="submit" name="update" value="<?php _e ('Update', 'redirection') ?>"/>
90
 
91
  </form>
92
  </div>
93
 
94
  <div class="wrap">
95
- <h2><?php _e ('Import', 'redirection'); ?></h2>
96
 
97
- <p><?php _e ('Here you can import redirections from an existing .htaccess file, a CSV file, or a Redirection XML.', 'redirection'); ?></p>
98
 
99
- <form action="<?php echo $this->url ($_SERVER['REQUEST_URI']) ?>" method="post" accept-charset="utf-8" enctype="multipart/form-data">
100
- <?php wp_nonce_field ('redirection-import'); ?>
101
 
102
  <input type="file" name="upload" value=""/>
103
 
104
- <?php _e ('Import into', 'redirection'); ?>: <select name="group">
105
- <?php echo $this->select ($groups);?>
106
  </select>
107
- <input class="button-primary" type="submit" name="import" value="<?php _e ('Upload', 'redirection'); ?>"/>
108
  </form>
109
 
110
- <p><?php _e ('Note that the group is ignored when uploading an XML file.', 'redirection'); ?></p>
111
  </div>
112
 
113
  <div class="wrap">
114
- <h2><?php _e ('Delete Redirection', 'redirection'); ?></h2>
115
- <p><?php _e ('Selecting this option will delete all redirections, all logs, and any options associated with the Redirection plugin. Make sure this is what you want to do.', 'redirection'); ?></p>
116
 
117
- <form action="<?php echo $this->url ($_SERVER['REQUEST_URI']) ?>" method="post" accept-charset="utf-8">
118
- <?php wp_nonce_field ('redirection-delete_plugin'); ?>
119
 
120
- <input class="button-primary" type="submit" name="delete" value="<?php _e ('Delete', 'redirection') ?>"/>
121
  </form>
122
  </div>
1
+ <?php if( !defined( 'ABSPATH' ) ) die( 'No direct access allowed' ); ?>
2
  <div class="wrap">
3
+ <?php screen_icon( ); ?>
4
+ <?php $this->render_admin('annoy' )?>
5
 
6
+ <h2><?php _e( 'Options', 'redirection' ) ?></h2>
7
+ <?php $this->render_admin( 'submenu' ); ?>
8
 
9
+ <form method="post" action="<?php echo $this->url( $_SERVER['REQUEST_URI'] ) ?>" style="clear: both">
10
 
11
+ <?php wp_nonce_field( 'redirection-update_options' ); ?>
12
 
13
  <table cellpadding="3" width="100%" class="form-table">
14
  <tr>
15
+ <th valign="top" align="right"><?php _e( 'Auto-generate URL', 'redirection' ) ?>:</th>
16
  <td>
17
+ <input type="text" name="auto_target" style="width: 95%" value="<?php echo esc_attr( $options['auto_target'] ) ?>"/>
18
  <br/>
19
+ <span class="sub"><?php _e( 'This will be used to auto-generate a URL if no URL is given. You can use the special tags $dec$ or $hex$ to have a unique ID inserted (either decimal or hex)', 'redirection' ); ?></span>
20
 
21
  </td>
22
  </tr>
23
  <tr>
24
+ <th align="right" valign="top"><?php _e( 'IP Lookup Service', 'redirection' ); ?>:</th>
25
  <td>
26
+ <input type="text" style="width: 95%" name="lookup" value="<?php echo esc_attr( $options['lookup'] ) ?>" id="lookup"/><br/>
27
  </td>
28
  </tr>
29
  <tr>
30
+ <th align="right"><?php _e( 'Plugin Support', 'redirection' ); ?>:</th>
31
  <td>
32
+ <input type="checkbox" name="support" <?php echo $this->checked( $options['support'] ) ?> id="support"/>
33
+ <label for="support"><span class="sub"><?php _e( 'I\'m a nice person and I have helped support the author of this plugin', 'redirection' ); ?></span></label>
34
  </td>
35
  </tr>
36
  <tr>
37
+ <th align="right"><?php _e( 'Logging', 'redirection' ); ?>:</th>
38
  <td>
39
+ <input type="checkbox" name="log_redirections" <?php echo $this->checked( $options['log_redirections'] ) ?> id="log_redirections"/>
40
+ <label for="log_redirections"><span class="sub"><?php _e( 'log redirected requests', 'redirection' ); ?></span></label><br />
41
+ <input type="checkbox" name="log_404s" <?php echo $this->checked( $options['log_404s'] ) ?> id="log_404s"/>
42
+ <label for="log_404s"><span class="sub"><?php _e( 'log 404 Not Found requests', 'redirection' ); ?></span></label><br />
43
+ <?php _e( 'Uncheck one or both of these to turn off logging and reduce database load if your redirected URLs are hit very frequently, and/or your site is very busy and pages are often not found.', 'redirection' ); ?>
44
  </td>
45
  </tr>
46
  <tr>
47
+ <th align="right"><?php _e( 'Expire Logs', 'redirection' ); ?>:</th>
48
  <td>
49
+ <input size="5" type="text" name="expire" value="<?php echo esc_attr( $options['expire'] ) ?>"/>
50
+ <?php _e( 'days (enter 0 for no expiry)', 'redirection' ); ?>
51
  </td>
52
  </tr>
53
  <tr>
54
+ <th align="right"><?php _e( 'RSS Token', 'redirection' ); ?>:</th>
55
  <td>
56
+ <input class="regular-text" size="5" type="text" name="token" value="<?php echo esc_attr( $options['token'] ) ?>"/><br/>
57
+ <?php _e( 'A unique token allowing feed readers access to Redirection RSS (leave blank to auto-generate)', 'redirection' ); ?>
58
  </td>
59
  </tr>
60
  </table>
61
 
62
+ <h3><?php _e( 'URL Monitoring', 'redirection' ); ?></h3>
63
+ <p><?php _e( 'You can have Redirection detect changes in URLs and have an automatic redirection created in a specific group.', 'redirection' ); ?></p>
64
 
65
  <table class="form-table">
66
  <tr>
67
+ <th><?php _e( 'Post &amp; Page URLs', 'redirection' ); ?>:</th>
68
  <td>
69
  <select name="monitor_post">
70
+ <option value="0"><?php _e( 'Don\'t monitor', 'redirection' ); ?></option>
71
+ <?php echo $this->select( $groups, $options['monitor_post'] );?>
72
  </select>
73
  &mdash;
74
+ <label for="create_url_for_new_posts"><?php _e( 'Monitor new posts', 'redirection' ); ?></label> <input type="checkbox" name="monitor_new_posts" <?php echo $this->checked( $options['monitor_new_posts'] ); ?> id="create_url_for_new_posts"/>
75
  </td>
76
  </tr>
77
  <!--
78
  <tr>
79
+ <th><?php _e( 'Category URLs', 'redirection' ); ?>:</th>
80
  <td>
81
  <select name="monitor_category">
82
+ <option value="0"><?php _e( 'Don\'t monitor', 'redirection' ); ?></option>
83
+ <?php echo $this->select( $groups, $options['monitor_category'] );?>
84
  </select>
85
  </td>
86
  </tr>-->
87
  </table>
88
 
89
+ <input class="button-primary" type="submit" name="update" value="<?php _e( 'Update', 'redirection' ) ?>"/>
90
 
91
  </form>
92
  </div>
93
 
94
  <div class="wrap">
95
+ <h2><?php _e( 'Import', 'redirection' ); ?></h2>
96
 
97
+ <p><?php _e( 'Here you can import redirections from an existing .htaccess file, a CSV file, or a Redirection XML.', 'redirection' ); ?></p>
98
 
99
+ <form action="<?php echo $this->url( $_SERVER['REQUEST_URI'] ) ?>" method="post" accept-charset="utf-8" enctype="multipart/form-data">
100
+ <?php wp_nonce_field( 'redirection-import' ); ?>
101
 
102
  <input type="file" name="upload" value=""/>
103
 
104
+ <?php _e( 'Import into', 'redirection' ); ?>: <select name="group">
105
+ <?php echo $this->select( $groups );?>
106
  </select>
107
+ <input class="button-primary" type="submit" name="import" value="<?php _e( 'Upload', 'redirection' ); ?>"/>
108
  </form>
109
 
110
+ <p><?php _e( 'Note that the group is ignored when uploading an XML file.', 'redirection' ); ?></p>
111
  </div>
112
 
113
  <div class="wrap">
114
+ <h2><?php _e( 'Delete Redirection', 'redirection' ); ?></h2>
115
+ <p><?php _e( 'Selecting this option will delete all redirections, all logs, and any options associated with the Redirection plugin. Make sure this is what you want to do.', 'redirection' ); ?></p>
116
 
117
+ <form action="<?php echo $this->url( $_SERVER['REQUEST_URI'] ) ?>" method="post" accept-charset="utf-8">
118
+ <?php wp_nonce_field( 'redirection-delete_plugin' ); ?>
119
 
120
+ <input class="button-primary" type="submit" name="delete" value="<?php _e( 'Delete', 'redirection' ) ?>"/>
121
  </form>
122
  </div>
view/admin/submenu.php CHANGED
@@ -1,11 +1,35 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
 
3
- <ul <?php echo $class ?>>
4
- <li><a <?php if (!isset($_GET['sub'])) echo 'class="current"'; ?>href="<?php echo $url ?><?php if (isset ($_GET['id'])) echo '&amp;id='.urlencode( $_GET['id'] ) ?>"><?php _e ('Redirects', 'redirection'); ?></a><?php echo $trail ?></li>
5
- <li><a <?php if (isset($_GET['sub']) && $_GET['sub'] == 'groups') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=groups<?php if (isset ($_GET['id'])) echo '&amp;id='.$_GET['id'] ?>"><?php _e ('Groups', 'redirection'); ?></a><?php echo $trail ?></li>
6
- <li><a <?php if (isset($_GET['sub']) && $_GET['sub'] == 'modules') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=modules"><?php _e ('Modules', 'redirection'); ?></a><?php echo $trail ?></li>
7
- <li><a <?php if (isset($_GET['sub']) && $_GET['sub'] == 'log') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=log"><?php _e ('Log', 'redirection'); ?></a><?php echo $trail ?></li>
8
- <li><a <?php if (isset($_GET['sub']) && $_GET['sub'] == 'options') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=options"><?php _e ('Options', 'redirection'); ?></a><?php echo $trail ?></li>
9
- <li><a <?php if (isset($_GET['sub']) && $_GET['sub'] == 'support') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=support"><?php _e ('Support', 'redirection'); ?></a></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  </ul>
11
 
1
+ <?php if ( !defined( 'ABSPATH' ) ) die( 'No direct access allowed' ); ?>
2
 
3
+ <ul class="subsubsub">
4
+ <li>
5
+ <a <?php if ( !isset( $_GET['sub'] ) ) echo 'class="current"'; ?>href="?page=redirection.php<?php if ( isset( $_GET['id'] ) ) echo '&amp;id='.urlencode( $_GET['id'] ) ?>">
6
+ <?php _e( 'Redirects', 'redirection' ); ?>
7
+ </a> |
8
+ </li>
9
+ <li>
10
+ <a <?php if ( isset( $_GET['sub'] ) && $_GET['sub'] == 'groups' ) echo 'class="current"'; ?>href="?page=redirection.php&amp;sub=groups<?php if ( isset( $_GET['id'] ) ) echo '&amp;id='.$_GET['id'] ?>">
11
+ <?php _e( 'Groups', 'redirection' ); ?>
12
+ </a> |
13
+ </li>
14
+ <li>
15
+ <a <?php if ( isset( $_GET['sub'] ) && $_GET['sub'] == 'modules' ) echo 'class="current"'; ?>href="?page=redirection.php&amp;sub=modules">
16
+ <?php _e( 'Modules', 'redirection' ); ?>
17
+ </a> |
18
+ </li>
19
+ <li>
20
+ <a <?php if ( isset( $_GET['sub'] ) && $_GET['sub'] == 'log' ) echo 'class="current"'; ?>href="?page=redirection.php&amp;sub=log">
21
+ <?php _e( 'Log', 'redirection' ); ?>
22
+ </a> |
23
+ </li>
24
+ <li>
25
+ <a <?php if ( isset( $_GET['sub'] ) && $_GET['sub'] == 'options' ) echo 'class="current"'; ?>href="?page=redirection.php&amp;sub=options">
26
+ <?php _e( 'Options', 'redirection' ); ?>
27
+ </a> |
28
+ </li>
29
+ <li>
30
+ <a <?php if ( isset( $_GET['sub'] ) && $_GET['sub'] == 'support' ) echo 'class="current"'; ?>href="?page=redirection.php&amp;sub=support">
31
+ <?php _e( 'Support', 'redirection' ); ?>
32
+ </a>
33
+ </li>
34
  </ul>
35
 
view/admin/support.php CHANGED
@@ -3,7 +3,7 @@
3
  <?php screen_icon(); ?>
4
 
5
  <h2><?php _e ('Redirection Support', 'redirection'); ?></h2>
6
- <?php $this->submenu (true); ?>
7
 
8
  <p style="clear: both">
9
  <?php _e( 'Redirection is free to use - life is wonderful and lovely! However, it has required a great deal of time and effort to develop and if it has been useful you can help support this development by <strong>making a small donation</strong>.', 'redirection'); ?>
@@ -18,7 +18,7 @@
18
  <input type="hidden" name="cmd" value="_xclick">
19
  <input type="hidden" name="business" value="admin@urbangiraffe.com">
20
  <input type="hidden" name="item_name" value="Redirection - Individual">
21
- <input type="hidden" name="amount" value="12.00">
22
  <input type="hidden" name="buyer_credit_promo_code" value="">
23
  <input type="hidden" name="buyer_credit_product_category" value="">
24
  <input type="hidden" name="buyer_credit_shipping_method" value="">
@@ -33,7 +33,7 @@
33
  <input type="image" style="border: none" src="<?php echo $this->url () ?>/images/donate.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/>
34
  </form>
35
 
36
- <p><strong>$12</strong><br/><?php _e( 'Individual<br/>Donation', 'redirection' ); ?></p>
37
  </li>
38
  <li>
39
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
@@ -62,13 +62,11 @@
62
  <p><?php _e( 'If you\'re multi-lingual then you may want to consider donating a translation:', 'redirection' )?>
63
 
64
  <ul class="translators">
65
- <?php foreach( $this->locales() AS $language => $author ) : ?>
66
- <li><?php echo $language ?> &mdash; <?php echo $author; ?></li>
67
  <?php endforeach; ?>
68
  </ul>
69
 
70
- <p style="clear: both"><br/><?php _e( 'All translators will have a link to their website placed on the plugin homepage at <a href="http://urbangiraffe.com/plugins/redirection/">UrbanGiraffe</a> and <a href="http://wordpress.org/extend/plugins/redirection/">WordPress.org</a>, in addition to being an individual supporter.', 'redirection' )?></p>
71
  <p><?php _e( 'Full details of producing a translation can be found in this <a href="http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/">guide to translating WordPress plugins</a>.', 'redirection' )?>
72
-
73
- <?php echo $this->contextual_help( '', 'tools_page_redirection' ); ?>
74
  </div>
3
  <?php screen_icon(); ?>
4
 
5
  <h2><?php _e ('Redirection Support', 'redirection'); ?></h2>
6
+ <?php $this->render_admin( 'submenu' ); ?>
7
 
8
  <p style="clear: both">
9
  <?php _e( 'Redirection is free to use - life is wonderful and lovely! However, it has required a great deal of time and effort to develop and if it has been useful you can help support this development by <strong>making a small donation</strong>.', 'redirection'); ?>
18
  <input type="hidden" name="cmd" value="_xclick">
19
  <input type="hidden" name="business" value="admin@urbangiraffe.com">
20
  <input type="hidden" name="item_name" value="Redirection - Individual">
21
+ <input type="hidden" name="amount" value="14.00">
22
  <input type="hidden" name="buyer_credit_promo_code" value="">
23
  <input type="hidden" name="buyer_credit_product_category" value="">
24
  <input type="hidden" name="buyer_credit_shipping_method" value="">
33
  <input type="image" style="border: none" src="<?php echo $this->url () ?>/images/donate.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/>
34
  </form>
35
 
36
+ <p><strong>$14</strong><br/><?php _e( 'Individual<br/>Donation', 'redirection' ); ?></p>
37
  </li>
38
  <li>
39
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
62
  <p><?php _e( 'If you\'re multi-lingual then you may want to consider donating a translation:', 'redirection' )?>
63
 
64
  <ul class="translators">
65
+ <?php foreach( $this->locales() AS $language ) : ?>
66
+ <li><?php echo esc_html( $language ); ?></li>
67
  <?php endforeach; ?>
68
  </ul>
69
 
70
+ <p style="clear: both"><br/><?php _e( 'All translators will have a link to their website placed on the plugin homepage at <a href="http://urbangiraffe.com/plugins/redirection/">UrbanGiraffe</a>, in addition to being an individual supporter.', 'redirection' )?></p>
71
  <p><?php _e( 'Full details of producing a translation can be found in this <a href="http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/">guide to translating WordPress plugins</a>.', 'redirection' )?>
 
 
72
  </div>