Hola,
Me levanto y me pongo con el plugin, de modo que me doy cuenta de algo que he soñado esta noche: no hacía falta, en realidad, una de las funciones, de hecho el plugin puede hacer su trabajo con una sola función. Y así es como queda el plugin ahora mismo, copio aquí el código fuente, por si alguien está interesado... que lo dudo.
Código PHP:
(function($){
$.fn.StyleSwichter = function(options){
var opts = $.extend({}, $.fn.StyleSwichter.defaults, options);
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
$('link').each(function(i){
if(this.rel == 'stylesheet' && this.title == o.linkTitle){
if(o.cssPath != ''){
this.href = o.cssPath;
$.cookie(o.cookieName,this.href,{
path: o.cookiePath,
expires: o.cookieDays,
domain: o.cookieDomain,
secure: o.cookieSecure
});
}else if($.cookie(o.cookieName)){
this.href = $.cookie(o.cookieName);
}
return true;
}
});
return false;
};
$.fn.StyleSwichter.defaults={
cssPath: '',
cookiePath: '',
cookieDays: 30,
cookieDomain: '',
cookieSecure: false,
linkTitle: 'styleswichter',
cookieName: 'selected-style'
};
})(jQuery);
Esto reduce también el tamaño del plugin, que, comprimido, queda en unos 600 bytes.