From f2521e86d9269c5a450b7c98b5c64b9da763b6b5 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Tue, 9 Jul 2019 16:10:40 -1000 Subject: [PATCH 01/59] Update .gitignore to ignore project/vendor files --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 600d2d3..44c26ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.vscode \ No newline at end of file +.vscode +.sass-cache +node_modules/ \ No newline at end of file From 9db6f55affe809c77ee81ad518f27ef529d5c37d Mon Sep 17 00:00:00 2001 From: Archetyped Date: Mon, 29 Jul 2019 16:53:53 -1000 Subject: [PATCH 02/59] Optimize:Link detection. * Update:Regex pattern. * Fix:`area` elements included in link detection. * Closes #731 --- controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller.php b/controller.php index 5b40db7..2b31631 100644 --- a/controller.php +++ b/controller.php @@ -675,8 +675,8 @@ protected function process_links($content, $group = null) { * @return array Links in content */ function get_links($content, $unique = false) { - $rgx = "/\]+href=.*?\>/i"; - $links = array(); + $rgx = "/\).)*\shref=[^\>\<]++\>/i"; + $links = []; preg_match_all($rgx, $content, $links); $links = $links[0]; if ( $unique ) From 87425782fca01baa688eb07c101f66ed66f8f1f7 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 1 Aug 2019 15:47:24 -1000 Subject: [PATCH 03/59] JS: Build production assets. --- client/js/prod/lib.admin.js | 2 +- client/js/prod/lib.core.js | 2 +- content-handlers/image/js/prod/handler.image.js | 2 +- template-tags/item/js/prod/tag.item.js | 2 +- template-tags/ui/js/prod/tag.ui.js | 2 +- themes/baseline/js/prod/client.js | 2 +- themes/default/js/prod/client.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/js/prod/lib.admin.js b/client/js/prod/lib.admin.js index b873643..a7ed50e 100644 --- a/client/js/prod/lib.admin.js +++ b/client/js/prod/lib.admin.js @@ -1 +1 @@ -window.SLB&&SLB.attach&&!function($){SLB.attach("Admin",{init:function(){postboxes&&postboxes.add_postbox_toggles(pagenow)}}),$(document).ready(function(){SLB.Admin.init()})}(jQuery); \ No newline at end of file +window.SLB&&SLB.attach&&function($){SLB.attach("Admin",{init:function(){postboxes&&postboxes.add_postbox_toggles(pagenow)}}),$(document).ready(function(){SLB.Admin.init()})}(jQuery); \ No newline at end of file diff --git a/client/js/prod/lib.core.js b/client/js/prod/lib.core.js index b50e06d..7d11293 100644 --- a/client/js/prod/lib.core.js +++ b/client/js/prod/lib.core.js @@ -1 +1 @@ -window.jQuery&&!function($){"use strict";var c_init=!1,Class=function(){};Class.extend=function(members){function Class(){c_init||("function"==typeof this._init&&this._init.apply(this,arguments),"function"==typeof this._c&&this._c.apply(this,arguments))}var _super=this.prototype;c_init=!0;var proto=new this;c_init=!1;var val,name;for(name in proto)$.isPlainObject(proto[name])&&(val=$.extend({},proto[name]),proto[name]=val);var make_handler=function(nm,fn){return function(){var tmp=this._super;this._super=_super[nm];var ret=fn.apply(this,arguments);return this._super=tmp,ret}};for(name in members)"function"==typeof members[name]&&"function"==typeof _super[name]?proto[name]=make_handler(name,members[name]):proto[name]=$.isPlainObject(members[name])?$.extend({},members[name]):members[name];return Class.prototype=proto,Class.prototype.constructor=Class,Class.extend=this.extend,Class};var Base={base:!1,_parent:null,prefix:"slb",_init:function(){this._set_parent()},_set_parent:function(p){this.util.is_set(p)&&(this._parent=p),this.util._parent=this},attach:function(member,data,simple){var ret=data;return simple="undefined"!=typeof simple&&!!simple,"string"===$.type(member)&&($.isPlainObject(data)&&!simple&&(data._parent=this,data=this.Class.extend(data)),this[member]="function"===$.type(data)?new data:data,ret=this[member]),ret},has_child:function(child){if(!this.util.is_string(child))return!1;var children=child.split(".");child=null;var x,o=this;for(x=0;x0},is_set:function(val){return"undefined"!=typeof val},is_type:function(val,type,nonempty){var ret=!1;if(this.is_set(val)&&null!==val&&this.is_set(type))switch($.type(type)){case"function":ret=val instanceof type;break;case"string":ret=$.type(val)===type;break;default:ret=!1}return!ret||this.is_set(nonempty)&&!nonempty||(ret=!this.is_empty(val)),ret},is_string:function(value,nonempty){return this.is_type(value,"string",nonempty)},is_array:function(value,nonempty){return this.is_type(value,"array",nonempty)},is_bool:function(value){return this.is_type(value,"boolean",!1)},is_obj:function(value,nonempty){return this.is_type(value,"object",nonempty)},is_func:function(value){return this.is_type(value,"function",!1)},is_method:function(obj,key){var ret=!1;if(this.is_string(key)&&(key=[key]),this.in_obj(obj,key)){ret=!0;for(var x=0;ret&&x').get(0)},parse_query:function(uri){var delim={vars:"&",val:"="},query={raw:[],parsed:{},string:""};if(uri=this.parse_uri(uri),0===uri.search.indexOf("?")){query.raw=uri.search.substr(1).split(delim.vars);var i,temp,key,val;for(i=0;i0?temp.join(delim.val):null,query.parsed[key]=val}return query.parsed},build_query:function(query){var val,q=[],delim={vars:"&",val:"="};for(var key in query)val=null!==query[key]?delim.val+query[key]:"",q.push(key+val);return q.join(delim.vars)}};Base.attach("util",Utilities,!0);var SLB_Base=Class.extend(Base),Core={base:!0,context:[],Class:SLB_Base,_init:function(){this._super(),$("html").addClass(this.util.get_prefix())}},SLB_Core=SLB_Base.extend(Core);window.SLB=new SLB_Core}(jQuery); \ No newline at end of file +window.jQuery&&function($){"use strict";var c_init=!1,Class=function(){},Base={base:!(Class.extend=function(members){var _super=this.prototype;c_init=!0;var val,name,proto=new this;for(name in c_init=!1,proto)$.isPlainObject(proto[name])&&(val=$.extend({},proto[name]),proto[name]=val);var make_handler=function(nm,fn){return function(){var tmp=this._super;this._super=_super[nm];var ret=fn.apply(this,arguments);return this._super=tmp,ret}};for(name in members)"function"==typeof members[name]&&"function"==typeof _super[name]?proto[name]=make_handler(name,members[name]):proto[name]=$.isPlainObject(members[name])?$.extend({},members[name]):members[name];function Class(){c_init||("function"==typeof this._init&&this._init.apply(this,arguments),"function"==typeof this._c&&this._c.apply(this,arguments))}return((Class.prototype=proto).constructor=Class).extend=this.extend,Class}),_parent:null,prefix:"slb",_init:function(){this._set_parent()},_set_parent:function(p){this.util.is_set(p)&&(this._parent=p),this.util._parent=this},attach:function(member,data,simple){var ret=data;return simple=void 0!==simple&&!!simple,"string"===$.type(member)&&($.isPlainObject(data)&&!simple&&(data._parent=this,data=this.Class.extend(data)),this[member]="function"===$.type(data)?new data:data,ret=this[member]),ret},has_child:function(child){if(!this.util.is_string(child))return!1;var children=child.split(".");child=null;var x,o=this;for(x=0;x').get(0)},parse_query:function(uri){var i,temp,key,val,delim_vars="&",delim_val="=",query={raw:[],parsed:{},string:""};if(0===(uri=this.parse_uri(uri)).search.indexOf("?"))for(query.raw=uri.search.substr(1).split(delim_vars),i=0;i",{src:item.get_uri()});dfr.resolve(out)};return $(img).on("load",function(e){handler(e)}),img.src=item.get_uri(),dfr.promise()}})}(jQuery); \ No newline at end of file +window.SLB&&SLB.has_child("View.extend_content_handler")&&function($){SLB.View.extend_content_handler("image",{render:function(item,dfr){var img=new Image;return $(img).on("load",function(e){!function(){item.set_data(img),item.set_attribute("dimensions",{width:img.width,height:img.height});var out=$("",{src:item.get_uri()});dfr.resolve(out)}()}),img.src=item.get_uri(),dfr.promise()}})}(jQuery); \ No newline at end of file diff --git a/template-tags/item/js/prod/tag.item.js b/template-tags/item/js/prod/tag.item.js index b60dcfb..955f9e1 100644 --- a/template-tags/item/js/prod/tag.item.js +++ b/template-tags/item/js/prod/tag.item.js @@ -1 +1 @@ -window.SLB&&SLB.has_child("View.extend_template_tag_handler")&&!function(){SLB.View.extend_template_tag_handler("item",{render:function(item,tag,dfr){var m="get_"+tag.get_prop(),ret=this.util.is_method(item,m)?item[m]():item.get_attribute(tag.get_prop(),"");return this.util.is_promise(ret)?ret.done(function(output){dfr.resolve(output)}):dfr.resolve(ret),dfr.promise()}})}(); \ No newline at end of file +window.SLB&&SLB.has_child("View.extend_template_tag_handler")&&SLB.View.extend_template_tag_handler("item",{render:function(item,tag,dfr){var m="get_"+tag.get_prop(),ret=this.util.is_method(item,m)?item[m]():item.get_attribute(tag.get_prop(),"");return this.util.is_promise(ret)?ret.done(function(output){dfr.resolve(output)}):dfr.resolve(ret),dfr.promise()}}); \ No newline at end of file diff --git a/template-tags/ui/js/prod/tag.ui.js b/template-tags/ui/js/prod/tag.ui.js index 70b1d56..b1f25ce 100644 --- a/template-tags/ui/js/prod/tag.ui.js +++ b/template-tags/ui/js/prod/tag.ui.js @@ -1 +1 @@ -window.SLB&&SLB.has_child("View.extend_template_tag_handler")&&!function(){SLB.View.extend_template_tag_handler("ui",{_hooks:function(){this.on("dom_init",function(ev){this.call_attribute("events_init",ev)})},events_init:function(ev){var v=ev.data.template.get_theme().get_viewer(),thm=v.get_theme();v.on("events-complete",function(ev,v){thm.dom_get_tag("ui","close").click(function(){return v.close()}),thm.dom_get_tag("ui","nav_next").click(function(){v.item_next()}),thm.dom_get_tag("ui","nav_prev").click(function(){v.item_prev()}),thm.dom_get_tag("ui","slideshow_control").click(function(){v.slideshow_toggle()})}),v.on("slideshow-toggle",function(ev,v){var tags=thm.get_tags("ui","slideshow_control");if(tags.length)for(var render_tag=function(tag){tag.render(v.get_item()).done(function(r){r.tag.dom_get().html(r.output)})},x=0;xthis.get_breakpoint("small")?{width:32,height:55}:{width:0,height:0}},margin:function(){var m;return m=document.documentElement.clientWidth>this.get_breakpoint("small")?{height:50,width:20}:{height:0,width:0}}})}(); \ No newline at end of file +window.SLB&&SLB.has_child("View.extend_theme")&&SLB.View.extend_theme("slb_baseline",{breakpoints:{small:480,large:1024},offset:function(){return document.documentElement.clientWidth>this.get_breakpoint("small")?{width:32,height:55}:{width:0,height:0}},margin:function(){return document.documentElement.clientWidth>this.get_breakpoint("small")?{height:50,width:20}:{height:0,width:0}}}); \ No newline at end of file diff --git a/themes/default/js/prod/client.js b/themes/default/js/prod/client.js index bc7b09c..1faf120 100644 --- a/themes/default/js/prod/client.js +++ b/themes/default/js/prod/client.js @@ -1 +1 @@ -window.SLB&&SLB.has_child("View.extend_theme")&&!function($){SLB.View.extend_theme("slb_default",{transition:{open:function(v,dfr){var l=v.get_layout().hide(),o=v.get_overlay().hide(),thm=this,d=v.dom_get();return d.find(".slb_content").css({width:"",height:""}).find(this.get_tag_selector()).hide(),d.find(".slb_details").height(0),d.show({always:function(){var pos={top_base:$(document).scrollTop()};document.documentElement.clientWidth>thm.get_breakpoint("small")?(pos.top=pos.top_base+$(window).height()/2-l.height()/2,pos.topthis.get_breakpoint("small")){var anims={layout:{opacity:0,top:$(document).scrollTop()+$(window).height()/2},content:{width:0,height:0},speed:"fast"},pos=l.animate(anims.layout,anims.speed).promise(),size=c.animate(anims.content,anims.speed).promise();$.when(pos,size).done(function(){v.get_overlay().fadeOut({always:function(){reset()}})})}else l.css("opacity",0),reset();return dfr.promise()},load:function(v){return v.get_layout().find(".slb_loading").show(),document.documentElement.clientWidth>this.get_breakpoint("small")?v.get_layout().fadeIn().promise():v.get_layout().show().promise()},unload:function(v,dfr){var l=v.get_layout(),det=l.find(".slb_details"),cont=l.find(".slb_content "+this.get_tag_selector()),props={height:0};return det.css(props),cont.hide(),$.when(det.promise(),cont.promise()).done(function(){dfr.resolve()}),dfr.promise()},complete:function(v,dfr){var l=v.get_layout(),loader=l.find(".slb_loading"),det=l.find(".slb_details"),det_data=det.find(".slb_data"),c=l.find(".slb_content"),c_tag=c.find(this.get_tag_selector());if(document.documentElement.clientWidth>this.get_breakpoint("small")){var spd="fast",dims_item=this.get_item_dimensions();det.width(dims_item.width);var dims_det={height:det_data.outerHeight()};det.width("");var pos={top_base:$(document).scrollTop()};pos.top=pos.top_base+$(window).height()/2-(dims_det.height+dims_item.height)/2,pos.topthm.get_breakpoint("small")?(pos.top=pos.top_base+$(window).height()/2-l.height()/2,pos.topthis.get_breakpoint("small")){var anims={layout:{opacity:0,top:$(document).scrollTop()+$(window).height()/2},content:{width:0,height:0},speed:"fast"},pos=l.animate(anims.layout,anims.speed).promise(),size=c.animate(anims.content,anims.speed).promise();$.when(pos,size).done(function(){v.get_overlay().fadeOut({always:function(){reset()}})})}else l.css("opacity",0),reset();return dfr.promise()},load:function(v){return v.get_layout().find(".slb_loading").show(),document.documentElement.clientWidth>this.get_breakpoint("small")?v.get_layout().fadeIn().promise():v.get_layout().show().promise()},unload:function(v,dfr){var l=v.get_layout(),det=l.find(".slb_details"),cont=l.find(".slb_content "+this.get_tag_selector());return det.css({height:0}),cont.hide(),$.when(det.promise(),cont.promise()).done(function(){dfr.resolve()}),dfr.promise()},complete:function(v,dfr){var l=v.get_layout(),loader=l.find(".slb_loading"),det=l.find(".slb_details"),det_data=det.find(".slb_data"),c=l.find(".slb_content"),c_tag=c.find(this.get_tag_selector());if(document.documentElement.clientWidth>this.get_breakpoint("small")){var dims_item=this.get_item_dimensions();det.width(dims_item.width);var dims_det_height=det_data.outerHeight();det.width("");var pos={top_base:$(document).scrollTop()};pos.top=pos.top_base+$(window).height()/2-(dims_det_height+dims_item.height)/2,pos.top Date: Thu, 1 Aug 2019 15:16:13 -1000 Subject: [PATCH 04/59] Optimize: Default title filtering. --- client/js/dev/lib.view.js | 80 ++++++++++++++++++++++++++++---------- client/js/prod/lib.view.js | 2 +- 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/client/js/dev/lib.view.js b/client/js/dev/lib.view.js index 5d9513f..ae39673 100644 --- a/client/js/dev/lib.view.js +++ b/client/js/dev/lib.view.js @@ -3029,7 +3029,7 @@ var Content_Item = { ret = ret.replace(/&(#38|amp);/, '&'); return ret; }, - + /** * Retrieve item title */ @@ -3044,6 +3044,33 @@ var Content_Item = { var title = ''; // Generate title from DOM values var dom = this.dom_get(); + var t = this; + /** + * Validate title value. + * + * Removes default title based on user option. + * + * @param string title Title to check. + * @return string Current title or empty string (if default title set and not permitted). + */ + var validate = function(title) { + // Return empty string if empty title set. + if ( typeof title !== 'string' || '' === title.trim() ) { + return ''; + } + // Cleanup title. + title = title.trim(); + // Stop processing if default title is allowed. + if ( t.get_viewer().get_attribute('title_default') ) { + return title; + } + + // Check if default title is used. + if ( title === t.get_title_default() ) { + title = ''; + } + return title; + }; // DOM-based caption if ( dom.length ) { @@ -3065,30 +3092,45 @@ var Content_Item = { if ( !title ) { var props = ['caption', 'title']; for ( var x = 0; x < props.length; x++ ) { - title = this.get_attribute(props[x], ''); + title = validate( this.get_attribute(props[x], '') ); if ( !this.util.is_empty(title) ) { break; } } } - + // Fallbacks if ( !title && dom.length ) { - // Alt attribute - title = dom.find('img').first().attr('alt'); + // Image Alt attribute + title = validate( dom.find('img').first().attr('alt') ); // Element text if ( !title ) { - title = dom.get(0).innerText.trim(); + title = validate( dom.get(0).innerText.trim() ); } } - // Validate - if ( !this.util.is_string(title, false) ) { - title = ''; - } - // Strip default title - if ( !this.util.is_empty(title) && !this.get_viewer().get_attribute('title_default') ) { + // Final validation. + title = validate(title); + + // Cache retrieved value + this.set_attribute(prop_cached, title); + // Return value + return title; + }, + + /** + * Retrieve default title. + * + * WordPress-generated default title for attachments is base file name (without extension). + * + * @return string Default title. + */ + get_title_default: function() { + var val = ''; + var prop = 'title_default'; + // Build default title if necessary. + if ( !this.has_attribute(prop) ) { var f = this.get_uri('source'); var i = f.lastIndexOf('/'); if ( -1 !== i ) { @@ -3097,17 +3139,13 @@ var Content_Item = { if ( -1 !== i ) { f = f.substr(0, i); } - if ( title === f ) { - title = ''; - } } + // Save default title + val = this.set_attribute(prop, f); + } else { + val = this.get_attribute(prop); } - - - // Cache retrieved value - this.set_attribute(prop_cached, title); - // Return value - return title; + return val; }, /** diff --git a/client/js/prod/lib.view.js b/client/js/prod/lib.view.js index 6dd113f..f24124c 100644 --- a/client/js/prod/lib.view.js +++ b/client/js/prod/lib.view.js @@ -1 +1 @@ -window.SLB&&SLB.attach&&function($){var View={assets:{},component_defaults:[],loading:[],cache:{},component_temps:{},options:{},_init:function(){this._super(),this.init_refs(),this.init_components()},init_refs:function(){var r,ref,prop;for(prop in this)if(prop=this[prop],this.is_component(prop)&&!this.util.is_empty(prop.prototype._refs))for(r in prop.prototype._refs)ref=prop.prototype._refs[r],this.util.is_string(ref)&&ref in this&&(ref=prop.prototype._refs[r]=this[ref]),this.util.is_class(ref)||delete prop.prototype_refs[r]},init_components:function(){this.component_defaults=[this.Viewer]},init:function(options){var t=this;$.when.apply($,this.loading).always(function(){$.extend(!0,t.options,options),$(window).on("popstate",function(e){var state=e.originalEvent.state;if(t.util.in_obj(state,["item","viewer"]))return t.get_viewer(state.viewer).history_handle(e),e.preventDefault()}),t.init_items()})},can_make_default_component:function(type){return-1!==$.inArray(type,this.component_defaults)},is_component:function(comp){return this.util.is_class(comp,this.Component)},get_components:function(type){var ret={};if(this.is_component(type)){var coll=type.prototype._slug+"s";coll in this.cache||(this.cache[coll]={}),ret=this.cache[coll]}return ret},get_component:function(type,id){var ret=null;if(!this.util.is_func(type))return ret;this.util.is_string(id)||(id=null);var coll=this.get_components(type);if(this.util.is_obj(coll)){var tid=this.util.is_string(id)?id:this.util.add_prefix("default");tid in coll&&(ret=coll[tid])}return this.util.is_empty(ret)&&(this.util.is_string(id)||this.can_make_default_component(type))&&(ret=this.add_component(type,id)),ret},add_component:function(type,id,options){if(!this.util.is_func(type))return!1;if(this.util.is_empty(id)&&!this.can_make_default_component(type))return!1;var ret=null;this.util.is_empty(id)&&(id=this.util.add_prefix("default")),this.util.is_obj(options)||(options={});var m="component"!==type.prototype._slug?"add_"+type.prototype._slug:null;if(ret=!this.util.is_empty(m)&&m in this&&this.util.is_func(this[m])?this[m](id,options):new type(id,options),this.util.is_type(ret,type)){var coll=this.get_components(type);switch($.type(coll)){case"object":coll[id]=ret;break;case"array":coll.push(ret)}}else ret=null;return ret},add_component_temp:function(type){var ret=null;return this.is_component(type)&&(ret=new type(""),this.component_temps[ret._slug]=ret),ret},get_component_temp:function(type){return this.has_component_temp(type)?this.component_temps[type.prototype._slug]:this.add_component_temp(type)},has_component_temp:function(type){return!!(this.is_component(type)&&type.prototype._slug in this.component_temps)},get_options:function(opts){var ret={};if(this.util.is_string(opts)&&(opts=[opts]),!this.util.is_array(opts))return ret;for(var x=0;x');$("head").append(out.join(""))}}},Component={_slug:"component",_ns:null,_refs:{},_reciprocal:!1,_dom:null,_attributes:!1,_attr_default:{},_attr_default_parsed:!1,_attr_init:null,_attr_map:{},_events:{},_status:null,_id:"",_c:function(id,attributes){this._set_id(id),this.util.is_obj(attributes)&&(this._attr_init=attributes),this._hooks()},_set_parent:function(){this._super(View)},_hooks:function(){},_set_id:function(id){return this.util.is_empty(this._id)&&(this._id=this.util.is_string(id)?id:this.util.guid()),this._id},get_id:function(ns){var id=this._id;return this.util.is_bool(ns)&&ns&&(id=this.add_ns(id)),id},get_ns:function(){return null===this._ns&&(this._ns=this.util.add_prefix(this._slug)),this._ns},add_ns:function(val){return this.util.is_string(val)?this.get_ns()+"_"+val:""},get_status:function(id,raw){var ret=!1;return this.util.in_obj(this._status,id)&&(ret=raw?this._status[id]:!!this._status[id]),ret},set_status:function(id,val){return this.util.is_string(id)?(this.util.is_set(val)||(val=!0),this.util.is_obj(this._status,!1)||(this._status={}),this._status[id]=val):this.util.is_set(val)||(val=!1),val},get_controller:function(){return this.get_parent()},has_reference:function(ref){return!!(this.util.is_string(ref)&&ref in this&&ref in this.get_references())},get_references:function(){return this._refs},get_reference:function(ref){return this.has_reference(ref)?this._refs[ref]:null},get_component:function(cname,options){var c=null;if(!this.has_reference(cname))return c;options=$.extend({},{check_attr:!0,get_default:!1},options);var ctype=this.get_reference(cname);return this.util.is_type(this[cname],ctype)?this[cname]:(c=this[cname]=null,options.check_attr&&(c=this.get_attribute(cname),this.util.is_empty(c)||(c=this.set_component(cname,c))),this.util.is_empty(c)&&options.get_default&&(c=this.get_controller().get_component(ctype)),c)},set_component:function(name,ref,validate){if(!this.has_reference(name))return null;if(this.util.is_empty(ref))ref=null;else{var ctype=this.get_reference(name);this.util.is_string(ref,!1)&&(ref=this.get_controller().get_component(ctype,ref)),(!this.util.is_type(ref,ctype)||this.util.is_func(validate)&&!validate.call(this,ref))&&(ref=null)}return this[name]=ref,this[name]},clear_component:function(name){this.set_component(name,null)},init_attributes:function(force){if(this.util.is_bool(force)||(force=!1),force||!this.util.is_obj(this._attributes)){var a=this._attributes={};$.extend(a,this.init_default_attributes()),this.util.is_obj(this._attr_init)&&$.extend(a,this._attr_init),$.extend(a,this.get_dom_attributes())}},init_default_attributes:function(){if(!this._attr_default_parsed&&this.util.is_obj(this._attr_map)){var opts=this.get_controller().get_options(this.util.obj_keys(this._attr_map));if(this.util.is_obj(opts)){for(var opt in this._attr_map)opt in opts&&null!==this._attr_map[opt]&&(opts[this._attr_map[opt]]=opts[opt],delete opts[opt]);$.extend(!0,this._attr_default,opts)}this._attr_default_parsed=!0}return this._attr_default},get_dom_attributes:function(){var attrs={},el=this.dom_get(null,{init:!1});if(0",options.tag),attrs).appendTo(d)).length&&this.util.is_method(options,"success")&&options.success.call(r,r),$(r).append(options.content),$(r)},dom_has:function(){return!!this.dom_get().length},get_data_key:function(){return this.get_ns()},on:function(event,fn,options){if(!this.util.is_string(event)||!this.util.is_func(fn)){var t=this,args=Array.prototype.slice.call(arguments,1);return this.util.is_array(event)?$.each(event,function(idx,val){t.on.apply(t,[val].concat(args))}):this.util.is_obj(event)&&$.each(event,function(ev,hdl){t.on.apply(t,[ev,hdl].concat(args))}),this}this.util.is_obj(options,!1)||(options={}),options=$.extend({},{clear:!1},options),this.util.is_obj(this._events,!1)||(this._events={});var es=this._events;return event in es&&this.util.is_obj(es[event],!1)&&!options.clear||(es[event]=[]),es[event].push(fn),this},trigger:function(event,data){var dfr=$.Deferred(),dfrs=[],t=this;if(this.util.is_array(event))return $.each(event,function(idx,val){dfrs.push(t.trigger(val,data))}),$.when.apply(t,dfrs).done(function(){dfr.resolve()}),dfr.promise();if(!(this.util.is_string(event)&&event in this._events))return dfr.resolve(),dfr.promise();var ev={type:event,data:null};return this.util.is_set(data)&&(ev.data=data),$.each(this._events[event],function(idx,fn){dfrs.push(fn.call(t,ev,t))}),$.when.apply(this,dfrs).done(function(){dfr.resolve()}),dfr.promise()}};View.Component=Component=SLB.Class.extend(Component);var Viewer={_slug:"viewer",_refs:{item:"Content_Item",theme:"Theme"},_reciprocal:!0,_attr_default:{loop:!0,animate:!0,autofit:!0,overlay_enabled:!0,overlay_opacity:"0.8",title_default:!1,container:null,slideshow_enabled:!0,slideshow_autostart:!1,slideshow_duration:2,slideshow_active:!1,slideshow_timer:null,labels:{close:"close",nav_prev:"« prev",nav_next:"next »",slideshow_start:"start slideshow",slideshow_stop:"stop slideshow",group_status:"Image %current% of %total%",loading:"loading"}},_attr_map:{theme:null,group_loop:"loop",ui_autofit:"autofit",ui_animate:"animate",ui_overlay_opacity:"overlay_opacity",ui_labels:"labels",ui_title_default:"title_default",slideshow_enabled:null,slideshow_autostart:null,slideshow_duration:null},item:null,item_queued:null,theme:null,item_working:null,active:!1,init:!1,open:!1,loading:!1,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")}).on(["close","item-change"],function(){t.unload().done(function(){t.unlock()})})},get_item:function(){return this.get_component("item")},set_item:function(item){this.clear_item(!1);var i=this.set_component("item",item,function(item){return item.has_type()});return!this.util.is_empty(i)},clear_item:function(full){this.util.is_bool(full)||(full=!0);var item=this.get_item();item&&item.reset(),full&&this.clear_component("item")},get_theme:function(){var ret=this.get_component("theme",{check_attr:!1});return this.util.is_empty(ret)&&(ret=this.set_component("theme",new View.Theme(this))),ret},set_theme:function(theme){this.set_component("theme",theme)},lock:function(){return this.set_status("item_working",$.Deferred())},get_lock:function(simple,full){this.util.is_bool(simple)||(simple=!1),this.util.is_bool(full)||(full=!1);var s="item_working";if(simple)return this.get_status(s);var r=this.get_status(s,!0);return this.util.is_promise(r)||(r=this.lock()),full?r:r.promise()},is_locked:function(){return this.get_lock(!0)},unlock:function(){return this.get_lock(!1,!0).resolve()},set_active:function(mode){return this.util.is_bool(mode)||(mode=!0),this.set_status("active",mode)},is_active:function(){return this.get_status("active")},set_loading:function(mode){var dfr=$.Deferred();this.util.is_bool(mode)||(mode=!0),this.loading=mode,this.slideshow_active()&&this.slideshow_pause(mode);var m=mode?"addClass":"removeClass";return $(this.dom_get())[m]("loading"),mode?this.get_theme().transition("load").always(function(){dfr.resolve()}):dfr.resolve(),dfr.promise()},unset_loading:function(){return this.set_loading(!1)},get_loading:function(){return!!this.util.is_bool(this.loading)&&this.loading},is_loading:function(){return this.get_loading()},show:function(item){this.item_queued=item;var vt="theme_valid",valid=!0;if(this.has_attribute(vt)?valid=this.get_attribute(vt,!0):(valid=!(!this.get_theme()||""===this.get_theme().get_template().get_layout(!1)),this.set_attribute(vt,valid)),!valid)return this.close(),!1;var v=this,fin=function(){if(v.lock(),v.set_status("show_deferred",!1),!v.set_item(v.item_queued))return v.close(),!1;v.history_add(),v.set_active(),v.render()};this.is_locked()?this.get_status("show_deferred")||(this.set_status("show_deferred"),this.get_lock().always(function(){fin()})):fin()},history_handle:function(e){var state=e.originalEvent.state;if(this.util.is_string(state.item,!1))this.get_controller().get_item(state.item).show({event:e}),this.trigger("item-change");else{var count=this.history_get(!0);this.history_set(0),-1!==count&&this.close()}},history_get:function(full){return this.get_status("history_count",full)},history_set:function(val){return this.set_status("history_count",val)},history_add:function(){if(!history.pushState)return!1;var item=this.get_item(),opts=item.get_attribute("options_show"),count=this.history_get()?this.history_get(!0):0;if(this.util.in_obj(opts,"event")){var e=opts.event.originalEvent;this.util.in_obj(e,"state")&&this.util.in_obj(e.state,"count")&&(count=e.state.count)}else{var state={viewer:this.get_id(),item:null,count:count};count||history.replaceState(state,null),state.item=this.get_controller().save_item(item).get_id(),state.count=++count,history.pushState(state,"")}this.history_set(count)},history_reset:function(){var count=this.history_get(!0);count&&(this.history_set(-1),history.go(-1*count))},is_open:function(){return"none"!==this.dom_get().css("display")},render:function(){var v=this,thm=this.get_theme();v.dom_prep(),this.get_status("render-events")||(this.set_status("render-events"),thm.on("render-loading",function(ev,thm){var dfr=$.Deferred();if(!v.is_active())return dfr.reject(),dfr.promise();var set_pos=function(){v.dom_get().css("top",$(window).scrollTop())},always=function(){v.set_loading().always(function(){dfr.resolve()})};return v.is_open()?thm.transition("unload").fail(function(){set_pos(),thm.dom_get_tag("item","content").attr("style","")}).always(always):thm.transition("open").always(function(){always(),v.events_open(),v.open=!0}).fail(function(){set_pos(),v.get_overlay().show(),v.dom_get().show()}),dfr.promise()}).on("render-complete",function(ev,thm){if(!v.is_active())return!1;var d=v.dom_get(),classes=["item_single","item_multi"],ms=["addClass","removeClass"];v.get_item().get_group().is_single()||ms.reverse(),$.each(ms,function(idx,val){d[val](classes[idx])}),v.events_complete(),thm.transition("complete").fail(function(){if(v.get_attribute("autofit",!0)){var dims=$.extend({display:"inline-block"},thm.get_item_dimensions());thm.dom_get_tag("item","content").css(dims)}}).always(function(){v.unset_loading(),v.trigger("render-complete"),v.init=!0})})),thm.render()},dom_get_container:function(){var sel=this.get_attribute("container");this.util.is_empty(sel)&&(sel="#"+this.add_ns("wrap"));var c=$(sel);if(!c.length){var id=0===sel.indexOf("#")?sel.substr(1):sel;c=$("
",{id:id}).appendTo("body")}return c},dom_init:function(){var d=this.dom_set($("
",{id:this.get_id(!0),class:this.get_ns()})).appendTo(this.dom_get_container()).hide(),thm=this.get_theme();d.addClass(thm.get_classes(" "));var v=this;this.get_status("render-init")||(this.set_status("render-init"),thm.on("render-init",function(ev){v.dom_put("layout",ev.data)})),thm.render(!0)},dom_prep:function(mode){var m=this.util.is_bool(mode)&&!mode?"removeClass":"addClass";$("html")[m](this.util.add_prefix("overlay"))},dom_restore:function(){this.dom_prep(!1)},get_layout:function(){return this.dom_get("layout",{put:{success:function(){$(this).hide()}}})},animation_enabled:function(){return this.get_attribute("animate",!0)},overlay_enabled:function(){var ov=this.get_attribute("overlay_enabled");return!!this.util.is_bool(ov)&&ov},get_overlay:function(){var o=null,v=this;return this.overlay_enabled()&&(o=this.dom_get("overlay",{put:{success:function(){$(this).hide().css("opacity",v.get_attribute("overlay_opacity"))}}})),$(o)},unload:function(){var dfr=$.Deferred();return this.get_theme().dom_get_tag("item").text(""),dfr.resolve(),dfr.promise()},reset:function(){this.dom_get().hide(),this.dom_restore(),this.history_reset(),this.clear_item(),this.set_active(!1),this.set_loading(!1),this.slideshow_stop(),this.keys_disable(),this.unlock()},get_labels:function(){return this.get_attribute("labels",{})},get_label:function(name){var lbls=this.get_labels();return name in lbls?lbls[name]:""},events_open:function(){if(this.keys_enable(),this.open)return!1;var l=this.get_layout();l.children().click(function(ev){ev.stopPropagation()});var v=this,close=function(){v.close()};l.click(close),this.get_overlay().click(close),this.trigger("events-open")},events_complete:function(){if(this.init)return!1;this.trigger("events-complete")},keys_enable:function(mode){this.util.is_bool(mode)||(mode=!0);var e=["keyup",this.util.get_prefix()].join("."),v=this;mode?$(document).on(e,function(ev){return v.keys_control(ev)}):$(document).off(e)},keys_disable:function(){this.keys_enable(!1)},keys_control:function(ev){var handlers={27:this.close,37:this.item_prev,39:this.item_next};if("rtl"===document.documentElement.getAttribute("dir")&&(handlers[37]=this.item_next,handlers[39]=this.item_prev),ev.which in handlers)return handlers[ev.which].call(this),!1},slideshow_enabled:function(){var o=this.get_attribute("slideshow_enabled");return!(!(this.util.is_bool(o)&&o&&this.get_item())||this.get_item().get_group().is_single())},slideshow_active:function(){return!(!this.slideshow_enabled()||!(this.get_attribute("slideshow_active")||!this.init&&this.get_attribute("slideshow_autostart")))},slideshow_clear_timer:function(){clearInterval(this.get_attribute("slideshow_timer"))},slideshow_set_timer:function(callback){this.set_attribute("slideshow_timer",setInterval(callback,1e3*this.get_attribute("slideshow_duration")))},slideshow_start:function(){if(!this.slideshow_enabled())return!1;this.set_attribute("slideshow_active",!0),this.dom_get().addClass("slideshow_active"),this.slideshow_clear_timer();var v=this;this.slideshow_set_timer(function(){v.slideshow_pause(),v.item_next()}),this.trigger("slideshow-start")},slideshow_stop:function(full){this.util.is_bool(full)||(full=!0),full&&(this.set_attribute("slideshow_active",!1),this.dom_get().removeClass("slideshow_active")),this.slideshow_clear_timer(),this.trigger("slideshow-stop")},slideshow_toggle:function(){if(!this.slideshow_enabled())return!1;this.slideshow_active()?this.slideshow_stop():this.slideshow_start(),this.trigger("slideshow-toggle")},slideshow_pause:function(mode){this.util.is_bool(mode)||(mode=!0),this.slideshow_active()&&(mode?this.slideshow_stop(!1):this.slideshow_start()),this.trigger("slideshow-pause")},slideshow_resume:function(){this.slideshow_pause(!1)},item_next:function(){var g=this.get_item().get_group(!0),v=this,ev="item-next",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(e){v.trigger(e.type)})),g.show_next()},item_prev:function(){var g=this.get_item().get_group(!0),v=this,ev="item-prev",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(){v.trigger(ev)})),g.show_prev()},close:function(){this.set_active(!1);var v=this,thm=this.get_theme();return thm.transition("unload").always(function(){thm.transition("close",!0).always(function(){v.reset(),v.trigger("close")})}).fail(function(){thm.dom_get_tag("item","content").attr("style","")}),!1}};View.Viewer=Component.extend(Viewer);var Group={_slug:"group",_reciprocal:!0,_refs:{current:"Content_Item"},current:null,selector:null,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")})},get_selector:function(){return this.util.is_empty(this.selector)&&(this.selector=this.util.format('a[%s="%s"]',this.dom_get_attribute(),this.get_id())),this.selector},get_items:function(){var items=$(this.get_selector());return 0===items.length&&this.has_current()&&(items=this.get_current().dom_get()),items},get_item:function(idx){this.util.is_int(idx)||(idx=0);var items=this.get_items(),max=this.get_size()-1;return maxoffset.width&&(max.width-=offset.width),max.height>offset.height&&(max.height-=offset.height);var factor=Math.min(max.width/dims.width,max.height/dims.height);factor<1&&$.each(dims,function(key){dims[key]=Math.round(dims[key]*factor)})}return $.extend({},dims)},get_dimensions:function(){var dims=this.get_item_dimensions(),offset=this.get_offset();return $.each(dims,function(key){dims[key]+=offset[key]}),dims},get_breakpoints:function(){return this.get_attribute_recursive("breakpoints")},get_breakpoint:function(target){var ret=0;if(this.util.is_string(target)){var b=this.get_attribute_recursive("breakpoints");this.util.is_obj(b)&&target in b&&(ret=b[target])}return ret},render:function(init){var thm=this,tpl=this.get_template(),st="events_render";this.get_status(st)||(this.set_status(st),tpl.on(["render-init","render-loading","render-complete"],function(ev){return thm.trigger(ev.type,ev.data)})),tpl.render(init)},transition:function(event,clear_queue){var dfr=null,attr="transition",v=this.get_viewer(),fx_temp=null,anim_on=v.animation_enabled();if(v.get_attribute(attr,!0)&&this.util.is_string(event)){clear_queue&&v.get_layout().find("*").each(function(){for(var el=$(this);el.queue().length;)el.stop(!1,!0)});var trns,attr_set=[attr,"set"].join("_");if(this.get_attribute(attr_set))trns=this.get_attribute(attr,{});else{var models=this.get_ancestors(!0);trns=[],this.set_attribute(attr_set,!0);var thm=this;$.each(models,function(idx,model){attr in model&&thm.util.is_obj(model[attr])&&trns.push(model[attr])}),trns.push({}),trns=this.set_attribute(attr,$.extend.apply($,trns.reverse()))}this.util.is_method(trns,event)&&(anim_on||(fx_temp=$.fx.off,$.fx.off=!0),dfr=trns[event].call(this,v,$.Deferred()))}return this.util.is_promise(dfr)||(dfr=$.Deferred()).reject(),dfr.always(function(){null!==fx_temp&&($.fx.off=fx_temp)}),dfr.promise()}};View.Theme=Modeled_Component.extend(Theme);var Template={_slug:"template",_reciprocal:!0,_refs:{theme:"Theme"},_attr_default:{layout_uri:"",layout_raw:"",layout_parsed:"",tags:null,model:null},theme:null,_c:function(attributes){this._super("",attributes)},_hooks:function(){this.on("dom_init",function(ev){var tags=this.get_tags(null,null,!0),names=[],t=this;$.each(tags,function(idx,tag){var name=tag.get_name();-1===$.inArray(name,names)&&(names.push(name),tag.get_handler().trigger(ev.type,{template:t}))})})},get_theme:function(){return this.get_component("theme")},render:function(init){var v=this.get_theme().get_viewer();if(this.util.is_bool(init)||(init=!1),init)this.trigger("render-init",this.dom_get());else{if(!v.is_active())return!1;var item=v.get_item();if(!this.util.is_type(item,View.Content_Item))return v.close(),!1;if(v.is_active()&&this.has_tags()){var loading_promise=this.trigger("render-loading"),tpl=this,tags=this.get_tags(),tag_promises=[];$.when(item.load(),loading_promise).done(function(){return!!v.is_active()&&($.each(tags,function(idx,tag){if(!v.is_active())return!1;tag_promises.push(tag.render(item).done(function(r){if(!v.is_active())return!1;r.tag.dom_get().html(r.output)}))}),!!v.is_active()&&void $.when.apply($,tag_promises).done(function(){tpl.trigger("render-complete")}))})}}},get_layout:function(parsed){return this.util.is_bool(parsed)||(parsed=!0),parsed?this.parse_layout():this.get_attribute("layout_raw","")},parse_layout:function(){var a="layout_parsed",ret=this.get_attribute(a);return this.util.is_string(ret)||(ret=this.sanitize_layout(this.get_layout(!1)),ret=this.parse_tags(ret),this.set_attribute(a,ret)),ret},sanitize_layout:function(l){if(this.util.is_empty(l))return l;var rtype=this.util.is_string(l)?"string":null,dom=$(l),tag_temp=this.get_tag_temp(),cls=tag_temp.get_class(),cls_new=["x",cls].join("_");switch($(tag_temp.get_selector(),dom).each(function(){$(this).removeClass(cls).addClass(cls_new)}),rtype){case"string":l=dom=dom.wrap("
").parent().html();break;default:l=dom}return l},parse_tags:function(l){if(!this.util.is_string(l))return"";for(var match,re=/\{{2}\s*(\w.*?)\s*\}{2}/gim;match=re.exec(l);)l=l.substring(0,match.index)+this.get_tag_container(match[1])+l.substring(match.index+match[0].length);return l},get_tag_container:function(tag){var attr=this.get_tag_attribute();return this.util.format('',attr,encodeURI(tag))},get_tag_attribute:function(){return this.get_tag_temp().dom_get_attribute()},get_tag:function(idx){var ret=null;if(this.has_tags()){var tags=this.get_tags();(!this.util.is_int(idx)||idx<0||idx>=tags.length)&&(idx=0),ret=tags[idx]}return ret},get_tags:function(name,prop,isolate){this.util.is_bool(isolate)||(isolate=!1);var a="tags",tags=this.get_attribute(a);if(!this.util.is_array(tags)){tags=[];var d=this.dom_get(),attr=this.get_tag_attribute(),nodes=$(d).find("["+attr+"]");$(nodes).each(function(){var el=$(this),tag=new View.Template_Tag(decodeURI(el.attr(attr)));tag.has_handler()&&(tags.push(tag),isolate||(tag.dom_set(el),el.addClass(tag.get_classes(" ")))),isolate||el.removeAttr(attr)}),isolate||this.set_attribute(a,tags,!1)}if(!this.util.is_empty(tags)&&this.util.is_string(name)){this.util.is_string(prop)||(prop=!1);for(var tags_filtered=[],tc=null,x=0;x');$("head").append(out.join(""))}}},Component={_slug:"component",_ns:null,_refs:{},_reciprocal:!1,_dom:null,_attributes:!1,_attr_default:{},_attr_default_parsed:!1,_attr_init:null,_attr_map:{},_events:{},_status:null,_id:"",_c:function(id,attributes){this._set_id(id),this.util.is_obj(attributes)&&(this._attr_init=attributes),this._hooks()},_set_parent:function(){this._super(View)},_hooks:function(){},_set_id:function(id){return this.util.is_empty(this._id)&&(this._id=this.util.is_string(id)?id:this.util.guid()),this._id},get_id:function(ns){var id=this._id;return this.util.is_bool(ns)&&ns&&(id=this.add_ns(id)),id},get_ns:function(){return null===this._ns&&(this._ns=this.util.add_prefix(this._slug)),this._ns},add_ns:function(val){return this.util.is_string(val)?this.get_ns()+"_"+val:""},get_status:function(id,raw){var ret=!1;return this.util.in_obj(this._status,id)&&(ret=raw?this._status[id]:!!this._status[id]),ret},set_status:function(id,val){return this.util.is_string(id)?(this.util.is_set(val)||(val=!0),this.util.is_obj(this._status,!1)||(this._status={}),this._status[id]=val):this.util.is_set(val)||(val=!1),val},get_controller:function(){return this.get_parent()},has_reference:function(ref){return!!(this.util.is_string(ref)&&ref in this&&ref in this.get_references())},get_references:function(){return this._refs},get_reference:function(ref){return this.has_reference(ref)?this._refs[ref]:null},get_component:function(cname,options){var c=null;if(!this.has_reference(cname))return c;options=$.extend({},{check_attr:!0,get_default:!1},options);var ctype=this.get_reference(cname);return this.util.is_type(this[cname],ctype)?this[cname]:(c=this[cname]=null,options.check_attr&&(c=this.get_attribute(cname),this.util.is_empty(c)||(c=this.set_component(cname,c))),this.util.is_empty(c)&&options.get_default&&(c=this.get_controller().get_component(ctype)),c)},set_component:function(name,ref,validate){if(!this.has_reference(name))return null;if(this.util.is_empty(ref))ref=null;else{var ctype=this.get_reference(name);this.util.is_string(ref,!1)&&(ref=this.get_controller().get_component(ctype,ref)),(!this.util.is_type(ref,ctype)||this.util.is_func(validate)&&!validate.call(this,ref))&&(ref=null)}return this[name]=ref,this[name]},clear_component:function(name){this.set_component(name,null)},init_attributes:function(force){if(this.util.is_bool(force)||(force=!1),force||!this.util.is_obj(this._attributes)){var a=this._attributes={};$.extend(a,this.init_default_attributes()),this.util.is_obj(this._attr_init)&&$.extend(a,this._attr_init),$.extend(a,this.get_dom_attributes())}},init_default_attributes:function(){if(!this._attr_default_parsed&&this.util.is_obj(this._attr_map)){var opts=this.get_controller().get_options(this.util.obj_keys(this._attr_map));if(this.util.is_obj(opts)){for(var opt in this._attr_map)opt in opts&&null!==this._attr_map[opt]&&(opts[this._attr_map[opt]]=opts[opt],delete opts[opt]);$.extend(!0,this._attr_default,opts)}this._attr_default_parsed=!0}return this._attr_default},get_dom_attributes:function(){var attrs={},el=this.dom_get(null,{init:!1});if(0",options.tag),attrs).appendTo(d)).length&&this.util.is_method(options,"success")&&options.success.call(r,r),$(r).append(options.content),$(r)},dom_has:function(){return!!this.dom_get().length},get_data_key:function(){return this.get_ns()},on:function(event,fn,options){if(!this.util.is_string(event)||!this.util.is_func(fn)){var t=this,args=Array.prototype.slice.call(arguments,1);return this.util.is_array(event)?$.each(event,function(idx,val){t.on.apply(t,[val].concat(args))}):this.util.is_obj(event)&&$.each(event,function(ev,hdl){t.on.apply(t,[ev,hdl].concat(args))}),this}this.util.is_obj(options,!1)||(options={}),options=$.extend({},{clear:!1},options),this.util.is_obj(this._events,!1)||(this._events={});var es=this._events;return event in es&&this.util.is_obj(es[event],!1)&&!options.clear||(es[event]=[]),es[event].push(fn),this},trigger:function(event,data){var dfr=$.Deferred(),dfrs=[],t=this;if(this.util.is_array(event))return $.each(event,function(idx,val){dfrs.push(t.trigger(val,data))}),$.when.apply(t,dfrs).done(function(){dfr.resolve()}),dfr.promise();if(!(this.util.is_string(event)&&event in this._events))return dfr.resolve(),dfr.promise();var ev={type:event,data:null};return this.util.is_set(data)&&(ev.data=data),$.each(this._events[event],function(idx,fn){dfrs.push(fn.call(t,ev,t))}),$.when.apply(this,dfrs).done(function(){dfr.resolve()}),dfr.promise()}};View.Component=Component=SLB.Class.extend(Component);var Viewer={_slug:"viewer",_refs:{item:"Content_Item",theme:"Theme"},_reciprocal:!0,_attr_default:{loop:!0,animate:!0,autofit:!0,overlay_enabled:!0,overlay_opacity:"0.8",title_default:!1,container:null,slideshow_enabled:!0,slideshow_autostart:!1,slideshow_duration:2,slideshow_active:!1,slideshow_timer:null,labels:{close:"close",nav_prev:"« prev",nav_next:"next »",slideshow_start:"start slideshow",slideshow_stop:"stop slideshow",group_status:"Image %current% of %total%",loading:"loading"}},_attr_map:{theme:null,group_loop:"loop",ui_autofit:"autofit",ui_animate:"animate",ui_overlay_opacity:"overlay_opacity",ui_labels:"labels",ui_title_default:"title_default",slideshow_enabled:null,slideshow_autostart:null,slideshow_duration:null},item:null,item_queued:null,theme:null,item_working:null,active:!1,init:!1,open:!1,loading:!1,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")}).on(["close","item-change"],function(){t.unload().done(function(){t.unlock()})})},get_item:function(){return this.get_component("item")},set_item:function(item){this.clear_item(!1);var i=this.set_component("item",item,function(item){return item.has_type()});return!this.util.is_empty(i)},clear_item:function(full){this.util.is_bool(full)||(full=!0);var item=this.get_item();item&&item.reset(),full&&this.clear_component("item")},get_theme:function(){var ret=this.get_component("theme",{check_attr:!1});return this.util.is_empty(ret)&&(ret=this.set_component("theme",new View.Theme(this))),ret},set_theme:function(theme){this.set_component("theme",theme)},lock:function(){return this.set_status("item_working",$.Deferred())},get_lock:function(simple,full){this.util.is_bool(simple)||(simple=!1),this.util.is_bool(full)||(full=!1);var s="item_working";if(simple)return this.get_status(s);var r=this.get_status(s,!0);return this.util.is_promise(r)||(r=this.lock()),full?r:r.promise()},is_locked:function(){return this.get_lock(!0)},unlock:function(){return this.get_lock(!1,!0).resolve()},set_active:function(mode){return this.util.is_bool(mode)||(mode=!0),this.set_status("active",mode)},is_active:function(){return this.get_status("active")},set_loading:function(mode){var dfr=$.Deferred();this.util.is_bool(mode)||(mode=!0),this.loading=mode,this.slideshow_active()&&this.slideshow_pause(mode);var m=mode?"addClass":"removeClass";return $(this.dom_get())[m]("loading"),mode?this.get_theme().transition("load").always(function(){dfr.resolve()}):dfr.resolve(),dfr.promise()},unset_loading:function(){return this.set_loading(!1)},get_loading:function(){return!!this.util.is_bool(this.loading)&&this.loading},is_loading:function(){return this.get_loading()},show:function(item){this.item_queued=item;var vt="theme_valid",valid=!0;if(this.has_attribute(vt)?valid=this.get_attribute(vt,!0):(valid=!(!this.get_theme()||""===this.get_theme().get_template().get_layout(!1)),this.set_attribute(vt,valid)),!valid)return this.close(),!1;var v=this,fin=function(){if(v.lock(),v.set_status("show_deferred",!1),!v.set_item(v.item_queued))return v.close(),!1;v.history_add(),v.set_active(),v.render()};this.is_locked()?this.get_status("show_deferred")||(this.set_status("show_deferred"),this.get_lock().always(function(){fin()})):fin()},history_handle:function(e){var state=e.originalEvent.state;if(this.util.is_string(state.item,!1))this.get_controller().get_item(state.item).show({event:e}),this.trigger("item-change");else{var count=this.history_get(!0);this.history_set(0),-1!==count&&this.close()}},history_get:function(full){return this.get_status("history_count",full)},history_set:function(val){return this.set_status("history_count",val)},history_add:function(){if(!history.pushState)return!1;var item=this.get_item(),opts=item.get_attribute("options_show"),count=this.history_get()?this.history_get(!0):0;if(this.util.in_obj(opts,"event")){var e=opts.event.originalEvent;this.util.in_obj(e,"state")&&this.util.in_obj(e.state,"count")&&(count=e.state.count)}else{var state={viewer:this.get_id(),item:null,count:count};count||history.replaceState(state,null),state.item=this.get_controller().save_item(item).get_id(),state.count=++count,history.pushState(state,"")}this.history_set(count)},history_reset:function(){var count=this.history_get(!0);count&&(this.history_set(-1),history.go(-1*count))},is_open:function(){return"none"!==this.dom_get().css("display")},render:function(){var v=this,thm=this.get_theme();v.dom_prep(),this.get_status("render-events")||(this.set_status("render-events"),thm.on("render-loading",function(ev,thm){var dfr=$.Deferred();if(!v.is_active())return dfr.reject(),dfr.promise();var set_pos=function(){v.dom_get().css("top",$(window).scrollTop())},always=function(){v.set_loading().always(function(){dfr.resolve()})};return v.is_open()?thm.transition("unload").fail(function(){set_pos(),thm.dom_get_tag("item","content").attr("style","")}).always(always):thm.transition("open").always(function(){always(),v.events_open(),v.open=!0}).fail(function(){set_pos(),v.get_overlay().show(),v.dom_get().show()}),dfr.promise()}).on("render-complete",function(ev,thm){if(!v.is_active())return!1;var d=v.dom_get(),classes=["item_single","item_multi"],ms=["addClass","removeClass"];v.get_item().get_group().is_single()||ms.reverse(),$.each(ms,function(idx,val){d[val](classes[idx])}),v.events_complete(),thm.transition("complete").fail(function(){if(v.get_attribute("autofit",!0)){var dims=$.extend({display:"inline-block"},thm.get_item_dimensions());thm.dom_get_tag("item","content").css(dims)}}).always(function(){v.unset_loading(),v.trigger("render-complete"),v.init=!0})})),thm.render()},dom_get_container:function(){var sel=this.get_attribute("container");this.util.is_empty(sel)&&(sel="#"+this.add_ns("wrap"));var c=$(sel);if(!c.length){var id=0===sel.indexOf("#")?sel.substr(1):sel;c=$("
",{id:id}).appendTo("body")}return c},dom_init:function(){var d=this.dom_set($("
",{id:this.get_id(!0),class:this.get_ns()})).appendTo(this.dom_get_container()).hide(),thm=this.get_theme();d.addClass(thm.get_classes(" "));var v=this;this.get_status("render-init")||(this.set_status("render-init"),thm.on("render-init",function(ev){v.dom_put("layout",ev.data)})),thm.render(!0)},dom_prep:function(mode){var m=this.util.is_bool(mode)&&!mode?"removeClass":"addClass";$("html")[m](this.util.add_prefix("overlay"))},dom_restore:function(){this.dom_prep(!1)},get_layout:function(){return this.dom_get("layout",{put:{success:function(){$(this).hide()}}})},animation_enabled:function(){return this.get_attribute("animate",!0)},overlay_enabled:function(){var ov=this.get_attribute("overlay_enabled");return!!this.util.is_bool(ov)&&ov},get_overlay:function(){var o=null,v=this;return this.overlay_enabled()&&(o=this.dom_get("overlay",{put:{success:function(){$(this).hide().css("opacity",v.get_attribute("overlay_opacity"))}}})),$(o)},unload:function(){var dfr=$.Deferred();return this.get_theme().dom_get_tag("item").text(""),dfr.resolve(),dfr.promise()},reset:function(){this.dom_get().hide(),this.dom_restore(),this.history_reset(),this.clear_item(),this.set_active(!1),this.set_loading(!1),this.slideshow_stop(),this.keys_disable(),this.unlock()},get_labels:function(){return this.get_attribute("labels",{})},get_label:function(name){var lbls=this.get_labels();return name in lbls?lbls[name]:""},events_open:function(){if(this.keys_enable(),this.open)return!1;var l=this.get_layout();l.children().click(function(ev){ev.stopPropagation()});var v=this,close=function(){v.close()};l.click(close),this.get_overlay().click(close),this.trigger("events-open")},events_complete:function(){if(this.init)return!1;this.trigger("events-complete")},keys_enable:function(mode){this.util.is_bool(mode)||(mode=!0);var e=["keyup",this.util.get_prefix()].join("."),v=this;mode?$(document).on(e,function(ev){return v.keys_control(ev)}):$(document).off(e)},keys_disable:function(){this.keys_enable(!1)},keys_control:function(ev){var handlers={27:this.close,37:this.item_prev,39:this.item_next};if("rtl"===document.documentElement.getAttribute("dir")&&(handlers[37]=this.item_next,handlers[39]=this.item_prev),ev.which in handlers)return handlers[ev.which].call(this),!1},slideshow_enabled:function(){var o=this.get_attribute("slideshow_enabled");return!(!(this.util.is_bool(o)&&o&&this.get_item())||this.get_item().get_group().is_single())},slideshow_active:function(){return!(!this.slideshow_enabled()||!(this.get_attribute("slideshow_active")||!this.init&&this.get_attribute("slideshow_autostart")))},slideshow_clear_timer:function(){clearInterval(this.get_attribute("slideshow_timer"))},slideshow_set_timer:function(callback){this.set_attribute("slideshow_timer",setInterval(callback,1e3*this.get_attribute("slideshow_duration")))},slideshow_start:function(){if(!this.slideshow_enabled())return!1;this.set_attribute("slideshow_active",!0),this.dom_get().addClass("slideshow_active"),this.slideshow_clear_timer();var v=this;this.slideshow_set_timer(function(){v.slideshow_pause(),v.item_next()}),this.trigger("slideshow-start")},slideshow_stop:function(full){this.util.is_bool(full)||(full=!0),full&&(this.set_attribute("slideshow_active",!1),this.dom_get().removeClass("slideshow_active")),this.slideshow_clear_timer(),this.trigger("slideshow-stop")},slideshow_toggle:function(){if(!this.slideshow_enabled())return!1;this.slideshow_active()?this.slideshow_stop():this.slideshow_start(),this.trigger("slideshow-toggle")},slideshow_pause:function(mode){this.util.is_bool(mode)||(mode=!0),this.slideshow_active()&&(mode?this.slideshow_stop(!1):this.slideshow_start()),this.trigger("slideshow-pause")},slideshow_resume:function(){this.slideshow_pause(!1)},item_next:function(){var g=this.get_item().get_group(!0),v=this,ev="item-next",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(e){v.trigger(e.type)})),g.show_next()},item_prev:function(){var g=this.get_item().get_group(!0),v=this,ev="item-prev",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(){v.trigger(ev)})),g.show_prev()},close:function(){this.set_active(!1);var v=this,thm=this.get_theme();return thm.transition("unload").always(function(){thm.transition("close",!0).always(function(){v.reset(),v.trigger("close")})}).fail(function(){thm.dom_get_tag("item","content").attr("style","")}),!1}};View.Viewer=Component.extend(Viewer);var Group={_slug:"group",_reciprocal:!0,_refs:{current:"Content_Item"},current:null,selector:null,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")})},get_selector:function(){return this.util.is_empty(this.selector)&&(this.selector=this.util.format('a[%s="%s"]',this.dom_get_attribute(),this.get_id())),this.selector},get_items:function(){var items=$(this.get_selector());return 0===items.length&&this.has_current()&&(items=this.get_current().dom_get()),items},get_item:function(idx){this.util.is_int(idx)||(idx=0);var items=this.get_items(),max=this.get_size()-1;return maxoffset.width&&(max.width-=offset.width),max.height>offset.height&&(max.height-=offset.height);var factor=Math.min(max.width/dims.width,max.height/dims.height);factor<1&&$.each(dims,function(key){dims[key]=Math.round(dims[key]*factor)})}return $.extend({},dims)},get_dimensions:function(){var dims=this.get_item_dimensions(),offset=this.get_offset();return $.each(dims,function(key){dims[key]+=offset[key]}),dims},get_breakpoints:function(){return this.get_attribute_recursive("breakpoints")},get_breakpoint:function(target){var ret=0;if(this.util.is_string(target)){var b=this.get_attribute_recursive("breakpoints");this.util.is_obj(b)&&target in b&&(ret=b[target])}return ret},render:function(init){var thm=this,tpl=this.get_template(),st="events_render";this.get_status(st)||(this.set_status(st),tpl.on(["render-init","render-loading","render-complete"],function(ev){return thm.trigger(ev.type,ev.data)})),tpl.render(init)},transition:function(event,clear_queue){var dfr=null,attr="transition",v=this.get_viewer(),fx_temp=null,anim_on=v.animation_enabled();if(v.get_attribute(attr,!0)&&this.util.is_string(event)){clear_queue&&v.get_layout().find("*").each(function(){for(var el=$(this);el.queue().length;)el.stop(!1,!0)});var trns,attr_set=[attr,"set"].join("_");if(this.get_attribute(attr_set))trns=this.get_attribute(attr,{});else{var models=this.get_ancestors(!0);trns=[],this.set_attribute(attr_set,!0);var thm=this;$.each(models,function(idx,model){attr in model&&thm.util.is_obj(model[attr])&&trns.push(model[attr])}),trns.push({}),trns=this.set_attribute(attr,$.extend.apply($,trns.reverse()))}this.util.is_method(trns,event)&&(anim_on||(fx_temp=$.fx.off,$.fx.off=!0),dfr=trns[event].call(this,v,$.Deferred()))}return this.util.is_promise(dfr)||(dfr=$.Deferred()).reject(),dfr.always(function(){null!==fx_temp&&($.fx.off=fx_temp)}),dfr.promise()}};View.Theme=Modeled_Component.extend(Theme);var Template={_slug:"template",_reciprocal:!0,_refs:{theme:"Theme"},_attr_default:{layout_uri:"",layout_raw:"",layout_parsed:"",tags:null,model:null},theme:null,_c:function(attributes){this._super("",attributes)},_hooks:function(){this.on("dom_init",function(ev){var tags=this.get_tags(null,null,!0),names=[],t=this;$.each(tags,function(idx,tag){var name=tag.get_name();-1===$.inArray(name,names)&&(names.push(name),tag.get_handler().trigger(ev.type,{template:t}))})})},get_theme:function(){return this.get_component("theme")},render:function(init){var v=this.get_theme().get_viewer();if(this.util.is_bool(init)||(init=!1),init)this.trigger("render-init",this.dom_get());else{if(!v.is_active())return!1;var item=v.get_item();if(!this.util.is_type(item,View.Content_Item))return v.close(),!1;if(v.is_active()&&this.has_tags()){var loading_promise=this.trigger("render-loading"),tpl=this,tags=this.get_tags(),tag_promises=[];$.when(item.load(),loading_promise).done(function(){return!!v.is_active()&&($.each(tags,function(idx,tag){if(!v.is_active())return!1;tag_promises.push(tag.render(item).done(function(r){if(!v.is_active())return!1;r.tag.dom_get().html(r.output)}))}),!!v.is_active()&&void $.when.apply($,tag_promises).done(function(){tpl.trigger("render-complete")}))})}}},get_layout:function(parsed){return this.util.is_bool(parsed)||(parsed=!0),parsed?this.parse_layout():this.get_attribute("layout_raw","")},parse_layout:function(){var a="layout_parsed",ret=this.get_attribute(a);return this.util.is_string(ret)||(ret=this.sanitize_layout(this.get_layout(!1)),ret=this.parse_tags(ret),this.set_attribute(a,ret)),ret},sanitize_layout:function(l){if(this.util.is_empty(l))return l;var rtype=this.util.is_string(l)?"string":null,dom=$(l),tag_temp=this.get_tag_temp(),cls=tag_temp.get_class(),cls_new=["x",cls].join("_");switch($(tag_temp.get_selector(),dom).each(function(){$(this).removeClass(cls).addClass(cls_new)}),rtype){case"string":l=dom=dom.wrap("
").parent().html();break;default:l=dom}return l},parse_tags:function(l){if(!this.util.is_string(l))return"";for(var match,re=/\{{2}\s*(\w.*?)\s*\}{2}/gim;match=re.exec(l);)l=l.substring(0,match.index)+this.get_tag_container(match[1])+l.substring(match.index+match[0].length);return l},get_tag_container:function(tag){var attr=this.get_tag_attribute();return this.util.format('',attr,encodeURI(tag))},get_tag_attribute:function(){return this.get_tag_temp().dom_get_attribute()},get_tag:function(idx){var ret=null;if(this.has_tags()){var tags=this.get_tags();(!this.util.is_int(idx)||idx<0||idx>=tags.length)&&(idx=0),ret=tags[idx]}return ret},get_tags:function(name,prop,isolate){this.util.is_bool(isolate)||(isolate=!1);var a="tags",tags=this.get_attribute(a);if(!this.util.is_array(tags)){tags=[];var d=this.dom_get(),attr=this.get_tag_attribute(),nodes=$(d).find("["+attr+"]");$(nodes).each(function(){var el=$(this),tag=new View.Template_Tag(decodeURI(el.attr(attr)));tag.has_handler()&&(tags.push(tag),isolate||(tag.dom_set(el),el.addClass(tag.get_classes(" ")))),isolate||el.removeAttr(attr)}),isolate||this.set_attribute(a,tags,!1)}if(!this.util.is_empty(tags)&&this.util.is_string(name)){this.util.is_string(prop)||(prop=!1);for(var tags_filtered=[],tc=null,x=0;x Date: Thu, 1 Aug 2019 16:00:03 -1000 Subject: [PATCH 05/59] Compat: Update PHP version required (5.6.20) Match with [WordPress' minimum PHP requirement](https://wordpress.org/about/requirements/). --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index da409d8..e393beb 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ License: GPLv2 Tags: lightbox, gallery, photography, images, theme, template, style Requires at least: 5.0 Tested up to: 5.1 -Requires PHP: 5.4 +Requires PHP: 5.6.20 Stable tag: trunk The highly customizable lightbox for WordPress From 5769dc07a5dbf9c148fd6fab2f33e12acc02fbce Mon Sep 17 00:00:00 2001 From: Archetyped Date: Fri, 2 Aug 2019 15:34:41 -1000 Subject: [PATCH 06/59] Meta: Update dev dependencies, Grunt tasks. --- grunt/phplint.js | 2 +- grunt/sass.js | 3 + package-lock.json | 2349 ++++++++++++++++++++++----------------------- package.json | 11 +- 4 files changed, 1173 insertions(+), 1192 deletions(-) diff --git a/grunt/phplint.js b/grunt/phplint.js index d1f095a..8769c37 100644 --- a/grunt/phplint.js +++ b/grunt/phplint.js @@ -3,7 +3,7 @@ module.exports = function(grunt) { grunt.config('phplint', { options : { phpArgs : { - '-lf': null + '-f': null } }, all : { diff --git a/grunt/sass.js b/grunt/sass.js index 884181e..20bd7ea 100644 --- a/grunt/sass.js +++ b/grunt/sass.js @@ -1,7 +1,10 @@ module.exports = function(grunt) { +const sass = require('node-sass'); + grunt.config('sass', { options : { + implementation: sass, outputStyle : 'compressed', }, core : { diff --git a/package-lock.json b/package-lock.json index f0e8af6..b0b5096 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,12 +4,30 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", @@ -23,10 +41,13 @@ "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "aproba": { "version": "1.2.0", @@ -35,13 +56,13 @@ "dev": true }, "are-we-there-yet": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", - "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.6" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" }, "dependencies": { "isarray": { @@ -56,22 +77,28 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -82,13 +109,21 @@ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "sprintf-js": "1.0.3" + "sprintf-js": "~1.0.2" + }, + "dependencies": { + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + } } }, "array-differ": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", - "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", "dev": true }, "array-find-index": { @@ -98,36 +133,30 @@ "dev": true }, "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "1.0.3" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", "dev": true }, "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } }, "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, "async": { @@ -149,15 +178,15 @@ "dev": true }, "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", "dev": true }, "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", "dev": true }, "balanced-match": { @@ -167,13 +196,12 @@ "dev": true }, "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, - "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "beeper": { @@ -188,48 +216,19 @@ "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, "requires": { - "inherits": "2.0.3" - } - }, - "body-parser": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.14.2.tgz", - "integrity": "sha1-EBXLH+LEQ4WCWVgdtTMy+NDPUPk=", - "dev": true, - "requires": { - "bytes": "2.2.0", - "content-type": "1.0.4", - "debug": "2.2.0", - "depd": "1.1.2", - "http-errors": "1.3.1", - "iconv-lite": "0.4.13", - "on-finished": "2.3.0", - "qs": "5.2.0", - "raw-body": "2.1.7", - "type-is": "1.6.16" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.13", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz", - "integrity": "sha1-H4irpKsLFQjoMSrMOTRfNumS4vI=", - "dev": true - }, - "qs": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-5.2.0.tgz", - "integrity": "sha1-qfMRQq9GjLcrJbMBNrokVoNJFr4=", - "dev": true - } + "inherits": "~2.0.0" } }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "body": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/body/-/body-5.1.0.tgz", + "integrity": "sha1-5LoM5BCkaTYyM2dgnstOZVMSUGk=", "dev": true, "requires": { - "hoek": "2.16.3" + "continuable-cache": "^0.3.1", + "error": "^7.0.0", + "raw-body": "~1.1.0", + "safe-json-parse": "~1.0.1" } }, "brace-expansion": { @@ -238,35 +237,14 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, - "browserify-zlib": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", - "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", - "dev": true, - "requires": { - "pako": "0.2.9" - } - }, - "buffer-from": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", - "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, "bytes": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-2.2.0.tgz", - "integrity": "sha1-/TVGSkA/b5EXwt42Cez/nK4ABYg=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz", + "integrity": "sha1-NWnt6Lo0MV+rmcPpLLBMciDeH6g=", "dev": true }, "cache-swap": { @@ -275,21 +253,10 @@ "integrity": "sha1-HFQaoQilAQb2ML3Zj+HeyLoTP1E=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", - "rimraf": "2.6.2" - }, - "dependencies": { - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "7.0.6" - } - } + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.1", + "object-assign": "^4.0.1", + "rimraf": "^2.4.0" } }, "camelcase": { @@ -304,27 +271,25 @@ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" } }, "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "cli": { @@ -334,21 +299,21 @@ "dev": true, "requires": { "exit": "0.1.2", - "glob": "7.1.2" + "glob": "^7.1.1" }, "dependencies": { "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } @@ -359,9 +324,9 @@ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" } }, "code-point-at": { @@ -376,6 +341,21 @@ "integrity": "sha1-56qDAZF+9iGzXYo580jc3R234z4=", "dev": true }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", @@ -383,18 +363,18 @@ "dev": true }, "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true }, "concat-map": { @@ -403,57 +383,13 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "1.0.0", - "inherits": "2.0.3", - "readable-stream": "2.3.6", - "typedarray": "0.0.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "5.1.2" - } - } - } - }, "console-browserify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", "dev": true, "requires": { - "date-now": "0.1.4" + "date-now": "^0.1.4" } }, "console-control-strings": { @@ -462,10 +398,10 @@ "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "continuable-cache": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/continuable-cache/-/continuable-cache-0.3.1.tgz", + "integrity": "sha1-vXJ6f67XfnH/OYWskzUakSczrQ8=", "dev": true }, "core-util-is": { @@ -480,38 +416,29 @@ "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", "dev": true, "requires": { - "lru-cache": "4.1.2", - "which": "1.2.14" + "lru-cache": "^4.0.1", + "which": "^1.2.9" }, "dependencies": { "lru-cache": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", - "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } } } }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, - "requires": { - "boom": "2.10.1" - } - }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "array-find-index": "1.0.2" + "array-find-index": "^1.0.1" } }, "dashdash": { @@ -520,15 +447,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "assert-plus": "^1.0.0" } }, "date-now": { @@ -543,7 +462,7 @@ "integrity": "sha1-GIdtC9pMGf5w3Tv0sDTygbEqQLY=", "dev": true, "requires": { - "time-zone": "0.1.0" + "time-zone": "^0.1.0" } }, "dateformat": { @@ -552,17 +471,17 @@ "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", "dev": true, "requires": { - "get-stdin": "4.0.1", - "meow": "3.7.0" + "get-stdin": "^4.0.1", + "meow": "^3.3.0" } }, "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "requires": { - "ms": "0.7.1" + "ms": "^2.1.1" } }, "decamelize": { @@ -583,40 +502,34 @@ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, "dom-serializer": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.1.tgz", + "integrity": "sha512-sK3ujri04WyjwQXVoK4PU3y8ula1stq10GJZpqHIUgoGZdsGzAGu65BnU3d08aTVSvO7mGPZUc0wTEDL+qGE0Q==", "dev": true, "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" + "domelementtype": "^2.0.1", + "entities": "^2.0.0" }, "dependencies": { "domelementtype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", + "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==", "dev": true }, "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", + "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==", "dev": true } } }, "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", "dev": true }, "domhandler": { @@ -625,7 +538,7 @@ "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", "dev": true, "requires": { - "domelementtype": "1.3.0" + "domelementtype": "1" } }, "domutils": { @@ -634,49 +547,49 @@ "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", "dev": true, "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" + "dom-serializer": "0", + "domelementtype": "1" } }, - "each-async": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz", - "integrity": "sha1-3uUim98KtrogEqOV4bhpq/iBNHM=", - "dev": true, - "requires": { - "onetime": "1.1.0", - "set-immediate-shim": "1.0.1" - } + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true }, "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, - "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true - }, "entities": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", "dev": true }, + "error": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/error/-/error-7.0.2.tgz", + "integrity": "sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI=", + "dev": true, + "requires": { + "string-template": "~0.2.1", + "xtend": "~4.0.0" + } + }, "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "requires": { - "is-arrayish": "0.2.1" + "is-arrayish": "^0.2.1" } }, "escape-string-regexp": { @@ -686,9 +599,9 @@ "dev": true }, "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "eventemitter2": { @@ -704,9 +617,9 @@ "dev": true }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "extsprintf": { @@ -715,13 +628,25 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, "faye-websocket": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", "dev": true, "requires": { - "websocket-driver": "0.7.0" + "websocket-driver": ">=0.5.1" } }, "figures": { @@ -730,8 +655,8 @@ "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", "dev": true, "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" } }, "find-up": { @@ -740,8 +665,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, "findup-sync": { @@ -750,7 +675,7 @@ "integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=", "dev": true, "requires": { - "glob": "5.0.15" + "glob": "~5.0.0" }, "dependencies": { "glob": { @@ -759,11 +684,11 @@ "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", "dev": true, "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } @@ -775,14 +700,14 @@ "dev": true }, "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.6", - "mime-types": "2.1.18" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" } }, "fs.realpath": { @@ -792,15 +717,15 @@ "dev": true }, "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.2.8" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, "gauge": { @@ -809,44 +734,29 @@ "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "gaze": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.2.tgz", - "integrity": "sha1-hHIkZ3rbiHDWeSV+0ziP22HkAQU=", - "dev": true, - "requires": { - "globule": "1.2.0" - } - }, - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", "dev": true, "requires": { - "is-property": "1.0.2" + "globule": "^1.0.0" } }, "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, "get-stdin": { @@ -867,15 +777,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "assert-plus": "^1.0.0" } }, "glob": { @@ -884,69 +786,70 @@ "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "globule": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.0.tgz", - "integrity": "sha1-HcScaCLdnoovoAuiopUAboZkvQk=", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", + "integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", "dev": true, "requires": { - "glob": "7.1.2", - "lodash": "4.17.10", - "minimatch": "3.0.4" + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" }, "dependencies": { "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } }, "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", + "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==", "dev": true }, "grunt": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.2.tgz", - "integrity": "sha1-TmpeaVtwRy/VME9fqeNCNoNqc7w=", - "dev": true, - "requires": { - "coffeescript": "1.10.0", - "dateformat": "1.0.12", - "eventemitter2": "0.4.14", - "exit": "0.1.2", - "findup-sync": "0.3.0", - "glob": "7.0.6", - "grunt-cli": "1.2.0", - "grunt-known-options": "1.1.0", - "grunt-legacy-log": "1.0.2", - "grunt-legacy-util": "1.0.0", - "iconv-lite": "0.4.21", - "js-yaml": "3.5.5", - "minimatch": "3.0.4", - "nopt": "3.0.6", - "path-is-absolute": "1.0.1", - "rimraf": "2.2.8" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.4.tgz", + "integrity": "sha512-PYsMOrOC+MsdGEkFVwMaMyc6Ob7pKmq+deg1Sjr+vvMWp35sztfwKE7qoN51V+UEtHsyNuMcGdgMLFkBHvMxHQ==", + "dev": true, + "requires": { + "coffeescript": "~1.10.0", + "dateformat": "~1.0.12", + "eventemitter2": "~0.4.13", + "exit": "~0.1.1", + "findup-sync": "~0.3.0", + "glob": "~7.0.0", + "grunt-cli": "~1.2.0", + "grunt-known-options": "~1.1.0", + "grunt-legacy-log": "~2.0.0", + "grunt-legacy-util": "~1.1.1", + "iconv-lite": "~0.4.13", + "js-yaml": "~3.13.0", + "minimatch": "~3.0.2", + "mkdirp": "~0.5.1", + "nopt": "~3.0.6", + "path-is-absolute": "~1.0.0", + "rimraf": "~2.6.2" }, "dependencies": { "grunt-cli": { @@ -955,106 +858,107 @@ "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", "dev": true, "requires": { - "findup-sync": "0.3.0", - "grunt-known-options": "1.1.0", - "nopt": "3.0.6", - "resolve": "1.1.7" + "findup-sync": "~0.3.0", + "grunt-known-options": "~1.1.0", + "nopt": "~3.0.6", + "resolve": "~1.1.0" } + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true } } }, "grunt-contrib-jshint": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-1.1.0.tgz", - "integrity": "sha1-Np2QmyWTxA6L55lAshNAhQx5Oaw=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-2.1.0.tgz", + "integrity": "sha512-65S2/C/6RfjY/umTxfwXXn+wVvaYmykHkHSsW6Q6rhkbv3oudTEgqnFFZvWzWCoHUb+3GMZLbP3oSrNyvshmIQ==", "dev": true, "requires": { - "chalk": "1.1.3", - "hooker": "0.2.3", - "jshint": "2.9.5" + "chalk": "^2.4.2", + "hooker": "^0.2.3", + "jshint": "~2.10.2" } }, "grunt-contrib-uglify": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-3.3.0.tgz", - "integrity": "sha512-W9O7lJE3PlD8VCc5fyaf98QV7f5wEDiU4PBIh0+/6UBbk2LhgzEFS0/p+taH5UD3+PlEn7QPN0o06Z0To6SqXw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-4.0.1.tgz", + "integrity": "sha512-dwf8/+4uW1+7pH72WButOEnzErPGmtUvc8p08B0eQS/6ON0WdeQu0+WFeafaPTbbY1GqtS25lsHWaDeiTQNWPg==", "dev": true, "requires": { - "chalk": "1.1.3", - "maxmin": "1.1.0", - "uglify-js": "3.3.22", - "uri-path": "1.0.0" + "chalk": "^2.4.1", + "maxmin": "^2.1.0", + "uglify-js": "^3.5.0", + "uri-path": "^1.0.0" } }, "grunt-contrib-watch": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-1.0.1.tgz", - "integrity": "sha512-8Zka/svGl6+ZwF7d6z/CfXwsb4cDODnajmZsY4nUAs9Ob0kJEcsLiDf5qm2HdDoEcm3NHjWCrFiWx+PZ2y4D7A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-1.1.0.tgz", + "integrity": "sha512-yGweN+0DW5yM+oo58fRu/XIRrPcn3r4tQx+nL7eMRwjpvk+rQY6R8o94BPK0i2UhTg9FN21hS+m8vR8v9vXfeg==", "dev": true, "requires": { - "async": "1.5.2", - "gaze": "1.1.2", - "lodash": "4.17.10", - "tiny-lr": "0.2.1" + "async": "^2.6.0", + "gaze": "^1.1.0", + "lodash": "^4.17.10", + "tiny-lr": "^1.1.1" + }, + "dependencies": { + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + } } }, "grunt-known-options": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.0.tgz", - "integrity": "sha1-pCdO6zL6dl2lp6OxcSYXzjsUQUk=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz", + "integrity": "sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ==", "dev": true }, "grunt-legacy-log": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-1.0.2.tgz", - "integrity": "sha512-WdedTJ/6zCXnI/coaouzqvkI19uwqbcPkdsXiDRKJyB5rOUlOxnCnTVbpeUdEckKVir2uHF3rDBYppj2p6N3+g==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-2.0.0.tgz", + "integrity": "sha512-1m3+5QvDYfR1ltr8hjiaiNjddxGdQWcH0rw1iKKiQnF0+xtgTazirSTGu68RchPyh1OBng1bBUjLmX8q9NpoCw==", "dev": true, "requires": { - "colors": "1.1.2", - "grunt-legacy-log-utils": "1.0.0", - "hooker": "0.2.3", - "lodash": "4.17.10" + "colors": "~1.1.2", + "grunt-legacy-log-utils": "~2.0.0", + "hooker": "~0.2.3", + "lodash": "~4.17.5" } }, "grunt-legacy-log-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-1.0.0.tgz", - "integrity": "sha1-p7ji0Ps1taUPSvmG/BEnSevJbz0=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.0.1.tgz", + "integrity": "sha512-o7uHyO/J+i2tXG8r2bZNlVk20vlIFJ9IEYyHMCQGfWYru8Jv3wTqKZzvV30YW9rWEjq0eP3cflQ1qWojIe9VFA==", "dev": true, "requires": { - "chalk": "1.1.3", - "lodash": "4.3.0" - }, - "dependencies": { - "lodash": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz", - "integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=", - "dev": true - } + "chalk": "~2.4.1", + "lodash": "~4.17.10" } }, "grunt-legacy-util": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.0.0.tgz", - "integrity": "sha1-OGqnjcbtUJhsKxiVcmWxtIq7m4Y=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.1.1.tgz", + "integrity": "sha512-9zyA29w/fBe6BIfjGENndwoe1Uy31BIXxTH3s8mga0Z5Bz2Sp4UCjkeyv2tI449ymkx3x26B+46FV4fXEddl5A==", "dev": true, "requires": { - "async": "1.5.2", - "exit": "0.1.2", - "getobject": "0.1.0", - "hooker": "0.2.3", - "lodash": "4.3.0", - "underscore.string": "3.2.3", - "which": "1.2.14" - }, - "dependencies": { - "lodash": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz", - "integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=", - "dev": true - } + "async": "~1.5.2", + "exit": "~0.1.1", + "getobject": "~0.1.0", + "hooker": "~0.2.3", + "lodash": "~4.17.10", + "underscore.string": "~3.3.4", + "which": "~1.3.0" } }, "grunt-phplint": { @@ -1063,8 +967,8 @@ "integrity": "sha1-bb4uauxTqiKc+sCtmnyZ4kGEhI0=", "dev": true, "requires": { - "cache-swap": "0.3.0", - "grunt": "0.4.5" + "cache-swap": "~0.3.0", + "grunt": "~0.4.1" }, "dependencies": { "argparse": { @@ -1073,8 +977,8 @@ "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", "dev": true, "requires": { - "underscore": "1.7.0", - "underscore.string": "2.4.0" + "underscore": "~1.7.0", + "underscore.string": "~2.4.0" }, "dependencies": { "underscore.string": { @@ -1121,8 +1025,8 @@ "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", "dev": true, "requires": { - "glob": "3.2.11", - "lodash": "2.4.2" + "glob": "~3.2.9", + "lodash": "~2.4.1" }, "dependencies": { "glob": { @@ -1131,8 +1035,8 @@ "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", "dev": true, "requires": { - "inherits": "2.0.3", - "minimatch": "0.3.0" + "inherits": "2", + "minimatch": "0.3" } }, "lodash": { @@ -1147,8 +1051,8 @@ "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", "dev": true, "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" + "lru-cache": "2", + "sigmund": "~1.0.0" } } } @@ -1159,9 +1063,9 @@ "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", "dev": true, "requires": { - "graceful-fs": "1.2.3", - "inherits": "1.0.2", - "minimatch": "0.2.14" + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" }, "dependencies": { "inherits": { @@ -1184,26 +1088,26 @@ "integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=", "dev": true, "requires": { - "async": "0.1.22", - "coffee-script": "1.3.3", - "colors": "0.6.2", + "async": "~0.1.22", + "coffee-script": "~1.3.3", + "colors": "~0.6.2", "dateformat": "1.0.2-1.2.3", - "eventemitter2": "0.4.14", - "exit": "0.1.2", - "findup-sync": "0.1.3", - "getobject": "0.1.0", - "glob": "3.1.21", - "grunt-legacy-log": "0.1.3", - "grunt-legacy-util": "0.2.0", - "hooker": "0.2.3", - "iconv-lite": "0.2.11", - "js-yaml": "2.0.5", - "lodash": "0.9.2", - "minimatch": "0.2.14", - "nopt": "1.0.10", - "rimraf": "2.2.8", - "underscore.string": "2.2.1", - "which": "1.0.9" + "eventemitter2": "~0.4.13", + "exit": "~0.1.1", + "findup-sync": "~0.1.2", + "getobject": "~0.1.0", + "glob": "~3.1.21", + "grunt-legacy-log": "~0.1.0", + "grunt-legacy-util": "~0.2.0", + "hooker": "~0.2.3", + "iconv-lite": "~0.2.11", + "js-yaml": "~2.0.5", + "lodash": "~0.9.2", + "minimatch": "~0.2.12", + "nopt": "~1.0.10", + "rimraf": "~2.2.8", + "underscore.string": "~2.2.1", + "which": "~1.0.5" } }, "grunt-legacy-log": { @@ -1212,11 +1116,11 @@ "integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=", "dev": true, "requires": { - "colors": "0.6.2", - "grunt-legacy-log-utils": "0.1.1", - "hooker": "0.2.3", - "lodash": "2.4.2", - "underscore.string": "2.3.3" + "colors": "~0.6.2", + "grunt-legacy-log-utils": "~0.1.1", + "hooker": "~0.2.3", + "lodash": "~2.4.1", + "underscore.string": "~2.3.3" }, "dependencies": { "lodash": { @@ -1239,9 +1143,9 @@ "integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=", "dev": true, "requires": { - "colors": "0.6.2", - "lodash": "2.4.2", - "underscore.string": "2.3.3" + "colors": "~0.6.2", + "lodash": "~2.4.1", + "underscore.string": "~2.3.3" }, "dependencies": { "lodash": { @@ -1264,13 +1168,13 @@ "integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=", "dev": true, "requires": { - "async": "0.1.22", - "exit": "0.1.2", - "getobject": "0.1.0", - "hooker": "0.2.3", - "lodash": "0.9.2", - "underscore.string": "2.2.1", - "which": "1.0.9" + "async": "~0.1.22", + "exit": "~0.1.1", + "getobject": "~0.1.0", + "hooker": "~0.2.3", + "lodash": "~0.9.2", + "underscore.string": "~2.2.1", + "which": "~1.0.5" } }, "iconv-lite": { @@ -1285,8 +1189,8 @@ "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", "dev": true, "requires": { - "argparse": "0.1.16", - "esprima": "1.0.4" + "argparse": "~ 0.1.11", + "esprima": "~ 1.0.2" } }, "lodash": { @@ -1301,8 +1205,8 @@ "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", "dev": true, "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" + "lru-cache": "2", + "sigmund": "~1.0.0" } }, "nopt": { @@ -1311,9 +1215,15 @@ "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", "dev": true, "requires": { - "abbrev": "1.1.1" + "abbrev": "1" } }, + "rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "dev": true + }, "underscore.string": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", @@ -1329,36 +1239,34 @@ } }, "grunt-sass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/grunt-sass/-/grunt-sass-2.1.0.tgz", - "integrity": "sha512-XkexnQt/9rhReNd+Y7T0n/2g5FqYOQKfi2iSlpwDqvgs7EgEaGTxNhnWzHnbW5oNRvzL9AHopBG3AgRxL0d+DA==", - "dev": true, - "requires": { - "each-async": "1.1.1", - "node-sass": "4.9.0", - "object-assign": "4.1.1" - } + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/grunt-sass/-/grunt-sass-3.0.2.tgz", + "integrity": "sha512-Ogq4cWqBre71gZIkgxIxevgzZHSIIsrKu/5yvPDl4Mvib0A4TRTJEQUdpQ0YV1iai0DPjayz02vDJE6KUVHQ2w==", + "dev": true }, "gzip-size": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-1.0.0.tgz", - "integrity": "sha1-Zs+LEBBHInuVus5uodoMF37Vwi8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz", + "integrity": "sha1-VGGI6b3DN/Zzdy+BZgRks4nc5SA=", "dev": true, "requires": { - "browserify-zlib": "0.1.4", - "concat-stream": "1.6.2" + "duplexer": "^0.1.1" } }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "dev": true, "requires": { - "chalk": "1.1.3", - "commander": "2.15.1", - "is-my-json-valid": "2.17.2", - "pinkie-promise": "2.0.1" + "ajv": "^6.5.5", + "har-schema": "^2.0.0" } }, "has-ansi": { @@ -1367,33 +1275,21 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "dev": true, - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true - }, "hooker": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", @@ -1401,9 +1297,9 @@ "dev": true }, "hosted-git-info": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.0.tgz", - "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, "htmlparser2": { @@ -1412,47 +1308,37 @@ "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", "dev": true, "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.3.0", - "domutils": "1.5.1", - "entities": "1.0.0", - "readable-stream": "1.1.14" - } - }, - "http-errors": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.3.1.tgz", - "integrity": "sha1-GX4izevUGYWF6GlO9nhhl7ke2UI=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "statuses": "1.5.0" + "domelementtype": "1", + "domhandler": "2.3", + "domutils": "1.5", + "entities": "1.0", + "readable-stream": "1.1" } }, "http-parser-js": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.12.tgz", - "integrity": "sha1-uc+/Sizybw/DSxDKFImid3HjR08=", + "version": "0.4.10", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz", + "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=", "dev": true }, "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.1", - "sshpk": "1.14.1" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "iconv-lite": { - "version": "0.4.21", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", - "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": ">= 2.1.2 < 3" } }, "in-publish": { @@ -1467,7 +1353,7 @@ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", "dev": true, "requires": { - "repeating": "2.0.1" + "repeating": "^2.0.0" } }, "inflight": { @@ -1476,14 +1362,14 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "invert-kv": { @@ -1504,22 +1390,13 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "1.1.1" - } - }, "is-finite": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-fullwidth-code-point": { @@ -1528,38 +1405,13 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, - "is-my-ip-valid": { + "is-typedarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", - "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", - "dev": true - }, - "is-my-json-valid": { - "version": "2.17.2", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", - "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", - "dev": true, - "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "is-my-ip-valid": "1.0.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" - } - }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, "is-utf8": { @@ -1587,50 +1439,41 @@ "dev": true }, "js-base64": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.3.tgz", - "integrity": "sha512-H7ErYLM34CvDMto3GbD6xD0JLUGYXR3QTcH6B/tr4Hi/QpSThnCsIp+Sy5FRTw3B0d6py4HcNkW7nO/wdtGWEw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz", + "integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==", "dev": true }, "js-yaml": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", - "integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { - "argparse": "1.0.10", - "esprima": "2.7.3" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true + "dev": true }, "jshint": { - "version": "2.9.5", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.5.tgz", - "integrity": "sha1-HnJSkVzmgbQIJ+4UJIxG006apiw=", + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.10.2.tgz", + "integrity": "sha512-e7KZgCSXMJxznE/4WULzybCMNXNAd/bf5TSrvVEq78Q/K8ZwFpmBqQeDtNiHc3l49nV4E/+YeHU/JZjSUIrLAA==", "dev": true, "requires": { - "cli": "1.0.1", - "console-browserify": "1.1.0", - "exit": "0.1.2", - "htmlparser2": "3.8.3", - "lodash": "3.7.0", - "minimatch": "3.0.4", - "shelljs": "0.3.0", - "strip-json-comments": "1.0.4" - }, - "dependencies": { - "lodash": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.7.0.tgz", - "integrity": "sha1-Nni9irmVBXwHreg27S7wh9qBHUU=", - "dev": true - } + "cli": "~1.0.0", + "console-browserify": "1.1.x", + "exit": "0.1.x", + "htmlparser2": "3.8.x", + "lodash": "~4.17.11", + "minimatch": "~3.0.2", + "shelljs": "0.3.x", + "strip-json-comments": "1.0.x" } }, "jshint-stylish": { @@ -1639,12 +1482,39 @@ "integrity": "sha1-JCCCosA1rgP9gQROBXDMQgjPbmE=", "dev": true, "requires": { - "beeper": "1.1.1", - "chalk": "1.1.3", - "log-symbols": "1.0.2", - "plur": "2.1.2", - "string-length": "1.0.1", - "text-table": "0.2.0" + "beeper": "^1.1.0", + "chalk": "^1.0.0", + "log-symbols": "^1.0.0", + "plur": "^2.1.0", + "string-length": "^1.0.0", + "text-table": "^0.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } } }, "json-schema": { @@ -1653,18 +1523,18 @@ "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", "dev": true }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", - "dev": true - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -1675,14 +1545,6 @@ "extsprintf": "1.3.0", "json-schema": "0.2.3", "verror": "1.10.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } } }, "lcid": { @@ -1691,25 +1553,25 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { - "invert-kv": "1.0.0" + "invert-kv": "^1.0.0" } }, "livereload-js": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-2.3.0.tgz", - "integrity": "sha512-j1R0/FeGa64Y+NmqfZhyoVRzcFlOZ8sNlKzHjh4VvLULFACZhn68XrX5DFg2FhMvSMJmROuFxRSa560ECWKBMg==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-2.4.0.tgz", + "integrity": "sha512-XPQH8Z2GDP/Hwz2PCDrh2mth4yFejwA1OZ/81Ti3LgKyhDcEjsSsqFWZojHG0va/duGd+WyosY7eXLDoOyqcPw==", "dev": true }, "load-grunt-tasks": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/load-grunt-tasks/-/load-grunt-tasks-3.5.2.tgz", - "integrity": "sha1-ByhWEYD9IP+KaSdQWFL8WKrqDIg=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/load-grunt-tasks/-/load-grunt-tasks-5.1.0.tgz", + "integrity": "sha512-oNj0Jlka1TsfDe+9He0kcA1cRln+TMoTsEByW7ij6kyktNLxBKJtslCFEvFrLC2Dj0S19IWJh3fOCIjLby2Xrg==", "dev": true, "requires": { - "arrify": "1.0.1", - "multimatch": "2.1.0", - "pkg-up": "1.0.0", - "resolve-pkg": "0.1.0" + "arrify": "^2.0.1", + "multimatch": "^4.0.0", + "pkg-up": "^3.1.0", + "resolve-pkg": "^2.0.0" } }, "load-json-file": { @@ -1718,35 +1580,35 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" } }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, - "lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", - "dev": true - }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } }, - "lodash.mergewith": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", - "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, "log-symbols": { @@ -1755,7 +1617,34 @@ "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", "dev": true, "requires": { - "chalk": "1.1.3" + "chalk": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } } }, "loud-rejection": { @@ -1764,8 +1653,8 @@ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { - "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" } }, "lru-cache": { @@ -1781,54 +1670,75 @@ "dev": true }, "maxmin": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/maxmin/-/maxmin-1.1.0.tgz", - "integrity": "sha1-cTZehKmd2Piz99X94vANHn9zvmE=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/maxmin/-/maxmin-2.1.0.tgz", + "integrity": "sha1-TTsiCQPZXu5+t6x/qGTnLcCaMWY=", "dev": true, "requires": { - "chalk": "1.1.3", - "figures": "1.7.0", - "gzip-size": "1.0.0", - "pretty-bytes": "1.0.4" + "chalk": "^1.0.0", + "figures": "^1.0.1", + "gzip-size": "^3.0.0", + "pretty-bytes": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } } }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "dev": true - }, "meow": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", - "loud-rejection": "1.6.0", - "map-obj": "1.0.1", - "minimist": "1.2.0", - "normalize-package-data": "2.4.0", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" } }, "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", "dev": true }, "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "version": "2.1.24", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", + "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", "dev": true, "requires": { - "mime-db": "1.33.0" + "mime-db": "1.40.0" } }, "minimatch": { @@ -1837,7 +1747,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -1864,48 +1774,48 @@ } }, "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "multimatch": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz", - "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", "dev": true, "requires": { - "array-differ": "1.0.0", - "array-union": "1.0.2", - "arrify": "1.0.1", - "minimatch": "3.0.4" + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" } }, "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", "dev": true }, "node-gyp": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.6.2.tgz", - "integrity": "sha1-m/vlRWIoYoSDjnUOrAUpWFP6HGA=", - "dev": true, - "requires": { - "fstream": "1.0.11", - "glob": "7.0.6", - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "npmlog": "4.1.2", - "osenv": "0.1.5", - "request": "2.79.0", - "rimraf": "2.2.8", - "semver": "5.3.0", - "tar": "2.2.1", - "which": "1.2.14" + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", + "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", + "dev": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" }, "dependencies": { "semver": { @@ -1917,30 +1827,55 @@ } }, "node-sass": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.9.0.tgz", - "integrity": "sha512-QFHfrZl6lqRU3csypwviz2XLgGNOoWQbo2GOvtsfQqOfL4cy1BtWnhx/XUeAO9LT3ahBzSRXcEO6DdvAH9DzSg==", - "dev": true, - "requires": { - "async-foreach": "0.1.3", - "chalk": "1.1.3", - "cross-spawn": "3.0.1", - "gaze": "1.1.2", - "get-stdin": "4.0.1", - "glob": "7.0.6", - "in-publish": "2.0.0", - "lodash.assign": "4.2.0", - "lodash.clonedeep": "4.5.0", - "lodash.mergewith": "4.6.1", - "meow": "3.7.0", - "mkdirp": "0.5.1", - "nan": "2.10.0", - "node-gyp": "3.6.2", - "npmlog": "4.1.2", - "request": "2.79.0", - "sass-graph": "2.2.4", - "stdout-stream": "1.4.0", - "true-case-path": "1.0.2" + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.12.0.tgz", + "integrity": "sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ==", + "dev": true, + "requires": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash": "^4.17.11", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.13.2", + "node-gyp": "^3.8.0", + "npmlog": "^4.0.0", + "request": "^2.88.0", + "sass-graph": "^2.2.4", + "stdout-stream": "^1.4.0", + "true-case-path": "^1.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } } }, "nopt": { @@ -1949,19 +1884,19 @@ "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", "dev": true, "requires": { - "abbrev": "1.1.1" + "abbrev": "1" } }, "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "requires": { - "hosted-git-info": "2.6.0", - "is-builtin-module": "1.0.0", - "semver": "5.5.0", - "validate-npm-package-license": "3.0.3" + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" } }, "npmlog": { @@ -1970,10 +1905,10 @@ "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "number-is-nan": { @@ -1983,9 +1918,9 @@ "dev": true }, "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", "dev": true }, "object-assign": { @@ -1994,30 +1929,15 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, - "onetime": { - "version": "1.1.0", - "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", - "dev": true - }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -2030,7 +1950,7 @@ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { - "lcid": "1.0.0" + "lcid": "^1.0.0" } }, "os-tmpdir": { @@ -2045,14 +1965,32 @@ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, - "pako": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", + "p-limit": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", + "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, "parse-json": { @@ -2061,7 +1999,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.2.0" } }, "parse-ms": { @@ -2070,19 +2008,13 @@ "integrity": "sha1-VjRtR0nXjyNDDKDHE4UK75GqNh0=", "dev": true }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", - "dev": true - }, "path-exists": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "2.0.1" + "pinkie-promise": "^2.0.0" } }, "path-is-absolute": { @@ -2091,17 +2023,29 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, "path-type": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -2120,16 +2064,27 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" } }, "pkg-up": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-1.0.0.tgz", - "integrity": "sha1-Pgj7RhUlxEIWJKM7n35tCvWwWiY=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", + "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", "dev": true, "requires": { - "find-up": "1.1.2" + "find-up": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + } } }, "plur": { @@ -2138,17 +2093,16 @@ "integrity": "sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=", "dev": true, "requires": { - "irregular-plurals": "1.4.0" + "irregular-plurals": "^1.0.0" } }, "pretty-bytes": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", - "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-3.0.1.tgz", + "integrity": "sha1-J9AAjXeAY6C0gRuzXHnxvV1fvM8=", "dev": true, "requires": { - "get-stdin": "4.0.1", - "meow": "3.7.0" + "number-is-nan": "^1.0.0" } }, "pretty-ms": { @@ -2157,9 +2111,9 @@ "integrity": "sha1-QlfCVt8/sLRR1q/6qwIYhBJpgdw=", "dev": true, "requires": { - "is-finite": "1.0.2", - "parse-ms": "1.0.1", - "plur": "1.0.0" + "is-finite": "^1.0.1", + "parse-ms": "^1.0.0", + "plur": "^1.0.0" }, "dependencies": { "plur": { @@ -2171,9 +2125,9 @@ } }, "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, "pseudomap": { @@ -2182,41 +2136,32 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "psl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz", + "integrity": "sha512-avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag==", + "dev": true + }, "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, "qs": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-5.1.0.tgz", - "integrity": "sha1-TZMuXH6kEcynajEtOaYGIA/VDNk=", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", "dev": true }, "raw-body": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.1.7.tgz", - "integrity": "sha1-rf6s4uT7MJgFgBTQjActzFl1h3Q=", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.7.tgz", + "integrity": "sha1-HQJ8K/oRasxmI7yo8AAWVyqH1CU=", "dev": true, "requires": { - "bytes": "2.4.0", - "iconv-lite": "0.4.13", - "unpipe": "1.0.0" - }, - "dependencies": { - "bytes": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-2.4.0.tgz", - "integrity": "sha1-fZcZb51br39pNeJZhVSe3SpsIzk=", - "dev": true - }, - "iconv-lite": { - "version": "0.4.13", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz", - "integrity": "sha1-H4irpKsLFQjoMSrMOTRfNumS4vI=", - "dev": true - } + "bytes": "1", + "string_decoder": "0.10" } }, "read-pkg": { @@ -2225,9 +2170,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" } }, "read-pkg-up": { @@ -2236,8 +2181,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" } }, "readable-stream": { @@ -2246,10 +2191,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", "isarray": "0.0.1", - "string_decoder": "0.10.31" + "string_decoder": "~0.10.x" } }, "redent": { @@ -2258,8 +2203,8 @@ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" } }, "repeating": { @@ -2268,41 +2213,41 @@ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { - "is-finite": "1.0.2" + "is-finite": "^1.0.0" } }, "request": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", - "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", - "dev": true, - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.7.0", - "caseless": "0.11.0", - "combined-stream": "1.0.6", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "2.0.6", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", - "oauth-sign": "0.8.2", - "qs": "6.3.2", - "stringstream": "0.0.5", - "tough-cookie": "2.3.4", - "tunnel-agent": "0.4.3", - "uuid": "3.2.1" + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" }, "dependencies": { "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true } } @@ -2320,36 +2265,64 @@ "dev": true }, "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } }, "resolve-from": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", - "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, "resolve-pkg": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/resolve-pkg/-/resolve-pkg-0.1.0.tgz", - "integrity": "sha1-AsyZNBDik2livZcWahsHfalyVTE=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg/-/resolve-pkg-2.0.0.tgz", + "integrity": "sha512-+1lzwXehGCXSeryaISr6WujZzowloigEofRB+dj75y9RRa/obVcYgbHJd53tdYw8pvZj8GojXaaENws8Ktw/hQ==", "dev": true, "requires": { - "resolve-from": "2.0.0" + "resolve-from": "^5.0.0" } }, "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "dev": true + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + }, + "dependencies": { + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } }, "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", + "dev": true + }, + "safe-json-parse": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-json-parse/-/safe-json-parse-1.0.1.tgz", + "integrity": "sha1-PnZyPjjf3aE8mx0poeB//uSzC1c=", "dev": true }, "safer-buffer": { @@ -2364,10 +2337,10 @@ "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", "dev": true, "requires": { - "glob": "7.0.6", - "lodash": "4.17.10", - "scss-tokenizer": "0.2.3", - "yargs": "7.1.0" + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^7.0.0" } }, "scss-tokenizer": { @@ -2376,8 +2349,8 @@ "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", "dev": true, "requires": { - "js-base64": "2.4.3", - "source-map": "0.4.4" + "js-base64": "^2.1.8", + "source-map": "^0.4.2" }, "dependencies": { "source-map": { @@ -2386,15 +2359,15 @@ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { - "amdefine": "1.0.1" + "amdefine": ">=0.0.4" } } } }, "semver": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", - "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "dev": true }, "set-blocking": { @@ -2403,12 +2376,6 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, - "set-immediate-shim": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", - "dev": true - }, "shelljs": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", @@ -2427,15 +2394,6 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, - "requires": { - "hoek": "2.16.3" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -2443,19 +2401,19 @@ "dev": true }, "spdx-correct": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", - "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", "dev": true, "requires": { - "spdx-expression-parse": "3.0.0", - "spdx-license-ids": "3.0.0" + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", "dev": true }, "spdx-expression-parse": { @@ -2464,59 +2422,46 @@ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", "dev": true, "requires": { - "spdx-exceptions": "2.1.0", - "spdx-license-ids": "3.0.0" + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, "spdx-license-ids": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", - "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", "dev": true }, "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", "dev": true }, "sshpk": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", - "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", "dev": true, "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" } }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "dev": true - }, "stdout-stream": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.0.tgz", - "integrity": "sha1-osfIWH5U2UJ+qe2zrD8s1SLfN4s=", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", + "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", "dev": true, "requires": { - "readable-stream": "2.3.6" + "readable-stream": "^2.0.1" }, "dependencies": { "isarray": { @@ -2531,22 +2476,28 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } } } @@ -2557,18 +2508,24 @@ "integrity": "sha1-VpcPscOFWOnnC3KL894mmsRa36w=", "dev": true, "requires": { - "strip-ansi": "3.0.1" + "strip-ansi": "^3.0.0" } }, + "string-template": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz", + "integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0=", + "dev": true + }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { @@ -2577,19 +2534,13 @@ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "dev": true - }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-bom": { @@ -2598,7 +2549,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "0.2.1" + "is-utf8": "^0.2.0" } }, "strip-indent": { @@ -2607,7 +2558,7 @@ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "dev": true, "requires": { - "get-stdin": "4.0.1" + "get-stdin": "^4.0.1" } }, "strip-json-comments": { @@ -2617,20 +2568,23 @@ "dev": true }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } }, "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", "dev": true, "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" } }, "text-table": { @@ -2640,18 +2594,45 @@ "dev": true }, "time-grunt": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/time-grunt/-/time-grunt-1.4.0.tgz", - "integrity": "sha1-BiIT5mDJB+hvRAVWwB6mWXtxJCA=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/time-grunt/-/time-grunt-2.0.0.tgz", + "integrity": "sha512-iQD2AeDYCAJrsPC/eUsfYZD9UT7TuBOmUIgFV5zeTQgRk6yLJKoc3aYR0gusJ0m+bG13B6qrDZ0SwPLe0/htHw==", "dev": true, "requires": { - "chalk": "1.1.3", - "date-time": "1.1.0", - "figures": "1.7.0", - "hooker": "0.2.3", - "number-is-nan": "1.0.1", - "pretty-ms": "2.1.0", - "text-table": "0.2.0" + "chalk": "^1.0.0", + "date-time": "^1.1.0", + "figures": "^1.0.0", + "hooker": "^0.2.3", + "number-is-nan": "^1.0.0", + "pretty-ms": "^2.1.0", + "text-table": "^0.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } } }, "time-zone": { @@ -2661,26 +2642,35 @@ "dev": true }, "tiny-lr": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tiny-lr/-/tiny-lr-0.2.1.tgz", - "integrity": "sha1-s/26gC5dVqM8L28QeUsy5Hescp0=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tiny-lr/-/tiny-lr-1.1.1.tgz", + "integrity": "sha512-44yhA3tsaRoMOjQQ+5v5mVdqef+kH6Qze9jTpqtVufgYjYt08zyZAwNwwVBj3i1rJMnR52IxOW0LK0vBzgAkuA==", "dev": true, "requires": { - "body-parser": "1.14.2", - "debug": "2.2.0", - "faye-websocket": "0.10.0", - "livereload-js": "2.3.0", - "parseurl": "1.3.2", - "qs": "5.1.0" + "body": "^5.1.0", + "debug": "^3.1.0", + "faye-websocket": "~0.10.0", + "livereload-js": "^2.3.0", + "object-assign": "^4.1.0", + "qs": "^6.4.0" } }, "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, "requires": { - "punycode": "1.4.1" + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } } }, "trim-newlines": { @@ -2690,66 +2680,53 @@ "dev": true }, "true-case-path": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.2.tgz", - "integrity": "sha1-fskRMJJHZsf1c74wIMNPj9/QDWI=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", + "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", "dev": true, "requires": { - "glob": "6.0.4" + "glob": "^7.1.2" }, "dependencies": { "glob": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", - "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "dev": true, "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } }, "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } }, "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "dev": true, - "requires": { - "media-typer": "0.3.0", - "mime-types": "2.1.18" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, "uglify-js": { - "version": "3.3.22", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.22.tgz", - "integrity": "sha512-tqw96rL6/BG+7LM5VItdhDjTQmL5zG/I0b2RqWytlgeHe2eydZHuBHdA9vuGpCDhH/ZskNGcqDhivoR2xt8RIw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", + "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", "dev": true, "requires": { - "commander": "2.15.1", - "source-map": "0.6.1" + "commander": "~2.20.0", + "source-map": "~0.6.1" } }, "underscore": { @@ -2759,16 +2736,23 @@ "dev": true }, "underscore.string": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.2.3.tgz", - "integrity": "sha1-gGmSYzZl1eX8tNsfs6hi62jp5to=", - "dev": true + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz", + "integrity": "sha512-g+dpmgn+XBneLmXXo+sGlW5xQEt4ErkS3mgeN2GFbremYeMBSJKr9Wf2KJplQVaiPY/f7FN6atosWYNm9ovrYg==", + "dev": true, + "requires": { + "sprintf-js": "^1.0.3", + "util-deprecate": "^1.0.2" + } }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "dev": true + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } }, "uri-path": { "version": "1.0.0", @@ -2783,19 +2767,19 @@ "dev": true }, "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true }, "validate-npm-package-license": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", - "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "requires": { - "spdx-correct": "3.0.0", - "spdx-expression-parse": "3.0.0" + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" } }, "verror": { @@ -2804,27 +2788,20 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "extsprintf": "^1.2.0" } }, "websocket-driver": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", - "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.3.tgz", + "integrity": "sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg==", "dev": true, "requires": { - "http-parser-js": "0.4.12", - "websocket-extensions": "0.1.3" + "http-parser-js": ">=0.4.0 <0.4.11", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" } }, "websocket-extensions": { @@ -2834,12 +2811,12 @@ "dev": true }, "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "which-module": { @@ -2849,12 +2826,12 @@ "dev": true }, "wide-align": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2 || 2" } }, "wrap-ansi": { @@ -2863,8 +2840,8 @@ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" } }, "wrappy": { @@ -2874,9 +2851,9 @@ "dev": true }, "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true }, "y18n": { @@ -2897,19 +2874,19 @@ "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", "dev": true, "requires": { - "camelcase": "3.0.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "1.4.0", - "read-pkg-up": "1.0.1", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "1.0.2", - "which-module": "1.0.0", - "y18n": "3.2.1", - "yargs-parser": "5.0.0" + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.0" }, "dependencies": { "camelcase": { @@ -2926,7 +2903,7 @@ "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", "dev": true, "requires": { - "camelcase": "3.0.0" + "camelcase": "^3.0.0" }, "dependencies": { "camelcase": { diff --git a/package.json b/package.json index 795fc5a..2175a10 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,14 @@ "private": true, "devDependencies": { "grunt": "^1.0.1", - "grunt-contrib-jshint": "^1.0.0", - "grunt-contrib-uglify": "^3.3.0", + "grunt-contrib-jshint": "^2.1.0", + "grunt-contrib-uglify": "^4.0.1", "grunt-contrib-watch": "^1.0.0", "grunt-phplint": "0.1.0", - "grunt-sass": "^2.1.0", + "grunt-sass": "^3.0.2", "jshint-stylish": "^2.2.1", - "load-grunt-tasks": "^3.5.2", - "time-grunt": "^1.4.0" + "load-grunt-tasks": "^5.1.0", + "node-sass": "^4.12.0", + "time-grunt": "^2.0.0" } } From 53ff9e835dba8a30be0323621a0e3307826e00de Mon Sep 17 00:00:00 2001 From: Archetyped Date: Fri, 2 Aug 2019 15:40:14 -1000 Subject: [PATCH 07/59] Build:Client files (JS). --- client/js/prod/lib.core.js | 2 +- client/js/prod/lib.view.js | 2 +- themes/default/js/prod/client.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/js/prod/lib.core.js b/client/js/prod/lib.core.js index 7d11293..ed1b3f9 100644 --- a/client/js/prod/lib.core.js +++ b/client/js/prod/lib.core.js @@ -1 +1 @@ -window.jQuery&&function($){"use strict";var c_init=!1,Class=function(){},Base={base:!(Class.extend=function(members){var _super=this.prototype;c_init=!0;var val,name,proto=new this;for(name in c_init=!1,proto)$.isPlainObject(proto[name])&&(val=$.extend({},proto[name]),proto[name]=val);var make_handler=function(nm,fn){return function(){var tmp=this._super;this._super=_super[nm];var ret=fn.apply(this,arguments);return this._super=tmp,ret}};for(name in members)"function"==typeof members[name]&&"function"==typeof _super[name]?proto[name]=make_handler(name,members[name]):proto[name]=$.isPlainObject(members[name])?$.extend({},members[name]):members[name];function Class(){c_init||("function"==typeof this._init&&this._init.apply(this,arguments),"function"==typeof this._c&&this._c.apply(this,arguments))}return((Class.prototype=proto).constructor=Class).extend=this.extend,Class}),_parent:null,prefix:"slb",_init:function(){this._set_parent()},_set_parent:function(p){this.util.is_set(p)&&(this._parent=p),this.util._parent=this},attach:function(member,data,simple){var ret=data;return simple=void 0!==simple&&!!simple,"string"===$.type(member)&&($.isPlainObject(data)&&!simple&&(data._parent=this,data=this.Class.extend(data)),this[member]="function"===$.type(data)?new data:data,ret=this[member]),ret},has_child:function(child){if(!this.util.is_string(child))return!1;var children=child.split(".");child=null;var x,o=this;for(x=0;x').get(0)},parse_query:function(uri){var i,temp,key,val,delim_vars="&",delim_val="=",query={raw:[],parsed:{},string:""};if(0===(uri=this.parse_uri(uri)).search.indexOf("?"))for(query.raw=uri.search.substr(1).split(delim_vars),i=0;i').get(0)},parse_query:function(uri){var i,temp,key,val,delim_vars="&",delim_val="=",query={raw:[],parsed:{},string:""};if(0===(uri=this.parse_uri(uri)).search.indexOf("?"))for(query.raw=uri.search.substr(1).split(delim_vars),i=0;i');$("head").append(out.join(""))}}},Component={_slug:"component",_ns:null,_refs:{},_reciprocal:!1,_dom:null,_attributes:!1,_attr_default:{},_attr_default_parsed:!1,_attr_init:null,_attr_map:{},_events:{},_status:null,_id:"",_c:function(id,attributes){this._set_id(id),this.util.is_obj(attributes)&&(this._attr_init=attributes),this._hooks()},_set_parent:function(){this._super(View)},_hooks:function(){},_set_id:function(id){return this.util.is_empty(this._id)&&(this._id=this.util.is_string(id)?id:this.util.guid()),this._id},get_id:function(ns){var id=this._id;return this.util.is_bool(ns)&&ns&&(id=this.add_ns(id)),id},get_ns:function(){return null===this._ns&&(this._ns=this.util.add_prefix(this._slug)),this._ns},add_ns:function(val){return this.util.is_string(val)?this.get_ns()+"_"+val:""},get_status:function(id,raw){var ret=!1;return this.util.in_obj(this._status,id)&&(ret=raw?this._status[id]:!!this._status[id]),ret},set_status:function(id,val){return this.util.is_string(id)?(this.util.is_set(val)||(val=!0),this.util.is_obj(this._status,!1)||(this._status={}),this._status[id]=val):this.util.is_set(val)||(val=!1),val},get_controller:function(){return this.get_parent()},has_reference:function(ref){return!!(this.util.is_string(ref)&&ref in this&&ref in this.get_references())},get_references:function(){return this._refs},get_reference:function(ref){return this.has_reference(ref)?this._refs[ref]:null},get_component:function(cname,options){var c=null;if(!this.has_reference(cname))return c;options=$.extend({},{check_attr:!0,get_default:!1},options);var ctype=this.get_reference(cname);return this.util.is_type(this[cname],ctype)?this[cname]:(c=this[cname]=null,options.check_attr&&(c=this.get_attribute(cname),this.util.is_empty(c)||(c=this.set_component(cname,c))),this.util.is_empty(c)&&options.get_default&&(c=this.get_controller().get_component(ctype)),c)},set_component:function(name,ref,validate){if(!this.has_reference(name))return null;if(this.util.is_empty(ref))ref=null;else{var ctype=this.get_reference(name);this.util.is_string(ref,!1)&&(ref=this.get_controller().get_component(ctype,ref)),(!this.util.is_type(ref,ctype)||this.util.is_func(validate)&&!validate.call(this,ref))&&(ref=null)}return this[name]=ref,this[name]},clear_component:function(name){this.set_component(name,null)},init_attributes:function(force){if(this.util.is_bool(force)||(force=!1),force||!this.util.is_obj(this._attributes)){var a=this._attributes={};$.extend(a,this.init_default_attributes()),this.util.is_obj(this._attr_init)&&$.extend(a,this._attr_init),$.extend(a,this.get_dom_attributes())}},init_default_attributes:function(){if(!this._attr_default_parsed&&this.util.is_obj(this._attr_map)){var opts=this.get_controller().get_options(this.util.obj_keys(this._attr_map));if(this.util.is_obj(opts)){for(var opt in this._attr_map)opt in opts&&null!==this._attr_map[opt]&&(opts[this._attr_map[opt]]=opts[opt],delete opts[opt]);$.extend(!0,this._attr_default,opts)}this._attr_default_parsed=!0}return this._attr_default},get_dom_attributes:function(){var attrs={},el=this.dom_get(null,{init:!1});if(0",options.tag),attrs).appendTo(d)).length&&this.util.is_method(options,"success")&&options.success.call(r,r),$(r).append(options.content),$(r)},dom_has:function(){return!!this.dom_get().length},get_data_key:function(){return this.get_ns()},on:function(event,fn,options){if(!this.util.is_string(event)||!this.util.is_func(fn)){var t=this,args=Array.prototype.slice.call(arguments,1);return this.util.is_array(event)?$.each(event,function(idx,val){t.on.apply(t,[val].concat(args))}):this.util.is_obj(event)&&$.each(event,function(ev,hdl){t.on.apply(t,[ev,hdl].concat(args))}),this}this.util.is_obj(options,!1)||(options={}),options=$.extend({},{clear:!1},options),this.util.is_obj(this._events,!1)||(this._events={});var es=this._events;return event in es&&this.util.is_obj(es[event],!1)&&!options.clear||(es[event]=[]),es[event].push(fn),this},trigger:function(event,data){var dfr=$.Deferred(),dfrs=[],t=this;if(this.util.is_array(event))return $.each(event,function(idx,val){dfrs.push(t.trigger(val,data))}),$.when.apply(t,dfrs).done(function(){dfr.resolve()}),dfr.promise();if(!(this.util.is_string(event)&&event in this._events))return dfr.resolve(),dfr.promise();var ev={type:event,data:null};return this.util.is_set(data)&&(ev.data=data),$.each(this._events[event],function(idx,fn){dfrs.push(fn.call(t,ev,t))}),$.when.apply(this,dfrs).done(function(){dfr.resolve()}),dfr.promise()}};View.Component=Component=SLB.Class.extend(Component);var Viewer={_slug:"viewer",_refs:{item:"Content_Item",theme:"Theme"},_reciprocal:!0,_attr_default:{loop:!0,animate:!0,autofit:!0,overlay_enabled:!0,overlay_opacity:"0.8",title_default:!1,container:null,slideshow_enabled:!0,slideshow_autostart:!1,slideshow_duration:2,slideshow_active:!1,slideshow_timer:null,labels:{close:"close",nav_prev:"« prev",nav_next:"next »",slideshow_start:"start slideshow",slideshow_stop:"stop slideshow",group_status:"Image %current% of %total%",loading:"loading"}},_attr_map:{theme:null,group_loop:"loop",ui_autofit:"autofit",ui_animate:"animate",ui_overlay_opacity:"overlay_opacity",ui_labels:"labels",ui_title_default:"title_default",slideshow_enabled:null,slideshow_autostart:null,slideshow_duration:null},item:null,item_queued:null,theme:null,item_working:null,active:!1,init:!1,open:!1,loading:!1,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")}).on(["close","item-change"],function(){t.unload().done(function(){t.unlock()})})},get_item:function(){return this.get_component("item")},set_item:function(item){this.clear_item(!1);var i=this.set_component("item",item,function(item){return item.has_type()});return!this.util.is_empty(i)},clear_item:function(full){this.util.is_bool(full)||(full=!0);var item=this.get_item();item&&item.reset(),full&&this.clear_component("item")},get_theme:function(){var ret=this.get_component("theme",{check_attr:!1});return this.util.is_empty(ret)&&(ret=this.set_component("theme",new View.Theme(this))),ret},set_theme:function(theme){this.set_component("theme",theme)},lock:function(){return this.set_status("item_working",$.Deferred())},get_lock:function(simple,full){this.util.is_bool(simple)||(simple=!1),this.util.is_bool(full)||(full=!1);var s="item_working";if(simple)return this.get_status(s);var r=this.get_status(s,!0);return this.util.is_promise(r)||(r=this.lock()),full?r:r.promise()},is_locked:function(){return this.get_lock(!0)},unlock:function(){return this.get_lock(!1,!0).resolve()},set_active:function(mode){return this.util.is_bool(mode)||(mode=!0),this.set_status("active",mode)},is_active:function(){return this.get_status("active")},set_loading:function(mode){var dfr=$.Deferred();this.util.is_bool(mode)||(mode=!0),this.loading=mode,this.slideshow_active()&&this.slideshow_pause(mode);var m=mode?"addClass":"removeClass";return $(this.dom_get())[m]("loading"),mode?this.get_theme().transition("load").always(function(){dfr.resolve()}):dfr.resolve(),dfr.promise()},unset_loading:function(){return this.set_loading(!1)},get_loading:function(){return!!this.util.is_bool(this.loading)&&this.loading},is_loading:function(){return this.get_loading()},show:function(item){this.item_queued=item;var vt="theme_valid",valid=!0;if(this.has_attribute(vt)?valid=this.get_attribute(vt,!0):(valid=!(!this.get_theme()||""===this.get_theme().get_template().get_layout(!1)),this.set_attribute(vt,valid)),!valid)return this.close(),!1;var v=this,fin=function(){if(v.lock(),v.set_status("show_deferred",!1),!v.set_item(v.item_queued))return v.close(),!1;v.history_add(),v.set_active(),v.render()};this.is_locked()?this.get_status("show_deferred")||(this.set_status("show_deferred"),this.get_lock().always(function(){fin()})):fin()},history_handle:function(e){var state=e.originalEvent.state;if(this.util.is_string(state.item,!1))this.get_controller().get_item(state.item).show({event:e}),this.trigger("item-change");else{var count=this.history_get(!0);this.history_set(0),-1!==count&&this.close()}},history_get:function(full){return this.get_status("history_count",full)},history_set:function(val){return this.set_status("history_count",val)},history_add:function(){if(!history.pushState)return!1;var item=this.get_item(),opts=item.get_attribute("options_show"),count=this.history_get()?this.history_get(!0):0;if(this.util.in_obj(opts,"event")){var e=opts.event.originalEvent;this.util.in_obj(e,"state")&&this.util.in_obj(e.state,"count")&&(count=e.state.count)}else{var state={viewer:this.get_id(),item:null,count:count};count||history.replaceState(state,null),state.item=this.get_controller().save_item(item).get_id(),state.count=++count,history.pushState(state,"")}this.history_set(count)},history_reset:function(){var count=this.history_get(!0);count&&(this.history_set(-1),history.go(-1*count))},is_open:function(){return"none"!==this.dom_get().css("display")},render:function(){var v=this,thm=this.get_theme();v.dom_prep(),this.get_status("render-events")||(this.set_status("render-events"),thm.on("render-loading",function(ev,thm){var dfr=$.Deferred();if(!v.is_active())return dfr.reject(),dfr.promise();var set_pos=function(){v.dom_get().css("top",$(window).scrollTop())},always=function(){v.set_loading().always(function(){dfr.resolve()})};return v.is_open()?thm.transition("unload").fail(function(){set_pos(),thm.dom_get_tag("item","content").attr("style","")}).always(always):thm.transition("open").always(function(){always(),v.events_open(),v.open=!0}).fail(function(){set_pos(),v.get_overlay().show(),v.dom_get().show()}),dfr.promise()}).on("render-complete",function(ev,thm){if(!v.is_active())return!1;var d=v.dom_get(),classes=["item_single","item_multi"],ms=["addClass","removeClass"];v.get_item().get_group().is_single()||ms.reverse(),$.each(ms,function(idx,val){d[val](classes[idx])}),v.events_complete(),thm.transition("complete").fail(function(){if(v.get_attribute("autofit",!0)){var dims=$.extend({display:"inline-block"},thm.get_item_dimensions());thm.dom_get_tag("item","content").css(dims)}}).always(function(){v.unset_loading(),v.trigger("render-complete"),v.init=!0})})),thm.render()},dom_get_container:function(){var sel=this.get_attribute("container");this.util.is_empty(sel)&&(sel="#"+this.add_ns("wrap"));var c=$(sel);if(!c.length){var id=0===sel.indexOf("#")?sel.substr(1):sel;c=$("
",{id:id}).appendTo("body")}return c},dom_init:function(){var d=this.dom_set($("
",{id:this.get_id(!0),class:this.get_ns()})).appendTo(this.dom_get_container()).hide(),thm=this.get_theme();d.addClass(thm.get_classes(" "));var v=this;this.get_status("render-init")||(this.set_status("render-init"),thm.on("render-init",function(ev){v.dom_put("layout",ev.data)})),thm.render(!0)},dom_prep:function(mode){var m=this.util.is_bool(mode)&&!mode?"removeClass":"addClass";$("html")[m](this.util.add_prefix("overlay"))},dom_restore:function(){this.dom_prep(!1)},get_layout:function(){return this.dom_get("layout",{put:{success:function(){$(this).hide()}}})},animation_enabled:function(){return this.get_attribute("animate",!0)},overlay_enabled:function(){var ov=this.get_attribute("overlay_enabled");return!!this.util.is_bool(ov)&&ov},get_overlay:function(){var o=null,v=this;return this.overlay_enabled()&&(o=this.dom_get("overlay",{put:{success:function(){$(this).hide().css("opacity",v.get_attribute("overlay_opacity"))}}})),$(o)},unload:function(){var dfr=$.Deferred();return this.get_theme().dom_get_tag("item").text(""),dfr.resolve(),dfr.promise()},reset:function(){this.dom_get().hide(),this.dom_restore(),this.history_reset(),this.clear_item(),this.set_active(!1),this.set_loading(!1),this.slideshow_stop(),this.keys_disable(),this.unlock()},get_labels:function(){return this.get_attribute("labels",{})},get_label:function(name){var lbls=this.get_labels();return name in lbls?lbls[name]:""},events_open:function(){if(this.keys_enable(),this.open)return!1;var l=this.get_layout();l.children().click(function(ev){ev.stopPropagation()});var v=this,close=function(){v.close()};l.click(close),this.get_overlay().click(close),this.trigger("events-open")},events_complete:function(){if(this.init)return!1;this.trigger("events-complete")},keys_enable:function(mode){this.util.is_bool(mode)||(mode=!0);var e=["keyup",this.util.get_prefix()].join("."),v=this;mode?$(document).on(e,function(ev){return v.keys_control(ev)}):$(document).off(e)},keys_disable:function(){this.keys_enable(!1)},keys_control:function(ev){var handlers={27:this.close,37:this.item_prev,39:this.item_next};if("rtl"===document.documentElement.getAttribute("dir")&&(handlers[37]=this.item_next,handlers[39]=this.item_prev),ev.which in handlers)return handlers[ev.which].call(this),!1},slideshow_enabled:function(){var o=this.get_attribute("slideshow_enabled");return!(!(this.util.is_bool(o)&&o&&this.get_item())||this.get_item().get_group().is_single())},slideshow_active:function(){return!(!this.slideshow_enabled()||!(this.get_attribute("slideshow_active")||!this.init&&this.get_attribute("slideshow_autostart")))},slideshow_clear_timer:function(){clearInterval(this.get_attribute("slideshow_timer"))},slideshow_set_timer:function(callback){this.set_attribute("slideshow_timer",setInterval(callback,1e3*this.get_attribute("slideshow_duration")))},slideshow_start:function(){if(!this.slideshow_enabled())return!1;this.set_attribute("slideshow_active",!0),this.dom_get().addClass("slideshow_active"),this.slideshow_clear_timer();var v=this;this.slideshow_set_timer(function(){v.slideshow_pause(),v.item_next()}),this.trigger("slideshow-start")},slideshow_stop:function(full){this.util.is_bool(full)||(full=!0),full&&(this.set_attribute("slideshow_active",!1),this.dom_get().removeClass("slideshow_active")),this.slideshow_clear_timer(),this.trigger("slideshow-stop")},slideshow_toggle:function(){if(!this.slideshow_enabled())return!1;this.slideshow_active()?this.slideshow_stop():this.slideshow_start(),this.trigger("slideshow-toggle")},slideshow_pause:function(mode){this.util.is_bool(mode)||(mode=!0),this.slideshow_active()&&(mode?this.slideshow_stop(!1):this.slideshow_start()),this.trigger("slideshow-pause")},slideshow_resume:function(){this.slideshow_pause(!1)},item_next:function(){var g=this.get_item().get_group(!0),v=this,ev="item-next",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(e){v.trigger(e.type)})),g.show_next()},item_prev:function(){var g=this.get_item().get_group(!0),v=this,ev="item-prev",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(){v.trigger(ev)})),g.show_prev()},close:function(){this.set_active(!1);var v=this,thm=this.get_theme();return thm.transition("unload").always(function(){thm.transition("close",!0).always(function(){v.reset(),v.trigger("close")})}).fail(function(){thm.dom_get_tag("item","content").attr("style","")}),!1}};View.Viewer=Component.extend(Viewer);var Group={_slug:"group",_reciprocal:!0,_refs:{current:"Content_Item"},current:null,selector:null,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")})},get_selector:function(){return this.util.is_empty(this.selector)&&(this.selector=this.util.format('a[%s="%s"]',this.dom_get_attribute(),this.get_id())),this.selector},get_items:function(){var items=$(this.get_selector());return 0===items.length&&this.has_current()&&(items=this.get_current().dom_get()),items},get_item:function(idx){this.util.is_int(idx)||(idx=0);var items=this.get_items(),max=this.get_size()-1;return maxoffset.width&&(max.width-=offset.width),max.height>offset.height&&(max.height-=offset.height);var factor=Math.min(max.width/dims.width,max.height/dims.height);factor<1&&$.each(dims,function(key){dims[key]=Math.round(dims[key]*factor)})}return $.extend({},dims)},get_dimensions:function(){var dims=this.get_item_dimensions(),offset=this.get_offset();return $.each(dims,function(key){dims[key]+=offset[key]}),dims},get_breakpoints:function(){return this.get_attribute_recursive("breakpoints")},get_breakpoint:function(target){var ret=0;if(this.util.is_string(target)){var b=this.get_attribute_recursive("breakpoints");this.util.is_obj(b)&&target in b&&(ret=b[target])}return ret},render:function(init){var thm=this,tpl=this.get_template(),st="events_render";this.get_status(st)||(this.set_status(st),tpl.on(["render-init","render-loading","render-complete"],function(ev){return thm.trigger(ev.type,ev.data)})),tpl.render(init)},transition:function(event,clear_queue){var dfr=null,attr="transition",v=this.get_viewer(),fx_temp=null,anim_on=v.animation_enabled();if(v.get_attribute(attr,!0)&&this.util.is_string(event)){clear_queue&&v.get_layout().find("*").each(function(){for(var el=$(this);el.queue().length;)el.stop(!1,!0)});var trns,attr_set=[attr,"set"].join("_");if(this.get_attribute(attr_set))trns=this.get_attribute(attr,{});else{var models=this.get_ancestors(!0);trns=[],this.set_attribute(attr_set,!0);var thm=this;$.each(models,function(idx,model){attr in model&&thm.util.is_obj(model[attr])&&trns.push(model[attr])}),trns.push({}),trns=this.set_attribute(attr,$.extend.apply($,trns.reverse()))}this.util.is_method(trns,event)&&(anim_on||(fx_temp=$.fx.off,$.fx.off=!0),dfr=trns[event].call(this,v,$.Deferred()))}return this.util.is_promise(dfr)||(dfr=$.Deferred()).reject(),dfr.always(function(){null!==fx_temp&&($.fx.off=fx_temp)}),dfr.promise()}};View.Theme=Modeled_Component.extend(Theme);var Template={_slug:"template",_reciprocal:!0,_refs:{theme:"Theme"},_attr_default:{layout_uri:"",layout_raw:"",layout_parsed:"",tags:null,model:null},theme:null,_c:function(attributes){this._super("",attributes)},_hooks:function(){this.on("dom_init",function(ev){var tags=this.get_tags(null,null,!0),names=[],t=this;$.each(tags,function(idx,tag){var name=tag.get_name();-1===$.inArray(name,names)&&(names.push(name),tag.get_handler().trigger(ev.type,{template:t}))})})},get_theme:function(){return this.get_component("theme")},render:function(init){var v=this.get_theme().get_viewer();if(this.util.is_bool(init)||(init=!1),init)this.trigger("render-init",this.dom_get());else{if(!v.is_active())return!1;var item=v.get_item();if(!this.util.is_type(item,View.Content_Item))return v.close(),!1;if(v.is_active()&&this.has_tags()){var loading_promise=this.trigger("render-loading"),tpl=this,tags=this.get_tags(),tag_promises=[];$.when(item.load(),loading_promise).done(function(){return!!v.is_active()&&($.each(tags,function(idx,tag){if(!v.is_active())return!1;tag_promises.push(tag.render(item).done(function(r){if(!v.is_active())return!1;r.tag.dom_get().html(r.output)}))}),!!v.is_active()&&void $.when.apply($,tag_promises).done(function(){tpl.trigger("render-complete")}))})}}},get_layout:function(parsed){return this.util.is_bool(parsed)||(parsed=!0),parsed?this.parse_layout():this.get_attribute("layout_raw","")},parse_layout:function(){var a="layout_parsed",ret=this.get_attribute(a);return this.util.is_string(ret)||(ret=this.sanitize_layout(this.get_layout(!1)),ret=this.parse_tags(ret),this.set_attribute(a,ret)),ret},sanitize_layout:function(l){if(this.util.is_empty(l))return l;var rtype=this.util.is_string(l)?"string":null,dom=$(l),tag_temp=this.get_tag_temp(),cls=tag_temp.get_class(),cls_new=["x",cls].join("_");switch($(tag_temp.get_selector(),dom).each(function(){$(this).removeClass(cls).addClass(cls_new)}),rtype){case"string":l=dom=dom.wrap("
").parent().html();break;default:l=dom}return l},parse_tags:function(l){if(!this.util.is_string(l))return"";for(var match,re=/\{{2}\s*(\w.*?)\s*\}{2}/gim;match=re.exec(l);)l=l.substring(0,match.index)+this.get_tag_container(match[1])+l.substring(match.index+match[0].length);return l},get_tag_container:function(tag){var attr=this.get_tag_attribute();return this.util.format('',attr,encodeURI(tag))},get_tag_attribute:function(){return this.get_tag_temp().dom_get_attribute()},get_tag:function(idx){var ret=null;if(this.has_tags()){var tags=this.get_tags();(!this.util.is_int(idx)||idx<0||idx>=tags.length)&&(idx=0),ret=tags[idx]}return ret},get_tags:function(name,prop,isolate){this.util.is_bool(isolate)||(isolate=!1);var a="tags",tags=this.get_attribute(a);if(!this.util.is_array(tags)){tags=[];var d=this.dom_get(),attr=this.get_tag_attribute(),nodes=$(d).find("["+attr+"]");$(nodes).each(function(){var el=$(this),tag=new View.Template_Tag(decodeURI(el.attr(attr)));tag.has_handler()&&(tags.push(tag),isolate||(tag.dom_set(el),el.addClass(tag.get_classes(" ")))),isolate||el.removeAttr(attr)}),isolate||this.set_attribute(a,tags,!1)}if(!this.util.is_empty(tags)&&this.util.is_string(name)){this.util.is_string(prop)||(prop=!1);for(var tags_filtered=[],tc=null,x=0;x');$("head").append(out.join(""))}}},Component={_slug:"component",_ns:null,_refs:{},_reciprocal:!1,_dom:null,_attributes:!1,_attr_default:{},_attr_default_parsed:!1,_attr_init:null,_attr_map:{},_events:{},_status:null,_id:"",_c:function(id,attributes){this._set_id(id),this.util.is_obj(attributes)&&(this._attr_init=attributes),this._hooks()},_set_parent:function(){this._super(View)},_hooks:function(){},_set_id:function(id){return this.util.is_empty(this._id)&&(this._id=this.util.is_string(id)?id:this.util.guid()),this._id},get_id:function(ns){var id=this._id;return this.util.is_bool(ns)&&ns&&(id=this.add_ns(id)),id},get_ns:function(){return null===this._ns&&(this._ns=this.util.add_prefix(this._slug)),this._ns},add_ns:function(val){return this.util.is_string(val)?this.get_ns()+"_"+val:""},get_status:function(id,raw){var ret=!1;return this.util.in_obj(this._status,id)&&(ret=raw?this._status[id]:!!this._status[id]),ret},set_status:function(id,val){return this.util.is_string(id)?(this.util.is_set(val)||(val=!0),this.util.is_obj(this._status,!1)||(this._status={}),this._status[id]=val):this.util.is_set(val)||(val=!1),val},get_controller:function(){return this.get_parent()},has_reference:function(ref){return!!(this.util.is_string(ref)&&ref in this&&ref in this.get_references())},get_references:function(){return this._refs},get_reference:function(ref){return this.has_reference(ref)?this._refs[ref]:null},get_component:function(cname,options){var c=null;if(!this.has_reference(cname))return c;options=$.extend({},{check_attr:!0,get_default:!1},options);var ctype=this.get_reference(cname);return this.util.is_type(this[cname],ctype)?this[cname]:(c=this[cname]=null,options.check_attr&&(c=this.get_attribute(cname),this.util.is_empty(c)||(c=this.set_component(cname,c))),this.util.is_empty(c)&&options.get_default&&(c=this.get_controller().get_component(ctype)),c)},set_component:function(name,ref,validate){if(!this.has_reference(name))return null;if(this.util.is_empty(ref))ref=null;else{var ctype=this.get_reference(name);this.util.is_string(ref,!1)&&(ref=this.get_controller().get_component(ctype,ref)),this.util.is_type(ref,ctype)&&(!this.util.is_func(validate)||validate.call(this,ref))||(ref=null)}return this[name]=ref,this[name]},clear_component:function(name){this.set_component(name,null)},init_attributes:function(force){if(this.util.is_bool(force)||(force=!1),force||!this.util.is_obj(this._attributes)){var a=this._attributes={};$.extend(a,this.init_default_attributes()),this.util.is_obj(this._attr_init)&&$.extend(a,this._attr_init),$.extend(a,this.get_dom_attributes())}},init_default_attributes:function(){if(!this._attr_default_parsed&&this.util.is_obj(this._attr_map)){var opts=this.get_controller().get_options(this.util.obj_keys(this._attr_map));if(this.util.is_obj(opts)){for(var opt in this._attr_map)opt in opts&&null!==this._attr_map[opt]&&(opts[this._attr_map[opt]]=opts[opt],delete opts[opt]);$.extend(!0,this._attr_default,opts)}this._attr_default_parsed=!0}return this._attr_default},get_dom_attributes:function(){var attrs={},el=this.dom_get(null,{init:!1});if(0",options.tag),attrs).appendTo(d)).length&&this.util.is_method(options,"success")&&options.success.call(r,r),$(r).append(options.content),$(r)},dom_has:function(){return!!this.dom_get().length},get_data_key:function(){return this.get_ns()},on:function(event,fn,options){if(!this.util.is_string(event)||!this.util.is_func(fn)){var t=this,args=Array.prototype.slice.call(arguments,1);return this.util.is_array(event)?$.each(event,function(idx,val){t.on.apply(t,[val].concat(args))}):this.util.is_obj(event)&&$.each(event,function(ev,hdl){t.on.apply(t,[ev,hdl].concat(args))}),this}this.util.is_obj(options,!1)||(options={}),options=$.extend({},{clear:!1},options),this.util.is_obj(this._events,!1)||(this._events={});var es=this._events;return event in es&&this.util.is_obj(es[event],!1)&&!options.clear||(es[event]=[]),es[event].push(fn),this},trigger:function(event,data){var dfr=$.Deferred(),dfrs=[],t=this;if(this.util.is_array(event))return $.each(event,function(idx,val){dfrs.push(t.trigger(val,data))}),$.when.apply(t,dfrs).done(function(){dfr.resolve()}),dfr.promise();if(!(this.util.is_string(event)&&event in this._events))return dfr.resolve(),dfr.promise();var ev={type:event,data:null};return this.util.is_set(data)&&(ev.data=data),$.each(this._events[event],function(idx,fn){dfrs.push(fn.call(t,ev,t))}),$.when.apply(this,dfrs).done(function(){dfr.resolve()}),dfr.promise()}};View.Component=Component=SLB.Class.extend(Component);var Viewer={_slug:"viewer",_refs:{item:"Content_Item",theme:"Theme"},_reciprocal:!0,_attr_default:{loop:!0,animate:!0,autofit:!0,overlay_enabled:!0,overlay_opacity:"0.8",title_default:!1,container:null,slideshow_enabled:!0,slideshow_autostart:!1,slideshow_duration:2,slideshow_active:!1,slideshow_timer:null,labels:{close:"close",nav_prev:"« prev",nav_next:"next »",slideshow_start:"start slideshow",slideshow_stop:"stop slideshow",group_status:"Image %current% of %total%",loading:"loading"}},_attr_map:{theme:null,group_loop:"loop",ui_autofit:"autofit",ui_animate:"animate",ui_overlay_opacity:"overlay_opacity",ui_labels:"labels",ui_title_default:"title_default",slideshow_enabled:null,slideshow_autostart:null,slideshow_duration:null},item:null,item_queued:null,theme:null,item_working:null,active:!1,init:!1,open:!1,loading:!1,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")}).on(["close","item-change"],function(){t.unload().done(function(){t.unlock()})})},get_item:function(){return this.get_component("item")},set_item:function(item){this.clear_item(!1);var i=this.set_component("item",item,function(item){return item.has_type()});return!this.util.is_empty(i)},clear_item:function(full){this.util.is_bool(full)||(full=!0);var item=this.get_item();item&&item.reset(),full&&this.clear_component("item")},get_theme:function(){var ret=this.get_component("theme",{check_attr:!1});return this.util.is_empty(ret)&&(ret=this.set_component("theme",new View.Theme(this))),ret},set_theme:function(theme){this.set_component("theme",theme)},lock:function(){return this.set_status("item_working",$.Deferred())},get_lock:function(simple,full){this.util.is_bool(simple)||(simple=!1),this.util.is_bool(full)||(full=!1);var s="item_working";if(simple)return this.get_status(s);var r=this.get_status(s,!0);return this.util.is_promise(r)||(r=this.lock()),full?r:r.promise()},is_locked:function(){return this.get_lock(!0)},unlock:function(){return this.get_lock(!1,!0).resolve()},set_active:function(mode){return this.util.is_bool(mode)||(mode=!0),this.set_status("active",mode)},is_active:function(){return this.get_status("active")},set_loading:function(mode){var dfr=$.Deferred();this.util.is_bool(mode)||(mode=!0),this.loading=mode,this.slideshow_active()&&this.slideshow_pause(mode);var m=mode?"addClass":"removeClass";return $(this.dom_get())[m]("loading"),mode?this.get_theme().transition("load").always(function(){dfr.resolve()}):dfr.resolve(),dfr.promise()},unset_loading:function(){return this.set_loading(!1)},get_loading:function(){return!!this.util.is_bool(this.loading)&&this.loading},is_loading:function(){return this.get_loading()},show:function(item){this.item_queued=item;var vt="theme_valid",valid=!0;if(this.has_attribute(vt)?valid=this.get_attribute(vt,!0):(valid=!(!this.get_theme()||""===this.get_theme().get_template().get_layout(!1)),this.set_attribute(vt,valid)),!valid)return this.close(),!1;function fin(){if(v.lock(),v.set_status("show_deferred",!1),!v.set_item(v.item_queued))return v.close(),!1;v.history_add(),v.set_active(),v.render()}var v=this;this.is_locked()?this.get_status("show_deferred")||(this.set_status("show_deferred"),this.get_lock().always(function(){fin()})):fin()},history_handle:function(e){var state=e.originalEvent.state;if(this.util.is_string(state.item,!1))this.get_controller().get_item(state.item).show({event:e}),this.trigger("item-change");else{var count=this.history_get(!0);this.history_set(0),-1!==count&&this.close()}},history_get:function(full){return this.get_status("history_count",full)},history_set:function(val){return this.set_status("history_count",val)},history_add:function(){if(!history.pushState)return!1;var item=this.get_item(),opts=item.get_attribute("options_show"),count=this.history_get()?this.history_get(!0):0;if(this.util.in_obj(opts,"event")){var e=opts.event.originalEvent;this.util.in_obj(e,"state")&&this.util.in_obj(e.state,"count")&&(count=e.state.count)}else{var state={viewer:this.get_id(),item:null,count:count};count||history.replaceState(state,null),state.item=this.get_controller().save_item(item).get_id(),state.count=++count,history.pushState(state,"")}this.history_set(count)},history_reset:function(){var count=this.history_get(!0);count&&(this.history_set(-1),history.go(-1*count))},is_open:function(){return"none"!==this.dom_get().css("display")},render:function(){var v=this,thm=this.get_theme();v.dom_prep(),this.get_status("render-events")||(this.set_status("render-events"),thm.on("render-loading",function(ev,thm){var dfr=$.Deferred();if(!v.is_active())return dfr.reject(),dfr.promise();function set_pos(){v.dom_get().css("top",$(window).scrollTop())}function always(){v.set_loading().always(function(){dfr.resolve()})}return v.is_open()?thm.transition("unload").fail(function(){set_pos(),thm.dom_get_tag("item","content").attr("style","")}).always(always):thm.transition("open").always(function(){always(),v.events_open(),v.open=!0}).fail(function(){set_pos(),v.get_overlay().show(),v.dom_get().show()}),dfr.promise()}).on("render-complete",function(ev,thm){if(!v.is_active())return!1;var d=v.dom_get(),classes=["item_single","item_multi"],ms=["addClass","removeClass"];v.get_item().get_group().is_single()||ms.reverse(),$.each(ms,function(idx,val){d[val](classes[idx])}),v.events_complete(),thm.transition("complete").fail(function(){if(v.get_attribute("autofit",!0)){var dims=$.extend({display:"inline-block"},thm.get_item_dimensions());thm.dom_get_tag("item","content").css(dims)}}).always(function(){v.unset_loading(),v.trigger("render-complete"),v.init=!0})})),thm.render()},dom_get_container:function(){var sel=this.get_attribute("container");this.util.is_empty(sel)&&(sel="#"+this.add_ns("wrap"));var c=$(sel);if(!c.length){var id=0===sel.indexOf("#")?sel.substr(1):sel;c=$("
",{id:id}).appendTo("body")}return c},dom_init:function(){var d=this.dom_set($("
",{id:this.get_id(!0),class:this.get_ns()})).appendTo(this.dom_get_container()).hide(),thm=this.get_theme();d.addClass(thm.get_classes(" "));var v=this;this.get_status("render-init")||(this.set_status("render-init"),thm.on("render-init",function(ev){v.dom_put("layout",ev.data)})),thm.render(!0)},dom_prep:function(mode){var m=this.util.is_bool(mode)&&!mode?"removeClass":"addClass";$("html")[m](this.util.add_prefix("overlay"))},dom_restore:function(){this.dom_prep(!1)},get_layout:function(){return this.dom_get("layout",{put:{success:function(){$(this).hide()}}})},animation_enabled:function(){return this.get_attribute("animate",!0)},overlay_enabled:function(){var ov=this.get_attribute("overlay_enabled");return!!this.util.is_bool(ov)&&ov},get_overlay:function(){var o=null,v=this;return this.overlay_enabled()&&(o=this.dom_get("overlay",{put:{success:function(){$(this).hide().css("opacity",v.get_attribute("overlay_opacity"))}}})),$(o)},unload:function(){var dfr=$.Deferred();return this.get_theme().dom_get_tag("item").text(""),dfr.resolve(),dfr.promise()},reset:function(){this.dom_get().hide(),this.dom_restore(),this.history_reset(),this.clear_item(),this.set_active(!1),this.set_loading(!1),this.slideshow_stop(),this.keys_disable(),this.unlock()},get_labels:function(){return this.get_attribute("labels",{})},get_label:function(name){var lbls=this.get_labels();return name in lbls?lbls[name]:""},events_open:function(){if(this.keys_enable(),this.open)return!1;var l=this.get_layout();l.children().click(function(ev){ev.stopPropagation()});function close(){v.close()}var v=this;l.click(close),this.get_overlay().click(close),this.trigger("events-open")},events_complete:function(){if(this.init)return!1;this.trigger("events-complete")},keys_enable:function(mode){this.util.is_bool(mode)||(mode=!0);var e=["keyup",this.util.get_prefix()].join("."),v=this;mode?$(document).on(e,function(ev){return v.keys_control(ev)}):$(document).off(e)},keys_disable:function(){this.keys_enable(!1)},keys_control:function(ev){var handlers={27:this.close,37:this.item_prev,39:this.item_next};if("rtl"===document.documentElement.getAttribute("dir")&&(handlers[37]=this.item_next,handlers[39]=this.item_prev),ev.which in handlers)return handlers[ev.which].call(this),!1},slideshow_enabled:function(){var o=this.get_attribute("slideshow_enabled");return!(!(this.util.is_bool(o)&&o&&this.get_item())||this.get_item().get_group().is_single())},slideshow_active:function(){return!(!this.slideshow_enabled()||!(this.get_attribute("slideshow_active")||!this.init&&this.get_attribute("slideshow_autostart")))},slideshow_clear_timer:function(){clearInterval(this.get_attribute("slideshow_timer"))},slideshow_set_timer:function(callback){this.set_attribute("slideshow_timer",setInterval(callback,1e3*this.get_attribute("slideshow_duration")))},slideshow_start:function(){if(!this.slideshow_enabled())return!1;this.set_attribute("slideshow_active",!0),this.dom_get().addClass("slideshow_active"),this.slideshow_clear_timer();var v=this;this.slideshow_set_timer(function(){v.slideshow_pause(),v.item_next()}),this.trigger("slideshow-start")},slideshow_stop:function(full){this.util.is_bool(full)||(full=!0),full&&(this.set_attribute("slideshow_active",!1),this.dom_get().removeClass("slideshow_active")),this.slideshow_clear_timer(),this.trigger("slideshow-stop")},slideshow_toggle:function(){if(!this.slideshow_enabled())return!1;this.slideshow_active()?this.slideshow_stop():this.slideshow_start(),this.trigger("slideshow-toggle")},slideshow_pause:function(mode){this.util.is_bool(mode)||(mode=!0),this.slideshow_active()&&(mode?this.slideshow_stop(!1):this.slideshow_start()),this.trigger("slideshow-pause")},slideshow_resume:function(){this.slideshow_pause(!1)},item_next:function(){var g=this.get_item().get_group(!0),v=this,ev="item-next",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(e){v.trigger(e.type)})),g.show_next()},item_prev:function(){var g=this.get_item().get_group(!0),v=this,ev="item-prev",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(){v.trigger(ev)})),g.show_prev()},close:function(){this.set_active(!1);var v=this,thm=this.get_theme();return thm.transition("unload").always(function(){thm.transition("close",!0).always(function(){v.reset(),v.trigger("close")})}).fail(function(){thm.dom_get_tag("item","content").attr("style","")}),!1}};View.Viewer=Component.extend(Viewer);var Group={_slug:"group",_reciprocal:!0,_refs:{current:"Content_Item"},current:null,selector:null,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")})},get_selector:function(){return this.util.is_empty(this.selector)&&(this.selector=this.util.format('a[%s="%s"]',this.dom_get_attribute(),this.get_id())),this.selector},get_items:function(){var items=$(this.get_selector());return 0===items.length&&this.has_current()&&(items=this.get_current().dom_get()),items},get_item:function(idx){this.util.is_int(idx)||(idx=0);var items=this.get_items(),max=this.get_size()-1;return maxoffset.width&&(max.width-=offset.width),max.height>offset.height&&(max.height-=offset.height);var factor=Math.min(max.width/dims.width,max.height/dims.height);factor<1&&$.each(dims,function(key){dims[key]=Math.round(dims[key]*factor)})}return $.extend({},dims)},get_dimensions:function(){var dims=this.get_item_dimensions(),offset=this.get_offset();return $.each(dims,function(key){dims[key]+=offset[key]}),dims},get_breakpoints:function(){return this.get_attribute_recursive("breakpoints")},get_breakpoint:function(target){var ret=0;if(this.util.is_string(target)){var b=this.get_attribute_recursive("breakpoints");this.util.is_obj(b)&&target in b&&(ret=b[target])}return ret},render:function(init){var thm=this,tpl=this.get_template(),st="events_render";this.get_status(st)||(this.set_status(st),tpl.on(["render-init","render-loading","render-complete"],function(ev){return thm.trigger(ev.type,ev.data)})),tpl.render(init)},transition:function(event,clear_queue){var dfr=null,attr="transition",v=this.get_viewer(),fx_temp=null,anim_on=v.animation_enabled();if(v.get_attribute(attr,!0)&&this.util.is_string(event)){clear_queue&&v.get_layout().find("*").each(function(){for(var el=$(this);el.queue().length;)el.stop(!1,!0)});var trns,attr_set=[attr,"set"].join("_");if(this.get_attribute(attr_set))trns=this.get_attribute(attr,{});else{var models=this.get_ancestors(!0);trns=[],this.set_attribute(attr_set,!0);var thm=this;$.each(models,function(idx,model){attr in model&&thm.util.is_obj(model[attr])&&trns.push(model[attr])}),trns.push({}),trns=this.set_attribute(attr,$.extend.apply($,trns.reverse()))}this.util.is_method(trns,event)&&(anim_on||(fx_temp=$.fx.off,$.fx.off=!0),dfr=trns[event].call(this,v,$.Deferred()))}return this.util.is_promise(dfr)||(dfr=$.Deferred()).reject(),dfr.always(function(){null!==fx_temp&&($.fx.off=fx_temp)}),dfr.promise()}};View.Theme=Modeled_Component.extend(Theme);var Template={_slug:"template",_reciprocal:!0,_refs:{theme:"Theme"},_attr_default:{layout_uri:"",layout_raw:"",layout_parsed:"",tags:null,model:null},theme:null,_c:function(attributes){this._super("",attributes)},_hooks:function(){this.on("dom_init",function(ev){var tags=this.get_tags(null,null,!0),names=[],t=this;$.each(tags,function(idx,tag){var name=tag.get_name();-1===$.inArray(name,names)&&(names.push(name),tag.get_handler().trigger(ev.type,{template:t}))})})},get_theme:function(){return this.get_component("theme")},render:function(init){var v=this.get_theme().get_viewer();if(this.util.is_bool(init)||(init=!1),init)this.trigger("render-init",this.dom_get());else{if(!v.is_active())return!1;var item=v.get_item();if(!this.util.is_type(item,View.Content_Item))return v.close(),!1;if(v.is_active()&&this.has_tags()){var loading_promise=this.trigger("render-loading"),tpl=this,tags=this.get_tags(),tag_promises=[];$.when(item.load(),loading_promise).done(function(){return!!v.is_active()&&($.each(tags,function(idx,tag){if(!v.is_active())return!1;tag_promises.push(tag.render(item).done(function(r){if(!v.is_active())return!1;r.tag.dom_get().html(r.output)}))}),!!v.is_active()&&void $.when.apply($,tag_promises).done(function(){tpl.trigger("render-complete")}))})}}},get_layout:function(parsed){return this.util.is_bool(parsed)||(parsed=!0),parsed?this.parse_layout():this.get_attribute("layout_raw","")},parse_layout:function(){var a="layout_parsed",ret=this.get_attribute(a);return this.util.is_string(ret)||(ret=this.sanitize_layout(this.get_layout(!1)),ret=this.parse_tags(ret),this.set_attribute(a,ret)),ret},sanitize_layout:function(l){if(this.util.is_empty(l))return l;var rtype=this.util.is_string(l)?"string":null,dom=$(l),tag_temp=this.get_tag_temp(),cls=tag_temp.get_class(),cls_new=["x",cls].join("_");switch($(tag_temp.get_selector(),dom).each(function(){$(this).removeClass(cls).addClass(cls_new)}),rtype){case"string":l=dom=dom.wrap("
").parent().html();break;default:l=dom}return l},parse_tags:function(l){if(!this.util.is_string(l))return"";for(var match,re=/\{{2}\s*(\w.*?)\s*\}{2}/gim;match=re.exec(l);)l=l.substring(0,match.index)+this.get_tag_container(match[1])+l.substring(match.index+match[0].length);return l},get_tag_container:function(tag){var attr=this.get_tag_attribute();return this.util.format('',attr,encodeURI(tag))},get_tag_attribute:function(){return this.get_tag_temp().dom_get_attribute()},get_tag:function(idx){var ret=null;if(this.has_tags()){var tags=this.get_tags();(!this.util.is_int(idx)||idx<0||idx>=tags.length)&&(idx=0),ret=tags[idx]}return ret},get_tags:function(name,prop,isolate){this.util.is_bool(isolate)||(isolate=!1);var a="tags",tags=this.get_attribute(a);if(!this.util.is_array(tags)){tags=[];var d=this.dom_get(),attr=this.get_tag_attribute(),nodes=$(d).find("["+attr+"]");$(nodes).each(function(){var el=$(this),tag=new View.Template_Tag(decodeURI(el.attr(attr)));tag.has_handler()&&(tags.push(tag),isolate||(tag.dom_set(el),el.addClass(tag.get_classes(" ")))),isolate||el.removeAttr(attr)}),isolate||this.set_attribute(a,tags,!1)}if(!this.util.is_empty(tags)&&this.util.is_string(name)){this.util.is_string(prop)||(prop=!1);for(var tags_filtered=[],tc=null,x=0;xthm.get_breakpoint("small")?(pos.top=pos.top_base+$(window).height()/2-l.height()/2,pos.topthis.get_breakpoint("small")){var anims={layout:{opacity:0,top:$(document).scrollTop()+$(window).height()/2},content:{width:0,height:0},speed:"fast"},pos=l.animate(anims.layout,anims.speed).promise(),size=c.animate(anims.content,anims.speed).promise();$.when(pos,size).done(function(){v.get_overlay().fadeOut({always:function(){reset()}})})}else l.css("opacity",0),reset();return dfr.promise()},load:function(v){return v.get_layout().find(".slb_loading").show(),document.documentElement.clientWidth>this.get_breakpoint("small")?v.get_layout().fadeIn().promise():v.get_layout().show().promise()},unload:function(v,dfr){var l=v.get_layout(),det=l.find(".slb_details"),cont=l.find(".slb_content "+this.get_tag_selector());return det.css({height:0}),cont.hide(),$.when(det.promise(),cont.promise()).done(function(){dfr.resolve()}),dfr.promise()},complete:function(v,dfr){var l=v.get_layout(),loader=l.find(".slb_loading"),det=l.find(".slb_details"),det_data=det.find(".slb_data"),c=l.find(".slb_content"),c_tag=c.find(this.get_tag_selector());if(document.documentElement.clientWidth>this.get_breakpoint("small")){var dims_item=this.get_item_dimensions();det.width(dims_item.width);var dims_det_height=det_data.outerHeight();det.width("");var pos={top_base:$(document).scrollTop()};pos.top=pos.top_base+$(window).height()/2-(dims_det_height+dims_item.height)/2,pos.topthm.get_breakpoint("small")?(pos.top=pos.top_base+$(window).height()/2-l.height()/2,pos.topthis.get_breakpoint("small")){var anims={layout:{opacity:0,top:$(document).scrollTop()+$(window).height()/2},content:{width:0,height:0},speed:"fast"},pos=l.animate(anims.layout,anims.speed).promise(),size=c.animate(anims.content,anims.speed).promise();$.when(pos,size).done(function(){v.get_overlay().fadeOut({always:function(){reset()}})})}else l.css("opacity",0),reset();return dfr.promise()},load:function(v){return v.get_layout().find(".slb_loading").show(),document.documentElement.clientWidth>this.get_breakpoint("small")?v.get_layout().fadeIn().promise():v.get_layout().show().promise()},unload:function(v,dfr){var l=v.get_layout(),det=l.find(".slb_details"),cont=l.find(".slb_content "+this.get_tag_selector());return det.css({height:0}),cont.hide(),$.when(det.promise(),cont.promise()).done(function(){dfr.resolve()}),dfr.promise()},complete:function(v,dfr){var l=v.get_layout(),loader=l.find(".slb_loading"),det=l.find(".slb_details"),det_data=det.find(".slb_data"),c=l.find(".slb_content"),c_tag=c.find(this.get_tag_selector());if(document.documentElement.clientWidth>this.get_breakpoint("small")){var dims_item=this.get_item_dimensions();det.width(dims_item.width);var dims_det_height=det_data.outerHeight();det.width("");var pos={top_base:$(document).scrollTop()};pos.top=pos.top_base+$(window).height()/2-(dims_det_height+dims_item.height)/2,pos.top Date: Fri, 2 Aug 2019 16:15:39 -1000 Subject: [PATCH 08/59] Meta:Confirm WordPress v5.2 compatibility. --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index e393beb..de122d2 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: Archetyped Donate link: http://gum.co/slb-donate License: GPLv2 Tags: lightbox, gallery, photography, images, theme, template, style -Requires at least: 5.0 -Tested up to: 5.1 +Requires at least: 5.2 +Tested up to: 5.2 Requires PHP: 5.6.20 Stable tag: trunk From f759ca29a758b8fd13e0dea98f27095418f69872 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 18 Sep 2019 15:12:26 -1000 Subject: [PATCH 09/59] Optimize media item data structure. * Avoid conflicts with custom metadata properties, etc. * Fixes #722 --- controller.php | 241 +++++++++++++++++++++++++++++-------------------- 1 file changed, 141 insertions(+), 100 deletions(-) diff --git a/controller.php b/controller.php index 2b31631..8772cd1 100644 --- a/controller.php +++ b/controller.php @@ -35,28 +35,74 @@ class SLB_Lightbox extends SLB_Base { var $template_tags = null; /** - * Collection of processed media items for output to client - * > Key (string) Attachment URI - * > Value (assoc-array) Attachment properties (url, etc.) - * > source: Source URL - * @var array + * Media item template. + * + * @var array { + * Media item properties. + * + * @type int $id WP post ID. Default null. + * @type string $type Item type. Default null. + * @type string $source Source URI. + * @type bool $internal Internal resource. Default false. + * @type string $title Item title. + * @type string $caption Item caption. + * @type string $description Item description. + * @type array $media { + * Media properties (indexed by size name). + * Original size = 'full'. + * + * @type string $file File URI. + * @type int $width File width in pixels. + * @type int $height File height in pixels. + * } + * @type array $meta { + * Item metadata. + * } + * } + */ + private $media_item_template = [ + 'id' => null, + 'type' => null, + 'internal' => false, + 'source' => '', + 'media' => [], + 'meta' => [] + ]; + + /** + * Processed media items for output to client. + * + * @var object[string] { + * Media item properties. + * + * @index string Unique ID (system-generated). + * + * @see $media_item_template. + * } */ - var $media_items = array(); - + private $media_items = []; + /** - * Collection of unprocessed media items - * Multi-dimensional array - * > props (array) Media properties indexed by ID - * > Key: (string) Unique ID (system-generated) - * > Value: (object) Media properties - * > type: (string) Item type (Default: null) - * > id: (int) WP item ID (Default: null) - * > uri (array) Index of cached URIs - * > Key: (string) Item URI - * > Value: (string) Item ID (pointer to item in `id` array) - * @var array + * Collection of unprocessed media items. + * + * @var array { + * @type object[string] $props { + * Media item properties. + * + * @index string Unique ID (system-generated). + * + * @see $media_item_template + * } + * @type string[string] $uri { + * Cached URIs. + * + * @index string URI. + * + * @type string Item ID (points to item in `props` array) + * } + * } */ - private $media_items_raw = array( 'props' => array(), 'uri' => array() ); + private $media_items_raw = [ 'props' => [], 'uri' => [] ]; /** * Manage excluded content @@ -794,153 +840,144 @@ function client_footer_script() { /** * Add media information to client output * - * @param array $commands Client script commands - * @return array Modified script commands + * @param array $client_script Client script commands. + * @return array Modified script commands. * TODO Refactor */ - function client_script_media($client_script) { + public function client_script_media($client_script) { global $wpdb; - // Init variables - $this->media_items = array(); - $props = array('id', 'type', 'description', 'title', 'source', 'caption'); - $props = (object) array_combine($props, $props); - $props_map = array('description' => 'post_content', 'title' => 'post_title', 'caption' => 'post_excerpt'); + // Init. + $this->media_items = $this->get_cached_media_items(); - // Separate media into buckets by type - $m_internals = array(); - $type = $id = null; - - $m_items = $this->media_items = $this->get_cached_media_items(); - foreach ( $m_items as $key => $p ) { - // Set aside internal links for additional processing - if ( $p->internal && !isset($m_internals[$key]) ) { - $m_internals[$key] =& $m_items[$key]; + // Extract internal links for additional processing. + $m_internals = []; + foreach ( $this->media_items as $key => $p ) { + if ( $p->internal ) { + $m_internals[$key] =& $this->media_items[$key]; } } + // Cleanup. unset($key, $p); - // Process internal links + // Process internal links. if ( !empty($m_internals) ) { - $uris_base = array(); + $uris_base = []; $uri_prefix = wp_upload_dir(); $uri_prefix = $this->util->normalize_path($uri_prefix['baseurl'], true); foreach ( $m_internals as $key => $p ) { - // Prepare internal links - // Create relative URIs for attachment data retrieval + // Prepare internal links. + // Create relative URIs for attachment data retrieval. if ( !$p->id && strpos($p->source, $uri_prefix) === 0 ) { $uris_base[str_replace($uri_prefix, '', $p->source)] = $key; } } + // Cleanup. unset($key, $p); - // Retrieve attachment IDs + // Retrieve attachment IDs. $uris_flat = "('" . implode("','", array_keys($uris_base)) . "')"; $q = $wpdb->prepare("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE `meta_key` = %s AND LOWER(`meta_value`) IN $uris_flat LIMIT %d", '_wp_attached_file', count($uris_base)); $pids = $wpdb->get_results($q); - // Match IDs to URIs + // Match IDs to URIs. if ( $pids ) { foreach ( $pids as $pd ) { $file =& $pd->meta_value; if ( isset($uris_base[$file]) ) { - $m_internals[ $uris_base[$file] ]->{$props->id} = absint($pd->post_id); + $m_internals[ $uris_base[$file] ]->id = absint($pd->post_id); } } } - // Destroy worker vars + // Cleanup. unset($uris_base, $uris_flat, $q, $pids, $pd, $file); } - // Process items with attachment IDs - $pids = array(); - foreach ( $m_items as $key => $p ) { - // Add post ID to query + // Process items with attachment IDs. + $pids = []; + foreach ( $this->media_items as $key => $p ) { + // Add post ID to query. if ( !!$p->id ) { - // Create array for ID (support multiple URIs per ID) + // Create array for ID (support multiple URIs per ID). if ( !isset($pids[$p->id]) ) { - $pids[$p->id] = array(); + $pids[$p->id] = []; } - // Add URI to ID + // Add URI to ID. $pids[$p->id][] = $key; } } + // Cleanup. unset($key, $p); - // Retrieve attachment properties + // Retrieve attachment properties. if ( !empty($pids) ) { $pids_flat = array_keys($pids); - // Retrieve attachment post data + // Retrieve attachment post data. $atts = get_posts(array('post_type' => 'attachment', 'include' => $pids_flat)); - // Process attachments + // Process attachments. if ( $atts ) { - // Retrieve attachment metadata + // Retrieve attachment metadata. $pids_flat = "('" . implode("','", $pids_flat) . "')"; $atts_meta = $wpdb->get_results($wpdb->prepare("SELECT `post_id`,`meta_value` FROM $wpdb->postmeta WHERE `post_id` IN $pids_flat AND `meta_key` = %s LIMIT %d", '_wp_attachment_metadata', count($atts))); - // Restructure metadata array by post ID + // Reindex metadata array by attachment ID. if ( $atts_meta ) { - $meta = array(); + $meta = []; foreach ( $atts_meta as $att_meta ) { $meta[$att_meta->post_id] = $att_meta->meta_value; } $atts_meta = $meta; + // Cleanup. unset($meta); } else { - $atts_meta = array(); + $atts_meta = []; } - $props_size = array('file', 'width', 'height'); - $props_exclude = array('hwstring_small'); + + // Process attachment data. + $media_props = array('file', 'width', 'height'); + $media_original_name = 'full'; + $props_post_map = [ 'title' => 'post_title', 'caption' => 'post_excerpt', 'description' => 'post_content' ]; + foreach ( $atts as $att ) { - // Set post data - $m = array(); - - // Remap post data to properties - foreach ( $props_map as $prop_key => $prop_source ) { - $m[$props->{$prop_key}] = $att->{$prop_source}; + $data = [ 'meta' => [], 'media' => [ $media_original_name => [] ] ]; + // Remap post data to metadata. + foreach ( $props_post_map as $props_post_key => $props_post_source ) { + $data[$props_post_key] = $att->{$props_post_source}; } - unset($prop_key, $prop_source); + // Cleanup. + unset($props_post_key, $props_post_source); - // Add metadata - if ( isset($atts_meta[$att->ID]) && ($a = unserialize($atts_meta[$att->ID])) && is_array($a) ) { - // Move original size into `sizes` array - foreach ( $props_size as $d ) { - if ( !isset($a[$d]) ) { - continue; - } - $a['sizes']['original'][$d] = $a[$d]; - unset($a[$d]); - } - - // Strip extraneous metadata - foreach ( $props_exclude as $d ) { + // Process metadata. + if ( isset( $atts_meta[$att->ID] ) && ( $a = unserialize( $atts_meta[$att->ID] ) ) && is_array( $a ) ) { + // Media properties. + // Source file. + foreach ( $media_props as $d ) { if ( isset($a[$d]) ) { - unset($a[$d]); + $data['media'][$media_original_name][$d] = $a[$d]; } } - - // Merge post data & meta data - $m = array_merge($a, $m); - // Destroy worker vars - unset($a, $d); + // Cleanup. + unset( $a, $d ); } - - // Save attachment data (post & meta) to original object(s) + // Save data to corresponding media item(s). if ( isset($pids[$att->ID]) ) { foreach ( $pids[$att->ID] as $key ) { - $this->media_items[$key] = array_merge( (array) $m_items[$key], $m); + $this->media_items[$key] = (object) array_merge( (array) $this->media_items[$key], $data ); } } } + // Cleanup. + unset($att, $data); } + // Cleanup. unset($atts, $atts_meta, $m, $a, $uri, $pids, $pids_flat); } - // Filter media item properties + // Filter media item properties. foreach ( $this->media_items as $key => $props ) { $this->media_items[$key] = $this->util->apply_filters('media_item_properties', (object) $props); } - // Build client output + // Build client output. $obj = 'View.assets'; $client_script[] = $this->util->extend_client_object($obj, $this->media_items); return $client_script; @@ -961,27 +998,31 @@ function client_script_media($client_script) { * @return string Unique ID for cached media item */ private function cache_media_item($uri, $type, $internal, $props = null) { - // Validate + // Validate. if ( !is_object($uri) || !is_string($type) ) { return false; } - // Check if URI already cached + // Check if URI already cached. $key = $this->get_media_item_id($uri->source); - // Cache new item + // Cache new item. if ( null == $key ) { - // Generate Unique ID + // Generate Unique ID. do { $key = (string) mt_rand(); } while ( isset($this->media_items_raw['props'][$key]) ); - // Build properties object - $i = array('id' => null); + // Build properties object. + $i = $this->media_item_template; if ( is_array($props) && !empty($props) ) { $i = array_merge($i, $props); } - $i = array_merge($i, array('type' => $type, 'source' => $uri->source, 'internal' => $internal)); - // Cache item properties + $i = array_merge( $i, [ + 'type' => $type, + 'source' => $uri->source, + 'internal' => $internal, + ] ); + // Cache item properties. $this->media_items_raw['props'][$key] = (object) $i; - // Cache Source URI (point to properties object) + // Cache Source URI (point to properties object). $this->media_items_raw['uri'][$uri->source] = $key; } return $key; From 61da6230efbfa5c30eeffa6de947c2b0ebd82f58 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 18 Sep 2019 15:34:00 -1000 Subject: [PATCH 10/59] Optimize: Remove unused properties from media item data object. * Properties removed: `media` and `meta`. * Code commented out until needed. * Tag: `@future: Metadata` --- controller.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/controller.php b/controller.php index 8772cd1..d74c4a2 100644 --- a/controller.php +++ b/controller.php @@ -65,18 +65,20 @@ class SLB_Lightbox extends SLB_Base { 'type' => null, 'internal' => false, 'source' => '', + /* @future: Metadata 'media' => [], 'meta' => [] + END @future: Metadata */ ]; /** * Processed media items for output to client. - * + * * @var object[string] { * Media item properties. - * + * * @index string Unique ID (system-generated). - * + * * @see $media_item_template. * } */ @@ -916,6 +918,7 @@ public function client_script_media($client_script) { // Process attachments. if ( $atts ) { + /* @future: Metadata // Retrieve attachment metadata. $pids_flat = "('" . implode("','", $pids_flat) . "')"; $atts_meta = $wpdb->get_results($wpdb->prepare("SELECT `post_id`,`meta_value` FROM $wpdb->postmeta WHERE `post_id` IN $pids_flat AND `meta_key` = %s LIMIT %d", '_wp_attachment_metadata', count($atts))); @@ -931,14 +934,21 @@ public function client_script_media($client_script) { } else { $atts_meta = []; } + END @future: Metadata */ + /* @future: Metadata // Process attachment data. $media_props = array('file', 'width', 'height'); $media_original_name = 'full'; + END @future: Metadata */ + $props_post_map = [ 'title' => 'post_title', 'caption' => 'post_excerpt', 'description' => 'post_content' ]; foreach ( $atts as $att ) { + $data = []; + /* @future: Metadata $data = [ 'meta' => [], 'media' => [ $media_original_name => [] ] ]; + END @future: Metadata */ // Remap post data to metadata. foreach ( $props_post_map as $props_post_key => $props_post_source ) { $data[$props_post_key] = $att->{$props_post_source}; @@ -946,6 +956,7 @@ public function client_script_media($client_script) { // Cleanup. unset($props_post_key, $props_post_source); + /* @future: Metadata // Process metadata. if ( isset( $atts_meta[$att->ID] ) && ( $a = unserialize( $atts_meta[$att->ID] ) ) && is_array( $a ) ) { // Media properties. @@ -958,6 +969,7 @@ public function client_script_media($client_script) { // Cleanup. unset( $a, $d ); } + END @future: Metadata */ // Save data to corresponding media item(s). if ( isset($pids[$att->ID]) ) { foreach ( $pids[$att->ID] as $key ) { From 6d6d501b554dff78971e5844a2d1903803d16156 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 18 Sep 2019 15:49:28 -1000 Subject: [PATCH 11/59] Optimize: Filter media item array (instead of each individual item). * Filter: `media_item_properties` => `media_items` --- controller.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/controller.php b/controller.php index d74c4a2..568f8f1 100644 --- a/controller.php +++ b/controller.php @@ -984,10 +984,8 @@ public function client_script_media($client_script) { unset($atts, $atts_meta, $m, $a, $uri, $pids, $pids_flat); } - // Filter media item properties. - foreach ( $this->media_items as $key => $props ) { - $this->media_items[$key] = $this->util->apply_filters('media_item_properties', (object) $props); - } + // Filter media items. + $this->media_items = $this->util->apply_filters('media_items', $this->media_items); // Build client output. $obj = 'View.assets'; From 0b7648ee3e12db49e5504bb4a1547ba2948be28c Mon Sep 17 00:00:00 2001 From: Archetyped Date: Mon, 21 Oct 2019 16:15:25 -1000 Subject: [PATCH 12/59] Options::validate(): Optimize inline documentation. --- includes/class.options.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/class.options.php b/includes/class.options.php index 8723a91..c451459 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -294,15 +294,18 @@ function set_parents($fields) { /* Processing */ /** - * Validate option values - * Used for validating options (e.g. admin form submission) prior to saving options to DB - * Reformats values based on options' default values (i.e. bool, int, string, etc.) - * Adds option items not included in original submission - * @param array $values (optional) Option values - * @return array Full options data + * Validate option values. + * + * Used for validating options (e.g. admin form submission) prior to saving options to DB. + * Reformats values based on options' default values (i.e. bool, int, string, etc.). + * Adds option items not included in original submission. + * + * @param array $values (optional) Option values to validate. + * @return array Full options data. */ function validate($values = null) { $qvar = $this->get_id('formatted'); + // Check for submitted data (e.g. form submission) when no values passed to method. if ( empty($values) && isset($_REQUEST[$qvar]) ) { $values = $_REQUEST[$qvar]; } From fe016417424d4bf2ec661dda1d2bc579c8a44f5c Mon Sep 17 00:00:00 2001 From: Archetyped Date: Mon, 21 Oct 2019 18:00:43 -1000 Subject: [PATCH 13/59] Options/Admin: Set/Check nonce. * Add nonce field to admin options form. * Validate nonce before processing form submission. --- includes/class.admin_page.php | 5 +++++ includes/class.options.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/class.admin_page.php b/includes/class.admin_page.php index 6e4d0a6..ae24740 100644 --- a/includes/class.admin_page.php +++ b/includes/class.admin_page.php @@ -149,9 +149,14 @@ public function handle() { if ( $this->is_required_form() ) { // Build form output $form_id = $this->add_prefix('admin_form_' . $this->get_id_raw()); + $nonce = (object) [ + 'action' => $this->get_id(), + 'name' => $this->get_id() . '_nonce', + ]; ?>
action, $nonce->name ); } ?>
diff --git a/includes/class.options.php b/includes/class.options.php index c451459..9ed7b8b 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -306,7 +306,7 @@ function set_parents($fields) { function validate($values = null) { $qvar = $this->get_id('formatted'); // Check for submitted data (e.g. form submission) when no values passed to method. - if ( empty($values) && isset($_REQUEST[$qvar]) ) { + if ( empty($values) && isset($_REQUEST[$qvar]) && check_admin_referer( $qvar, $qvar . '_nonce' ) ) { $values = $_REQUEST[$qvar]; } if ( is_array($values) ) { From f726e042ba7e7ce1754791df4624de17790bde50 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 24 Oct 2019 14:51:13 -1000 Subject: [PATCH 14/59] Field: Optimize escaping data for form output. --- includes/class.field_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index 854a856..59c4f3d 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -1000,7 +1000,7 @@ function format($value, $context = '') { */ function format_form($value) { if ( is_string($value) ) - $value = htmlspecialchars($value); + $value = esc_attr($value); return $value; } From 6d6bd7d95bd3da285f72fe2a38724d1c483f17f5 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 24 Oct 2019 15:54:55 -1000 Subject: [PATCH 15/59] Field_Type: Refactor placeholder processing (initial). Refactor functionality from `build_layout()` to new `process_placeholders()` method. --- includes/class.field_type.php | 71 +++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 39701f4..f8cd829 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -150,8 +150,6 @@ function has_caller() { return !empty($this->caller); } - - /** * Sets an element for the field type * @param string $name Name of element @@ -369,32 +367,7 @@ function build_layout($layout = 'form', $data = null) { $out = $this->get_layout($layout); // Only parse valid layouts if ( $this->is_valid_layout($out) ) { - // Parse Layout - $ph = $this->get_placeholder_defaults(); - - // Search layout for placeholders - while ( $ph->match = $this->parse_layout($out, $ph->pattern_general) ) { - // Iterate through placeholders (tag, id, etc.) - foreach ( $ph->match as $tag => $instances ) { - // Iterate through instances of current placeholder - foreach ( $instances as $instance ) { - // Process value based on placeholder name - $target_property = $this->util->apply_filters(array('process_placeholder_' . $tag, false), '', $this, $instance, $layout, $data); - // Process value using default processors (if necessary) - if ( '' == $target_property ) { - $target_property = $this->util->apply_filters(array('process_placeholder', false), $target_property, $this, $instance, $layout, $data); - } - - // Clear value if value not a string - if ( !is_scalar($target_property) ) { - $target_property = ''; - } - - // Replace layout placeholder with retrieved item data - $out = str_replace($ph->start . $instance['match'] . $ph->end, $target_property, $out); - } - } - } + $out = $this->process_placeholders( $out, $layout, $data ); } else { $out = $out_default; } @@ -402,4 +375,46 @@ function build_layout($layout = 'form', $data = null) { $out = $this->format_final($out); return $out; } + + /** + * Processes placeholders in a string. + * + * Finds and expands placeholders in a string to their full values. + * + * @since dev + * + * @param string $out String containing placeholders. + * @param string $layout Optional. Name of layout being built. + * @param array $data Optional. Additional data for current item. + * @return string Original text with placeholders converted to full values. + */ + function process_placeholders( $out, $layout = 'form', $data = null ) { + // Parse Layout + $ph = $this->get_placeholder_defaults(); + + // Search layout for placeholders + while ( $ph->match = $this->parse_layout($out, $ph->pattern_general) ) { + // Iterate through placeholders (tag, id, etc.) + foreach ( $ph->match as $tag => $instances ) { + // Iterate through instances of current placeholder + foreach ( $instances as $instance ) { + // Process value based on placeholder name + $target_property = $this->util->apply_filters(array('process_placeholder_' . $tag, false), '', $this, $instance, $layout, $data); + // Process value using default processors (if necessary) + if ( '' == $target_property ) { + $target_property = $this->util->apply_filters(array('process_placeholder', false), $target_property, $this, $instance, $layout, $data); + } + + // Clear value if value not a string + if ( !is_scalar($target_property) ) { + $target_property = ''; + } + + // Replace layout placeholder with retrieved item data + $out = str_replace($ph->start . $instance['match'] . $ph->end, $target_property, $out); + } + } + } + return $out; + } } \ No newline at end of file From 43b4ae615c565bdbadb607b494128ce87a1964aa Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 24 Oct 2019 16:27:29 -1000 Subject: [PATCH 16/59] Field::process_placeholders(): Cleanup (WPCS) --- includes/class.field_type.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index f8cd829..618f971 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -379,42 +379,42 @@ function build_layout($layout = 'form', $data = null) { /** * Processes placeholders in a string. * - * Finds and expands placeholders in a string to their full values. + * Finds and replaces placeholders in a string to their full values. * * @since dev * - * @param string $out String containing placeholders. + * @param string $str String with placeholders to replace. * @param string $layout Optional. Name of layout being built. * @param array $data Optional. Additional data for current item. * @return string Original text with placeholders converted to full values. */ - function process_placeholders( $out, $layout = 'form', $data = null ) { - // Parse Layout + function process_placeholders( $str, $layout = 'form', $data = null ) { + // Parse Layout. $ph = $this->get_placeholder_defaults(); - // Search layout for placeholders - while ( $ph->match = $this->parse_layout($out, $ph->pattern_general) ) { + // Search layout for placeholders. + while ( $ph->match = $this->parse_layout( $str, $ph->pattern_general ) ) { // Iterate through placeholders (tag, id, etc.) foreach ( $ph->match as $tag => $instances ) { // Iterate through instances of current placeholder foreach ( $instances as $instance ) { // Process value based on placeholder name - $target_property = $this->util->apply_filters(array('process_placeholder_' . $tag, false), '', $this, $instance, $layout, $data); + $target_property = $this->util->apply_filters( array( 'process_placeholder_' . $tag, false ), '', $this, $instance, $layout, $data ); // Process value using default processors (if necessary) if ( '' == $target_property ) { - $target_property = $this->util->apply_filters(array('process_placeholder', false), $target_property, $this, $instance, $layout, $data); + $target_property = $this->util->apply_filters( array( 'process_placeholder', false ), $target_property, $this, $instance, $layout, $data ); } // Clear value if value not a string - if ( !is_scalar($target_property) ) { + if ( !is_scalar( $target_property ) ) { $target_property = ''; } // Replace layout placeholder with retrieved item data - $out = str_replace($ph->start . $instance['match'] . $ph->end, $target_property, $out); + $str = str_replace( $ph->start . $instance['match'] . $ph->end, $target_property, $str ); } } } - return $out; + return $str; } } \ No newline at end of file From 950ff94c8206a65dbb9cdc196184966bd1614600 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 24 Oct 2019 16:40:01 -1000 Subject: [PATCH 17/59] Field_Type::process_placeholders(): Set visibility (public) --- includes/class.field_type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 618f971..9eda8bb 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -388,7 +388,7 @@ function build_layout($layout = 'form', $data = null) { * @param array $data Optional. Additional data for current item. * @return string Original text with placeholders converted to full values. */ - function process_placeholders( $str, $layout = 'form', $data = null ) { + public function process_placeholders( $str, $layout = 'form', $data = null ) { // Parse Layout. $ph = $this->get_placeholder_defaults(); From 5473fdabe03891237ac2968712a7b54bb28ca145 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 24 Oct 2019 16:58:22 -1000 Subject: [PATCH 18/59] Fields::process_placeholder_default(): Process placeholders and escape attribute values. --- includes/class.fields.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/includes/class.fields.php b/includes/class.fields.php index d21537c..091a7a2 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -201,11 +201,15 @@ function process_placeholder_default($output, $item, $placeholder, $layout, $dat if ( 'properties' == $placeholder['tag'] && ($prop_group = $item->get_group($placeholder['attributes']['group'])) && !empty($prop_group) ) { /* Process group */ $group_out = array(); - // Iterate through properties in group and build string - foreach ( array_keys($prop_group) as $prop_key ) { - $prop_val = $item->get_property($prop_key); - if ( !is_null($prop_val) ) - $group_out[] = $prop_key . '="' . $prop_val . '"'; + // Iterate through properties in group and build string. + foreach ( array_keys( $prop_group ) as $prop_key ) { + $prop_val = $item->get_property( $prop_key ); + if ( !is_null( $prop_val ) ) { + // Process placeholders. + $prop_val = $item->process_placeholders( $prop_val, $layout, $data ); + // Add property to attribute string output. + $group_out[] = $prop_key . '="' . esc_attr( $prop_val ) . '"'; + } } $output = implode(' ', $group_out); } From a17ce6c94554ac7c495038f8104ebcd35eac6faf Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 30 Oct 2019 16:42:50 -1000 Subject: [PATCH 19/59] Fields: Optimize ID formatting storage/retrieval. --- includes/class.field_base.php | 103 +++++++++++++++++++--------- includes/class.field_collection.php | 18 ++--- 2 files changed, 80 insertions(+), 41 deletions(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index 59c4f3d..1167913 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -20,32 +20,18 @@ class SLB_Field_Base extends SLB_Base { var $id = ''; /** - * ID formatting options - * Merged with defaults during initialization - * @see $id_formats_default - * @var array + * ID formatting options. + * + * @var array $id_formats */ - var $id_formats = null; - + private $id_formats = []; + /** - * Default ID Formatting options - * Structure: - * > Key (string): Format name - * > Val (array): Options - * @var array + * Flag for ID format initialization status. + * + * @var bool $id_formats_init */ - var $id_formats_default = array( - 'attr_id' => array( - 'wrap' => array('open' => '_', 'segment_open' => '_'), - 'prefix' => array('get_container', 'get_id', 'add_prefix'), - 'recursive' => true - ), - 'attr_name' => array( - 'wrap' => array('open' => '[', 'close' => ']', 'segment_open' => '[', 'segment_close' => ']'), - 'recursive' => true, - 'prefix' => array('get_container', 'get_id', 'add_prefix') - ) - ); + private $id_formats_init = false; /** * Special characters/phrases @@ -355,7 +341,6 @@ function set_id($id) { function get_id($options = array()) { $item_id = trim($this->id); $formats = $this->get_id_formats(); - // Setup options $wrap_default = array('open' => '', 'close' => '', 'segment_open' => '', 'segment_close' => ''); @@ -452,19 +437,71 @@ function get_id($options = array()) { } /** - * Retrieve ID formatting options for class - * Format options arrays are merged together and saved to $id_formats - * @uses $id_formats - * @uses $id_formats_default - * @return array ID Formatting options + * Retrieves ID formats. + * + * @return array ID formats. */ - function &get_id_formats() { - if ( is_null($this->id_formats) ) { - $this->id_formats = wp_parse_args($this->id_formats, $this->id_formats_default); - } + private function &get_id_formats() { + $this->init_id_formats(); return $this->id_formats; } + /** + * Initializes default ID formats. + * + * @since dev + * + * @return void + */ + private function init_id_formats() { + if ( ! $this->id_formats_init ) { + $this->id_formats_init = true; + // Initilize default formats. + $this->add_id_format( + 'attr_id', + [ 'open' => '_', 'segment_open' => '_' ], + [ 'get_container', 'get_id', 'add_prefix' ], + true, + true + ); + $this->add_id_format( + 'attr_name', + [ 'open' => '[', 'close' => ']', 'segment_open' => '[', 'segment_close' => ']' ], + [ 'get_container', 'get_id', 'add_prefix' ], + true, + true + ); + + } + } + + /** + * Adds custom ID format. + * + * @since dev + * + * @param string $name Format name. + * @param array $wrap + * @param array $prefix + * @param bool $recursive Optional. + * @param bool $overwrite Optional. Overwrite existing format. Default false. + * @return void + */ + protected function add_id_format( string $name, array $wrap, array $prefix, bool $recursive = false, bool $overwrite = false ) { + // Init ID formats before adding new ones. + $this->init_id_formats(); + // Do not add format if name matches existing format (when overwriting not allowed). + if ( ! $overwrite && in_array( $name, array_keys( $this->id_formats ) ) ) { + return; + } + // Add format. + $this->id_formats[ $name ] = [ + 'wrap' => $wrap, + 'prefix' => $prefix, + 'recursive' => $recursive, + ]; + } + /** * Retrieve value from data member * @param string $context Context to format data for diff --git a/includes/class.field_collection.php b/includes/class.field_collection.php index 5d7ae6c..d9d4b02 100644 --- a/includes/class.field_collection.php +++ b/includes/class.field_collection.php @@ -25,14 +25,6 @@ class SLB_Field_Collection extends SLB_Field_Base { */ var $items = array(); - var $id_formats = array ( - 'formatted' => array( - 'wrap' => array ( 'open' => '_' ), - 'recursive' => false, - 'prefix' => array('get_prefix') - ) - ); - var $build_vars_default = array ( 'groups' => array(), 'context' => '', @@ -79,7 +71,17 @@ public function __construct($id, $properties = null) { public function _init() { parent::_init(); + + // Load properties. $this->load($this->properties_init, false); + + // Add custom ID format(s). + $this->add_id_format( + 'formatted', + [ 'open' => '_' ], + [ 'get_prefix' ], + false + ); } /*-** Getters/Setters **-*/ From 781907567e68afa65646933365ff4eff19aa4f60 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 30 Oct 2019 17:34:29 -1000 Subject: [PATCH 20/59] Fields: Update Field_Base::add_id_format() signature (options array instead of separate parameters). --- includes/class.field_base.php | 26 ++++++++++++++------------ includes/class.field_collection.php | 8 +++++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index 1167913..1d56e38 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -459,16 +459,20 @@ private function init_id_formats() { // Initilize default formats. $this->add_id_format( 'attr_id', - [ 'open' => '_', 'segment_open' => '_' ], - [ 'get_container', 'get_id', 'add_prefix' ], - true, + [ + 'wrap' => [ 'open' => '_', 'segment_open' => '_' ], + 'prefix' => [ 'get_container', 'get_id', 'add_prefix' ], + 'recursive' => true, + ], true ); $this->add_id_format( 'attr_name', - [ 'open' => '[', 'close' => ']', 'segment_open' => '[', 'segment_close' => ']' ], - [ 'get_container', 'get_id', 'add_prefix' ], - true, + [ + 'wrap' => [ 'open' => '[', 'close' => ']', 'segment_open' => '[', 'segment_close' => ']' ], + 'prefix' => [ 'get_container', 'get_id', 'add_prefix' ], + 'recursive' => true, + ], true ); @@ -487,19 +491,17 @@ private function init_id_formats() { * @param bool $overwrite Optional. Overwrite existing format. Default false. * @return void */ - protected function add_id_format( string $name, array $wrap, array $prefix, bool $recursive = false, bool $overwrite = false ) { + protected function add_id_format( string $name, array $options, bool $overwrite = false ) { // Init ID formats before adding new ones. $this->init_id_formats(); // Do not add format if name matches existing format (when overwriting not allowed). if ( ! $overwrite && in_array( $name, array_keys( $this->id_formats ) ) ) { return; } + // Normlize options. + $options = wp_parse_args( $options, [ 'wrap' => [], 'prefix' => [], 'recursive' => false ] ); // Add format. - $this->id_formats[ $name ] = [ - 'wrap' => $wrap, - 'prefix' => $prefix, - 'recursive' => $recursive, - ]; + $this->id_formats[ $name ] = $options; } /** diff --git a/includes/class.field_collection.php b/includes/class.field_collection.php index d9d4b02..561865e 100644 --- a/includes/class.field_collection.php +++ b/includes/class.field_collection.php @@ -78,9 +78,11 @@ public function _init() { // Add custom ID format(s). $this->add_id_format( 'formatted', - [ 'open' => '_' ], - [ 'get_prefix' ], - false + [ + 'wrap' => [ 'open' => '_' ], + 'prefix' => [ 'get_prefix' ], + 'recursive' => false, + ] ); } From f607203c8a559dc589d50162fe3aca20044e290c Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 30 Oct 2019 17:38:10 -1000 Subject: [PATCH 21/59] Fields: Escape field `id` and `name` attributes. --- includes/class.fields.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class.fields.php b/includes/class.fields.php index 091a7a2..69a56eb 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -233,7 +233,7 @@ function process_placeholder_default($output, $item, $placeholder, $layout, $dat function process_placeholder_id($output, $item, $placeholder, $layout, $data) { // Get attributes $args = wp_parse_args($placeholder['attributes'], array('format' => 'attr_id')); - return $item->get_id($args); + return esc_attr( $item->get_id($args) ); } /** @@ -245,7 +245,7 @@ function process_placeholder_id($output, $item, $placeholder, $layout, $data) { function process_placeholder_name($output, $item, $placeholder, $layout, $data) { // Get attributes $args = wp_parse_args($placeholder['attributes'], array('format' => 'attr_name')); - return $item->get_id($args); + return esc_attr( $item->get_id($args) ); } /** From 360706c0b35e23480dab9594045d4a504ce3d0aa Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 14:30:56 -1000 Subject: [PATCH 22/59] Fields:Refactor `Fields::process_placeholder_data_ext()` * Remove assignments from conditionals. * Add type hinting to parameters. * Update documentation. --- includes/class.fields.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/includes/class.fields.php b/includes/class.fields.php index 69a56eb..1d1e551 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -355,15 +355,23 @@ function process_placeholder_loop($output, $item, $placeholder, $layout, $data) // Return output return implode($out); } - + /** - * Returns specified value from extended data array for item - * @see SLB_Field_Type::process_placeholder_default for parameter descriptions - * @return string Placeholder output + * Returns specified value from extended data array for item. + * + * @param string $output Value to be used in place of placeholder. + * @param SLB_Field $item Field containing placeholder. + * @param array $placeholder Current placeholder. + * @see SLB_Field::parse_layout for structure of `$placeholder` array. + * @param string $layout Name of layout being built. + * @param array $data Extended data for item. + * + * @return string Processed value. */ - function process_placeholder_data_ext($output, $item, $placeholder, $layout, $data) { - if ( isset($placeholder['attributes']['id']) && ($key = $placeholder['attributes']['id']) && isset($data[$key]) ) { - $output = strval($data[$key]); + function process_placeholder_data_ext( string $output, SLB_Field $item, array $placeholder, string $layout, array $data ) { + $key = ( isset( $placeholder['attributes']['id'] ) ) ? $placeholder['attributes']['id'] : false; + if ( !! $key && isset( $data[ $key ] ) && is_scalar( $data[ $key ] ) ) { + $output = strval( $data[ $key ] ); } return $output; From 4aac0fd3f6aec8d0a808c9e67049d034a910f16d Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 16:32:27 -1000 Subject: [PATCH 23/59] Fields:Refactor `Field::format_form()` to `Field:format_attr()` --- includes/class.field_base.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index 1d56e38..a4d872e 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -1031,15 +1031,19 @@ function format($value, $context = '') { // Return formatted value return $value; } - + /** - * Format value for output in form field - * @param mixed $value Value to format - * @return mixed Formatted value + * Format value for output as an attribute. + * + * Only strings are formatted. + * + * @param mixed $value Value to format. + * @return mixed Formatted value. */ - function format_form($value) { - if ( is_string($value) ) + function format_attr( $value ) { + if ( is_string($value) ) { $value = esc_attr($value); + } return $value; } From 1acbeb285311ed749ec75de79b6857926fb80ecc Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 16:33:44 -1000 Subject: [PATCH 24/59] Options:Text:Remove unnecessary `context` attribute from `{data}` placeholder. --- includes/class.options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.options.php b/includes/class.options.php index 9ed7b8b..e6dba91 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -249,7 +249,7 @@ function register_fields($fields) { $otxt = new SLB_Field_Type('option_text', 'text'); $otxt->set_property('class', '{inherit} code'); $otxt->set_property('size', null); - $otxt->set_property('value', '{data context="form"}'); + $otxt->set_property('value', '{data}'); $otxt->set_layout('label', $l->label); $otxt->set_layout('form', $form); $fields->add($otxt); From 5f6de8365c1fb00f5c1245f0184dc7550d6ef060 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 16:34:31 -1000 Subject: [PATCH 25/59] Fields:Format output based on `context` attribute. --- includes/class.field_type.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 9eda8bb..0786084 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -409,6 +409,11 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) { if ( !is_scalar( $target_property ) ) { $target_property = ''; } + + // Format output based on context. + if ( ! empty( $target_property ) && isset( $instance['attributes']['context'] ) ) { + $target_property = $this->format( $target_property, $instance['attributes']['context'] ); + } // Replace layout placeholder with retrieved item data $str = str_replace( $ph->start . $instance['match'] . $ph->end, $target_property, $str ); From 711fc7562b9195f7c2a6caff79854fb8ff124141 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 16:35:42 -1000 Subject: [PATCH 26/59] Fields:Select:Format data used for option value as an attribute. --- includes/class.fields.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class.fields.php b/includes/class.fields.php index 1d1e551..b21bf83 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -111,8 +111,8 @@ function register_types() { $select->set_property('options', array()); $select->set_layout('form', '{label ref_base="layout"} {form_start ref_base="layout"}{option_loop ref_base="layout"}{form_end ref_base="layout"}'); $select->set_layout('option_loop', '{loop data="properties.options" layout="option" layout_data="option_data"}'); - $select->set_layout('option', '<{tag_option} value="{data_ext id="option_value"}">{data_ext id="option_text"}'); - $select->set_layout('option_data', '<{tag_option} value="{data_ext id="option_value"}" selected="selected">{data_ext id="option_text"}'); + $select->set_layout('option', '<{tag_option} value="{data_ext id="option_value" context="attr"}">{data_ext id="option_text"}'); + $select->set_layout('option_data', '<{tag_option} value="{data_ext id="option_value" context="attr"}" selected="selected">{data_ext id="option_text"}'); $this->add($select); // Span From c8c0fc85553cb86fdac448feb5215ea3b599f19f Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 16:40:49 -1000 Subject: [PATCH 27/59] Fields:Meta:Add `@since` tag to `Field_Base::format_attr()` --- includes/class.field_base.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index a4d872e..c4c853a 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -1036,7 +1036,9 @@ function format($value, $context = '') { * Format value for output as an attribute. * * Only strings are formatted. - * + * + * @since dev + * * @param mixed $value Value to format. * @return mixed Formatted value. */ From 2c8d3eef0b6c5d08da2611f46761b9937813aeeb Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 16:56:40 -1000 Subject: [PATCH 28/59] Fields:Add `Field_Base::format_text()` method. --- includes/class.field_base.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index c4c853a..a069a20 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -1049,6 +1049,24 @@ function format_attr( $value ) { return $value; } + /** + * Formats value for output as plain text. + * + * Escapes HTML, etc. + * Only strings are formatted. + * + * @since dev + * + * @param mixed $value Value to format. + * @return mixed Formatted value. + */ + function format_text( $value ) { + if ( is_string( $value ) ) { + $value = esc_html( $value ); + } + return $value; + } + /** * Final formatting before output * Restores special characters, etc. From c146aa7c44981ff42e66739193c3e982d2dfd247 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 16:57:28 -1000 Subject: [PATCH 29/59] Fields:Select:Format data used for option text as plain text (escape HTML, etc.). --- includes/class.fields.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class.fields.php b/includes/class.fields.php index b21bf83..9acd96d 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -111,8 +111,8 @@ function register_types() { $select->set_property('options', array()); $select->set_layout('form', '{label ref_base="layout"} {form_start ref_base="layout"}{option_loop ref_base="layout"}{form_end ref_base="layout"}'); $select->set_layout('option_loop', '{loop data="properties.options" layout="option" layout_data="option_data"}'); - $select->set_layout('option', '<{tag_option} value="{data_ext id="option_value" context="attr"}">{data_ext id="option_text"}'); - $select->set_layout('option_data', '<{tag_option} value="{data_ext id="option_value" context="attr"}" selected="selected">{data_ext id="option_text"}'); + $select->set_layout('option', '<{tag_option} value="{data_ext id="option_value" context="attr"}">{data_ext id="option_text" context="text"}'); + $select->set_layout('option_data', '<{tag_option} value="{data_ext id="option_value" context="attr"}" selected="selected">{data_ext id="option_text" context="text"}'); $this->add($select); // Span From 68aea9d559774fe9d1d7090ab1eb31c9796423ca Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 17:00:09 -1000 Subject: [PATCH 30/59] Fields:Optimize `Field_Base::format_attr()` formatting. --- includes/class.field_base.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index a069a20..ecbfa7d 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -1043,8 +1043,8 @@ function format($value, $context = '') { * @return mixed Formatted value. */ function format_attr( $value ) { - if ( is_string($value) ) { - $value = esc_attr($value); + if ( is_string( $value ) ) { + $value = esc_attr( $value ); } return $value; } From a19d14e50c6e2c88ea199d42b86cff5f455952f7 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 18:00:15 -1000 Subject: [PATCH 31/59] Fields:Optimize placeholder output formatting (special character handling). --- includes/class.field_type.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 0786084..1634ea3 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -410,9 +410,13 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) { $target_property = ''; } - // Format output based on context. - if ( ! empty( $target_property ) && isset( $instance['attributes']['context'] ) ) { - $target_property = $this->format( $target_property, $instance['attributes']['context'] ); + // Format output. + if ( ! empty( $target_property ) ) { + $context = ( isset( $instance['attributes']['context'] ) ) ? $instance['attributes']['context'] : ''; + // Handle special characters. + $target_property = $this->preserve_special_chars( $target_property, $context ); + // Context-specific formatting. + $target_property = $this->format( $target_property, $context ); } // Replace layout placeholder with retrieved item data From 437e1a25e22e8ffeeeca0ef1a427969c2ef056a6 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 31 Oct 2019 18:17:28 -1000 Subject: [PATCH 32/59] Fields:Remove redundant formatting in `Fields::process_placeholder_data()` Placeholder formatting handled upstream. --- includes/class.field_type.php | 14 ++++++-------- includes/class.fields.php | 17 ++++++----------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 1634ea3..066b0af 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -401,17 +401,11 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) { // Process value based on placeholder name $target_property = $this->util->apply_filters( array( 'process_placeholder_' . $tag, false ), '', $this, $instance, $layout, $data ); // Process value using default processors (if necessary) - if ( '' == $target_property ) { + if ( '' === $target_property ) { $target_property = $this->util->apply_filters( array( 'process_placeholder', false ), $target_property, $this, $instance, $layout, $data ); } - - // Clear value if value not a string - if ( !is_scalar( $target_property ) ) { - $target_property = ''; - } - // Format output. - if ( ! empty( $target_property ) ) { + if ( ! is_null( $target_property ) ) { $context = ( isset( $instance['attributes']['context'] ) ) ? $instance['attributes']['context'] : ''; // Handle special characters. $target_property = $this->preserve_special_chars( $target_property, $context ); @@ -419,6 +413,10 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) { $target_property = $this->format( $target_property, $context ); } + // Clear value if value not a string + if ( !is_scalar( $target_property ) ) { + $target_property = ''; + } // Replace layout placeholder with retrieved item data $str = str_replace( $ph->start . $instance['match'] . $ph->end, $target_property, $str ); } diff --git a/includes/class.fields.php b/includes/class.fields.php index 9acd96d..df45aa4 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -268,24 +268,19 @@ function process_placeholder_label($output, $item, $placeholder, $layout, $data) * @return string Placeholder output */ function process_placeholder_data($output, $item, $placeholder, $layout) { - $attr_default = array ( - 'context' => '', - ); - $opts = wp_parse_args($placeholder['attributes'], $attr_default); - // Save context to separate variable - $context = $opts['context']; - unset($opts['context']); + $opts = $placeholder['attributes']; + // Strip context from data retrieval options (Formatting handled upstream). + if ( is_array( $opts ) ) { + unset( $opts['context'] ); + } // Get data $out = $item->get_data($opts); - if ( !is_null($out) ) { + if ( ! is_null($out) ) { // Get specific member in value (e.g. value from a specific item element) if ( isset($opts['element']) && is_array($out) && ( $el = $opts['element'] ) && isset($out[$el]) ) $out = $out[$el]; } - // Format data based on context - $out = $item->preserve_special_chars($out, $context); - $out = $item->format($out, $context); // Return data return $out; } From 05ad2b50ade75d429473103fc11d82fa82cfe7fb Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 6 Nov 2019 12:56:54 -1000 Subject: [PATCH 33/59] Fields: Refactor `Field_Type::parse_layout()` * Add default placeholder properties. * Break bulk of code out of conditional. * Optimize variable declaration. --- includes/class.field_type.php | 122 +++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 52 deletions(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 066b0af..226d9ea 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -260,75 +260,93 @@ function is_valid_layout($layout_content) { * 'attributes' => (array) attributes */ function parse_layout($layout, $search) { - $ph_xml = ''; $parse_match = ''; + $result = []; + + // Find all nested layouts in layout. + $match_value = preg_match_all( $search, $layout, $parse_match, PREG_PATTERN_ORDER ); + + // Stop if no matches found. + if ( ! $match_value ) { + return $result; + } + + /* Process matches */ + + $ph_xml = ''; $ph_root_tag = 'ph_root_element'; $ph_start_xml = '<'; $ph_end_xml = ' />'; $ph_wrap_start = '<' . $ph_root_tag . '>'; $ph_wrap_end = ''; - $parse_result = false; + $parse_result = []; - // Find all nested layouts in layout - $match_value = preg_match_all($search, $layout, $parse_match, PREG_PATTERN_ORDER); + // Get all matched elements. + $parse_match = $parse_match[1]; - if ($match_value !== false && $match_value > 0) { - $parse_result = array(); - // Get all matched elements - $parse_match = $parse_match[1]; + // Build XML string from placeholders. + foreach ( $parse_match as $ph ) { + $ph_xml .= $ph_start_xml . $ph . $ph_end_xml . ' '; + } + $ph_xml = $ph_wrap_start . $ph_xml . $ph_wrap_end; + // Parse XML data. + $ph_prs = xml_parser_create(); + xml_parser_set_option($ph_prs, XML_OPTION_SKIP_WHITE, 1); + xml_parser_set_option($ph_prs, XML_OPTION_CASE_FOLDING, 0); + $ph_parsed = xml_parse_into_struct($ph_prs, $ph_xml, $parse_result['values'], $parse_result['index']); + xml_parser_free($ph_prs); + + // Stop if placeholder parsing failed. + if ( ! $ph_parsed ) { + return $result; + } - // Build XML string from placeholders - foreach ($parse_match as $ph) { - $ph_xml .= $ph_start_xml . $ph . $ph_end_xml . ' '; - } - $ph_xml = $ph_wrap_start . $ph_xml . $ph_wrap_end; - // Parse XML data - $ph_prs = xml_parser_create(); - xml_parser_set_option($ph_prs, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($ph_prs, XML_OPTION_CASE_FOLDING, 0); - $ret = xml_parse_into_struct($ph_prs, $ph_xml, $parse_result['values'], $parse_result['index']); - xml_parser_free($ph_prs); - - // Build structured array with all parsed data - - unset($parse_result['index'][$ph_root_tag]); - - // Build structured array - $result = array(); - foreach ($parse_result['index'] as $tag => $instances) { - $result[$tag] = array(); - // Instances - foreach ($instances as $instance) { - // Skip instance if it doesn't exist in parse results - if (!isset($parse_result['values'][$instance])) - continue; - - // Stop processing instance if a previously-saved instance with the same options already exists - foreach ($result[$tag] as $tag_match) { - if ($tag_match['match'] == $parse_match[$instance - 1]) - continue 2; + unset( $parse_result['index'][$ph_root_tag] ); + + // Build structured array with all parsed data. + $ph_default = [ + 'tag' => '', + 'match' => '', + 'attributes' => [], + ]; + + // Build structured array. + foreach ( $parse_result['index'] as $tag => $instances ) { + // Create container for instances of current placeholder. + $result[ $tag ] = []; + // Process placeholder instances. + foreach ( $instances as $instance ) { + // Skip instance if it doesn't exist in parse results. + if ( !isset( $parse_result['values'][ $instance ] ) ) { + continue; + } + // Stop processing instance if a previously-saved instance with the same options already exists. + foreach ( $result[ $tag ] as $tag_match ) { + if ( $tag_match['match'] == $parse_match[ $instance - 1 ] ) { + continue 2; } + } + $instance_parsed = $parse_result['values'][ $instance ]; + // Init instance data array. + $instance_data = $ph_default; - // Init instance data array - $inst_data = array(); - - // Add Tag to array - $inst_data['tag'] = $parse_result['values'][$instance]['tag']; + // Set tag. + $instance_data['tag'] = $instance_parsed['tag']; - // Add instance data to array - $inst_data['attributes'] = (isset($parse_result['values'][$instance]['attributes'])) ? $inst_data['attributes'] = $parse_result['values'][$instance]['attributes'] : ''; + // Set attributes. + if ( isset( $instance_parsed['attributes'] ) && is_array( $instance_parsed['attributes'] ) ) { + $instance_data['attributes'] = $instance_parsed['attributes']; + } - // Add match to array - $inst_data['match'] = $parse_match[$instance - 1]; + // Add match to array. + $instance_data['match'] = $parse_match[ $instance - 1 ]; - // Add to result array - $result[$tag][] = $inst_data; - } + // Add to result array. + $result[ $tag ][] = $instance_data; } - $parse_result = $result; } - return $parse_result; + return $result; } /** From 485be01f626d2579ab5ad3737fb5ebac6d3328a0 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 6 Nov 2019 12:59:28 -1000 Subject: [PATCH 34/59] Fields: Pass placeholder to handlers by reference * In `Field_Type::process_placeholders()` --- includes/class.field_type.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 226d9ea..546f8bd 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -416,11 +416,11 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) { foreach ( $ph->match as $tag => $instances ) { // Iterate through instances of current placeholder foreach ( $instances as $instance ) { - // Process value based on placeholder name - $target_property = $this->util->apply_filters( array( 'process_placeholder_' . $tag, false ), '', $this, $instance, $layout, $data ); - // Process value using default processors (if necessary) + // Process value based on placeholder name. + $target_property = $this->util->apply_filters_ref_array( 'process_placeholder_' . $tag, [ '', $this, &$instance, $layout, $data ], false ); + // Process value using default processors (if necessary). if ( '' === $target_property ) { - $target_property = $this->util->apply_filters( array( 'process_placeholder', false ), $target_property, $this, $instance, $layout, $data ); + $target_property = $this->util->apply_filters_ref_array( 'process_placeholder', [ $target_property, $this, &$instance, $layout, $data ], false ); } // Format output. if ( ! is_null( $target_property ) ) { From 0be2f5c57bfdf7f080868a0fc2e4c3142436e1ff Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 6 Nov 2019 13:02:27 -1000 Subject: [PATCH 35/59] Fields:Set default placeholder context via handler * `Fields::process_placeholder_id()` (Default Context: `attr`). * `Fields::process_placeholder_name()` (Default Context: `attr`). --- includes/class.fields.php | 53 +++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/includes/class.fields.php b/includes/class.fields.php index df45aa4..15d4223 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -226,26 +226,53 @@ function process_placeholder_default($output, $item, $placeholder, $layout, $dat } /** - * Build Field ID attribute - * @see SLB_Field_Type::process_placeholder_default for parameter descriptions - * @return string Placeholder output + * Renders field ID formatted for a form field's `id` attribute. + * + * ID is formatted to be unique identifier for form field. + * Example: `options_field_id`. + * Registered as handler for `{field_id}` placeholder. + * + * @param string $output Placeholder's rendered value. + * @param SLB_Field $item Field containing placeholder. + * @param array &$placeholder Placeholder being processed. + * @param string $layout Name of layout being built. + * @param array $data Additional data for current field. + * @return string Field's ID (formatted for a form field's `id` attribute). */ - function process_placeholder_id($output, $item, $placeholder, $layout, $data) { + function process_placeholder_id( $output, $item, &$placeholder, $layout, $data ) { // Get attributes - $args = wp_parse_args($placeholder['attributes'], array('format' => 'attr_id')); - return esc_attr( $item->get_id($args) ); + $args = wp_parse_args($placeholder['attributes'], array('format' => 'attr_id')); + $output = $item->get_id($args); + // Set default placeholder context. + if ( ! isset( $placeholder['attributes']['context'] ) ) { + $placeholder['attributes']['context'] = 'attr'; + } + return $output; } - + /** - * Build Field name attribute - * Name is formatted as an associative array for processing by PHP after submission - * @see SLB_Field_Type::process_placeholder_default for parameter descriptions - * @return string Placeholder output + * Renders field ID formatted for a form field's `name` attribute. + * + * ID is formatted to be part of an associative array for processing form submission. + * Example: `options[field_id]`. + * Registered as handler for `{field_name}` placeholder. + * + * @param string $output Placeholder's rendered value. + * @param SLB_Field $item Field containing placeholder. + * @param array &$placeholder Placeholder being processed. + * @param string $layout Name of layout being built. + * @param array $data Additional data for current field. + * @return string Field's ID (formatted for a form field's `name` attribute). */ - function process_placeholder_name($output, $item, $placeholder, $layout, $data) { + function process_placeholder_name($output, $item, &$placeholder, $layout, $data) { // Get attributes $args = wp_parse_args($placeholder['attributes'], array('format' => 'attr_name')); - return esc_attr( $item->get_id($args) ); + $output = $item->get_id($args); + // Set default placeholder context. + if ( ! isset( $placeholder['attributes']['context'] ) ) { + $placeholder['attributes']['context'] = 'attr'; + } + return $output; } /** From 1f606b56eee02e10e06023b1486f854f0419a68e Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 6 Nov 2019 13:25:29 -1000 Subject: [PATCH 36/59] Fields:Escape property name when rendering `{properties}` placeholder. --- includes/class.fields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.fields.php b/includes/class.fields.php index 15d4223..d7af102 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -208,7 +208,7 @@ function process_placeholder_default($output, $item, $placeholder, $layout, $dat // Process placeholders. $prop_val = $item->process_placeholders( $prop_val, $layout, $data ); // Add property to attribute string output. - $group_out[] = $prop_key . '="' . esc_attr( $prop_val ) . '"'; + $group_out[] = esc_attr( $prop_key ) . '="' . esc_attr( $prop_val ) . '"'; } } $output = implode(' ', $group_out); From 0e59e063af7bd65cd8b84da1d385bbf36a175352 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 6 Nov 2019 16:30:11 -1000 Subject: [PATCH 37/59] Fields:Cleanup placeholder processor filter hook Include variable in double-quoted string instead of string concatenation. --- includes/class.field_type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 546f8bd..81df6e8 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -417,7 +417,7 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) { // Iterate through instances of current placeholder foreach ( $instances as $instance ) { // Process value based on placeholder name. - $target_property = $this->util->apply_filters_ref_array( 'process_placeholder_' . $tag, [ '', $this, &$instance, $layout, $data ], false ); + $target_property = $this->util->apply_filters_ref_array( "process_placeholder_${tag}", [ '', $this, &$instance, $layout, $data ], false ); // Process value using default processors (if necessary). if ( '' === $target_property ) { $target_property = $this->util->apply_filters_ref_array( 'process_placeholder', [ $target_property, $this, &$instance, $layout, $data ], false ); From 99fc566112ec4dc0199a1c19ad411aa8d3a9fe73 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Fri, 15 Nov 2019 15:48:06 -1000 Subject: [PATCH 38/59] Options:Use `$_POST` instead of `$_REQUEST` to process form submissions. --- includes/class.options.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/class.options.php b/includes/class.options.php index e6dba91..8be97ba 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -306,8 +306,8 @@ function set_parents($fields) { function validate($values = null) { $qvar = $this->get_id('formatted'); // Check for submitted data (e.g. form submission) when no values passed to method. - if ( empty($values) && isset($_REQUEST[$qvar]) && check_admin_referer( $qvar, $qvar . '_nonce' ) ) { - $values = $_REQUEST[$qvar]; + if ( empty($values) && isset($_POST[$qvar]) && check_admin_referer( $qvar, $qvar . '_nonce' ) ) { + $values = $_POST[$qvar]; } if ( is_array($values) ) { // Format data based on option type (bool, string, etc.) @@ -323,8 +323,8 @@ function validate($values = null) { // Get groups that were output in request $qvar_groups = $qvar . '_groups'; - if ( isset($_REQUEST[$qvar_groups]) ) { - $groups = explode( ',', implode(',', $_REQUEST[$qvar_groups]) ); + if ( isset($_POST[$qvar_groups]) ) { + $groups = explode( ',', implode(',', $_POST[$qvar_groups]) ); // Get group items $items = array(); @@ -619,7 +619,7 @@ public function admin_build_group($obj, $box) { */ public function admin_parse_build_vars($vars, $opts) { // Handle form submission - if ( isset($_REQUEST[$opts->get_id('formatted')]) ) { + if ( isset($_POST[$opts->get_id('formatted')]) ) { $vars['validate_pre'] = $vars['save_pre'] = true; } return $vars; From e5c35817b0d4e1b0e89b02c9a37b25306bf1a128 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Fri, 15 Nov 2019 16:33:41 -1000 Subject: [PATCH 39/59] Fields:Set visibility for `Field_Base::$data_loaded` property to `protected`. --- includes/class.field_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index ecbfa7d..10b1bb2 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -111,7 +111,7 @@ class SLB_Field_Base extends SLB_Base { * Whether data has been fetched or not * @var bool */ - var $data_loaded = false; + protected $data_loaded = false; /** * @var array Script resources to include for object From add198cb1fb14c6ede8210d116a17cfa7f81785e Mon Sep 17 00:00:00 2001 From: Archetyped Date: Fri, 15 Nov 2019 16:35:18 -1000 Subject: [PATCH 40/59] Options:Call `parent::load_data()` instead of modifying `$data_loaded` property directly. --- includes/class.options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.options.php b/includes/class.options.php index 8be97ba..1fc943d 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -382,7 +382,7 @@ function load_data() { if ( !$this->data_loaded ) { // Retrieve data $this->data = $this->fetch_data(); - $this->data_loaded = true; + parent::load_data(); // Check update $this->check_update(); } From 182c5cf23db04af3ca5e1c1232e0142825893916 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Mon, 25 Nov 2019 12:35:35 -1000 Subject: [PATCH 41/59] Options:Optimize `Options::validate()` data validation/sanitization * Refactor flow - parameter evaluation, default form submission handling, etc. * Optimize data type enforcement. * Optimize data sanitization. --- includes/class.options.php | 117 ++++++++++++++++++++++++------------- 1 file changed, 75 insertions(+), 42 deletions(-) diff --git a/includes/class.options.php b/includes/class.options.php index 1fc943d..ac4d364 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -294,61 +294,94 @@ function set_parents($fields) { /* Processing */ /** - * Validate option values. + * Validates option data. * - * Used for validating options (e.g. admin form submission) prior to saving options to DB. - * Reformats values based on options' default values (i.e. bool, int, string, etc.). - * Adds option items not included in original submission. + * Validates option values (e.g. prior to saving to DB, after form submission, etc.). + * Values are formatted and sanitized according to corresponding option's data type + * (e.g. boolean, string, number, etc.). * - * @param array $values (optional) Option values to validate. - * @return array Full options data. + * @since 1.5.5 + * + * @param array $values Optional. Option data to validate. + * Indexed by option ID. + * Default form-submission data used. + * @return array Validated data. Indexed by option ID. */ - function validate($values = null) { - $qvar = $this->get_id('formatted'); - // Check for submitted data (e.g. form submission) when no values passed to method. - if ( empty($values) && isset($_POST[$qvar]) && check_admin_referer( $qvar, $qvar . '_nonce' ) ) { - $values = $_POST[$qvar]; + function validate( $values = null ) { + /** @var array $values_valid Validated option data. Indexed by option ID. */ + $values_valid = []; + // Enforce values data type. + if ( ! is_array( $values ) ) { + /** @var array $values */ + $values = []; } - if ( is_array($values) ) { - // Format data based on option type (bool, string, etc.) - foreach ( $values as $id => $val ) { - // Get default - $d = $this->get_default($id); - if ( is_bool($d) && !empty($val) ) - $values[$id] = true; - } - - // Merge in additional options that are not in post data - // Missing options (e.g. disabled checkboxes, empty fields, etc.) - - // Get groups that were output in request + // Get options form field group ID. + $qvar = $this->get_id('formatted'); + // Use form submission data when no values provided. + if ( empty( $values ) && isset( $_POST[ $qvar ] ) && check_admin_referer( $qvar, $qvar . '_nonce' ) ) { + /** @var array $values */ + $values = $_POST[ $qvar ]; + // Append non-submitted, but rendered fields (e.g. unchecked checkboxes) $qvar_groups = $qvar . '_groups'; - if ( isset($_POST[$qvar_groups]) ) { - $groups = explode( ',', implode(',', $_POST[$qvar_groups]) ); + if ( isset( $_POST[ $qvar_groups ] ) ) { + // Merge all group names into single array (accomodate multiple fields with groups). + $groups = explode( ',', implode( ',', $_POST[ $qvar_groups ] ) ); - // Get group items - $items = array(); - $items_temp = null; + // Get items in each group. + $items = array(); foreach ( $groups as $gid ) { - $items_temp = $this->get_group_items($gid); - $items = array_merge($items, $items_temp); + $items = array_merge( $items, $this->get_group_items( $gid ) ); } - unset($items_temp); - $items = call_user_func_array('array_merge', $items); + // Flatten item array (break out of priority grouping). + $items = array_merge( ...$items ); + // Add boolean options (marked as false). foreach ( $items as $id => $opt ) { - // Add options that were not included in form submission - if ( !array_key_exists($id, $values) ) { - if ( is_bool($opt->get_default()) ) - $values[$id] = false; - else - $values[$id] = $opt->get_default(); + if ( ! array_key_exists( $id, $values ) && is_bool( $opt->get_default() ) ) { + $values_valid[ $id ] = false; } } } } - - // Return value - return $values; + // Process values. + /** + * @var string $id Option ID. + * @var mixed $val Option value (raw/unsanitized). + */ + foreach ( $values as $id => $val ) { + // Do not process invalid option IDs or invalid (non-scalar) data. + if ( ! $this->has( $id ) || ! is_scalar( $val ) ) { + continue; + } + // Conform to option's data type and sanitize. + /** @var scalar $d Option's default data. */ + $d = $this->get_default( $id ); + // Boolean. + if ( is_bool( $d ) ) { + $val = !! $val; + } + // Numeric - do not process non-numeric values for int/float fields. + elseif ( ( is_int( $d ) || is_float( $d ) ) && ! is_numeric( $val ) ) { + continue; + } + // Integer. + elseif ( is_int( $d ) ) { + $val = (int) $val; + } + // Float. + elseif ( is_float( $d ) ) { + $val = (float) $val; + } + // Defaut: Handle as string. + else { + $val = sanitize_text_field( $val ); + } + // Add to validated data. + $values_valid[ $id ] = $val; + } + unset( $id, $val ); + + // Return validated values. + return $values_valid; } /* Data */ From 0b074af192a1a1aff85271a3148a747f443a39a5 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Mon, 25 Nov 2019 17:30:08 -1000 Subject: [PATCH 42/59] Options:Form:Add fields to keep track of boolean options * Fields are passed with form submission to handle non-submitted data (e.g. unchecked checkboxes). --- includes/class.options.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/class.options.php b/includes/class.options.php index ac4d364..e6b6483 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -257,7 +257,8 @@ function register_fields($fields) { // Checkbox $ocb = new SLB_Field_Type('option_checkbox', 'checkbox'); $ocb->set_layout('label', $l->label); - $ocb->set_layout('form', $form); + $ocb->set_layout('field_reference', sprintf( '', "{$this->get_id('formatted')}_items[]" ) ); + $ocb->set_layout('form', '{field_reference ref_base="layout"}' . $form); $fields->add($ocb); // Select @@ -621,7 +622,7 @@ public function admin_build_groups() { add_meta_box($g->id, $g->title, $this->m('admin_build_group'), $state->screen, $state->context, $state->priority, array('group' => $g->id, 'page' => $page)); $groups_built[] = $gid; } - + // Define groups built if ( !empty($groups_built) ) { echo $this->util->build_html_element(array( @@ -633,6 +634,9 @@ public function admin_build_groups() { ), )); } + + // Add list of rendered boolean options. + } /** From 120ed6289137ebbc93cbfc7c6e8a1cb15ae4477a Mon Sep 17 00:00:00 2001 From: Archetyped Date: Mon, 25 Nov 2019 18:01:04 -1000 Subject: [PATCH 43/59] Options:Refactor `Options::validate()`:Use field references to handle rendered options not included in form submission (e.g. unchecked checkboxes). * Remove references to rendered option groups list. --- includes/class.options.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/includes/class.options.php b/includes/class.options.php index e6b6483..6254f02 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -323,25 +323,18 @@ function validate( $values = null ) { /** @var array $values */ $values = $_POST[ $qvar ]; // Append non-submitted, but rendered fields (e.g. unchecked checkboxes) - $qvar_groups = $qvar . '_groups'; - if ( isset( $_POST[ $qvar_groups ] ) ) { - // Merge all group names into single array (accomodate multiple fields with groups). - $groups = explode( ',', implode( ',', $_POST[ $qvar_groups ] ) ); - - // Get items in each group. - $items = array(); - foreach ( $groups as $gid ) { - $items = array_merge( $items, $this->get_group_items( $gid ) ); - } - // Flatten item array (break out of priority grouping). - $items = array_merge( ...$items ); - // Add boolean options (marked as false). - foreach ( $items as $id => $opt ) { - if ( ! array_key_exists( $id, $values ) && is_bool( $opt->get_default() ) ) { - $values_valid[ $id ] = false; + $qvar_items = "{$qvar}_items"; + /** @var string[] $items_bool Boolean options rendered in submitted form. */ + $items_bool = ( isset( $_POST[ $qvar_items ] ) ) ? $_POST[ $qvar_items ] : null; + if ( ! empty( $items_bool ) && is_array( $items_bool) ) { + foreach ( $items_bool as $item_id ) { + // Add missing boolean options (false == unchecked). + if ( ! array_key_exists( $item_id, $values ) && $this->has( $item_id ) && is_bool( $this->get_default( $item_id ) ) ) { + $values_valid[ $item_id ] = false; } } } + unset( $qvar_items, $items_bool, $item_id ); } // Process values. /** From 4cae5e8c07c9e8735351f3ef550c8eaa71d3505b Mon Sep 17 00:00:00 2001 From: Archetyped Date: Mon, 25 Nov 2019 18:03:26 -1000 Subject: [PATCH 44/59] Options:Remove rendered groups list from form output --- includes/class.options.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/includes/class.options.php b/includes/class.options.php index 6254f02..8cf61dd 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -600,7 +600,6 @@ public function admin_build_groups() { // Get all groups $groups_all = $this->get_groups(); - $groups_built = array(); if ( empty($groups) ) { $groups = array_keys($groups_all); } @@ -613,23 +612,7 @@ public function admin_build_groups() { // Add meta box for each group $g = $groups_all[$gid]; add_meta_box($g->id, $g->title, $this->m('admin_build_group'), $state->screen, $state->context, $state->priority, array('group' => $g->id, 'page' => $page)); - $groups_built[] = $gid; } - - // Define groups built - if ( !empty($groups_built) ) { - echo $this->util->build_html_element(array( - 'tag' => 'input', - 'attributes' => array ( - 'type' => 'hidden', - 'value' => implode(',', $groups_built), - 'name' => $this->get_id('formatted') . '_groups[]' - ), - )); - } - - // Add list of rendered boolean options. - } /** From 2dd6ba42246cd837cc5013a6fdb1b5f7ed3d6db5 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Tue, 26 Nov 2019 17:10:44 -1000 Subject: [PATCH 45/59] Options:`Options::validate()`:Optimize query var name generation. * Use closure to generate query vars using a common base. --- includes/class.options.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/includes/class.options.php b/includes/class.options.php index 8cf61dd..2272041 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -316,14 +316,36 @@ function validate( $values = null ) { /** @var array $values */ $values = []; } + /** + * Generates query variable using common base. + * + * @since dev + * + * @param string $text Optional. Text to append to base. + * + * @return string Query variable name. Format: "{base}_{text}". Default "{base}". + */ + $qv = function ( $text = '' ) { + static $base; + // Get base. + if ( empty( $base ) ) { + $base = $this->get_id( 'formatted' ); + } + $out = $base; + // Append text to base. + if ( is_string( $text ) && ! empty( $text ) ) { + $out .= "_{$text}"; + } + return $out; + }; // Get options form field group ID. - $qvar = $this->get_id('formatted'); + $qvar = $qv(); // Use form submission data when no values provided. - if ( empty( $values ) && isset( $_POST[ $qvar ] ) && check_admin_referer( $qvar, $qvar . '_nonce' ) ) { + if ( empty( $values ) && isset( $_POST[ $qvar ] ) && check_admin_referer( $qvar, $qv( 'nonce' ) ) ) { /** @var array $values */ $values = $_POST[ $qvar ]; // Append non-submitted, but rendered fields (e.g. unchecked checkboxes) - $qvar_items = "{$qvar}_items"; + $qvar_items = $qv( 'items' ); /** @var string[] $items_bool Boolean options rendered in submitted form. */ $items_bool = ( isset( $_POST[ $qvar_items ] ) ) ? $_POST[ $qvar_items ] : null; if ( ! empty( $items_bool ) && is_array( $items_bool) ) { From 0584be0186ac4ec9d8514ff2878ef88f872143f9 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 27 Nov 2019 09:48:18 -1000 Subject: [PATCH 46/59] Options:`Options::valiidate()` Cleanup worker var --- includes/class.options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.options.php b/includes/class.options.php index 2272041..55fbc3f 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -356,7 +356,7 @@ function validate( $values = null ) { } } } - unset( $qvar_items, $items_bool, $item_id ); + unset( $qvar, $qvar_items, $items_bool, $item_id ); } // Process values. /** From dfe283d360259459705bbadb8d55db3a6234bca8 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Fri, 6 Dec 2019 16:53:03 -1000 Subject: [PATCH 47/59] Options:Strip escape characters during input sanitization --- includes/class.options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.options.php b/includes/class.options.php index 55fbc3f..1e5f5f1 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -389,7 +389,7 @@ function validate( $values = null ) { } // Defaut: Handle as string. else { - $val = sanitize_text_field( $val ); + $val = sanitize_text_field( wp_unslash( $val ) ); } // Add to validated data. $values_valid[ $id ] = $val; From edf246c6d468a672e2a97e64fd4f6ccde1136536 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 15:37:35 -1000 Subject: [PATCH 48/59] Utilities:Update:`call_client_method()` uses `wp_json_encode()` instead of `json_encode()` * For additional error handling. --- includes/class.utilities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class.utilities.php b/includes/class.utilities.php index 012d414..1b92559 100644 --- a/includes/class.utilities.php +++ b/includes/class.utilities.php @@ -558,7 +558,7 @@ function call_client_method($method, $params = null, $encode = true, $validate = // Build parameters if ( !is_null($params) ) { if ( $encode ) { - $params = json_encode($params); + $params = wp_json_encode($params); } elseif ( is_array($params) ) { $params = implode(',', $params); } From 29de53a14ec578bccc2fd69f230deb8ba067dc85 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 16:57:25 -1000 Subject: [PATCH 49/59] Meta:Update PHP version requirement to v7.2+ --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index de122d2..426d467 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ License: GPLv2 Tags: lightbox, gallery, photography, images, theme, template, style Requires at least: 5.2 Tested up to: 5.2 -Requires PHP: 5.6.20 +Requires PHP: 7.2 Stable tag: trunk The highly customizable lightbox for WordPress From 550238ac2e9b4c6dcc50c066e0f7cdf6e534ce77 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 17:08:53 -1000 Subject: [PATCH 50/59] Meta:Update WordPress version requirement to v5.3+ --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 426d467..f7df74f 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: Archetyped Donate link: http://gum.co/slb-donate License: GPLv2 Tags: lightbox, gallery, photography, images, theme, template, style -Requires at least: 5.2 -Tested up to: 5.2 +Requires at least: 5.3 +Tested up to: 5.3 Requires PHP: 7.2 Stable tag: trunk From fc30244f5370549a1b2b3f46212af1ade98b0296 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 17:16:46 -1000 Subject: [PATCH 51/59] Meta:Combine plugin header with file-level DocBlock --- main.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/main.php b/main.php index b9896d1..585c7d8 100644 --- a/main.php +++ b/main.php @@ -1,22 +1,20 @@ * @copyright 2018 Archetyped - */ - -/* -Plugin Name: Simple Lightbox -Plugin URI: http://archetyped.com/tools/simple-lightbox/ -Description: The highly customizable lightbox for WordPress -Version: 0.0.0-dev -Text Domain: simple-lightbox -Domain Path: /l10n -Author: Archetyped -Author URI: http://archetyped.com -Support URI: https://github.com/archetyped/simple-lightbox/wiki/Feedback-&-Support + * + * Plugin Name: Simple Lightbox + * Plugin URI: http://archetyped.com/tools/simple-lightbox/ + * Description: The highly customizable lightbox for WordPress + * Version: 0.0.0-dev + * Text Domain: simple-lightbox + * Domain Path: /l10n + * Author: Archetyped + * Author URI: http://archetyped.com + * Support URI: https://github.com/archetyped/simple-lightbox/wiki/Feedback-&-Support */ require_once dirname( __FILE__ ) . '/includes/class-requirements-check.php'; From fc500ea68ccf1398b8ce50a9c0993fd3389b75e2 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 17:17:59 -1000 Subject: [PATCH 52/59] Meta:Update copyright year to 2019 --- main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.php b/main.php index 585c7d8..a7d789c 100644 --- a/main.php +++ b/main.php @@ -4,7 +4,7 @@ * * @package Simple Lightbox * @author Archetyped - * @copyright 2018 Archetyped + * @copyright 2019 Archetyped * * Plugin Name: Simple Lightbox * Plugin URI: http://archetyped.com/tools/simple-lightbox/ From 8c5a5ac2bff4c054ba4ad57e45c1e6824f491783 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 17:21:07 -1000 Subject: [PATCH 53/59] Meta:Add WordPress and PHP version requirements (matching `readme.txt` headers). --- main.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.php b/main.php index a7d789c..6bee50b 100644 --- a/main.php +++ b/main.php @@ -10,6 +10,8 @@ * Plugin URI: http://archetyped.com/tools/simple-lightbox/ * Description: The highly customizable lightbox for WordPress * Version: 0.0.0-dev + * Requires at least: 5.3 + * Requires PHP: 7.2 * Text Domain: simple-lightbox * Domain Path: /l10n * Author: Archetyped From b92e9482281e166b1caf3653bd9e62b15a801133 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 17:36:30 -1000 Subject: [PATCH 54/59] Maintenance:Remove trailing whitespace (PHP files) --- controller.php | 328 +++++++++++----------- functions.php | 2 +- includes/class.admin.php | 124 ++++----- includes/class.admin_action.php | 34 +-- includes/class.admin_menu.php | 10 +- includes/class.admin_page.php | 26 +- includes/class.admin_section.php | 10 +- includes/class.admin_view.php | 130 ++++----- includes/class.base.php | 114 ++++---- includes/class.base_collection.php | 60 ++-- includes/class.base_object.php | 58 ++-- includes/class.collection_controller.php | 20 +- includes/class.component.php | 30 +- includes/class.content_handler.php | 20 +- includes/class.content_handlers.php | 62 ++--- includes/class.field_base.php | 154 +++++------ includes/class.field_collection.php | 116 ++++---- includes/class.field_type.php | 20 +- includes/class.fields.php | 66 ++--- includes/class.option.php | 42 +-- includes/class.options.php | 126 ++++----- includes/class.template_tags.php | 32 +-- includes/class.theme.php | 24 +- includes/class.themes.php | 68 ++--- includes/class.utilities.php | 336 +++++++++++------------ 25 files changed, 1006 insertions(+), 1006 deletions(-) diff --git a/controller.php b/controller.php index 568f8f1..1e6982b 100644 --- a/controller.php +++ b/controller.php @@ -1,33 +1,33 @@ - [], 'uri' => [] ]; - + /** * Manage excluded content * @var object */ private $exclude = null; - + private $groups = array ( 'auto' => 0, 'manual' => array(), ); - + /** * Validated URIs * Caches validation of parsed URIs @@ -125,22 +125,22 @@ class SLB_Lightbox extends SLB_Base { * @var array */ private $validated_uris = array(); - + /* Widget properties */ - + /** * Used to track if widget is currently being processed or not * Set to Widget ID currently being processed * @var bool|string */ private $widget_processing = false; - + /** * Parameters for widget being processed * @param array */ private $widget_processing_params = null; - + /** * Manage nested widget processing * Used to avoid premature widget output @@ -150,7 +150,7 @@ class SLB_Lightbox extends SLB_Base { /** * Constructor - */ + */ public function __construct() { parent::__construct(); // Init instances @@ -160,14 +160,14 @@ public function __construct() { $this->template_tags = new SLB_Template_Tags($this); } } - + /* Init */ - + public function _init() { parent::_init(); $this->util->do_action('init'); } - + /** * Declare client files (scripts, styles) * @uses parent::_client_files() @@ -200,7 +200,7 @@ protected function _client_files($files = null) { ); parent::_client_files($files); } - + /** * Register hooks * @uses parent::_hooks() @@ -211,18 +211,18 @@ protected function _hooks() { /* Admin */ add_action('admin_menu', $this->m('admin_menus')); $this->util->add_filter('admin_plugin_row_meta_support', $this->m('admin_plugin_row_meta_support')); - + /* Init */ add_action('wp', $this->m('_hooks_init')); } - + /** * Init Hooks */ public function _hooks_init() { if ( $this->is_enabled() ) { $priority = $this->util->priority('low'); - + // Init lightbox add_action('wp_footer', $this->m('client_footer')); $this->util->add_action('footer_script', $this->m('client_init'), 1); @@ -236,17 +236,17 @@ public function _hooks_init() { $this->util->add_filter('pre_process_links', $this->m('exclude_content')); $this->util->add_filter('pre_exclude_content', $this->m('exclude_shortcodes')); $this->util->add_filter('post_process_links', $this->m('restore_excluded_content')); - + // Grouping if ( $this->options->get_bool('group_post') ) { - $this->util->add_filter('get_group_id', $this->m('post_group_id'), 1); + $this->util->add_filter('get_group_id', $this->m('post_group_id'), 1); } - + // Shortcode grouping if ( $this->options->get_bool('group_gallery') ) { add_filter('the_content', $this->m('group_shortcodes'), 1); } - + // Widgets if ( $this->options->get_bool('enabled_widget') ) { add_action('dynamic_sidebar_before', $this->m('widget_process_nested')); @@ -258,7 +258,7 @@ public function _hooks_init() { add_action('dynamic_sidebar_before', $this->m('widget_block_start')); add_action('dynamic_sidebar_after', $this->m('widget_block_finish')); } - + // Menus if ( $this->options->get_bool('enabled_menu') ) { add_filter('wp_nav_menu', $this->m('menu_process'), $priority, 2); @@ -282,7 +282,7 @@ public function post_group_id($group_segments) { } return $group_segments; } - + /** * Init options */ @@ -314,7 +314,7 @@ protected function _options() { 'slideshow_duration' => array('title' => __('Slide Duration (Seconds)', 'simple-lightbox'), 'default' => '6', 'attr' => array('size' => 3, 'maxlength' => 3), 'group' => array('ui', 40), 'in_client' => true), 'group_loop' => array('title' => __('Loop through items', 'simple-lightbox'),'default' => true, 'group' => array('ui', 50), 'in_client' => true), 'ui_overlay_opacity' => array('title' => __('Overlay Opacity (0 - 1)', 'simple-lightbox'), 'default' => '0.8', 'attr' => array('size' => 3, 'maxlength' => 3), 'group' => array('ui', 60), 'in_client' => true), - 'ui_title_default' => array('title' => __('Enable default title', 'simple-lightbox'), 'default' => false, 'group' => array('ui', 70), 'in_client' => true), + 'ui_title_default' => array('title' => __('Enable default title', 'simple-lightbox'), 'default' => false, 'group' => array('ui', 70), 'in_client' => true), 'txt_loading' => array('title' => __('Loading indicator', 'simple-lightbox'), 'default' => 'Loading', 'group' => array('labels', 20)), 'txt_close' => array('title' => __('Close button', 'simple-lightbox'), 'default' => 'Close', 'group' => array('labels', 10)), 'txt_nav_next' => array('title' => __('Next Item button', 'simple-lightbox'), 'default' => 'Next', 'group' => array('labels', 30)), @@ -348,7 +348,7 @@ protected function _options() { 'txt_closeLink' => 'txt_link_close', 'txt_nextLink' => 'txt_link_next', 'txt_prevLink' => 'txt_link_prev', - 'txt_startSlideshow' => 'txt_slideshow_start', + 'txt_startSlideshow' => 'txt_slideshow_start', 'txt_stopSlideshow' => 'txt_slideshow_stop', 'txt_loadingMsg' => 'txt_loading', 'txt_link_next' => 'txt_nav_next', @@ -356,12 +356,12 @@ protected function _options() { 'txt_link_close' => 'txt_close', ) ); - + parent::_set_options($opts); } /* Methods */ - + /*-** Admin **-*/ /** @@ -378,13 +378,13 @@ function admin_menus() { $pg_opts = $this->admin->add_theme_page('options', $lbls_opts) ->require_form() ->add_content('options', 'Options', $this->options); - + // Add Support information $support = $this->util->get_plugin_info('SupportURI'); if ( !empty($support) ) { $pg_opts->add_content('support', __('Feedback & Support', 'simple-lightbox'), $this->m('theme_page_callback_support'), 'secondary'); } - + // Add Actions $lbls_reset = array ( 'title' => __('Reset', 'simple-lightbox'), @@ -394,7 +394,7 @@ function admin_menus() { ); $this->admin->add_action('reset', $lbls_reset, $this->options); } - + /** * Support information */ @@ -407,7 +407,7 @@ public function theme_page_callback_support() { $lnk_txt = __('Get Support & Provide Feedback', 'simple-lightbox'); echo $this->util->build_html_link($lnk_uri, $lnk_txt, array('target' => '_blank', 'class' => 'button')); } - + /** * Filter support link text in plugin metadata * @param string $text Original link text @@ -418,7 +418,7 @@ public function admin_plugin_row_meta_support($text) { } /*-** Functionality **-*/ - + /** * Checks whether lightbox is currently enabled/disabled * @return bool TRUE if lightbox is currently enabled, FALSE otherwise @@ -452,10 +452,10 @@ function is_enabled() { // Return value (force boolean) return !!$ret; } - + /** * Make sure content is valid for processing/activation - * + * * @param string $content Content to validate * @return bool TRUE if content is valid (FALSE otherwise) */ @@ -467,16 +467,16 @@ protected function is_content_valid($content) { // Non-string value if ( !is_string($content) ) return false; - + // Empty string $content = trim($content); if ( empty($content) ) return false; - + // Content is valid return $this->util->apply_filters('is_content_valid', true, $content); } - + /** * Activates galleries extracted from post * @see get_post_galleries() @@ -493,7 +493,7 @@ function activate_galleries($galleries) { if ( is_array($gallery) ) { return $galleries; } - + // Activate galleries $group = ( $this->options->get_bool('group_gallery') ) ? true : null; foreach ( $galleries as $key => $val ) { @@ -502,17 +502,17 @@ function activate_galleries($galleries) { } // Activate links in gallery $gallery = $this->process_links($val, $group); - + // Save modified gallery $galleries[$key] = $gallery; } - + return $galleries; } - + /** * Scans post content for image links and activates them - * + * * Lightbox will not be activated for feeds * @param string $content Content to activate * @param string (optonal) $group Group ID for content @@ -525,23 +525,23 @@ public function activate_links($content, $group = null) { } // Filter content before processing links $content = $this->util->apply_filters('pre_process_links', $content); - + // Process links $content = $this->process_links($content, $group); - + // Filter content after processing links $content = $this->util->apply_filters('post_process_links', $content); - + return $content; } - + /** * Process links in content * @global obj $wpdb DB instance * @global obj $post Current post * @param string $content Text containing links * @param string (optional) $group Group to add links to (Default: none) - * @return string Content with processed links + * @return string Content with processed links */ protected function process_links($content, $group = null) { // Extract links @@ -563,7 +563,7 @@ protected function process_links($content, $group = null) { $uri_proto = (object) array('raw' => '', 'source' => '', 'parts' => ''); } $uri_parts_required = array('host' => ''); - + // Setup group properties $g_props = (object) array( 'enabled' => $this->options->get_bool('group_links'), @@ -575,14 +575,14 @@ protected function process_links($content, $group = null) { if ( $g_props->enabled ) { $g_props->base = ( is_scalar($group) ) ? trim(strval($group)) : ''; } - + // Initialize content handlers if ( !( $this->handlers instanceof SLB_Content_Handlers ) ) { $this->handlers = new SLB_Content_Handlers($this); } - + // Iterate through and activate supported links - + foreach ( $links as $link ) { // Init vars $pid = 0; @@ -592,30 +592,30 @@ protected function process_links($content, $group = null) { $props_extra = array(); $key = null; $internal = false; - + // Parse link attributes $attrs = $this->util->parse_attribute_string($link_new, array('href' => '')); // Get URI $uri->raw = $attrs['href']; - + // Stop processing invalid links if ( !$this->validate_uri($uri->raw) || $this->has_attribute($attrs, 'active', false) // Previously-processed ) { continue; } - + // Normalize URI (make absolute) $uri->source = WP_HTTP::make_absolute_url($uri->raw, $uri_origin['scheme'] . '://' . $uri_origin['host']); - + // URI cached? $key = $this->get_media_item_id($uri->source); - + // Internal URI? (e.g. attachments) if ( !$key ) { $uri->parts = array_merge( $uri_parts_required, (array) parse_url($uri->source) ); $internal = ( $uri->parts['host'] === $uri_origin['host'] ) ? true : false; - + // Attachment? if ( $internal && is_local_attachment($uri->source) ) { $pid = url_to_postid($uri->source); @@ -629,7 +629,7 @@ protected function process_links($content, $group = null) { unset($src); } } - + // Determine content type if ( !$key ) { // Get handler match @@ -643,23 +643,23 @@ protected function process_links($content, $group = null) { unset($props_extra['uri']); } } - + // Cache valid item if ( !!$type ) { $key = $this->cache_media_item($uri, $type, $internal, $props_extra); } } - + // Stop processing invalid links if ( !$key ) { // Cache invalid URI $this->validated_uris[$uri->source] = false; if ( $uri->raw !== $uri->source ) { - $this->validated_uris[$uri->raw] = false; + $this->validated_uris[$uri->raw] = false; } continue; } - + // Activate link $this->set_attribute($attrs, 'active'); $this->set_attribute($attrs, 'asset', $key); @@ -667,7 +667,7 @@ protected function process_links($content, $group = null) { if ( $internal ) { $this->set_attribute($attrs, 'internal', $pid); } - + // Set group (if enabled) if ( $g_props->enabled ) { $group = array(); @@ -678,31 +678,31 @@ protected function process_links($content, $group = null) { } elseif ( !empty($g_props->base) ) { $group[] = $g_props->base; } - + /** * Filter group ID components - * + * * @see process_links() - * + * * @param array $group Components used to build group ID */ $group = $this->util->apply_filters('get_group_id', $group); - + // Default group if ( empty($group) || !is_array($group) ) { $group = $this->get_prefix(); } else { $group = implode('_', $group); } - + // Set group attribute $this->set_attribute($attrs, $g_props->attr, $group); unset($g); } - + // Filter attributes $attrs = $this->util->apply_filters('process_link_attributes', $attrs); - + // Update link in content $link_new = 'util->build_attribute_string($attrs) . '>'; $content = str_replace($link, $link_new, $content); @@ -712,7 +712,7 @@ protected function process_links($content, $group = null) { if ( !!$this->widget_processing && 'the_content' == current_filter() ) { $content = $this->exclude_wrap($content); } - + return $content; } @@ -731,12 +731,12 @@ function get_links($content, $unique = false) { $links = array_unique($links); return $links; } - + /** * Validate URI * Matches specified URI against internal & external regex patterns * URI is **invalid** if it matches a regex - * + * * @param string $uri URI to validate * @return bool TRUE if URI is valid */ @@ -758,7 +758,7 @@ protected function validate_uri($uri) { // Get patterns if ( is_null($patterns) ) { $patterns = $this->util->apply_filters('validate_uri_regex', array()); - } + } // Iterate through patterns until match found foreach ( $patterns as $pattern ) { if ( 1 === preg_match($pattern, $uri) ) { @@ -767,23 +767,23 @@ protected function validate_uri($uri) { } } } - + // Cache $this->validated_uris[$uri] = $valid; return $valid; } - + /** * Add URI validation regex pattern - * @param + * @param */ public function validate_uri_regex_default($patterns) { $patterns[] = '@^https?://[^/]*(wikipedia|wikimedia)\.org/wiki/file:.*$@i'; return $patterns; - } - + } + /* Client */ - + /** * Checks if output should be loaded in current request * @uses `is_enabled()` @@ -793,7 +793,7 @@ public function validate_uri_regex_default($patterns) { public function is_request_valid() { return ( $this->is_enabled() && $this->has_cached_media_items() ) ? true : false; } - + /** * Sets options/settings to initialize lightbox functionality on page load * @return void @@ -801,17 +801,17 @@ public function is_request_valid() { function client_init($client_script) { // Get options $options = $this->options->build_client_output(); - + // Load UI Strings if ( ($labels = $this->build_labels()) && !empty($labels) ) { $options['ui_labels'] = $labels; } - + // Build client output $client_script[] = $this->util->call_client_method('View.init', $options); return $client_script; } - + /** * Output code in footer * > Media attachment URLs @@ -821,14 +821,14 @@ function client_init($client_script) { function client_footer() { if ( !$this->has_cached_media_items() ) return false; - + // Set up hooks add_action('wp_print_footer_scripts', $this->m('client_footer_script')); - + // Build client output $this->util->do_action('footer'); } - + /** * Output client footer scripts */ @@ -838,17 +838,17 @@ function client_footer_script() { echo $this->util->build_script_element($client_script, 'footer', true, true); } } - + /** * Add media information to client output - * + * * @param array $client_script Client script commands. * @return array Modified script commands. * TODO Refactor */ public function client_script_media($client_script) { global $wpdb; - + // Init. $this->media_items = $this->get_cached_media_items(); @@ -861,7 +861,7 @@ public function client_script_media($client_script) { } // Cleanup. unset($key, $p); - + // Process internal links. if ( !empty($m_internals) ) { $uris_base = []; @@ -876,7 +876,7 @@ public function client_script_media($client_script) { } // Cleanup. unset($key, $p); - + // Retrieve attachment IDs. $uris_flat = "('" . implode("','", array_keys($uris_base)) . "')"; $q = $wpdb->prepare("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE `meta_key` = %s AND LOWER(`meta_value`) IN $uris_flat LIMIT %d", '_wp_attached_file', count($uris_base)); @@ -893,7 +893,7 @@ public function client_script_media($client_script) { // Cleanup. unset($uris_base, $uris_flat, $q, $pids, $pd, $file); } - + // Process items with attachment IDs. $pids = []; foreach ( $this->media_items as $key => $p ) { @@ -909,13 +909,13 @@ public function client_script_media($client_script) { } // Cleanup. unset($key, $p); - + // Retrieve attachment properties. if ( !empty($pids) ) { $pids_flat = array_keys($pids); // Retrieve attachment post data. $atts = get_posts(array('post_type' => 'attachment', 'include' => $pids_flat)); - + // Process attachments. if ( $atts ) { /* @future: Metadata @@ -955,7 +955,7 @@ public function client_script_media($client_script) { } // Cleanup. unset($props_post_key, $props_post_source); - + /* @future: Metadata // Process metadata. if ( isset( $atts_meta[$att->ID] ) && ( $a = unserialize( $atts_meta[$att->ID] ) ) && is_array( $a ) ) { @@ -994,7 +994,7 @@ public function client_script_media($client_script) { } /*-** Media **-*/ - + /** * Cache media properties for later processing * @uses array self::$media_items_raw Stores media items for output @@ -1037,7 +1037,7 @@ private function cache_media_item($uri, $type, $internal, $props = null) { } return $key; } - + /** * Retrieve ID for media item * @uses self::$media_items_raw @@ -1050,7 +1050,7 @@ private function get_media_item_id($uri) { } return null; } - + /** * Checks if media item has already been cached * @param string $uri URI of media item @@ -1059,7 +1059,7 @@ private function get_media_item_id($uri) { private function media_item_cached($uri) { return ( is_string($uri) && !empty($uri) && isset($this->media_items_raw['uri'][$uri]) ) ? true : false; } - + /** * Retrieve cached media item * @param string $uri Media item URI @@ -1072,7 +1072,7 @@ private function get_cached_media_item($uri) { } return null; } - + /** * Retrieve cached media items (properties) * @uses self::$media_items_raw @@ -1081,17 +1081,17 @@ private function get_cached_media_item($uri) { private function &get_cached_media_items() { return $this->media_items_raw['props']; } - + /** * Check if media items have been cached * @return boolean */ private function has_cached_media_items() { - return ( empty($this->media_items_raw['props']) ) ? false : true; + return ( empty($this->media_items_raw['props']) ) ? false : true; } - + /*-** Exclusion **-*/ - + /** * Retrieve exclude object * Initialize object properties if necessary @@ -1109,11 +1109,11 @@ private function get_exclude() { } return $this->exclude; } - + /** * Get exclusion tags (open/close) * Example: open => [slb_exclude], close => [/slb_exclude] - * + * * @return object Exclusion tags */ private function get_exclude_tags() { @@ -1129,11 +1129,11 @@ private function get_exclude_tags() { } return $tags; } - + /** * Get exclusion tag ("[slb_exclude]") * @uses `get_exclude_tags()` to retrieve tag - * + * * @param string $type (optional) Tag to retrieve (open or close) * @return string Exclusion tag */ @@ -1145,7 +1145,7 @@ private function get_exclude_tag( $type = "open" ) { } return $tags->{$type}; } - + /** * Build exclude placeholder * @return object Exclude placeholder properties @@ -1172,7 +1172,7 @@ private function get_exclude_placeholder() { } return $ph; } - + /** * Wrap content in exclusion tags * @uses `get_exclude_tag()` to wrap content with exclusion tag @@ -1188,7 +1188,7 @@ private function exclude_wrap($content) { $tags = $this->get_exclude_tags(); return $tags->open . $content . $tags->close; } - + /** * Remove excluded content * Caches content for restoring later @@ -1207,7 +1207,7 @@ public function exclude_content($content, $group = null) { $cache =& $ex->cache[$group]; $content = $this->util->apply_filters('pre_exclude_content', $content); - + // Search content $matches = null; if ( false !== strpos($content, $ex->tags->open) && preg_match_all($ex->tags->search, $content, $matches) ) { @@ -1225,14 +1225,14 @@ public function exclude_content($content, $group = null) { unset($midx, $match); // Replace content with placeholder $content = str_replace($matches[0], $ph, $content); - + // Cleanup unset($matches, $ph); } - + return $content; } - + /** * Exclude shortcodes from link activation * @param string $content Content to exclude shortcodes from @@ -1245,11 +1245,11 @@ public function exclude_shortcodes($content) { $shortcodes = array_fill_keys($shortcodes, $this->m('exclude_shortcodes_handler')); return $this->util->do_shortcode($content, $shortcodes); } - + /** * Wrap shortcode in exclude tags * @uses Util->make_shortcode() to rebuild original shortcode - * + * * @param array $attr Shortcode attributes * @param string $content Content enclosed in shortcode * @param string $tag Shortcode name @@ -1260,7 +1260,7 @@ public function exclude_shortcodes_handler($attr, $content, $tag) { // Exclude shortcode return $this->exclude_wrap($code); } - + /** * Restore excluded content * @param string $content Content to restore excluded content to @@ -1277,7 +1277,7 @@ public function restore_excluded_content($content, $group = null) { return $content; } $cache =& $ex->cache[$group]; - + // Search content for placeholders $matches = null; if ( false !== strpos($content, $ex->ph->open . $ex->ph->base) && preg_match_all($ex->ph->search, $content, $matches) ) { @@ -1298,12 +1298,12 @@ public function restore_excluded_content($content, $group = null) { // Cleanup unset($idx, $ph, $matches, $key); } - + return $content; } - + /*-** Grouping **-*/ - + /** * Builds wrapper for grouping * @return string Format for wrapping content in group @@ -1315,7 +1315,7 @@ function group_get_wrapper() { } return $fmt; } - + /** * Wraps shortcodes for automatic grouping * @uses `the_content` Filter hook @@ -1334,7 +1334,7 @@ function group_shortcodes($content) { // Process gallery shortcodes return $this->util->do_shortcode($content, $shortcodes); } - + /** * Groups shortcodes for later processing * @param array $attr Shortcode attributes @@ -1347,7 +1347,7 @@ function group_shortcodes_handler($attr, $content, $tag) { // Wrap shortcode return sprintf( $this->group_get_wrapper(), $code); } - + /** * Activate groups in content * @param string $content Content to activate @@ -1377,9 +1377,9 @@ function activate_groups_handler($attr, $content, $tag) { } return $this->process_links($content, $group); } - + /*-** Widgets **-*/ - + /** * Set widget up for processing/activation * Buffers widget output for further processing @@ -1401,7 +1401,7 @@ public function widget_process_start($widget_args) { // Begin output buffer ob_start(); } - + /** * Handles inter-widget processing * After widget output generated, Before next widget starts @@ -1411,7 +1411,7 @@ public function widget_process_inter( $params ) { $this->widget_process_finish(); return $params; } - + /** * Complete widget processing * Activate widget output @@ -1431,7 +1431,7 @@ public function widget_process_finish() { } // Activate widget output $out = $this->activate_links(ob_get_clean()); - + // Clear grouping callback if ( $this->options->get_bool('group_widget') ) { $this->util->remove_filter('get_group_id', $this->m('widget_group_id')); @@ -1442,7 +1442,7 @@ public function widget_process_finish() { // Output widget echo $out; } - + /** * Add widget ID to link group ID * Widget ID precedes all other group segments @@ -1457,7 +1457,7 @@ public function widget_group_id($group_segments) { } return $group_segments; } - + /** * Handles nested activation in widgets * @uses widget_processing @@ -1469,11 +1469,11 @@ public function widget_process_nested() { if ( !$this->widget_processing ) { return; } - + // Increment nesting level $this->widget_processing_level++; } - + /** * Mark the end of a nested widget * @uses $widget_processing_level @@ -1484,7 +1484,7 @@ public function widget_process_nested_finish() { $this->widget_processing_level--; } } - + /** * Begin blocking widget activation * @return void @@ -1492,7 +1492,7 @@ public function widget_process_nested_finish() { public function widget_block_start() { $this->util->add_filter('is_content_valid', $this->m('widget_block_handle')); } - + /** * Stop blocking widget activation * @return void @@ -1500,16 +1500,16 @@ public function widget_block_start() { public function widget_block_finish() { $this->util->remove_filter('is_content_valid', $this->m('widget_block_handle')); } - + /** * Handle widget activation blocking */ public function widget_block_handle($is_content_valid) { return false; } - + /*-** Menus **-*/ - + /** * Process navigation menu links * @@ -1533,16 +1533,16 @@ public function menu_process($nav_menu, $args) { } else { $group = null; } - + // Process menu $nav_menu = $this->activate_links($nav_menu, $group); - + return $nav_menu; } - + /** * Generate unique group ID - * + * * @param string $group Group ID to check * @return string Unique group ID */ @@ -1557,7 +1557,7 @@ public function group_id_unique($group) { } return $group; } - + /*-** Helpers **-*/ /** @@ -1602,10 +1602,10 @@ function set_attribute(&$attrs, $name, $value = true) { } // Add attribute $attrs = array_merge($attrs, array( $this->make_attribute_name($name) => strval($value) )); - + return $attrs; } - + /** * Convert attribute string into array * @param string $attr_string Attribute string @@ -1629,10 +1629,10 @@ function get_attributes($attr_string, $internal = true) { $ret = $ret_f; } } - + return $ret; } - + /** * Retrieve attribute value * @param string|array $attrs Attributes to retrieve attribute value from @@ -1652,7 +1652,7 @@ function get_attribute($attrs, $attr, $internal = true) { } return $ret; } - + /** * Checks if attribute exists * If supplied, the attribute's value is also validated @@ -1681,7 +1681,7 @@ function has_attribute($attrs, $attr, $value = null, $internal = true) { } return $ret; } - + /** * Build JS object of UI strings when initializing lightbox * @return array UI strings diff --git a/functions.php b/functions.php index 469db62..637dc5e 100644 --- a/functions.php +++ b/functions.php @@ -7,7 +7,7 @@ */ /* Template Tags */ - + /** * Activate links in user-defined content * @param string $content diff --git a/includes/class.admin.php b/includes/class.admin.php index 784f60f..84d3d71 100644 --- a/includes/class.admin.php +++ b/includes/class.admin.php @@ -8,18 +8,18 @@ */ class SLB_Admin extends SLB_Base { /* Configuration */ - + protected $mode = 'sub'; /* Properties */ - + /** * Parent object * Set on initialization * @var obj */ protected $parent = null; - + /** * Messages * @var array @@ -29,9 +29,9 @@ class SLB_Admin extends SLB_Base { 'beta' => 'Notice: This update is a Beta version. It is highly recommended that you test the update on a test server before updating the plugin on a production server.', 'access_denied' => 'You do not have sufficient permissions' ); - + /* Views */ - + /** * Custom admin top-level menus * Associative Array @@ -40,7 +40,7 @@ class SLB_Admin extends SLB_Base { * @var array */ protected $menus = array(); - + /** * Custom admin pages * Associative Array @@ -49,16 +49,16 @@ class SLB_Admin extends SLB_Base { * @var array */ protected $pages = array(); - + /** * Custom admin sections * Associative Array * > Key: Section ID - * > Val: Section properties + * > Val: Section properties * @var array */ protected $sections = array(); - + /** * Actions * Index Array @@ -67,34 +67,34 @@ class SLB_Admin extends SLB_Base { protected $actions = array(); /* Constructor */ - + public function __construct(&$parent) { parent::__construct(); // Set parent if ( is_object($parent) ) $this->parent = $parent; } - + /* Init */ - + protected function _hooks() { parent::_hooks(); // Init add_action('admin_menu', $this->m('init_menus'), 11); - + // Plugin actions add_action('admin_action_' . $this->add_prefix('admin'), $this->m('handle_action')); - + // Notices add_action('admin_notices', $this->m('handle_notices')); - + // Plugin listing add_filter('plugin_action_links_' . $this->util->get_plugin_base_name(), $this->m('plugin_action_links'), 10, 4); add_filter('plugin_row_meta', $this->m('plugin_row_meta'), 10, 4); add_action('in_plugin_update_message-' . $this->util->get_plugin_base_name(), $this->m('plugin_update_message'), 10, 2); add_filter('site_transient_update_plugins', $this->m('plugin_update_transient')); } - + /** * Declare client files (scripts, styles) * @uses parent::_client_files() @@ -122,9 +122,9 @@ protected function _client_files($files = null) { ); parent::_client_files($files); } - + /* Handlers */ - + /** * Handle routing of internal action to appropriate handler */ @@ -137,7 +137,7 @@ public function handle_action() { $this->add_prefix_ref($g); $this->add_prefix_ref($o); $r =& $_REQUEST; - + // Retrieve view that initiated the action if ( isset($r[$t]) && 'view' == $r[$t] ) { if ( isset($r[$g]) && ( $prop = $r[$g] . 's' ) && property_exists($this, $prop) && is_array($this->{$prop}) && isset($r[$o]) && isset($this->{$prop}[$r[$o]]) ) { @@ -147,7 +147,7 @@ public function handle_action() { } } } - + /** * Display notices * Messages are localized upon display @@ -170,9 +170,9 @@ public function handle_notices() { set_hookname($hook); $this->menus[$menu->get_id_raw()] =& $menu; } - + $page; // Add subpages foreach ( $this->pages as $page ) { @@ -199,20 +199,20 @@ public function init_menus() { if ( $page->is_parent_wp() ) { $f = 'add_' . $page->get_parent() . '_page'; } - + // Handle pages for custom menus if ( ! function_exists($f) ) { array_unshift( $args, $page->get_parent() ); $f = 'add_submenu_page'; } - + // Add admin page $hook = call_user_func_array($f, $args); // Save hook to page properties $page->set_hookname($hook); $this->pages[$page->get_id_raw()] =& $page; } - + // Add sections $section; foreach ( $this->sections as $section ) { @@ -222,7 +222,7 @@ public function init_menus() { /* Methods */ - + /** * Add a new view * @param string $type View type @@ -246,7 +246,7 @@ protected function add_view($type, $id, $args) { unset($r); return $view; } - + /** * Add plugin action link * @uses `add_view()` to init/attach action instance @@ -263,9 +263,9 @@ public function add_action($id, $labels, $data = null) { $args = func_get_args(); return $this->add_view('action', $id, $args); } - + /*-** Menus **-*/ - + /** * Adds custom admin panel * @param string $id Menu ID @@ -277,9 +277,9 @@ public function add_menu($id, $labels, $position = null) { $args = array ( $id, $labels, null, null, null, $position ); return $this->add_view('menu', $id, $args); } - + /* Page */ - + /** * Add admin page * @uses this->pages @@ -295,9 +295,9 @@ public function add_page($id, $parent, $labels, $callback = null, $capability = $args = func_get_args(); return $this->add_view('page', $id, $args); } - + /* WP Pages */ - + /** * Add admin page to a standard WP menu * @uses this->add_page() @@ -318,7 +318,7 @@ public function add_wp_page($id, $parent, $labels, $callback = null, $capability } return $pg; } - + /** * Add admin page to Dashboard menu * @see add_dashboard_page() @@ -344,7 +344,7 @@ public function add_dashboard_page($id, $labels, $callback = null, $capability = public function add_comments_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'comments', $labels, $capability); } - + /** * Add admin page to Links menu * @see add_links_page() @@ -358,7 +358,7 @@ public function add_links_page($id, $labels, $callback = null, $capability = nul return $this->add_wp_page($id, 'links', $labels, $capability); } - + /** * Add admin page to Posts menu * @see add_posts_page() @@ -371,7 +371,7 @@ public function add_links_page($id, $labels, $callback = null, $capability = nul public function add_posts_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'posts', $labels, $capability); } - + /** * Add admin page to Pages menu * @see add_pages_page() @@ -384,7 +384,7 @@ public function add_posts_page($id, $labels, $callback = null, $capability = nul public function add_pages_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'pages', $labels, $capability); } - + /** * Add admin page to Media menu * @see add_media_page() @@ -397,7 +397,7 @@ public function add_pages_page($id, $labels, $callback = null, $capability = nul public function add_media_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'media', $labels, $capability); } - + /** * Add admin page to Themes menu * @see add_theme_page() @@ -410,7 +410,7 @@ public function add_media_page($id, $labels, $callback = null, $capability = nul public function add_theme_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'theme', $labels, $capability); } - + /** * Add admin page to Plugins menu * @see add_plugins_page() @@ -423,7 +423,7 @@ public function add_theme_page($id, $labels, $callback = null, $capability = nul public function add_plugins_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'plugins', $labels, $capability); } - + /** * Add admin page to Options menu * @see add_options_page() @@ -436,7 +436,7 @@ public function add_plugins_page($id, $labels, $callback = null, $capability = n public function add_options_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'options', $labels, $capability); } - + /** * Add admin page to Tools menu * @see add_management_page() @@ -449,7 +449,7 @@ public function add_options_page($id, $labels, $callback = null, $capability = n public function add_management_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'management', $labels, $capability); } - + /** * Add admin page to Users menu * @uses this->add_wp_page() @@ -461,9 +461,9 @@ public function add_management_page($id, $labels, $callback = null, $capability public function add_users_page($id, $labels, $callback = null, $capability = null) { return $this->add_wp_page($id, 'users', $labels, $capability); } - + /* Section */ - + /** * Add section * @uses this->sections @@ -475,16 +475,16 @@ public function add_users_page($id, $labels, $callback = null, $capability = nul public function add_section($id, $parent, $labels) { $args = func_get_args(); $section = $this->add_view('section', $id, $args); - + // Add Section if ( $section->is_valid() ) $this->sections[$id] = $section; - + return $section; } - + /* Operations */ - + /** * Adds custom links below plugin on plugin listing page * @uses `plugin_action_links_$plugin-name` Filter hook @@ -498,10 +498,10 @@ public function plugin_action_links($actions, $plugin_file, $plugin_data, $conte // Add link to settings (only if active) if ( is_plugin_active($this->util->get_plugin_base_name()) ) { /* Get Actions */ - + $acts = array(); $type = 'plugin_action'; - + /* Get view links */ foreach ( array('menus', 'pages', 'sections') as $views ) { foreach ( $this->{$views} as $view ) { @@ -515,7 +515,7 @@ public function plugin_action_links($actions, $plugin_file, $plugin_data, $conte ); } } - + /* Get action links */ $type = 'title'; foreach ( $this->actions as $a ) { @@ -530,13 +530,13 @@ public function plugin_action_links($actions, $plugin_file, $plugin_data, $conte ); } unset($a); - + // Add links $links = array(); foreach ( $acts as $act ) { $links[$act->id] = $this->util->build_html_link($act->uri, $act->label, $act->attributes); } - + // Add links $actions = array_merge($links, $actions); } @@ -565,7 +565,7 @@ public function plugin_row_meta($plugin_meta, $plugin_file, $plugin_data, $statu } return $plugin_meta; } - + /** * Adds additional message for plugin updates * @uses `in_plugin_update_message-$plugin-name` Action hook @@ -581,7 +581,7 @@ public function plugin_update_message($plugin_data, $r) { echo '
' . $this->plugin_update_get_message($r); } } - + /** * Modify update plugins response data if necessary * @uses `site_transient_update_plugins` Filter hook @@ -597,7 +597,7 @@ public function plugin_update_transient($transient) { } return $transient; } - + /** * Retrieve custom update message * @uses this->get_message() @@ -614,9 +614,9 @@ protected function plugin_update_get_message($r) { } return $msg; } - + /*-** Messages **-*/ - + /** * Retrieve stored messages * @param string $msg_id Message ID @@ -630,7 +630,7 @@ public function get_message($msg_id) { } return $msg; } - + /** * Retrieve all messages * Initializes messages if necessary @@ -648,7 +648,7 @@ function get_messages() { } return $this->messages; } - + /** * Set message text * @uses this->messages diff --git a/includes/class.admin_action.php b/includes/class.admin_action.php index 3ef1af1..88d700f 100644 --- a/includes/class.admin_action.php +++ b/includes/class.admin_action.php @@ -9,13 +9,13 @@ */ class SLB_Admin_Action extends SLB_Admin_View { /* Properties */ - + protected $parent_required = false; - + public $hook_prefix = 'admin_action'; - + /* Init */ - + /** * Init * @param string $id ID @@ -31,9 +31,9 @@ function __construct($id, $labels, $data = null) { } return $this; } - + /* Handlers */ - + /** * Default handler * Handles action @@ -43,12 +43,12 @@ public function handle() { // Validate user if ( ! current_user_can('activate_plugins') || ! check_admin_referer($this->get_id()) ) wp_die(__('Access Denied', 'simple-lightbox')); - + // Get data $content = $this->get_content(); - + $success = true; - + // Iterate through data $hook = $this->util->get_hook($this->get_id_raw()); foreach ( $content as $c ) { @@ -59,12 +59,12 @@ public function handle() { $success = $res; } } - + // Set Status Message $lbl = ( $success ) ? 'success' : 'failure'; $this->set_message($this->get_label($lbl)); } - + /** * Get URI * @see Admin_View::get_uri() @@ -72,7 +72,7 @@ public function handle() { public function get_uri($file = null, $format = null) { return wp_nonce_url(add_query_arg($this->get_query_args(), remove_query_arg($this->get_query_args_remove(), $_SERVER['REQUEST_URI'])), $this->get_id()); } - + protected function get_query_args() { return array ( 'action' => $this->add_prefix('admin'), @@ -81,25 +81,25 @@ protected function get_query_args() { $this->add_prefix('obj') => $this->get_id_raw() ); } - + protected function get_query_args_remove() { $args_r = array ( '_wpnonce', $this->add_prefix('action') ); - + return array_unique( array_merge( array_keys( $this->get_query_args() ), $args_r ) ); } - + public function get_link_attr() { return array ( 'class' => $this->util->get_hook($this->get_id_raw()), 'onclick' => "return confirm('" . esc_js( $this->get_label('confirm') ) . "')" ); } - + /* Content */ - + /** * Save options */ diff --git a/includes/class.admin_menu.php b/includes/class.admin_menu.php index f70f76d..c181300 100644 --- a/includes/class.admin_menu.php +++ b/includes/class.admin_menu.php @@ -9,15 +9,15 @@ */ class SLB_Admin_Menu extends SLB_Admin_View { /* Properties */ - + /** * Menu position * @var int */ protected $position = null; - + /* Init */ - + public function __construct($id, $labels, $callback = null, $capability = null, $icon = null, $position = null) { // Default parent::__construct($id, $labels, $callback, $capability, $icon); @@ -25,9 +25,9 @@ public function __construct($id, $labels, $callback = null, $capability = null, $this->set_position($position); return $this; } - + /* Getters/Setters */ - + /** * Set menu position * @return obj Current instance diff --git a/includes/class.admin_page.php b/includes/class.admin_page.php index ae24740..35fcde8 100644 --- a/includes/class.admin_page.php +++ b/includes/class.admin_page.php @@ -9,18 +9,18 @@ */ class SLB_Admin_Page extends SLB_Admin_View { /* Properties */ - + protected $parent_required = true; - + public $hook_prefix = 'admin_page'; - + /** * Required features/elements */ private $_required = array(); - + /* Init */ - + public function __construct($id, $parent, $labels, $callback = null, $capability = null) { // Default parent::__construct($id, $labels, $callback, $capability); @@ -28,9 +28,9 @@ public function __construct($id, $parent, $labels, $callback = null, $capability $this->set_parent($parent); return $this; } - + /* Operations */ - + /** * Add content to page * @uses parent::add_content() @@ -53,7 +53,7 @@ public function add_content($id, $title, $callback = null, $context = 'primary', ) ); } - + /** * Parse content by parameters * Sets content value @@ -73,7 +73,7 @@ protected function parse_content() { } return $content; } - + /** * Render content blocks * @param string $context (optional) Context to render @@ -110,7 +110,7 @@ protected function render_content($context = 'primary') {
_require('form_submit'); return $this; } - + /** * Check if form submission is required * @return bool TRUE if form submission required @@ -127,9 +127,9 @@ public function require_form() { private function is_required_form() { return $this->_is_required('form_submit'); } - + /* Handlers */ - + /** * Default Page handler * Builds content blocks diff --git a/includes/class.admin_section.php b/includes/class.admin_section.php index 096a9a0..4ea8d3c 100644 --- a/includes/class.admin_section.php +++ b/includes/class.admin_section.php @@ -9,12 +9,12 @@ */ class SLB_Admin_Section extends SLB_Admin_View { /* Properties */ - + protected $parent_required = true; protected $parent_custom = false; - + /* Init */ - + public function __construct($id, $parent, $labels, $callback = null, $capability = null) { // Default parent::__construct($id, $labels, $callback, $capability); @@ -22,9 +22,9 @@ public function __construct($id, $parent, $labels, $callback = null, $capability $this->set_parent($parent); return $this; } - + /* Getters/Setters */ - + /** * Retrieve URI * @uses Admin_View::get_uri() diff --git a/includes/class.admin_view.php b/includes/class.admin_view.php index cc0d402..31ceb19 100644 --- a/includes/class.admin_view.php +++ b/includes/class.admin_view.php @@ -2,62 +2,62 @@ /** * Admin View Base - * Core functionality Admin UI components + * Core functionality Admin UI components * @package Simple Lightbox * @subpackage Admin * @author Archetyped */ class SLB_Admin_View extends SLB_Base_Object { /* Properties */ - + /** * Labels * @var array (Associative) */ protected $labels = array(); - + /** * Function to handle building UI * @var callback */ protected $callback = null; - + /** * Capability for access control - * @var string + * @var string */ protected $capability = 'manage_options'; - + /** * Icon to use * @var string */ protected $icon = null; - + /** * View parent ID/Slug * @var string */ protected $parent = null; - + /** * Whether parent is a custom view or a default WP one * @var bool */ protected $parent_custom = true; - + /** * If view requires a parent * @var bool */ protected $parent_required = false; - + /** * WP-Generated hook name for view * @var string */ protected $hookname = null; - + /** * Raw content parameters * Stores pre-rendered content parameters @@ -65,20 +65,20 @@ class SLB_Admin_View extends SLB_Base_Object { * @var array */ protected $content_raw = array(); - + /** * Parsed content parameters * @var array */ protected $content = array(); - + /** * Messages to be displayed * Indexed Array * @var array */ protected $messages = array(); - + /** * Required properties * Associative array @@ -87,7 +87,7 @@ class SLB_Admin_View extends SLB_Base_Object { * @var array */ private $required = array(); - + /** * Default required properties * Merged into $required array with this->init_required() @@ -95,9 +95,9 @@ class SLB_Admin_View extends SLB_Base_Object { * @var array */ private $_required = array ( 'id' => 'string', 'labels' => 'array' ); - + /* Init */ - + /** * Constructor * @return obj Current instance @@ -113,14 +113,14 @@ public function __construct($id, $labels, $callback = null, $capability = null, $this->init_required(); return $this; } - + protected function init_required() { $this->required = array_merge($this->_required, $this->required); // Check for parent requirement if ( $this->parent_required ) $this->required['parent'] = 'string'; } - + /** * Set required feature * @param string $feature Required feature @@ -131,7 +131,7 @@ protected function _require($feature) { } return $this; } - + /** * Check if feature is required * @param string $feature Feature to check for @@ -140,9 +140,9 @@ protected function _require($feature) { protected function _is_required($feature) { return ( isset($this->_required[$feature]) ) ? true : false; } - + /* Property Methods */ - + /** * Retrieve ID (Formatted by default) * @param bool $formatted (optional) Whether ID should be formatted for external use or not @@ -154,7 +154,7 @@ public function get_id($formatted = true) { $this->add_prefix_ref($id); return $id; } - + /** * Retrieve raw ID * @return string Raw ID @@ -162,7 +162,7 @@ public function get_id($formatted = true) { public function get_id_raw() { return $this->get_id(false); } - + /** * Retrieve label * Uses first label (or default if defined) if specified type does not exist @@ -179,10 +179,10 @@ public function get_label($type, $default = null) { reset($this->labels); $default = current($this->labels); } - + return ( empty($default) ) ? '' : $default; } - + /** * Set text labels * @param array|string $labels @@ -194,8 +194,8 @@ public function set_labels($labels) { // Single string if ( is_string($labels) ) { $labels = array ( $labels ); - } - + } + // Array if ( is_array($labels) ) { // Merge with existing labels @@ -206,7 +206,7 @@ public function set_labels($labels) { } return $this; } - + /** * Set single text label * @uses this->set_labels() @@ -221,7 +221,7 @@ public function set_label($type, $value) { } return $this; } - + /** * Checks if specified label is set on view * @param string $type Label type @@ -230,9 +230,9 @@ public function set_label($type, $value) { public function has_label($type) { return ( isset($this->labels[$type]) ); } - + /* Content */ - + /** * Add content block to view * Child classes define method functionality @@ -248,7 +248,7 @@ public function add_content($id, $args) { // Return instance reference return $this; } - + /** * Retrieve content */ @@ -266,7 +266,7 @@ protected function get_content($parsed = true) { } return $content; } - + /** * Parse content * Child classes define functionality @@ -275,7 +275,7 @@ protected function get_content($parsed = true) { protected function parse_content() { return $this->get_content(false); } - + /** * Check if content has been added to view * @return bool TRUE if content added @@ -284,12 +284,12 @@ protected function has_content() { $raw = $this->get_content(false); return !empty($raw); } - + /** * Render content */ protected function render_content($context = 'default') {} - + /** * Retrieve view messages * @return array Messages @@ -299,7 +299,7 @@ protected function &get_messages() { $this->messages = array(); return $this->messages; } - + /** * Save message * @param string $text Message text @@ -313,7 +313,7 @@ public function set_message($text) { $msgs[] = $text; return $this; } - + /** * Add messages to array * Called by internal `admin_messages` filter hook @@ -326,7 +326,7 @@ public function do_messages($msgs = array()) { $msgs = array_merge($msgs, $m); return $msgs; } - + /** * Retrieve view callback * @return callback Callback (Default: standard handler method) @@ -334,7 +334,7 @@ public function do_messages($msgs = array()) { public function get_callback() { return ( $this->has_callback() ) ? $this->callback : $this->m('handle'); } - + /** * Set callback function for building item * @param callback $callback Callback function to use @@ -344,7 +344,7 @@ public function set_callback($callback) { $this->callback = ( is_callable($callback) ) ? $callback : null; return $this; } - + /** * Check if callback set * @return bool TRUE if callback is set @@ -352,14 +352,14 @@ public function set_callback($callback) { protected function has_callback() { return ( !empty($this->callback) ) ? true : false; } - + /** * Run callback */ public function do_callback() { call_user_func($this->get_callback()); } - + /** * Retrieve capability * @return string Capability @@ -367,7 +367,7 @@ public function do_callback() { public function get_capability() { return $this->capability; } - + /** * Set capability for access control * @param string $capability Capability @@ -378,7 +378,7 @@ public function set_capability($capability) { $this->capability = $capability; return $this; } - + /** * Set icon * @param string $icon Icon URI @@ -389,11 +389,11 @@ public function set_icon($icon) { $this->icon = $icon; return $this; } - + protected function get_hookname() { return ( empty($this->hookname) ) ? '' : $this->hookname; } - + /** * Set hookname * @param string $hookname Hookname value @@ -404,7 +404,7 @@ public function set_hookname($hookname) { $this->hookname = $hookname; return $this; } - + /** * Retrieve parent * Formats parent ID for custom parents @@ -415,7 +415,7 @@ public function get_parent() { $parent = parent::get_parent(); return ( $this->is_parent_custom() ) ? $this->add_prefix($parent) : $parent; } - + /** * Set parent for view * @param string $parent Parent ID @@ -430,7 +430,7 @@ public function set_parent($parent) { } return $this; } - + /** * Specify whether parent is a custom view or a WP view * @param bool $custom (optional) TRUE if custom, FALSE if WP @@ -442,7 +442,7 @@ protected function set_parent_custom($custom = true) { } return $this; } - + /** * Set parent as WP view * @uses this->set_parent_custom() @@ -452,18 +452,18 @@ public function set_parent_wp() { $this->set_parent_custom(false); return $this; } - + /** * Get view URI * URI Structures: * > Top Level Menus: admin.php?page={menu_id} * > Pages: [parent_page_file.php|admin.php]?page={page_id} * > Section: [parent_menu_uri]#{section_id} - * + * * @uses $admin_page_hooks to determine if page is child of default WP page * @param string $file (optional) Base file name * @param string $format (optional) Format string for URI - * @return string Object URI + * @return string Object URI */ public function get_uri($file = null, $format = null) { static $page_hooks = null; @@ -478,7 +478,7 @@ public function get_uri($file = null, $format = null) { if ( isset($page_hooks[$parent]) ) $file = $page_hooks[$parent]; } - + if ( empty($format) ) { $delim = ( strpos($file, '?') === false ) ? '?' : '&'; $format = '%1$s' . $delim . 'page=%2$s'; @@ -487,20 +487,20 @@ public function get_uri($file = null, $format = null) { return $uri; } - + /* Handlers */ - + /** * Default View handler * Used as callback when none set */ public function handle() {} - + /* Validation */ - + /** * Check if instance is valid based on required properties/data types - * @return bool TRUE if valid, FALSE if not valid + * @return bool TRUE if valid, FALSE if not valid */ public function is_valid() { $valid = true; @@ -513,17 +513,17 @@ public function is_valid() { } return $valid; } - + protected function is_child() { return $this->parent_required; } - + protected function is_parent_custom() { return ( $this->is_child() && $this->parent_custom ) ? true : false; } - + public function is_parent_wp() { return ( $this->is_child() && !$this->parent_custom ) ? true : false; } - + } \ No newline at end of file diff --git a/includes/class.base.php b/includes/class.base.php index 4f02a86..bf04043 100644 --- a/includes/class.base.php +++ b/includes/class.base.php @@ -8,7 +8,7 @@ */ class SLB_Base { /* Configuration */ - + /** * Class type * Controls initialization, etc. @@ -18,53 +18,53 @@ class SLB_Base { * @var string */ protected $mode = 'full'; - + /** * Indicates that instance is model (main controller) * @var bool */ protected $model = false; - + /* Properties */ - + /** * Variable name of base object in global scope * @var string */ protected $base = 'slb'; - + /** * Prefix for plugin-related data (attributes, DB tables, etc.) * @var string */ public $prefix = 'slb'; - + /** * Prefix to be added when creating internal hook (action/filter) tags * Used by Utilities * @var string */ public $hook_prefix = ''; - + /** * Global data * Facilitates sharing between decoupled objects * @var array */ private static $globals = array(); - + protected $shared = array('options', 'admin'); - + /** * Capabilities * @var array */ protected $caps = null; - + protected $_init = false; - + private static $_init_passed = false; - + /* Client */ /** @@ -80,36 +80,36 @@ class SLB_Base { * > Context in which the script should be included * > in_footer (bool) optional [Default: FALSE] * > If TRUE, file will be included in footer of page, otherwise it will be included in the header - * + * * Array is processed and converted to an object on init */ private $client_files = array ( 'scripts' => array(), 'styles' => array() ); - + /*-** Instances **-*/ - + /** * Utilities * @var SLB_Utilities */ var $util = null; - + /** * Options * @var SLB_Options */ protected $options = null; - + /** * Admin * @var SLB_Admin */ var $admin = null; - + /*-** Initialization **-*/ - + /** * Constructor */ @@ -124,7 +124,7 @@ function __construct() { } } } - + /** * Default initialization method * @uses _init_passed @@ -145,7 +145,7 @@ public function _init() { if ( $this->can('control') ) { // Options $this->_options(); - + // Admin if ( is_admin() ) $this->_admin(); @@ -153,11 +153,11 @@ public function _init() { // Hooks $this->_hooks(); - + // Client files $this->_client_files(); } - + /** * Initialize environment (Localization, etc.) */ @@ -172,17 +172,17 @@ private function _env() { if ( is_dir($lpath_abs) ) { load_plugin_textdomain('simple-lightbox', false, $lpath); } - + // Context add_action( ( is_admin() ) ? 'admin_print_footer_scripts' : 'wp_footer', $this->util->m('set_client_context'), $this->util->priority('client_footer_output') ); } - + /** * Initialize options * To be implemented in child classes */ protected function _options() {} - + /** * Initialize options * To be called by child class @@ -206,7 +206,7 @@ protected function _set_options($options_config = null) { // Set instance property $this->options = $opts; } - + /** * Initialize admin * To be called by child class @@ -229,7 +229,7 @@ private function _admin() { // Set instance property $this->admin = $adm; } - + /** * Register default hooks */ @@ -239,13 +239,13 @@ protected function _hooks() { $func_activate = '_activate'; if ( method_exists($this, $func_activate) ) register_activation_hook($base, $this->m($func_activate)); - + // Deactivation $func_deactivate = '_deactivate'; if ( method_exists($this, $func_deactivate) ) register_deactivation_hook($base, $this->m($func_deactivate)); } - + /** * Initialize client files */ @@ -253,7 +253,7 @@ protected function _client_files($files = null) { // Validation if ( !is_array($files) || empty($files) ) { return false; - } + } foreach ( $this->client_files as $key => $val ) { if ( isset($files[$key]) && is_array($files[$key]) || !empty($files[$key]) ) { $this->client_files[$key] = $this->util->parse_client_files($files[$key], $key); @@ -263,16 +263,16 @@ protected function _client_files($files = null) { unset($this->client_files[$key]); } } - - + + // Stop if no files are set for registration if ( empty($this->client_files) ) { return false; } - + // Register add_action('init', $this->m('register_client_files')); - + // Enqueue $hk_prfx = ( ( is_admin() ) ? 'admin' : 'wp' ); $hk_enqueue = $hk_prfx . '_enqueue_scripts' ; @@ -280,7 +280,7 @@ protected function _client_files($files = null) { add_action($hk_enqueue, $this->m('enqueue_client_files'), 10, 0); add_action($hk_enqueue_ft, $this->m('enqueue_client_files_footer'), 1); } - + /** * Register client files * @see enqueue_client_files() for actual loading of files based on context @@ -311,7 +311,7 @@ public function register_client_files() { } } } - + /** * Enqueues files for client output (scripts/styles) based on context * @uses `admin_enqueue_scripts` Action hook depending on context @@ -384,7 +384,7 @@ function enqueue_client_files($footer = false) { public function enqueue_client_files_footer() { $this->enqueue_client_files(true); } - + /** * Build function name for handling client operations */ @@ -394,9 +394,9 @@ function get_client_files_handler($type, $action) { $func = false; return $func; } - + /*-** Reflection **-*/ - + /** * Retrieve base object * @return object|bool Base object (FALSE if object does not exist) @@ -404,12 +404,12 @@ function get_client_files_handler($type, $action) { function &get_base() { $base = false; if ( isset($GLOBALS[$this->base]) ) - $base =& $GLOBALS[$this->base]; + $base =& $GLOBALS[$this->base]; return $base; } - + /*-** Method/Function calling **-*/ - + /** * Returns callback to instance method * @param string $method Method name @@ -418,9 +418,9 @@ function &get_base() { function m($method) { return $this->util->m($this, $method); } - + /*-** Prefix **-*/ - + /** * Retrieve class prefix (with separator if set) * @param bool|string $sep Separator to append to class prefix (Default: no separator) @@ -430,7 +430,7 @@ function get_prefix($sep = null) { $args = func_get_args(); return call_user_func_array($this->util->m($this->util, 'get_prefix'), $args); } - + /** * Check if a string is prefixed * @param string $text Text to check for prefix @@ -440,7 +440,7 @@ function has_prefix($text, $sep = null) { $args = func_get_args(); return call_user_func_array($this->util->m($this->util, 'has_prefix'), $args); } - + /** * Prepend plugin prefix to some text * @param string $text Text to add to prefix @@ -452,7 +452,7 @@ function add_prefix($text, $sep = null, $once = true) { $args = func_get_args(); return call_user_func_array($this->util->m($this->util, 'add_prefix'), $args); } - + /** * Prepend uppercased plugin prefix to some text * @param string $text Text to add to prefix @@ -464,7 +464,7 @@ function add_prefix_uc($text, $sep = null, $once = true) { $args = func_get_args(); return call_user_func_array($this->util->m($this->util, 'add_prefix_uc'), $args); } - + /** * Add prefix to variable reference * Updates actual variable rather than return value @@ -479,7 +479,7 @@ function add_prefix_ref(&$var, $sep = null, $once = true) { $args[0] =& $var; call_user_func_array($this->util->m($this->util, 'add_prefix_ref'), $args); } - + /** * Remove prefix from specified string * @param string $text String to remove prefix from @@ -489,9 +489,9 @@ function remove_prefix($text, $sep = null) { $args = func_get_args(); return call_user_func_array($this->util->m($this->util, 'remove_prefix'), $args); } - + /*-** Capabilities **-*/ - + protected function can($cap) { if ( is_null($this->caps) ) { // Build capabilities based on instance properties @@ -503,9 +503,9 @@ protected function can($cap) { } return ( isset($this->caps[$cap]) ) ? $this->caps[$cap] : false; } - + /*-** Globals **-*/ - + /** * Get/Set (internal) global variables * @uses $globals to get/set global variables @@ -531,13 +531,13 @@ private function gvar($name = null, $val = null) { } return $ret; } - + private function shares($name) { return ( !empty($this->shared) && in_array($name, $this->shared) ) ? true : false; } - + /*-** Options **-*/ - + /** * Checks if options are valid * @param array $data Data to be used on options diff --git a/includes/class.base_collection.php b/includes/class.base_collection.php index 1f83d10..356ab93 100644 --- a/includes/class.base_collection.php +++ b/includes/class.base_collection.php @@ -8,7 +8,7 @@ */ class SLB_Base_Collection extends SLB_Base { /* Configuration */ - + /** * Set object mode * @var string @@ -20,28 +20,28 @@ class SLB_Base_Collection extends SLB_Base { * @var string */ protected $item_type = null; - + /** * Property to use for item key * Example: A property or method of the item * @var string */ protected $key_prop = null; - + /** * Should $key_prop be called or retrieved? * Default: Retrieved (FALSE) * @var bool */ protected $key_call = false; - + /** * Items in collection unique? * Default: FALSE * @var bool */ protected $unique = false; - + /* Properties */ /** @@ -49,16 +49,16 @@ class SLB_Base_Collection extends SLB_Base { * @var array */ protected $items = null; - + /** * Item metadata * Indexed by item key * @var array */ protected $items_meta = array(); - + /* Item Management */ - + /** * Initialize collections * Calls `init` action if collection has a hook prefix @@ -72,7 +72,7 @@ private function init() { } } } - + /** * Normalize/Validate item(s) * TODO: If no items are specified, then collection is normalized @@ -98,12 +98,12 @@ protected function normalize($items) { } return $items; } - + protected function item_valid($item) { - // Validate item type + // Validate item type return ( empty($this->item_type) || ( $item instanceof $this->item_type ) ) ? true : false; } - + /** * Validate item key * Checks collection for existence of key as well @@ -114,7 +114,7 @@ protected function key_valid($key) { $this->init(); return ( ( ( is_string($key) && !empty($key) ) || is_int($key) ) && isset($this->items[$key]) ) ? true : false; } - + /** * Generate key for item (for storing in collection, etc.) * @param mixed $item Item to generate key for @@ -141,7 +141,7 @@ protected function get_key($item, $check_existing = false) { } return $ret; } - + /** * Add item to collection * @param mixed $item Item to add to collection @@ -167,11 +167,11 @@ public function add($item, $meta = null) { } return $this; } - + /** * Remove item from collection * @param int|string $item Key of item to remove - * @return Current instance + * @return Current instance */ public function remove($item) { if ( $this->key_valid($item) ) { @@ -179,7 +179,7 @@ public function remove($item) { } return $this; } - + /** * Clear collection * @return Current instance @@ -188,7 +188,7 @@ public function clear() { $this->items = array(); return $this; } - + /** * Checks if item exists in the collection * @param mixed $item Item(s) to check for @@ -198,7 +198,7 @@ public function has($items) { // Attempt to locate item return false; } - + /** * Retrieve item(s) from collection * If no items specified, entire collection returned @@ -215,9 +215,9 @@ public function get($args = null) { 'exclude' => array(), ); $r = wp_parse_args($args, $args_default); - + $items = $this->items; - + /* Sort */ if ( !is_null($r['orderby']) ) { // Validate @@ -260,9 +260,9 @@ public function get($args = null) { } return $items; } - + /* Metadata */ - + /** * Add metadata for item * @param string|int $item Item key @@ -291,7 +291,7 @@ protected function add_meta($item, $meta_key, $meta_value = null, $reset = false } return $this; } - + /** * Remove item metadata * @param string $item Item key @@ -309,7 +309,7 @@ protected function remove_meta($item, $meta_key = null) { } return $this; } - + /** * Retrieve metadata * @param string $item Item key @@ -327,9 +327,9 @@ protected function get_meta($item, $meta_key = null) { } return $ret; } - + /* Collection */ - + /** * Build entire collection of items * Prints output @@ -345,7 +345,7 @@ function build($build_vars = array()) { // Post-build output $this->util->do_action_ref_array('build_post', array($this)); } - + /** * Parses build variables prior to use * @uses this->reset_build_vars() to reset build variables for each request @@ -353,9 +353,9 @@ function build($build_vars = array()) { */ function parse_build_vars($build_vars = array()) { $this->reset_build_vars(); - $this->build_vars = $this->util->apply_filters('parse_build_vars', wp_parse_args($build_vars, $this->build_vars), $this); + $this->build_vars = $this->util->apply_filters('parse_build_vars', wp_parse_args($build_vars, $this->build_vars), $this); } - + /** * Reset build variables to defaults * Default Variables diff --git a/includes/class.base_object.php b/includes/class.base_object.php index 7b456dd..7a99b3d 100644 --- a/includes/class.base_object.php +++ b/includes/class.base_object.php @@ -8,27 +8,27 @@ */ class SLB_Base_Object extends SLB_Base { /* Configuration */ - + /** * @var string * @see Base::$mode */ protected $mode = 'object'; - + /*-** Properties **-*/ - + /** * Unique ID * @var string */ protected $id = ''; - + /** * Parent object * @var Base_Object */ protected $parent = null; - + /** * Attached files * @var array @@ -39,15 +39,15 @@ class SLB_Base_Object extends SLB_Base { 'scripts' => array(), 'styles' => array() ); - + /** * Properties that can be inherited from parent * @var array */ protected $parent_props = array(); - + /*-** Methods **-*/ - + /** * Constructor * @param string $id Unique ID for content type @@ -59,7 +59,7 @@ public function __construct($id, $props = null) { ->set_id($id) ->set_props($props); } - + /** * Checks if object is valid * To be overriden by child classes @@ -67,9 +67,9 @@ public function __construct($id, $props = null) { public function is_valid() { return true; } - + /*-** Getters/Setters **-*/ - + /** * Get ID * @return string ID @@ -77,7 +77,7 @@ public function is_valid() { public function get_id() { return $this->id; } - + /** * Set ID * @param string $id ID @@ -90,7 +90,7 @@ public function set_id($id) { } return $this; } - + /** * Set type properties * @param array $props Type properties to set @@ -107,7 +107,7 @@ protected function set_props($props) { } return $this; } - + /** * Get parent * @return object|null Parent @@ -115,7 +115,7 @@ protected function set_props($props) { public function get_parent() { return $this->parent; } - + /** * Set parent * @param object $parent Parent object @@ -133,7 +133,7 @@ public function set_parent($parent) { public function has_parent() { return ( is_null($this->parent) ) ? false : true; } - + /** * Retrieve all ancestors * @return array Ancestors @@ -149,9 +149,9 @@ public function get_ancestors() { } return $ret; } - + /* Files */ - + /** * Add file * @param string $type Group to add file to @@ -170,11 +170,11 @@ protected function add_file($type, $handle, $src, $deps = array()) { $this->files[$type] = array(); } // Add file to group - $this->files[$type][$handle] = array('handle' => $handle, 'uri' => $src, 'deps' => $deps); + $this->files[$type][$handle] = array('handle' => $handle, 'uri' => $src, 'deps' => $deps); } return $this; } - + /** * Add multiple files * @param string $type Group to add files to @@ -195,7 +195,7 @@ protected function add_files($type, $files) { } return $this; } - + /** * Retrieve files * All files or a specific group of files can be retrieved @@ -212,7 +212,7 @@ protected function get_files($type = null) { } return $ret; } - + /** * Retrieve file * @param string $type Group to retrieve file from @@ -258,7 +258,7 @@ protected function get_file($type, $handle, $format = null) { } return $ret; } - + /** * Add stylesheet * @param string $handle Name of the stylesheet @@ -268,7 +268,7 @@ protected function get_file($type, $handle, $format = null) { public function add_style($handle, $src, $deps = array()) { return $this->add_file('styles', $handle, $src, $deps); } - + /** * Retrieve stylesheet files * @return array Stylesheet files @@ -295,7 +295,7 @@ public function get_styles($opts = null) { } return $files; } - + /** * Retrieve stylesheet file * @param string $handle Name of stylesheet @@ -305,7 +305,7 @@ public function get_styles($opts = null) { public function get_style($handle, $format = null) { return $this->get_file('styles', $handle, $format); } - + /** * Add script * @param string $handle Name of the script @@ -315,7 +315,7 @@ public function get_style($handle, $format = null) { public function add_script($handle, $src, $deps = array()) { return $this->add_file('scripts', $handle, $src, $deps); } - + /** * Retrieve script files * @return array Script files @@ -323,7 +323,7 @@ public function add_script($handle, $src, $deps = array()) { public function get_scripts() { return $this->get_files('scripts'); } - + /** * Retrieve script file * @param string $handle Name of script @@ -333,5 +333,5 @@ public function get_scripts() { public function get_script($handle, $format = null) { return $this->get_file('scripts', $handle, $format); } - + } \ No newline at end of file diff --git a/includes/class.collection_controller.php b/includes/class.collection_controller.php index f284cb8..210cc33 100644 --- a/includes/class.collection_controller.php +++ b/includes/class.collection_controller.php @@ -8,26 +8,26 @@ */ class SLB_Collection_Controller extends SLB_Base_Collection { /* Configuration */ - + protected $mode = 'full'; - + protected $unique = true; - + /* Properties */ - + protected $parent = null; - + /* Methods */ public function __construct($parent = null) { $this->set_parent($parent); parent::__construct(); } - + /* Initialization */ - + /* Parent */ - + /** * Set parent instance * @param SLB_Base $parent (optional) Parent instance @@ -37,7 +37,7 @@ protected function set_parent($parent = null) { $this->parent = ( $parent instanceof SLB_Base ) ? $parent : null; return $this; } - + /** * Check if parent set * @return bool TRUE if parent set @@ -45,7 +45,7 @@ protected function set_parent($parent = null) { protected function has_parent() { return ( is_object($this->get_parent()) ) ? true : false; } - + /** * Retrieve parent * @uses $parent diff --git a/includes/class.component.php b/includes/class.component.php index 5b2d887..cc07f60 100644 --- a/includes/class.component.php +++ b/includes/class.component.php @@ -8,19 +8,19 @@ */ class SLB_Component extends SLB_Base_Object { /* Properties */ - + /** * Pretty name * @var string */ protected $name = ''; - + protected $props_required = array(); - + private $props_required_base = array('id'); - + /* Get/Set */ - + /** * Set name * @param string $name Name @@ -35,21 +35,21 @@ public function set_name($name) { } return $this; } - + public function get_name() { return $this->name; } - + public function set_scripts($scripts) { $this->add_files('scripts', $scripts); } - + public function set_styles($styles) { $this->add_files('styles', $styles); } - + /* Assets */ - + /** * Get formatted handle for file * @param string $base_handle Base handle to format @@ -58,7 +58,7 @@ public function set_styles($styles) { public function get_handle($base_handle) { return $this->add_prefix( array('asset', $this->get_id(), $base_handle), '-'); } - + /** * Enqueue files in client * @param string $type (optional) Type of file to load (singular) (Default: All client file types) @@ -82,7 +82,7 @@ public function enqueue_client_files($type = null) { $f = (object) $f; // Format handle $handle = $this->get_handle($f->handle); - + // Format dependencies $deps = array(); foreach ( $f->deps as $dep ) { @@ -96,7 +96,7 @@ public function enqueue_client_files($type = null) { unset($files, $f, $param_final, $handle, $deps, $dep); } } - + /** * Enqueue scripts */ @@ -110,9 +110,9 @@ public function enqueue_scripts() { public function enqueue_styles() { $this->enqueue_client_files('style'); } - + /* Helpers */ - + /** * Validate instance * @see `Base_Object::is_valid()` diff --git a/includes/class.content_handler.php b/includes/class.content_handler.php index f9a7b72..d4edcbe 100644 --- a/includes/class.content_handler.php +++ b/includes/class.content_handler.php @@ -8,21 +8,21 @@ */ class SLB_Content_Handler extends SLB_Component { /* Properties */ - + /** * Match handler * @var callback */ protected $match; - + /** * Custom attributes * @var callback */ protected $attributes; - + /* Matching */ - + /** * Set matching handler * @param callback $callback Handler callback @@ -32,7 +32,7 @@ public function set_match($callback) { $this->match = ( is_callable($callback) ) ? $callback : null; return $this; } - + /** * Retrieve match handler * @return callback|null Match handler @@ -40,14 +40,14 @@ public function set_match($callback) { protected function get_match() { return $this->match; } - + /** * Check if valid match set */ protected function has_match() { return ( is_null($this->match) ) ? false : true; } - + /** * Match handler against URI * @param string $uri URI to check for match @@ -60,14 +60,14 @@ public function match($uri, $uri_raw = null) { } return $ret; } - + /* Attributes */ - + public function set_attributes($callback) { $this->attributes = ( is_callable($callback) ) ? $callback : null; return $this; } - + public function get_attributes() { $ret = array(); // Callback diff --git a/includes/class.content_handlers.php b/includes/class.content_handlers.php index 4e0ec10..486cd30 100644 --- a/includes/class.content_handlers.php +++ b/includes/class.content_handlers.php @@ -8,36 +8,36 @@ */ class SLB_Content_Handlers extends SLB_Collection_Controller { /* Configuration */ - + protected $item_type = 'SLB_Content_Handler'; - + public $hook_prefix = 'content_handlers'; - + protected $key_prop = 'get_id'; - + protected $key_call = true; - + /* Properties */ - + protected $request_matches = array(); - + /** * Cache properties (key, group) * @var object */ protected $cache_props = null; - + /* Initialization */ - + protected function _hooks() { parent::_hooks(); $this->util->add_action('init', $this->m('init_defaults'), 5); $this->util->add_action('footer', $this->m('client_output'), 1, 0, false); $this->util->add_filter('footer_script', $this->m('client_output_script'), $this->util->priority('client_footer_output'), 1, false); } - + /* Collection Management */ - + /** * Add content type handler * Accepts properties to create new handler OR previously-initialized handler instance @@ -65,7 +65,7 @@ public function add($id, $props = array(), $priority = 10) { // Add to collection return parent::add($handler, array('priority' => $priority)); } - + /** * Remove item * @uses clear_cache() @@ -76,7 +76,7 @@ public function remove($item) { $this->clear_cache(); return parent::remove($item); } - + /** * Clear collection * @uses clear_cache() @@ -87,7 +87,7 @@ public function clear() { $this->clear_cache(); return parent::clear(); } - + /** * Retrieves handlers sorted by priority * @see parent::get() @@ -104,7 +104,7 @@ public function get($args = null) { } return $items; } - + /** * Get matching handler for URI * @param string $uri URI to find match for @@ -133,9 +133,9 @@ public function match($uri) { } return $ret; } - + /* Cache */ - + /** * Retrieve cached items * @uses get_cache_props() @@ -147,7 +147,7 @@ protected function get_cache() { $items = wp_cache_get($cprops->key, $cprops->group); return ( is_array($items) ) ? $items : array(); } - + /** * Update cached items * Cache is cleared if no items specified @@ -159,7 +159,7 @@ protected function update_cache($data = null) { $props = $this->get_cache_props(); wp_cache_set($props->key, $data, $props->group); } - + /** * Clear cache * @uses update_cache() @@ -167,7 +167,7 @@ protected function update_cache($data = null) { protected function clear_cache() { $this->update_cache(); } - + /** * Retrieve cache properites (key, group) * @return object Cache properties @@ -179,11 +179,11 @@ protected function get_cache_props() { 'group' => $this->get_prefix(), ); } - return $this->cache_props; + return $this->cache_props; } - + /* Handlers */ - + /** * Initialize default handlers * @param SLB_Content_Handlers $handlers Handlers controller @@ -204,7 +204,7 @@ public function init_defaults($handlers) { $handlers->add($id, $props); } } - + /** * Matches image URIs * @param string $uri URI to match @@ -213,22 +213,22 @@ public function init_defaults($handlers) { public function match_image($uri, $handlers) { // Basic matching $match = ( $this->util->has_file_extension($uri, array('jpg', 'jpeg', 'jpe', 'jfif', 'jif', 'gif', 'png')) ) ? true : false; - + // Filter result $extra = new stdClass(); $match = $this->util->apply_filters('image_match', $match, $uri, $extra); - + // Handle extra data passed from filters // Currently only `uri` supported if ( $match && isset($extra->uri) && is_string($extra->uri) ) { $match = array('uri' => $extra->uri); } - + return $match; } - + /* Output */ - + /** * Build client output * Load handler files in client @@ -239,7 +239,7 @@ public function client_output() { $handler->enqueue_scripts(); } } - + /** * Client output script * @param array $commands Client script commands @@ -248,7 +248,7 @@ public function client_output() { public function client_output_script($commands) { $out = array('/* CHDL */'); $code = array(); - + foreach ( $this->request_matches as $handler ) { // Attributes $attrs = $handler->get_attributes(); diff --git a/includes/class.field_base.php b/includes/class.field_base.php index 10b1bb2..41a6d12 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -11,28 +11,28 @@ class SLB_Field_Base extends SLB_Base { /*-** Config **-*/ protected $mode = 'object'; protected $shared = false; - + /*-** Properties **-*/ - + /** * @var string Unique name */ var $id = ''; - + /** * ID formatting options. - * + * * @var array $id_formats */ private $id_formats = []; /** * Flag for ID format initialization status. - * + * * @var bool $id_formats_init */ private $id_formats_init = false; - + /** * Special characters/phrases * Used for preserving special characters during formatting @@ -43,7 +43,7 @@ class SLB_Field_Base extends SLB_Base { * @var array */ var $special_chars = null; - + var $special_chars_default = array( '{' => '%SQB_L%', '}' => '%SQB_R%', @@ -70,13 +70,13 @@ class SLB_Field_Base extends SLB_Base { * @var array Object Properties */ var $properties = array(); - + /** * Initialization properties * @var array */ protected $properties_init = null; - + /** * Structure: Property names stored as keys in group * Root @@ -86,33 +86,33 @@ class SLB_Field_Base extends SLB_Base { * @var array Groupings of Properties */ var $property_groups = array(); - + /** * Keys to filter out of properties array before setting properties * @var array */ var $property_filter = array('group'); - + /** * Define order of properties * Useful when processing order is important (e.g. one property depends on another) * @var array */ var $property_priority = array(); - + /** * Data for object * May also contain data for nested objects * @var mixed */ var $data = null; - + /** * Whether data has been fetched or not * @var bool */ protected $data_loaded = false; - + /** * @var array Script resources to include for object */ @@ -128,7 +128,7 @@ class SLB_Field_Base extends SLB_Base { * @var array */ var $hooks = array(); - + /** * Mapping of child properties to parent members * Allows more flexibility when creating new instances of child objects using property arrays @@ -138,7 +138,7 @@ class SLB_Field_Base extends SLB_Base { * @var array */ var $map = null; - + /** * Options used when building collection (callbacks, etc.) * Associative array @@ -147,9 +147,9 @@ class SLB_Field_Base extends SLB_Base { * @var array */ var $build_vars = array(); - + var $build_vars_default = array(); - + /** * Constructor */ @@ -166,7 +166,7 @@ function __construct($id = '', $properties = null) { } /* Getters/Setters */ - + /** * Checks if the specified path exists in the object * @param array $path Path to check for @@ -189,7 +189,7 @@ function path_isset($path = '') { return false; } } - return true; + return true; } /** @@ -289,7 +289,7 @@ function &get_member_value($member, $name = '', $default = '', $dir = 'parent') if ( 'parent' == $dir ) $ex_val = $this->get_parent_value($member, $name, $default); elseif ( method_exists($this, 'get_container_value') ) - $ex_val = $this->get_container_value($member, $name, $default); + $ex_val = $this->get_container_value($member, $name, $default); // Handle inheritance if ( is_array($val) ) { // Combine Arrays @@ -322,7 +322,7 @@ function get_object_value(&$object, $member, $name = '', $default = '', $dir = ' $ret = $object->get_member_value($member, $name, $default, $dir); return $ret; } - + /** * Set item ID * @param string $id Unique item ID @@ -332,7 +332,7 @@ function set_id($id) { return false; $this->id = trim($id); } - + /** * Retrieves field ID * @param array|string $options (optional) Options or ID of format to use @@ -343,7 +343,7 @@ function get_id($options = array()) { $formats = $this->get_id_formats(); // Setup options $wrap_default = array('open' => '', 'close' => '', 'segment_open' => '', 'segment_close' => ''); - + $options_default = array( 'format' => null, 'wrap' => array(), @@ -351,7 +351,7 @@ function get_id($options = array()) { 'prefix' => '', 'recursive' => false ); - + // Load options based on format if ( !is_array($options) ) $options = array('format' => $options); @@ -365,15 +365,15 @@ function get_id($options = array()) { // Validate options $wrap = wp_parse_args($wrap, $wrap_default); - + if ( !is_array($segments_pre) ) $segments_pre = array($segments_pre); $segments_pre = array_reverse($segments_pre); - + // Format ID based on options $item_id = array($item_id); - // Add parent objects to ID + // Add parent objects to ID if ( !!$recursive ) { // Create array of ID components $m = 'get_caller'; @@ -388,7 +388,7 @@ function get_id($options = array()) { } unset($c); } - + // Additional segments (Pre) foreach ( $segments_pre as $seg ) { if ( is_null($seg) ) @@ -400,7 +400,7 @@ function get_id($options = array()) { elseif ( '' != strval($seg) ) $item_id[] = strval($seg); } - + // Prefix if ( is_array($prefix) ) { // Array is sequence of instance methods to call on object @@ -415,7 +415,7 @@ function get_id($options = array()) { continue; // Build callback $m = $this->util->m($p, $m); - // Call callback + // Call callback $val = call_user_func_array($m, $args); // Returned value may be an instance object if ( is_object($val) ) @@ -429,16 +429,16 @@ function get_id($options = array()) { if ( is_numeric($prefix) ) $prefix = strval($prefix); if ( empty($prefix) || !is_string($prefix) ) - $prefix = ''; + $prefix = ''; // Convert array to string $item_id = $prefix . $wrap['open'] . implode($wrap['segment_close'] . $wrap['segment_open'], array_reverse($item_id)) . $wrap['close']; return $item_id; } - + /** * Retrieves ID formats. - * + * * @return array ID formats. */ private function &get_id_formats() { @@ -448,9 +448,9 @@ private function &get_id_formats() { /** * Initializes default ID formats. - * + * * @since dev - * + * * @return void */ private function init_id_formats() { @@ -475,7 +475,7 @@ private function init_id_formats() { ], true ); - + } } @@ -483,7 +483,7 @@ private function init_id_formats() { * Adds custom ID format. * * @since dev - * + * * @param string $name Format name. * @param array $wrap * @param array $prefix @@ -519,7 +519,7 @@ function get_data($context = '', $top = true) { $args = wp_parse_args($args[0], $opt_d); extract($args); } - + if ( is_string($top) ) { if ( 'false' == $top ) $top = false; @@ -550,7 +550,7 @@ function get_data($context = '', $top = true) { $new->load_data(); } } - + $obj =& $new; unset($new); // Stop iteration @@ -596,7 +596,7 @@ function set_data($value, $name = '') { $ref =& $this->get_path_value('data', $name); $ref = $value; } - + /** * Sets parent object of current instance * Parent objects must be the same object type as current instance @@ -612,11 +612,11 @@ function set_parent($parent = null) { // Parent passed as object reference wrapped in array if ( is_array($parent) && isset($parent[0]) && is_object($parent[0]) ) $parent = $parent[0]; - + // No parent set but parent ID (previously) set in object if ( empty($parent) && is_string($this->parent) ) $parent = $this->parent; - + // Retrieve reference object if ID was supplied if ( is_string($parent) ) { $parent = trim($parent); @@ -629,7 +629,7 @@ function set_parent($parent = null) { $parent = $b->fields->get($parent); } } - + // Set parent value on object if ( is_string($parent) || is_object($parent) ) $this->parent = $parent; @@ -677,7 +677,7 @@ function get_description() { return $this->get_member_value('description', '','', $dir); return $desc; } - + /** * Sets multiple properties on field type at once * @param array $properties Properties. Each element is an array containing the arguments to set a new property @@ -698,7 +698,7 @@ function set_properties($properties) { unset($properties[$prop]); } } - + // Filter properties $properties = $this->filter_properties($properties); // Set additional instance properties @@ -706,7 +706,7 @@ function set_properties($properties) { $this->set_property($name, $val); } } - + /** * Remap properties based on $map * @uses $map For determine how child properties should map to parent properties @@ -718,7 +718,7 @@ function remap_properties($properties) { // Return remapped properties return $this->util->array_remap($properties, $this->map); } - + /** * Sort properties based on priority * @uses this::property_priority @@ -741,7 +741,7 @@ function sort_properties($properties) { $props = array_merge($props, $properties); return $props; } - + /** * Build properties array * @param array $props Instance properties @@ -763,15 +763,15 @@ function make_properties($props, $signature = array()) { } return $props; } - + function validate_id($id) { return ( is_scalar($id) && !empty($id) ) ? true : false; } - + function integrate_id($id) { return ( $this->validate_id($id) ) ? array('id' => $id) : array(); } - + /** * Filter property members * @uses $property_filter to remove define members to remove from $properties @@ -781,7 +781,7 @@ function integrate_id($id) { function filter_properties($props = array()) { return $this->util->array_filter_keys($props, $this->property_filter); } - + /** * Add/Set a property on the field definition * @param string $name Name of property @@ -814,7 +814,7 @@ function get_property($name) { $val = $this->get_member_value('properties', $name); return $val; } - + /** * Removes a property from item * @param string $name Property ID @@ -863,7 +863,7 @@ function set_group_property($group, $property) { function get_group($group) { return $this->get_member_value('property_groups', $group, array()); } - + /** * Save field data * Child classes will define their own @@ -873,9 +873,9 @@ function get_group($group) { function save() { return true; } - + /*-** Hooks **-*/ - + /** * Retrieve hooks added to object * @return array Hooks @@ -883,7 +883,7 @@ function save() { function get_hooks() { return $this->get_member_value('hooks', '', array()); } - + /** * Add hook for object * @see add_filter() for parameter defaults @@ -902,11 +902,11 @@ function add_hook($tag, $function_to_add, $priority = 10, $accepted_args = 1) { elseif ( is_array($function_to_add) && !empty($function_to_add) ) $id = strval($function_to_add[count($function_to_add) - 1]); else - $id = 'function_' . ( count($this->hooks[$tag]) + 1 ); + $id = 'function_' . ( count($this->hooks[$tag]) + 1 ); // Add hook $this->hooks[$tag][$id] = func_get_args(); } - + /** * Convenience method for adding an action for object * @see add_filter() for parameter defaults @@ -918,7 +918,7 @@ function add_hook($tag, $function_to_add, $priority = 10, $accepted_args = 1) { function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) { $this->add_hook($tag, $function_to_add, $priority, $accepted_args); } - + /** * Convenience method for adding a filter for object * @see add_filter() for parameter defaults @@ -930,9 +930,9 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) { $this->add_hook($tag, $function_to_add, $priority, $accepted_args); } - + /*-** Dependencies **-*/ - + /** * Adds dependency to object * @param string $type Type of dependency to add (script, style) @@ -954,14 +954,14 @@ function add_dependency($type, $context, $handle, $src = false, $deps = array(), // Wrap single contexts in an array if ( is_string($context) ) $context = array($context); - else + else $context = array(); } // Add file to instance property if ( isset($this->{$type}) && is_array($this->{$type}) ) $this->{$type}[$handle] = array('context' => $context, 'params' => $args); } - + /** * Add script to object to be added in specified contexts * @param array|string $context Array of contexts to add script to page @@ -986,7 +986,7 @@ function add_script( $context, $handle, $src = false, $deps = array(), $ver = fa function get_scripts() { return $this->get_member_value('scripts', '', array()); } - + /** * Add style to object to be added in specified contexts * @param array|string $context Array of contexts to add style to page @@ -1010,9 +1010,9 @@ function add_style( $handle, $src = false, $deps = array(), $ver = false, $media function get_styles() { return $this->get_member_value('styles', '', array()); } - + /* Helpers */ - + /** * Format value based on specified context * @param mixed $value Value to format @@ -1034,7 +1034,7 @@ function format($value, $context = '') { /** * Format value for output as an attribute. - * + * * Only strings are formatted. * * @since dev @@ -1048,13 +1048,13 @@ function format_attr( $value ) { } return $value; } - + /** * Formats value for output as plain text. - * + * * Escapes HTML, etc. * Only strings are formatted. - * + * * @since dev * * @param mixed $value Value to format. @@ -1066,7 +1066,7 @@ function format_text( $value ) { } return $value; } - + /** * Final formatting before output * Restores special characters, etc. @@ -1079,25 +1079,25 @@ function format_text( $value ) { function format_final($value, $context = '') { if ( !is_string($value) ) return $value; - + // Restore special chars return $this->restore_special_chars($value, $context); } - + function preserve_special_chars($value, $context = '') { if ( !is_string($value) ) return $value; $specials = $this->get_special_chars(); return str_replace(array_keys($specials), $specials, $value); } - + function restore_special_chars($value, $context = '') { if ( !is_string($value) ) return $value; $specials = $this->get_special_chars(); return str_replace($specials, array_keys($specials), $value); } - + /** * Retrieve special characters/placeholders * Merges defaults with class-specific characters diff --git a/includes/class.field_collection.php b/includes/class.field_collection.php index 561865e..83837f7 100644 --- a/includes/class.field_collection.php +++ b/includes/class.field_collection.php @@ -8,31 +8,31 @@ class SLB_Field_Collection extends SLB_Field_Base { /* Configuration */ - + protected $mode = 'sub'; - + /* Properties */ - + /** * Item type * @var string */ var $item_type = 'SLB_Field'; - + /** * Indexed array of items in collection * @var array */ var $items = array(); - - var $build_vars_default = array ( + + var $build_vars_default = array ( 'groups' => array(), 'context' => '', 'layout' => 'form', 'build' => true, 'build_groups' => true, ); - + /** * Associative array of groups in collection * Key: Group ID @@ -44,9 +44,9 @@ class SLB_Field_Collection extends SLB_Field_Base { * @var array */ var $groups = array(); - + protected $properties_init = null; - + /* Constructors */ /** @@ -64,14 +64,14 @@ public function __construct($id, $properties = null) { $properties = $this->make_properties($args); // Parent constructor parent::__construct($properties); - + // Save initial properties $this->properties_init = $properties; } - + public function _init() { parent::_init(); - + // Load properties. $this->load($this->properties_init, false); @@ -85,11 +85,11 @@ public function _init() { ] ); } - + /*-** Getters/Setters **-*/ - + /* Setup */ - + /** * Load collection with specified properties * Updates existing properties @@ -112,9 +112,9 @@ public function load($properties, $update = true) { } return $this; } - + /* Data */ - + /** * Retrieve external data for items in collection * Retrieved data is saved to the collection's $data property @@ -128,7 +128,7 @@ public function load($properties, $update = true) { function load_data() { $this->data_loaded = true; } - + /** * Set data for an item * @param mixed $item Field to set data for @@ -159,7 +159,7 @@ function set_data($item, $value = '', $save = true, $force_set = false) { } /* Item */ - + /** * Adds item to collection * @param string|obj $id Unique name for item or item instance @@ -180,7 +180,7 @@ function add($id, $properties = array(), $update = false) { if ( !is_array($properties) ) { $properties = array(); } - + // Handle item instance if ( $id instanceof $this->item_type ) { $item = $id; @@ -204,21 +204,21 @@ function add($id, $properties = array(), $update = false) { $item = new $type($properties); } } - + if ( empty($item) || 0 == strlen($item->get_id()) ) { return false; } - + // Set container $item->set_container($this); // Add item to collection $this->items[$item->get_id()] = $item; - + if ( isset($properties['group']) ) { $this->add_to_group($properties['group'], $item->get_id()); } - + return $item; } @@ -239,11 +239,11 @@ function remove($item, $save = true) { } // Remove item data from collection $this->remove_data($item, false); - + if ( !!$save ) $this->save(); } - + /** * Remove item data from collection * @param string|object $item Object or item ID to remove @@ -255,7 +255,7 @@ function remove_data($item, $save = true) { $item = $this->get($item); $item = $item->get_id(); } - + // Remove data from data member if ( is_string($item) && is_array($this->data) ) { unset($this->data[$item]); @@ -272,7 +272,7 @@ function remove_data($item, $save = true) { function has($item) { return ( !is_string($item) || empty($item) || is_null($this->get_member_value('items', $item, null)) ) ? false : true; } - + /** * Retrieve specified item in collection * @param string|object $item Item object or ID to retrieve @@ -292,7 +292,7 @@ function get($item, $safe_mode = false) { } else { $item = false; } - + if ( !!$safe_mode && !is_object($item) ) { // Fallback: Return empty item if no item exists $type = $this->item_type; @@ -300,7 +300,7 @@ function get($item, $safe_mode = false) { } return $item; } - + /** * Retrieve item data * @param $item Item to get data for @@ -317,14 +317,14 @@ function get_data($item = null, $context = '', $top = true) { } else { $ret = parent::get_data($context, $top); } - + if ( is_string($item) && is_array($ret) && isset($ret[$item]) ) $ret = $ret[$item]; return $ret; } /* Items (Collection) */ - + /** * Add multiple items to collection * @param array $items Items to add to collection @@ -343,7 +343,7 @@ function add_items($items = array(), $update = false) { $this->add($id, $props, $update); } } - + /** * Retrieve reference to items in collection * @return array Collection items (reference) @@ -374,7 +374,7 @@ function &get_items($group = null, $sort = 'priority') { } return $items; } - + /** * Build output for items in specified group * If no group specified, all items in collection are built @@ -386,16 +386,16 @@ function build_items($group = null) { if ( empty($items) ) { return false; } - + $this->util->do_action_ref_array('build_items_pre', array($this)); foreach ( $items as $item ) { $item->build(); } $this->util->do_action_ref_array('build_items_post', array($this)); } - + /* Group */ - + /** * Add groups to collection * @param array $groups Associative array of group properties @@ -413,10 +413,10 @@ function add_groups($groups = array(), $update = false) { $this->add_group($id, $props, null, $update); } } - + /** * Adds group to collection - * Groups are used to display related items in the UI + * Groups are used to display related items in the UI * @param string $id Unique name for group * @param string $title Group title * @param string $description Short description of group's purpose @@ -488,7 +488,7 @@ function &create_group($id = '', $title = '', $description = '', $priority = 10) $group->items = array(); return $group; } - + /** * Checks if group exists in collection * @param string $id Group name @@ -505,7 +505,7 @@ function group_exists($group) { } return $ret; } - + /** * Adds item to a group in the collection * Group is created if it does not already exist @@ -517,7 +517,7 @@ function add_to_group($group, $items, $priority = 10) { if ( empty($items) || empty($group) || ( !is_string($group) && !is_array($group) ) ) { return false; } - + // Get group ID if ( is_string($group) ) { $group = array($group, $priority); @@ -531,7 +531,7 @@ function add_to_group($group, $items, $priority = 10) { if ( !is_int($priority) ) { $priority = 10; } - + // Prepare group if ( !$this->group_exists($gid) ) { // TODO Follow @@ -614,7 +614,7 @@ function &get_group($group) { } return $this->get_member_value('groups', $group); } - + /** * Retrieve a group's items * @uses SLB_Field_Collection::get_group() to retrieve group object @@ -651,14 +651,14 @@ function &get_groups($opts = array()) { } return $groups; } - + /** * Output groups * @uses self::build_vars to determine groups to build */ function build_groups() { $this->util->do_action_ref_array('build_groups_pre', array($this)); - + // Get groups to build $groups = ( !empty($this->build_vars['groups']) ) ? $this->build_vars['groups'] : array_keys($this->get_groups(array('sort' => 'priority'))); // Check options @@ -671,7 +671,7 @@ function build_groups() { $this->build_group($group); } } - + $this->util->do_action_ref_array('build_groups_post', array($this)); } @@ -687,19 +687,19 @@ function build_group($group) { if ( !count($this->get_items($group)) ) { return false; } - + // Pre action $this->util->do_action_ref_array('build_group_pre', array($this, $group)); - + // Build items $this->build_items($group); - + // Post action $this->util->do_action_ref_array('build_group_post', array($this, $group)); } /* Collection */ - + /** * Build entire collection of items * Prints output @@ -715,16 +715,16 @@ function build($build_vars = array()) { // Post-build output $this->util->do_action_ref_array('build_post', array($this)); } - + /** * Set build variable * @param string $key Variable name - * @param mixed $val Variable value + * @param mixed $val Variable value */ function set_build_var($key, $val) { $this->build_vars[$key] = $val; } - + /** * Retrieve build variable * @param string $key Variable name @@ -734,7 +734,7 @@ function set_build_var($key, $val) { function get_build_var($key, $default = null) { return ( array_key_exists($key, $this->build_vars) ) ? $this->build_vars[$key] : $default; } - + /** * Delete build variable * @param string $key Variable name to delete @@ -744,7 +744,7 @@ function delete_build_var($key) { unset($this->build_vars[$key]); } } - + /** * Parses build variables prior to use * @uses this->reset_build_vars() to reset build variables for each request @@ -752,9 +752,9 @@ function delete_build_var($key) { */ function parse_build_vars($build_vars = array()) { $this->reset_build_vars(); - $this->build_vars = $this->util->apply_filters('parse_build_vars', wp_parse_args($build_vars, $this->build_vars), $this); + $this->build_vars = $this->util->apply_filters('parse_build_vars', wp_parse_args($build_vars, $this->build_vars), $this); } - + /** * Reset build variables to defaults * Default Variables diff --git a/includes/class.field_type.php b/includes/class.field_type.php index 81df6e8..b41794c 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -42,7 +42,7 @@ function __construct($id = '', $parent = null) { $defaults = $this->integrate_id($id); if ( !is_array($parent) ) $defaults['parent'] = $parent; - + $props = $this->make_properties($args, $defaults); parent::__construct($props); } @@ -262,17 +262,17 @@ function is_valid_layout($layout_content) { function parse_layout($layout, $search) { $parse_match = ''; $result = []; - + // Find all nested layouts in layout. $match_value = preg_match_all( $search, $layout, $parse_match, PREG_PATTERN_ORDER ); - + // Stop if no matches found. if ( ! $match_value ) { return $result; } - + /* Process matches */ - + $ph_xml = ''; $ph_root_tag = 'ph_root_element'; $ph_start_xml = '<'; @@ -362,7 +362,7 @@ function get_placeholder_defaults() { $ph->pattern_layout = '/' . $ph->start . '([a-zA-Z0-9].*?\s+' . $ph->reserved['ref'] . '="layout.*?".*?)' . $ph->end . '/i'; return $ph; } - + /** * Build item output * @param string $layout (optional) Layout to build @@ -373,7 +373,7 @@ function build($layout = null, $data = null) { echo $this->build_layout($layout, $data); $this->util->do_action_ref_array('build_post', array($this)); } - + /** * Builds HTML for a field based on its properties * @param string $layout (optional) Name of layout to build @@ -396,9 +396,9 @@ function build_layout($layout = 'form', $data = null) { /** * Processes placeholders in a string. - * + * * Finds and replaces placeholders in a string to their full values. - * + * * @since dev * * @param string $str String with placeholders to replace. @@ -430,7 +430,7 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) { // Context-specific formatting. $target_property = $this->format( $target_property, $context ); } - + // Clear value if value not a string if ( !is_scalar( $target_property ) ) { $target_property = ''; diff --git a/includes/class.fields.php b/includes/class.fields.php index d7af102..816a08d 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -7,21 +7,21 @@ * */ class SLB_Fields extends SLB_Field_Collection { - + var $item_type = 'SLB_Field_Type'; - + /** * Placeholder handlers * @var array */ var $placholders = null; - + /* Constructor */ - + function __construct() { parent::__construct('fields'); } - + protected function _hooks() { parent::_hooks(); // Init fields @@ -29,9 +29,9 @@ protected function _hooks() { // Init placeholders add_action('init', $this->m('register_placeholders')); } - + /* Field Types */ - + /** * Initialize fields */ @@ -73,7 +73,7 @@ function register_types() { $text->set_property('label'); $text->set_layout('form', '{label ref_base="layout"} {inherit}'); $this->add($text); - + // Checkbox $cb = new SLB_Field_Type('checkbox', 'input'); $cb->set_property('type', 'checkbox'); @@ -88,7 +88,7 @@ function register_types() { $ta->set_property('cols', 40, 'attr'); $ta->set_property('rows', 3, 'attr'); $this->add($ta); - + // Rich Text $rt = new SLB_Field_Type('richtext', 'textarea'); $rt->set_property('class', 'theEditor {inherit}'); @@ -112,25 +112,25 @@ function register_types() { $select->set_layout('form', '{label ref_base="layout"} {form_start ref_base="layout"}{option_loop ref_base="layout"}{form_end ref_base="layout"}'); $select->set_layout('option_loop', '{loop data="properties.options" layout="option" layout_data="option_data"}'); $select->set_layout('option', '<{tag_option} value="{data_ext id="option_value" context="attr"}">{data_ext id="option_text" context="text"}'); - $select->set_layout('option_data', '<{tag_option} value="{data_ext id="option_value" context="attr"}" selected="selected">{data_ext id="option_text" context="text"}'); + $select->set_layout('option_data', '<{tag_option} value="{data_ext id="option_value" context="attr"}" selected="selected">{data_ext id="option_text" context="text"}'); $this->add($select); - + // Span $span = new SLB_Field_Type('span', 'base_closed'); $span->set_description(__('Inline wrapper', 'simple-lightbox')); $span->set_property('tag', 'span'); $span->set_property('value', 'Hello there!'); $this->add($span); - + // Enable plugins to modify (add, remove, etc.) field types $this->util->do_action_ref_array('register_fields', array($this), false); - + // Signal completion of field registration $this->util->do_action_ref_array('fields_registered', array($this), false); } - + /* Placeholder handlers */ - + function register_placeholders() { // Default placeholder handlers $this->register_placeholder('all', $this->m('process_placeholder_default'), 11); @@ -141,14 +141,14 @@ function register_placeholders() { $this->register_placeholder('loop', $this->m('process_placeholder_loop')); $this->register_placeholder('label', $this->m('process_placeholder_label')); $this->register_placeholder('checked', $this->m('process_placeholder_checked')); - + // Allow other code to register placeholders $this->util->do_action_ref_array('register_field_placeholders', array($this), false); - + // Signal completion of field placeholder registration $this->util->do_action_ref_array('field_placeholders_registered', array($this), false); } - + /** * Register a function to handle a placeholder * Multiple handlers may be registered for a single placeholder @@ -168,7 +168,7 @@ function register_placeholder($placeholder, $callback, $priority = 10) { $hook = $this->add_prefix('process_placeholder' . $placeholder); add_filter($hook, $callback, $priority, 5); } - + /** * Default placeholder processing * To be executed when current placeholder has not been handled by another handler @@ -227,11 +227,11 @@ function process_placeholder_default($output, $item, $placeholder, $layout, $dat /** * Renders field ID formatted for a form field's `id` attribute. - * + * * ID is formatted to be unique identifier for form field. * Example: `options_field_id`. * Registered as handler for `{field_id}` placeholder. - * + * * @param string $output Placeholder's rendered value. * @param SLB_Field $item Field containing placeholder. * @param array &$placeholder Placeholder being processed. @@ -252,11 +252,11 @@ function process_placeholder_id( $output, $item, &$placeholder, $layout, $data ) /** * Renders field ID formatted for a form field's `name` attribute. - * + * * ID is formatted to be part of an associative array for processing form submission. * Example: `options[field_id]`. * Registered as handler for `{field_name}` placeholder. - * + * * @param string $output Placeholder's rendered value. * @param SLB_Field $item Field containing placeholder. * @param array &$placeholder Placeholder being processed. @@ -266,7 +266,7 @@ function process_placeholder_id( $output, $item, &$placeholder, $layout, $data ) */ function process_placeholder_name($output, $item, &$placeholder, $layout, $data) { // Get attributes - $args = wp_parse_args($placeholder['attributes'], array('format' => 'attr_name')); + $args = wp_parse_args($placeholder['attributes'], array('format' => 'attr_name')); $output = $item->get_id($args); // Set default placeholder context. if ( ! isset( $placeholder['attributes']['context'] ) ) { @@ -274,7 +274,7 @@ function process_placeholder_name($output, $item, &$placeholder, $layout, $data) } return $output; } - + /** * Build item label * @see SLB_Fields::process_placeholder_default for parameter descriptions @@ -288,7 +288,7 @@ function process_placeholder_label($output, $item, $placeholder, $layout, $data) $out = $item->get_title(); return $out; } - + /** * Retrieve data for item * @see SLB_Field_Type::process_placeholder_default for parameter descriptions @@ -307,11 +307,11 @@ function process_placeholder_data($output, $item, $placeholder, $layout) { if ( isset($opts['element']) && is_array($out) && ( $el = $opts['element'] ) && isset($out[$el]) ) $out = $out[$el]; } - + // Return data return $out; } - + /** * Set checked attribute on item * Evaluates item's data to see if item should be checked or not @@ -351,11 +351,11 @@ function process_placeholder_loop($output, $item, $placeholder, $layout, $data) // Get data for loop $path = explode('.', $attr['data']); $loop_data = $item->get_member_value($path); - + // Check if data is callback if ( is_callable($loop_data) ) $loop_data = call_user_func($loop_data); - + // Get item data $data = $item->get_data(); @@ -395,12 +395,12 @@ function process_placeholder_data_ext( string $output, SLB_Field $item, array $p if ( !! $key && isset( $data[ $key ] ) && is_scalar( $data[ $key ] ) ) { $output = strval( $data[ $key ] ); } - + return $output; } - + /* Build */ - + /** * Output items in a group * @param string $group ID of Group to output diff --git a/includes/class.option.php b/includes/class.option.php index 886280e..7aa8cad 100644 --- a/includes/class.option.php +++ b/includes/class.option.php @@ -6,17 +6,17 @@ * @author Archetyped */ class SLB_Option extends SLB_Field { - + /* Properties */ - + public $hook_prefix = 'option'; - + /** * Determines whether option will be sent to client * @var bool */ var $in_client = false; - + /** * Child mapping * @see SLB_Field_Base::map @@ -26,11 +26,11 @@ class SLB_Option extends SLB_Field { 'default' => 'data', 'attr' => 'properties' ); - + var $property_priority = array ('id', 'data', 'parent'); - + /* Init */ - + /** * @see SLB_Field::__construct() * @uses parent::__construct() to initialize instance @@ -51,17 +51,17 @@ function __construct($id, $title = '', $default = '') { // Send to parent constructor parent::__construct($props); } - + /* Getters/Setters */ - + /** * Retrieve default value for option * @return mixed Default option value */ function get_default($context = '') { - return $this->get_data($context, false); + return $this->get_data($context, false); } - + /** * Sets parent based on default value */ @@ -78,7 +78,7 @@ function set_parent($parent = null) { } parent::set_parent($parent); } - + /** * Set in_client property * @uses this::in_client @@ -88,7 +88,7 @@ function set_parent($parent = null) { function set_in_client($in_client = false) { $this->in_client = !!$in_client; } - + /** * Determines whether option should be included in client output * @uses this::in_client @@ -97,9 +97,9 @@ function set_in_client($in_client = false) { function get_in_client() { return $this->in_client; } - + /* Formatting */ - + /** * Format data as string for browser output * @see SLB_Field_Base::format() @@ -121,13 +121,13 @@ function format_display($value, $context = '') { } return htmlentities($value); } - + /** * Format data using same format as default value * @see SLB_Field_Base::format() * @param mixed $value Data to format * @param string $context (optional) Current context - * @return mixed Formatted option value + * @return mixed Formatted option value */ function format_default($value, $context = '') { // Get default value @@ -140,7 +140,7 @@ function format_default($value, $context = '') { $value = $this->format_string($value); return $value; } - + /** * Format data as boolean (true/false) * @see SLB_Field_Base::format() @@ -153,7 +153,7 @@ function format_bool($value, $context = '') { $value = !!$value; return $value; } - + /** * Format data as string * @see SLB_Field_Base::format() @@ -164,13 +164,13 @@ function format_bool($value, $context = '') { function format_string($value, $context = '') { if ( is_bool($value) ) { $value = ( $value ) ? 'true' : 'false'; - } + } elseif ( is_object($value) ) { $value = get_class($value); } elseif ( is_array($value) ) { $value = implode(' ', $value); - } + } else { $value = strval($value); } diff --git a/includes/class.options.php b/includes/class.options.php index 1e5f5f1..1191784 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -7,9 +7,9 @@ * @uses SLB_Field_Collection */ class SLB_Options extends SLB_Field_Collection { - + /* Properties */ - + public $hook_prefix = 'options'; var $item_type = 'SLB_Option'; @@ -19,24 +19,24 @@ class SLB_Options extends SLB_Field_Collection { * @var string */ private $version_key = 'version'; - + /** * Whether version has been checked * @var bool */ var $version_checked = false; - + var $items_migrated = false; - + var $build_vars = array ( 'validate_pre' => false, 'validate_post' => false, 'save_pre' => false, 'save_post' => false ); - + /* Init */ - + function __construct($id = '', $props = array()) { // Validate arguments $args = func_get_args(); @@ -49,7 +49,7 @@ function __construct($id = '', $props = array()) { parent::__construct($props); $this->add_prefix_ref($this->version_key); } - + protected function _hooks() { parent::_hooks(); // Register fields @@ -62,9 +62,9 @@ protected function _hooks() { $this->util->add_action('admin_page_render_content', $this->m('admin_page_render_content'), 10, 3, false); $this->util->add_filter('admin_action_reset', $this->m('admin_action_reset'), 10, 3, false); } - + /* Legacy/Migration */ - + /** * Checks whether new version has been installed and migrates necessary settings * @uses $version_key as option name @@ -93,10 +93,10 @@ function check_update() { // Migrate $this->migrate($version_changed); } - + return $this->version_checked; } - + /** * Save plugin version to DB * If no version supplied, will fetch plugin data to determine version @@ -110,7 +110,7 @@ function set_version($ver = null) { } return update_option($this->version_key, $ver); } - + /** * Retrieve saved version data * @return string Saved version @@ -118,7 +118,7 @@ function set_version($ver = null) { function get_version() { return get_option($this->version_key, ''); } - + /** * Migrate options from old versions to current version * @uses self::items_migrated to determine if simple migration has been performed in current request or not @@ -128,13 +128,13 @@ function get_version() { function migrate($full = false) { if ( !$full && $this->items_migrated ) return false; - + // Legacy options $d = null; $this->load_data(); - + $items = $this->get_items(); - + // Migrate separate options to unified option if ( $full ) { foreach ( $items as $opt => $props ) { @@ -148,7 +148,7 @@ function migrate($full = false) { } } } - + // Migrate legacy items if ( is_array($this->properties_init) && isset($this->properties_init['legacy']) && is_array($this->properties_init['legacy']) ) { $l =& $this->properties_init['legacy']; @@ -161,7 +161,7 @@ function migrate($full = false) { unset($l[$opt]); } } - + /* Separate options */ if ( $full ) { foreach ( $l as $opt => $dest ) { @@ -178,9 +178,9 @@ function migrate($full = false) { delete_option($oid); } } - + /* Simple Migration (Internal options only) */ - + // Get existing items that are also legacy items $opts = array_intersect_key($this->get_data(), $l); foreach ( $opts as $opt => $val ) { @@ -200,9 +200,9 @@ function migrate($full = false) { // Set flag $this->items_migrated = true; } - + /* Option setup */ - + /** * Get elements for creating fields * @return obj @@ -225,7 +225,7 @@ function get_field_elements() { } return $o; } - + /** * Register option-specific fields * @param SLB_Fields $fields Reference to global fields object @@ -235,7 +235,7 @@ function register_fields($fields) { // Layouts $o = $this->get_field_elements(); $l =& $o->layout; - + $form = implode('', array ( $l->opt_pre, $l->label_ref, @@ -244,7 +244,7 @@ function register_fields($fields) { $l->field_post, $l->opt_post )); - + // Text input $otxt = new SLB_Field_Type('option_text', 'text'); $otxt->set_property('class', '{inherit} code'); @@ -253,14 +253,14 @@ function register_fields($fields) { $otxt->set_layout('label', $l->label); $otxt->set_layout('form', $form); $fields->add($otxt); - + // Checkbox $ocb = new SLB_Field_Type('option_checkbox', 'checkbox'); $ocb->set_layout('label', $l->label); $ocb->set_layout('field_reference', sprintf( '', "{$this->get_id('formatted')}_items[]" ) ); $ocb->set_layout('form', '{field_reference ref_base="layout"}' . $form); $fields->add($ocb); - + // Select $othm = new SLB_Field_Type('option_select', 'select'); $othm->set_layout('label', $l->label); @@ -269,7 +269,7 @@ function register_fields($fields) { $othm->set_layout('form', $l->opt_pre . '{inherit}' . $l->opt_post); $fields->add($othm); } - + /** * Set parent field types for options * Parent only set for Admin pages @@ -291,18 +291,18 @@ function set_parents($fields) { $p = 'o:' . $p->id; } } - + /* Processing */ - + /** * Validates option data. - * + * * Validates option values (e.g. prior to saving to DB, after form submission, etc.). * Values are formatted and sanitized according to corresponding option's data type * (e.g. boolean, string, number, etc.). - * + * * @since 1.5.5 - * + * * @param array $values Optional. Option data to validate. * Indexed by option ID. * Default form-submission data used. @@ -318,11 +318,11 @@ function validate( $values = null ) { } /** * Generates query variable using common base. - * + * * @since dev - * + * * @param string $text Optional. Text to append to base. - * + * * @return string Query variable name. Format: "{base}_{text}". Default "{base}". */ $qv = function ( $text = '' ) { @@ -334,7 +334,7 @@ function validate( $values = null ) { $out = $base; // Append text to base. if ( is_string( $text ) && ! empty( $text ) ) { - $out .= "_{$text}"; + $out .= "_{$text}"; } return $out; }; @@ -359,7 +359,7 @@ function validate( $values = null ) { unset( $qvar, $qvar_items, $items_bool, $item_id ); } // Process values. - /** + /** * @var string $id Option ID. * @var mixed $val Option value (raw/unsanitized). */ @@ -399,9 +399,9 @@ function validate( $values = null ) { // Return validated values. return $values_valid; } - + /* Data */ - + /** * Retrieve options from database * @uses get_option to retrieve option data @@ -422,7 +422,7 @@ function fetch_data($sanitize = true) { } return $data; } - + /** * Retrieves option data for collection * @see SLB_Field_Collection::load_data() @@ -436,7 +436,7 @@ function load_data() { $this->check_update(); } } - + /** * Resets option values to their default values * @param bool $hard Reset all options if TRUE (default), Reset only unset options if FALSE @@ -450,7 +450,7 @@ function reset($hard = true) { // Save $this->save(); } - + /** * Save options data to database */ @@ -458,7 +458,7 @@ function save() { $this->normalize_data(); update_option($this->get_key(), $this->data); } - + /** * Normalize data * Assures that data in collection match items @@ -474,7 +474,7 @@ function normalize_data() { } /* Collection */ - + /** * Build key for saving/retrieving data to options table * @return string Key @@ -482,7 +482,7 @@ function normalize_data() { function get_key() { return $this->add_prefix($this->get_id()); } - + /** * Add option to collection * @uses SLB_Field_Collection::add() to add item @@ -494,10 +494,10 @@ function get_key() { function &add($id, $properties = array(), $update = false) { // Create item $args = func_get_args(); - $ret = call_user_func_array(array('parent', 'add'), $args); + $ret = call_user_func_array(array('parent', 'add'), $args); return $ret; } - + /** * Retrieve option value * @uses get_data() to retrieve option data @@ -508,7 +508,7 @@ function &add($id, $properties = array(), $update = false) { function get_value($option, $context = '') { return $this->get_data($option, $context); } - + /** * Retrieve option value as boolean (true/false) * @uses get_data() to retrieve option data @@ -518,11 +518,11 @@ function get_value($option, $context = '') { function get_bool($option) { return $this->get_value($option, 'bool'); } - + function get_string($option) { return $this->get_value($option, 'string'); } - + /** * Retrieve option's default value * @uses get_data() to retrieve option data @@ -533,9 +533,9 @@ function get_string($option) { function get_default($option, $context = '') { return $this->get_data($option, $context, false); } - + /* Output */ - + function build_init() { if ( $this->build_vars['validate_pre'] ) { $values = $this->validate(); @@ -544,7 +544,7 @@ function build_init() { } } } - + /** * Build array of option values for client output * @return array Associative array of options @@ -559,9 +559,9 @@ function build_client_output() { } return $out; } - + /* Admin */ - + /** * Handles output building for options on admin pages * @param obj|array $opts Options instance or Array of options instance and groups to build @@ -586,7 +586,7 @@ public function admin_page_render_content($opts, $page, $state) { 'parse_build_vars' => array( $this->m('admin_parse_build_vars'), 10, 2 ) ) ); - + // Add hooks foreach ( $hooks as $type => $hook ) { $m = 'add_' . $type; @@ -595,10 +595,10 @@ public function admin_page_render_content($opts, $page, $state) { call_user_func_array($this->util->m($m), $args); } } - + // Build output $this->build(array('build_groups' => $this->m('admin_build_groups'))); - + // Remove hooks foreach ( $hooks as $type => $hook ) { $m = 'remove_' . $type; @@ -619,7 +619,7 @@ public function admin_build_groups() { $page = $this->get_build_var('admin_page'); $state = $this->get_build_var('admin_state'); $groups = $this->get_build_var('groups'); - + // Get all groups $groups_all = $this->get_groups(); if ( empty($groups) ) { @@ -636,7 +636,7 @@ public function admin_build_groups() { add_meta_box($g->id, $g->title, $this->m('admin_build_group'), $state->screen, $state->context, $state->priority, array('group' => $g->id, 'page' => $page)); } } - + /** * Group output handler for admin pages * @param obj $obj Object passed by `do_meta_boxes()` call (Default: NULL) @@ -647,7 +647,7 @@ public function admin_build_group($obj, $box) { $group = $a['group']; $this->build_group($group); } - + /** * Parse build vars * @uses `options_parse_build_vars` filter hook diff --git a/includes/class.template_tags.php b/includes/class.template_tags.php index c5ada5e..d624512 100644 --- a/includes/class.template_tags.php +++ b/includes/class.template_tags.php @@ -8,36 +8,36 @@ */ class SLB_Template_Tags extends SLB_Collection_Controller { /* Configuration */ - + protected $item_type = 'SLB_Template_Tag'; - + public $hook_prefix = 'template_tags'; - + // Use tag ID as key protected $key_prop = 'get_id'; - + // Call $key_prop is a method to be called protected $key_call = true; - + /* Properties */ - + /** * Cache properties (key, group) * @var object */ protected $cache_props = null; - + /* Initialization */ - + protected function _hooks() { parent::_hooks(); $this->util->add_action('init', $this->m('init_defaults')); $this->util->add_action('footer', $this->m('client_output'), 1, 0, false); $this->util->add_filter('footer_script', $this->m('client_output_script'), $this->util->priority('client_footer_output'), 1, false); } - + /* Collection Management */ - + /** * Add template tag * Accepts properties to create new template tag OR previously-initialized tag instance @@ -51,9 +51,9 @@ public function add($id, $props = array()) { // Add to collection return parent::add($o); } - + /* Defaults */ - + /** * Initialize default template tags * @param SLB_Template_Tags $tags Tags controller @@ -78,9 +78,9 @@ public function init_defaults($tags) { $tags->add($id, $props); } } - + /* Output */ - + /** * Build client output */ @@ -90,7 +90,7 @@ public function client_output() { $tag->enqueue_scripts(); } } - + /** * Client output script * @param array $commands Client script commands @@ -99,7 +99,7 @@ public function client_output() { public function client_output_script($commands) { $out = array('/* TPLT */'); $code = array(); - + foreach ( $this->get() as $tag ) { $styles = $tag->get_styles(array('uri_format'=>'full')); if ( empty($styles) ) { diff --git a/includes/class.theme.php b/includes/class.theme.php index 3a40612..405162c 100644 --- a/includes/class.theme.php +++ b/includes/class.theme.php @@ -8,17 +8,17 @@ */ class SLB_Theme extends SLB_Component { /* Properties */ - + protected $props_required = array('name'); - + /** * Public flag * @var bool */ protected $public = true; - + /* Get/Set */ - + /** * Retrieve theme's ancestors * @param bool $sort_topdown (optional) Ancestor sorting (Default: Nearest to Farthest) @@ -45,7 +45,7 @@ public function get_ancestors($sort_topdown = false) { } return $ret; } - + /** * Set public flag * @param bool $public @@ -53,7 +53,7 @@ public function get_ancestors($sort_topdown = false) { public function set_public($public) { $this->public = !!$public; } - + /** * Get privacy state * @return bool @@ -61,9 +61,9 @@ public function set_public($public) { public function get_public() { return !!$this->public; } - + /* Templates */ - + /** * Add template file * @see `add_file()` @@ -74,7 +74,7 @@ public function get_public() { protected function add_template($handle, $src) { return $this->add_file('template', $handle, $src); } - + /** * Retrieve template file * @see `get_file()` @@ -85,9 +85,9 @@ protected function add_template($handle, $src) { protected function get_template($handle, $format = null) { return $this->get_file('template', $handle, $format); } - + /* Layout */ - + /** * Set theme layout * @uses `add_template()` @@ -97,7 +97,7 @@ protected function get_template($handle, $format = null) { public function set_layout($src) { return $this->add_template('layout', $src); } - + /** * Get layout * @param string $format (optional) Layout data format diff --git a/includes/class.themes.php b/includes/class.themes.php index 689c34b..729adfb 100644 --- a/includes/class.themes.php +++ b/includes/class.themes.php @@ -8,31 +8,31 @@ */ class SLB_Themes extends SLB_Collection_Controller { /* Configuration */ - + protected $item_type = 'SLB_Theme'; - + public $hook_prefix = 'themes'; - + protected $key_prop = 'get_id'; - + protected $key_call = true; - + /* Properties */ - + protected $id_default = null; - + /* Initialization */ - + protected function _hooks() { parent::_hooks(); // Register themes $this->util->add_action('init', $this->m('init_defaults'), 1); - + // Client output $this->util->add_action('footer', $this->m('client_output'), 1, 0, false); $this->util->add_filter('footer_script', $this->m('client_output_script'), $this->util->priority('client_footer_output'), 1, false); } - + protected function _options() { $opts = array ( 'items' => array ( @@ -46,10 +46,10 @@ protected function _options() { ), ) ); - + parent::_set_options($opts); } - + /** * Add default themes * @param SLB_Themes $themes Themes controller @@ -90,14 +90,14 @@ function init_defaults($themes) { ) ), ); - + foreach ( $defaults as $id => $props ) { $themes->add($id, $props); } } /* Collection management */ - + /** * Add theme * Accepts properties to create new theme or previously-created theme instance @@ -119,7 +119,7 @@ public function add($id, $props = array()) { // Add to collection return parent::add($o); } - + /** * Get themes * @param array $args (optional) Arguments @@ -134,12 +134,12 @@ public function get($args = null) { $r = wp_parse_args($args, $args_default); $r['include_public'] = !!$r['include_public']; $r['include_private'] = !!$r['include_private']; - + $items = parent::get($args); - + if ( empty($items) ) return $items; - + /* Process custom arguments */ // Filter @@ -161,7 +161,7 @@ public function get($args = null) { } /* Helpers */ - + /** * Retrieve default theme ID * @uses `$id_default` @@ -173,7 +173,7 @@ public function get_default_id() { } return $this->id_default; } - + /** * Retrieve currently-selected theme * @return SLB_Theme Selected theme @@ -188,29 +188,29 @@ protected function get_selected() { } return $thms[$id]; } - + /* Output */ - + /** * Build client output */ public function client_output() { // Process active theme $thm = $this->get_selected(); - + // Get theme ancestors $thms = $thm->get_ancestors(true); $thms[] = $thm; - + foreach ( $thms as $thm ) { // Load files $thm->enqueue_scripts(); } } - + /** * Client output script - * + * * @param array $commands Client script commands * @return array Modified script commands */ @@ -221,10 +221,10 @@ public function client_output_script($commands) { // Process theme ancestors $thms = $thm->get_ancestors(true); $thms[] = $thm; - + $out = array('/* THM */'); $code = array(); - + // Build output for each theme foreach ( $thms as $thm ) { // Setup client parameters @@ -248,7 +248,7 @@ public function client_output_script($commands) { } // Add properties to parameters $params[] = json_encode($thm_props); - + // Add theme to client $code[] = $this->util->call_client_method('View.extend_theme', $params, false); } @@ -259,9 +259,9 @@ public function client_output_script($commands) { } return $commands; } - + /* Options */ - + /** * Retrieve themes for use in option field * @uses self::theme_default @@ -276,17 +276,17 @@ public function opt_get_field_values() { $itm_d = $items[$d]; unset($items[$d]); } - + // Sort themes by name uasort( $items, function( $a, $b ) { return strcmp( $a->get_name(), $b->get_name() ); }); - + // Insert default theme at top of array if ( isset($itm_d) ) { $items = array( $d => $itm_d ) + $items; } - + // Build options foreach ( $items as $item ) { $items[$item->get_id()] = $item->get_name(); diff --git a/includes/class.utilities.php b/includes/class.utilities.php index 1b92559..e067d50 100644 --- a/includes/class.utilities.php +++ b/includes/class.utilities.php @@ -2,22 +2,22 @@ /** * Utility methods - * + * * @package Simple Lightbox * @subpackage Utilities * @author Archetyped * */ class SLB_Utilities { - + /* Properties */ - + /** * Instance parent * @var object */ private $_parent = null; - + /** * Plugin Base * @var string @@ -38,13 +38,13 @@ class SLB_Utilities { 'AuthorURI' => 'Author URI', ) ); - + /** * Plugin base path * @var string */ private $_path_base = null; - + /** * Standard hook priorities * @var array @@ -55,15 +55,15 @@ class SLB_Utilities { 'safe' => 15, 'client_footer_output' => 25, ); - + /* Constructors */ - + function __construct($obj) { if ( is_object($obj) ) { $this->_parent = $obj; } } - + /** * Returns callback array to instance method * @param object $obj Instance object @@ -81,11 +81,11 @@ function m($obj, $method = '') { $cb = array($obj, $method); return $cb; } - + /* Helper Functions */ - + /*-** Prefix **-*/ - + /** * Get valid separator * @param string $sep (optional) Separator supplied @@ -96,7 +96,7 @@ function get_sep($sep = false) { $sep = ''; return ( is_string($sep) ) ? $sep : '_'; } - + /** * Retrieve class prefix (with separator if set) * @param bool|string $sep Separator to append to class prefix (Default: no separator) @@ -107,7 +107,7 @@ function get_prefix($sep = null) { $prefix = ( !empty($this->_parent->prefix) ) ? $this->_parent->prefix . $sep : ''; return $prefix; } - + /** * Check if a string is prefixed * @param string|array $text Text to check for prefix @@ -122,7 +122,7 @@ function has_prefix($text, $sep = null) { $text = $text[0]; return ( !empty($text) && stripos($text, $this->get_prefix($sep)) === 0 ); } - + /** * Prepend plugin prefix to some text * @param string|array $text Text to add to prefix @@ -141,7 +141,7 @@ function add_prefix($text, $sep = '_', $once = true) { array_unshift($text, $this->get_prefix()); return implode($sep, $text); } - + /** * Prepend uppercased plugin prefix to some text * @param string|array $text Text to add to prefix @@ -155,7 +155,7 @@ function add_prefix_uc($text, $sep = '_', $once = true) { $pre = $this->get_prefix(); return str_replace($pre . $sep, strtoupper($pre) . $sep, $var); } - + /** * Add prefix to variable reference * Updates actual variable rather than return value @@ -169,7 +169,7 @@ function add_prefix_ref(&$var, $sep = null, $once = true) { $args = func_get_args(); $var = call_user_func_array($this->m($this, 'add_prefix'), $args); } - + /** * Remove prefix from specified string * @param string $text String to remove prefix from @@ -180,7 +180,7 @@ function remove_prefix($text, $sep = '_') { $text = substr($text, strlen($this->get_prefix($sep))); return $text; } - + /** * Returns Database prefix for plugin-related DB Tables * @return string Database prefix @@ -189,9 +189,9 @@ function get_db_prefix() { global $wpdb; return $wpdb->prefix . $this->get_prefix('_'); } - + /*-** Priority **-*/ - + /** * Retrieve standard priority * @var string $id Priority ID to retrieve @@ -204,9 +204,9 @@ public function priority($id = null) { } return $pri; } - + /* Wrapped Values */ - + /** * Create wrapper object * Properties @@ -221,13 +221,13 @@ function get_wrapper($start = null, $end = null) { // Validate existing wrapper if ( is_object($start) && isset($start->start) && isset($start->end) ) return $start; - + // Initialize wrapper $w = array ( 'start' => '[', 'end' => ']', ); - + if ( !empty($start) ) { if ( is_string($start) ) { $w['start'] = $start; @@ -244,10 +244,10 @@ function get_wrapper($start = null, $end = null) { if ( is_string($end) ) { $w['end'] = $end; } - + return (object) $w; } - + /** * Check if text is wrapped by specified character(s) * @uses this->get_wrapper() to Validate wrapper text @@ -260,11 +260,11 @@ function has_wrapper($text, $start = null, $end = null) { return false; // Validate wrapper $w = $this->get_wrapper($start, $end); - + // Check for wrapper return ( substr($text, 0, strlen($w->start)) == $w->start && substr($text, -1, strlen($w->end)) == $w->end ) ? true : false; } - + /** * Remove wrapper from specified text * @uses this->has_wrapper() to check if text is wrapped @@ -279,10 +279,10 @@ function remove_wrapper($text, $start = null, $end = null) { $w = $this->get_wrapper($start, $end); $text = substr($text, strlen($w->start), strlen($text) - strlen($w->start) - strlen($w->end) ); } - + return $text; } - + /** * Add wrapper to specified text * @uses Utilities::get_wrapper() to retrieve wrapper object @@ -298,9 +298,9 @@ function add_wrapper($text, $start = null, $end = null, $once = true) { $text = $w->start . $text . $w->end; return $text; } - + /*-** Client **-*/ - + /** * Parses client files array * > Adds ID property (prefixed file key) @@ -311,11 +311,11 @@ function add_wrapper($text, $start = null, $end = null, $once = true) { * > deps (array) [optional]: Dependencies * > Values wrapped in square brackets (`[` & `]`) are internal files * > callback (string|array) [optional]: Global callback to determine whether file should be loaded - * > Values wrapped in square brackets (`[` & `]`) are internal methods (of parent object) + * > Values wrapped in square brackets (`[` & `]`) are internal methods (of parent object) * > context (array) [optional]: Context(s) in which to load the file * Acceptable values * > string: Context name - * > array: Context name + callback (both must return TRUE to load file) + * > array: Context name + callback (both must return TRUE to load file) * > Callback follows same pattern as `callback` member * @param array $files Files array * @return object Client files @@ -362,15 +362,15 @@ function parse_client_files($files, $type = 'scripts') { else unset($p[$m]); } - + // Normalize file properties $p = array_merge($defaults, $p); - + /* File name */ - + // Validate file $file =& $p['file']; - + // Determine if filename or callback if ( !$this->is_file($file) ) $file = ( is_callable($file) ) ? $file : null; @@ -379,9 +379,9 @@ function parse_client_files($files, $type = 'scripts') { unset($files[$h]); continue; } - + /* Dependencies */ - + // Format internal dependencies foreach ( $p['deps'] as $idx => $dep ) { if ( $this->has_wrapper($dep) ) { @@ -389,9 +389,9 @@ function parse_client_files($files, $type = 'scripts') { $p['deps'][$idx] = $this->add_prefix($dep); } } - + /* Context */ - + // Validate callback $cb =& $p['callback']; if ( !is_null($cb) && !is_callable($cb) ) { @@ -399,7 +399,7 @@ function parse_client_files($files, $type = 'scripts') { unset($files[$h]); continue; } - + // Validate contexts $ctxs =& $p['context']; $ctxs = array_unique($ctxs); @@ -423,7 +423,7 @@ function parse_client_files($files, $type = 'scripts') { $ctx = false; break; } - + // Remove invalid contexts if ( empty($ctx) ) { unset($ctxs[$idx]); @@ -437,9 +437,9 @@ function parse_client_files($files, $type = 'scripts') { continue; } $ctxs = array_values($ctxs); - + /* Finalize Properties */ - + // Convert properties to object $files[$h] = (object) $p; } @@ -463,7 +463,7 @@ function get_client_object($path = null) { } return $obj; } - + /** * Build jQuery JS expression to add data to specified client object * @param string|obj $obj Name of client object (Set to root object if not a valid name) @@ -508,7 +508,7 @@ function extend_client_object($obj, $data = null, $out = false) { /** * Validate client object $obj before running command $cmd - * + * * @param string $obj Full object name * @param string $cmd (optional) Command to wrap in validation * @return string Command wrapped in validation block @@ -517,7 +517,7 @@ function extend_client_object($obj, $data = null, $out = false) { public function validate_client_object($obj, $cmd = null) { // Get base object $base = $this->get_client_object(); - + // Build condition $sep = '.'; $obj = trim($obj, $sep); @@ -530,14 +530,14 @@ public function validate_client_object($obj, $cmd = null) { $fmt .= ' && %1$s.has_child(\'%2$s\')'; } $condition = sprintf($fmt, $base, $obj); - + // Wrap command in validation if ( !empty($cmd) && is_string($cmd) ) { $condition = sprintf('if ( %1$s ) { %2$s }', $condition, $cmd); } return $condition; } - + /** * Build client method call * @uses get_client_object() to generate the body of the method call @@ -554,17 +554,17 @@ function call_client_method($method, $params = null, $encode = true, $validate = } $encode = !!$encode; $validate = !!$validate; - + // Build parameters if ( !is_null($params) ) { if ( $encode ) { - $params = wp_json_encode($params); + $params = wp_json_encode($params); } elseif ( is_array($params) ) { - $params = implode(',', $params); + $params = implode(',', $params); } } if ( !is_string($params) ) { - $params = ''; + $params = ''; } $ret = sprintf('%s(%s);', $this->get_client_object($method), $params); if ( $validate ) { @@ -572,9 +572,9 @@ function call_client_method($method, $params = null, $encode = true, $validate = } return $ret; } - + /*-** WP **-*/ - + /** * Checks if $post is a valid Post object * If $post is not valid, assigns global post object to $post (if available) @@ -598,8 +598,8 @@ function check_post(&$post) { return false; return true; } - - + + /** * Retrieve parent object * @return obj|bool Parent object (FALSE if no valid parent set) @@ -609,9 +609,9 @@ function get_parent() { return $this->_parent; } else { return false; - } + } } - + /** * Retrieve parent property value * @uses self::get_parent() @@ -621,11 +621,11 @@ function get_parent() { */ function get_parent_property($prop, $default = '') { $p = $this->get_parent(); - return ( !!$p && property_exists($p, $prop) ) ? $p->{$prop} : $default; + return ( !!$p && property_exists($p, $prop) ) ? $p->{$prop} : $default; } - + /* Hooks */ - + /** * Retrieve formatted name for internal hooks * Prefixes with parent prefix and hook prefix @@ -648,7 +648,7 @@ function get_hook($tag, $hook_prefix = true) { // Prefix return $this->add_prefix($hook . $tag); } - + /** * Run internal action * Namespaces $tag @@ -667,7 +667,7 @@ function do_action($tag, $arg = '') { $args[0] = $this->get_hook($tag, $hook_prefix); return call_user_func_array('do_action', $args); } - + /** * Run internal action passing arguments in array * @uses do_action_ref_array() @@ -676,7 +676,7 @@ function do_action($tag, $arg = '') { function do_action_ref_array($tag, $args, $hook_prefix = true) { return do_action_ref_array($this->get_hook($tag, $hook_prefix), $args); } - + /** * Run internal filter * Namespaces $tag @@ -695,16 +695,16 @@ function apply_filters($tag, $value) { $args[0] = $this->get_hook($tag, $hook_prefix); return call_user_func_array('apply_filters', $args); } - + /** * Run internal filter passing arguments in array * @uses apply_filters_ref_array() * @param bool|string $hook_prefix (optional) Secondary prefix to use for hook (Default: Use predefined hook name, FALSE: no secondary hook) */ function apply_filters_ref_array($tag, $args, $hook_prefix = true) { - return apply_filters_ref_array($this->get_hook($tag, $hook_prefix), $args); + return apply_filters_ref_array($this->get_hook($tag, $hook_prefix), $args); } - + /** * Add internal action * Namespaces $tag @@ -715,7 +715,7 @@ function apply_filters_ref_array($tag, $args, $hook_prefix = true) { function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1, $hook_prefix = true) { return add_action($this->get_hook($tag, $hook_prefix), $function_to_add, $priority, $accepted_args); } - + /** * Add internal filter * Namespaces $tag @@ -726,7 +726,7 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1, function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1, $hook_prefix = true) { return add_filter($this->get_hook($tag, $hook_prefix), $function_to_add, $priority, $accepted_args); } - + /** * Remove internal action * Namespaces $tag @@ -735,9 +735,9 @@ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1, * @param bool|string $hook_prefix (optional) Secondary prefix to use for hook (Default: Use predefined hook name, FALSE: no secondary hook) */ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1, $hook_prefix = true) { - return remove_action($this->get_hook($tag, $hook_prefix), $function_to_remove, $priority, $accepted_args); + return remove_action($this->get_hook($tag, $hook_prefix), $function_to_remove, $priority, $accepted_args); } - + /** * Remove internal filter * Namespaces $tag @@ -748,22 +748,22 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1, $hook_prefix = true) { return remove_filter($this->get_hook($tag, $hook_prefix), $function_to_remove, $priority, $accepted_args); } - + /* Shortcode */ - + /** * Process specific shortcode(s) in content * Default: Process all existing shortcodes * @uses $shortcode_tags - array tag => callback * @uses do_shortcode() - * + * * @param string $content Content to process for shortcodes * @param string|array $shortcode Single tag or array of tags to process * > Associative array sets temporary callbacks for shortcodes (`tag => callback`) */ public function do_shortcode($content, $shortcode = null) { global $shortcode_tags; - + // Process custom shortcodes if ( !is_null($shortcode) ) { // Cast to array @@ -782,19 +782,19 @@ public function do_shortcode($content, $shortcode = null) { } } } - + // Process shortcodes in content $content = do_shortcode($content); - + // Restore default shortcode handlers if ( isset($tags_temp) ) { $shortcode_tags = $tags_temp; unset($tags_temp); } - + return $content; } - + /** * Build shortcode tag * @param string $tag Shortcode base @@ -811,7 +811,7 @@ public function make_shortcode($tag, $attr = null, $content = null) { } /* Meta */ - + /** * Retrieves post metadata for internal methods * Metadata set internally is wrapped in an array so it is unwrapped before returned the retrieved value @@ -827,7 +827,7 @@ function post_meta_get($post_id, $key, $single = false) { $meta_value = $meta_value[0]; return $meta_value; } - + /** * Wraps metadata in array for storage in database * @param mixed $meta_value Value to be set as metadata @@ -836,7 +836,7 @@ function post_meta_get($post_id, $key, $single = false) { function post_meta_prepare_value($meta_value) { return array($meta_value); } - + /** * Adds Metadata for a post to database * For internal methods @@ -851,7 +851,7 @@ function post_meta_add($post_id, $meta_key, $meta_value, $unique = false) { $meta_value = $this->post_meta_value_prepare($meta_value); return add_post_meta($post_id, $meta_key, $meta_value, $unique); } - + /** * Updates post metadata for internal data/methods * @see update_post_meta() @@ -865,10 +865,10 @@ function post_meta_update($post_id, $meta_key, $meta_value, $prev_value = '') { $meta_value = $this->post_meta_prepare_value($meta_value); return update_post_meta($post_id, $meta_key, $meta_value, $prev_value); } - + /** * Builds postmeta key for custom data set by plugin - * @param string $key Base key name + * @param string $key Base key name * @return string Formatted postmeta key */ function post_meta_get_key($key) { @@ -880,10 +880,10 @@ function post_meta_get_key($key) { return $sep . implode($sep, $key); } } - + return $key; } - + /** * Creates a meta key for storing post meta data * Prefixes standard prefixed text with underscore to hide meta data on post edit forms @@ -893,9 +893,9 @@ function post_meta_get_key($key) { function make_meta_key($text = '') { return '_' . $this->add_prefix($text); } - + /* Class */ - + /** * Retrieve name of internal class * @param string $class Base name of class @@ -903,10 +903,10 @@ function make_meta_key($text = '') { */ function get_class($class) { return $this->add_prefix_uc($class); - } - + } + /* Context */ - + /** * Retrieve context for current request * @return array Context @@ -952,18 +952,18 @@ function get_context() { $u = wp_get_current_user(); $ctx[] = $this->build_context('user', ( $u->ID ) ? 'registered' : 'guest', false); } - + return $ctx; } - + /** * Builds context from multiple components * Usage: * > $prefix can be omitted and context strings can be added as needed * > Multiple context strings may be passed to be joined together - * + * * @param string (optional) $context Variable number of components to add to context - * @param bool (optional) $prefix Whether or not to prefix context with request type (public or admin) [Default: TRUE] + * @param bool (optional) $prefix Whether or not to prefix context with request type (public or admin) [Default: TRUE] * @return string Context */ function build_context($context = null, $prefix = true) { @@ -972,8 +972,8 @@ function build_context($context = null, $prefix = true) { if ( !empty($args) ) { $prefix = ( is_bool($args[count($args) - 1]) ) ? array_pop($args) : true; } - - // Validate + + // Validate $context = array_filter($args, 'is_string'); $sep = '_'; @@ -982,7 +982,7 @@ function build_context($context = null, $prefix = true) { array_unshift($context, ( is_admin() ) ? 'admin' : 'public' ); return implode($sep, $context); } - + /** * Check if context exists in current request * @param string $context Context to check for @@ -1011,9 +1011,9 @@ function set_client_context() { $ctx->context = $this->get_context(); $this->extend_client_object($ctx, true); } - + /* Path */ - + /** * Joins and normalizes the slashes in the paths passed to method * All forward/back slashes are converted to forward slashes @@ -1035,7 +1035,7 @@ function normalize_path($path, $trailing_slash = false) { if ( is_bool($arg_last) ) { $arg_last = array($arg_last); } - + if ( is_array($arg_last) && count($arg_last) > 0 && is_bool($arg_last[0]) ) { // Remove slash paramter from args array array_pop($parts); @@ -1048,19 +1048,19 @@ function normalize_path($path, $trailing_slash = false) { } // Extract to slash options local variables list($trailing_slash, $leading_slash) = $slashes; - + // Clean path segments foreach ( $parts as $key => $part ) { // Trim slashes/spaces $parts[$key] = trim($part, " " . $sl_f . $sl_b); - + // Verify path segment still contains value if ( empty($parts[$key]) ) { unset($parts[$key]); continue; } } - + // Join path parts together $parts = implode($sl_b, $parts); $parts = str_replace($sl_b, $sl_f, $parts); @@ -1074,7 +1074,7 @@ function normalize_path($path, $trailing_slash = false) { } return $parts; } - + /** * Returns URL of file (assumes that it is in plugin directory) * @param string $file name of file get URL @@ -1087,7 +1087,7 @@ function get_file_url($file, $relative = null) { } return $file; } - + /** * Returns path to plugin file * @param string $file file name @@ -1100,13 +1100,13 @@ function get_file_path($file, $relative = null) { } return $file; } - + function get_plugin_file_path($file, $trailing_slash = false) { if ( is_string($file) && '' != trim($file) ) $file = $this->normalize_path($this->get_plugin_base(), $file, $trailing_slash); return $file; } - + /** * Checks if value is valid file name * @param string $filename File name to check @@ -1116,7 +1116,7 @@ function is_file($filename) { $ext = $this->get_file_extension($filename); return ( empty($ext) ) ? false : true; } - + /** * Check if string is valid URI * @param string $uri String to check @@ -1125,7 +1125,7 @@ function is_file($filename) { function is_uri($uri) { return ( preg_match('|^(https?:)?//|', $uri) ) ? true : false; } - + /** * Retrieves file extension * @param string $file file name/path @@ -1142,13 +1142,13 @@ function get_file_extension($file, $lowercase = true) { if ( ( $qpos = strpos($file, '?') ) && $qpos !== false ) { $file = substr($file, 0, $qpos); } - if ( ( $rpos = strrpos($file, $sep) ) > 0 ) + if ( ( $rpos = strrpos($file, $sep) ) > 0 ) $ret = substr($file, $rpos + 1); if ( !!$lowercase ) $ret = strtolower($ret); return $ret; } - + /** * Checks if file has specified extension * @uses get_file_extension() @@ -1163,10 +1163,10 @@ function has_file_extension($file, $extension, $case_sensitive = false) { if ( !$case_sensitive ) { // Normalize extensions $extension = array_map('strtolower', $extension); - } + } return ( in_array($this->get_file_extension($file, !$case_sensitive), $extension) ) ? true : false; } - + /** * Removes file extension from file name * The extension is the text following the last period ('.') in the file name @@ -1181,7 +1181,7 @@ function strip_file_extension($file) { } return $file; } - + /** * Retrieve base URL for plugin-specific files * @uses get_plugin_base() @@ -1208,10 +1208,10 @@ function get_url_base($trailing_slash = false, $relative = null) { $ret = $this->get_relative_path($ret, $relative); } } - + return $ret; } - + /** * Retrieve plugin's base path * @uses WP_PLUGIN_DIR @@ -1251,7 +1251,7 @@ function get_path_base($relative = null) { } return $ret; } - + /** * Retrieve relative path for absolute paths * @param string $path Path to modify @@ -1273,7 +1273,7 @@ function get_relative_path($path, $relative = true) { } return $path; } - + /** * Retrieve plugin's base directory * @uses WP_PLUGIN_DIR @@ -1288,7 +1288,7 @@ function get_plugin_base() { } return $ret; } - + /** * Retrieve plugin's base file path * @uses get_path_base() @@ -1321,7 +1321,7 @@ function get_plugin_base_file() { // Return return $ret; } - + /** * Retrieve plugin's internal name * Internal name is used by WP core @@ -1336,13 +1336,13 @@ function get_plugin_base_name() { } return $ret; } - + private function set_plugin_info($data) { if ( is_array($data) ) { $this->_plugin['data'] = $data; } } - + /** * Retrieve plugin info * Parses info comment in main plugin file @@ -1353,7 +1353,7 @@ function get_plugin_info($field = null) { $ret = $this->_plugin['data']; // Get plugin data if ( empty($ret) ) { - $this->get_plugin_base_file(); + $this->get_plugin_base_file(); $ret = $this->_plugin['data']; } // Return specified field @@ -1362,7 +1362,7 @@ function get_plugin_info($field = null) { } return $ret; } - + /** * Retrieve plugin version * @uses get_plugin_info() @@ -1380,7 +1380,7 @@ function get_plugin_version($strip_desc = true) { // Return return $ret; } - + /** * Retrieve current post type based on URL query variables * @return string|null Current post type @@ -1395,7 +1395,7 @@ public function get_post_type() { } return $pt; } - + /** * Retrieve current action based on URL query variables * @param mixed $default (optional) Default action if no action exists @@ -1403,7 +1403,7 @@ public function get_post_type() { */ function get_action($default = null) { $action = ''; - + // Check if action is set in URL if ( isset($_GET['action']) ) $action = $_GET['action']; @@ -1419,7 +1419,7 @@ function get_action($default = null) { 'edit' => array('edit', 'edit-pages') ); $page = basename($_SERVER['SCRIPT_NAME'], '.php'); - + foreach ( $actions as $act => $pages ) { if ( in_array($page, $pages) ) { $action = $act; @@ -1431,13 +1431,13 @@ function get_action($default = null) { $action = $default; return $action; } - + /*-** General **-*/ - + /** * Checks if a property exists in a class or object * Compatibility method for PHP 4 - * @param mixed $class Class or object to check + * @param mixed $class Class or object to check * @param string $property Name of property to look for in $class */ function property_exists($class, $property) { @@ -1449,7 +1449,7 @@ function property_exists($class, $property) { return array_key_exists($property, $class); } } - + /** * Retrieve specified property from object or array * @param object|array $obj Object or array to get property from @@ -1471,7 +1471,7 @@ function &get_property(&$obj, $property) { return $cvars[$property]; } } - + /** * Remap array members based on a * mapping of source/destination keys @@ -1503,7 +1503,7 @@ function array_remap($arr, $map = array(), $overwrite = false) { // Return remapped properties return $arr; } - + function array_filter_keys($arr, $keys) { if ( is_array($arr) && !empty($arr) && is_array($keys) && !empty($keys) ) { foreach ( $keys as $rem ) { @@ -1514,10 +1514,10 @@ function array_filter_keys($arr, $keys) { return $arr; } - + /** * Insert an item into an array at the specified position - * @param mixed $item Item to insert into array + * @param mixed $item Item to insert into array * @param int $pos Index position to insert item into array * @return array Modified array */ @@ -1525,7 +1525,7 @@ function array_insert($array, $item, $pos = null) { array_splice($array, $pos, 0, $item); return $array; } - + /** * Merges 1 or more arrays together * Methodology @@ -1575,10 +1575,10 @@ function array_merge_recursive_distinct($arr1) { } return $merged; } - + /** * Replaces string value in one array with the value of the matching element in a another array - * + * * @param string $search Text to search for in array * @param array $arr_replace Array to use for replacing values * @param array $arr_subject Array to search for specified value @@ -1596,10 +1596,10 @@ function array_replace_recursive($search, $arr_replace, $arr_subject) { if (is_array($val) && is_array($arr_replace[$key])) $arr_subject[$key] = $this->array_replace_recursive($search, $arr_replace[$key], $val); } - + return $arr_subject; } - + /** * Checks if item at specified path in array is set * @param array $arr Array to check for item @@ -1610,7 +1610,7 @@ function array_item_isset(&$arr, &$path) { $f_path = $this->get_array_path($path); return eval('return isset($arr' . $f_path . ');'); } - + /** * Build formatted string based on array values * Array values in formatted string will be ordered by index order @@ -1653,7 +1653,7 @@ function get_array_path($attribute = '', $format = null) { } return $fmtd; } - + /** * Builds array of path elements based on arguments * Each item in path array represents a deeper level in structure path is for (object, array, filesystem, etc.) @@ -1663,12 +1663,12 @@ function get_array_path($attribute = '', $format = null) { function build_path() { $path = array(); $args = func_get_args(); - + // Iterate through parameters and build path foreach ( $args as $arg ) { if ( empty($arg) ) continue; - + if (is_array($arg)) { // Recurse through array items to pull out any more arrays foreach ($arg as $key => $val) { @@ -1679,10 +1679,10 @@ function build_path() { $path[] = $arg; } } - + return $path; } - + /** * Build generic element * @param array $args @@ -1703,23 +1703,23 @@ public function build_element($args = array()) { ); $args = wp_parse_args($args, $args_default); $args['format'] = wp_parse_args($args['format'], $format_default); - + // Validate if ( !is_string($args['tag']) || empty($args['tag']) ) { return $ret; } - + $args = (object) $args; - + $args->attributes = $this->build_attribute_string($args->attributes); if ( strlen($args->attributes) > 0 ) { $args->attributes = ' ' . $args->attributes; } - + // Build output $args->format = (object) $args->format; $ret = sprintf( $args->format->open, $args->tag . $args->attributes); - + // Wrap content if necessary if ( $args->wrap || ( is_string($args->content) && !empty($args->content) ) ) { $ret .= $args->content . sprintf( $args->format->close, $args->tag); @@ -1727,7 +1727,7 @@ public function build_element($args = array()) { return $ret; } - + /** * Parse string of attributes into array * For XML/XHTML tag attributes @@ -1755,7 +1755,7 @@ function parse_attribute_string($txt, $defaults = array()) { return array_merge($defaults, $attr); } - + /** * Builds attribute string for HTML element * @param array $attr Attributes @@ -1776,8 +1776,8 @@ function build_attribute_string($attr) { } return $ret; } - - /* HTML */ + + /* HTML */ /** * Generate HTML element based on values @@ -1798,7 +1798,7 @@ public function build_html_element($args) { // Build element return $this->build_element($args); } - + /** * Build HTML link element * @uses build_html_element() to build link output @@ -1811,7 +1811,7 @@ function build_html_link($uri, $content, $attributes = array()) { $attributes = array_merge(array('href' => $uri, 'title' => $content), $attributes); return $this->build_html_element(array('tag' => 'a', 'wrap' => true, 'content' => $content, 'attributes' => $attributes)); } - + /** * Generate external stylesheet element * @param $url Stylesheet URL @@ -1821,10 +1821,10 @@ function build_stylesheet_element($url) { $attributes = array('href' => $url, 'type' => 'text/css', 'rel' => 'stylesheet'); return $this->build_html_element(array('tag' => 'link', 'wrap' => false, 'attributes' => $attributes)); } - + /** * Build client-side script element - * + * * @param string $content Script content * @param string $id (optional) Element ID * @param bool $wrap_jquery (optional) Wrap commands in jQuery? (Default: Yes) @@ -1844,14 +1844,14 @@ function build_script_element($content = '', $id = '', $wrap_jquery = true, $wai if ( $wrap_jquery ) { $start[] = 'if ( !!window.jQuery ) {(function($){'; $end[] = '})(jQuery);}'; - + // Add event handler (if necessary) if ( $wait_doc_ready ) { $start[] = '$(document).ready(function(){'; $end[] = '})'; } } - + // Reverse order of end values $end = array_reverse($end); $content = implode('', array_merge($start, array($content), $end)); From 1abdbcf666734b6e0c6a27160e75821b44330fc5 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 17:43:37 -1000 Subject: [PATCH 55/59] Maintenance:Remove trailing whitespace (JS [Dev] files) * Production files regenerated (no changes) --- Gruntfile.js | 10 +- client/js/dev/lib.admin.js | 2 +- client/js/dev/lib.core.js | 142 +-- client/js/dev/lib.view.js | 866 +++++++++--------- .../image/js/dev/handler.image.js | 2 +- grunt/phplint.js | 2 +- template-tags/item/js/dev/tag.item.js | 2 +- template-tags/ui/js/dev/tag.ui.js | 12 +- themes/default/js/dev/client.js | 6 +- 9 files changed, 522 insertions(+), 522 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 0d387f6..1371405 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -11,13 +11,13 @@ module.exports = function(grunt) { paths : { // Base dir assets dir base : 'client', - + // PHP assets php : { files_std : ['*.php', '**/*.php', '!node_modules/**/*.php'], // Standard file match files : '<%= paths.php.files_std %>' // Dynamic file match }, - + // JavaScript assets js : { base : 'js', // Base dir @@ -26,7 +26,7 @@ module.exports = function(grunt) { files_std : '**/<%= paths.js.src %>/**/*.js', // Standard file match files : '<%= paths.js.files_std %>' // Dynamic file match }, - + // Sass assets sass : { src : 'sass', // Source files dir @@ -39,10 +39,10 @@ module.exports = function(grunt) { } }, }); - + // Load task configurations grunt.loadTasks('grunt'); - + // Default Tasks grunt.registerTask('build', ['phplint', 'jshint:all', 'uglify', 'sass']); grunt.registerTask('watch_all', ['watch:js', 'watch:sass']); diff --git a/client/js/dev/lib.admin.js b/client/js/dev/lib.admin.js index ff0bf91..6109c3a 100644 --- a/client/js/dev/lib.admin.js +++ b/client/js/dev/lib.admin.js @@ -11,7 +11,7 @@ if ( !!window.SLB && !!SLB.attach ) { (function ($) { SLB.attach('Admin', { /** - * Initialization routines + * Initialization routines */ init: function() { if ( postboxes ) { diff --git a/client/js/dev/lib.core.js b/client/js/dev/lib.core.js index 820b6df..72b9c90 100644 --- a/client/js/dev/lib.core.js +++ b/client/js/dev/lib.core.js @@ -9,7 +9,7 @@ if ( window.jQuery ){(function($) { /** * Extendible class * Adapted from John Resig - * @link http://ejohn.org/blog/simple-javascript-inheritance/ + * @link http://ejohn.org/blog/simple-javascript-inheritance/ */ var c_init = false; var Class = function() {}; @@ -21,13 +21,13 @@ var Class = function() {}; */ Class.extend = function(members) { var _super = this.prototype; - + // Copy instance to prototype c_init = true; var proto = new this(); c_init = false; - - var val, name; + + var val, name; // Scrub prototype objects (Decouple from super class) for ( name in proto ) { if ( $.isPlainObject(proto[name]) ) { @@ -35,7 +35,7 @@ Class.extend = function(members) { proto[name] = val; } } - + /** * Create class method with access to super class method * @param string nm Method name @@ -67,7 +67,7 @@ Class.extend = function(members) { proto[name] = ( $.isPlainObject(members[name]) ) ? $.extend({}, members[name]) : members[name]; } } - + /** * Class constructor * Supports pre-construction initilization (`Class._init()`) @@ -85,17 +85,17 @@ Class.extend = function(members) { } } } - - + + // Populate new prototype Class.prototype = proto; - + // Set constructor Class.prototype.constructor = Class; - + // Set extender Class.extend = this.extend; - + // Return function return Class; }; @@ -105,7 +105,7 @@ Class.extend = function(members) { */ var Base = { /* Properties */ - + /** * Base object flag * @var bool @@ -121,9 +121,9 @@ var Base = { * @var string */ prefix: 'slb', - + /* Methods */ - + /** * Constructor * Sets instance parent @@ -131,7 +131,7 @@ var Base = { _init: function() { this._set_parent(); }, - + /** * Set instance parent * Set utilities parent to current instance @@ -143,7 +143,7 @@ var Base = { } this.util._parent = this; }, - + /** * Attach new member to instance * Member can be property (value) or method @@ -172,11 +172,11 @@ var Base = { } return ret; }, - + /** * Check for child object * Child object can be multi-level (e.g. Child.Level2child.Level3child) - * + * * @param string child Name of child object */ has_child: function(child) { @@ -184,7 +184,7 @@ var Base = { if ( !this.util.is_string(child) ) { return false; } - + var children = child.split('.'); child = null; var o = this; @@ -202,7 +202,7 @@ var Base = { } return true; }, - + /** * Check if instance is set as a base * @uses base @@ -211,7 +211,7 @@ var Base = { is_base: function() { return !!this.base; }, - + /** * Get parent instance * @uses `Base._parent` property @@ -232,14 +232,14 @@ var Base = { */ var Utilities = { /* Properties */ - + _base: null, _parent: null, - + /* Methods */ - + /* Connections */ - + /** * Get base ancestor * @return obj Base ancestor @@ -262,7 +262,7 @@ var Utilities = { } return this._base; }, - + /** * Get parent object or parent property value * @param string prop (optional) Property to retrieve @@ -281,9 +281,9 @@ var Utilities = { } return ret; }, - + /* Prefix */ - + /** * Retrieve valid separator * If supplied argument is not a valid separator, use default separator @@ -294,7 +294,7 @@ var Utilities = { var sep_default = '_'; return ( this.is_string(sep, false) ) ? sep : sep_default; }, - + /** * Retrieve prefix * @return string Prefix @@ -303,14 +303,14 @@ var Utilities = { var p = this.get_parent('prefix'); return ( this.is_string(p, false) ) ? p : ''; }, - + /** * Check if string is prefixed */ has_prefix: function(val, sep) { return ( this.is_string(val) && 0 === val.indexOf(this.get_prefix() + this.get_sep(sep)) ); }, - + /** * Add Prefix to a string * @param string val Value to add prefix to @@ -327,10 +327,10 @@ var Utilities = { if ( !this.is_bool(once) ) { once = true; } - + return ( once && this.has_prefix(val, sep) ) ? val : [this.get_prefix(), val].join(sep); }, - + /** * Remove Prefix from a string * @param string val Value to add prefix to @@ -358,9 +358,9 @@ var Utilities = { } return val; }, - + /* Attributes */ - + /* * Get attribute name * @param string attr_base Attribute's base name @@ -378,9 +378,9 @@ var Utilities = { } return attr; }, - + /* Request */ - + /** * Retrieve valid context * @return array Context @@ -394,11 +394,11 @@ var Utilities = { // Return context return b.context; }, - + /** * Check if a context exists in current request * If multiple contexts are supplied, result will be TRUE if at least ONE context exists - * + * * @param string|array ctx Context to check for * @return bool TRUE if context exists, FALSE otherwise */ @@ -409,9 +409,9 @@ var Utilities = { } return ( this.is_array(ctx) && this.arr_intersect(this.get_context(), ctx).length > 0 ); }, - + /* Helpers */ - + /** * Check if value is set/defined * @param mixed val Value to check @@ -420,7 +420,7 @@ var Utilities = { is_set: function(val) { return ( typeof val !== 'undefined' ); }, - + /** * Validate data type * @param mixed val Value to validate @@ -443,14 +443,14 @@ var Utilities = { break; } } - + // Validate empty values if ( ret && ( !this.is_set(nonempty) || !!nonempty ) ) { ret = !this.is_empty(val); } return ret; }, - + /** * Check if value is a string * @uses is_type() @@ -461,7 +461,7 @@ var Utilities = { is_string: function(value, nonempty) { return this.is_type(value, 'string', nonempty); }, - + /** * Check if value is an array * @uses is_type() @@ -472,7 +472,7 @@ var Utilities = { is_array: function(value, nonempty) { return ( this.is_type(value, 'array', nonempty) ); }, - + /** * Check if value is a boolean * @uses is_type() @@ -482,7 +482,7 @@ var Utilities = { is_bool: function(value) { return this.is_type(value, 'boolean', false); }, - + /** * Check if value is an object * @uses is_type() @@ -493,7 +493,7 @@ var Utilities = { is_obj: function(value, nonempty) { return this.is_type(value, 'object', nonempty); }, - + /** * Check if value is a function * @uses is_type() @@ -503,7 +503,7 @@ var Utilities = { is_func: function(value) { return this.is_type(value, 'function', false); }, - + /** * Checks if an object has a method * @param obj obj Object to check @@ -525,7 +525,7 @@ var Utilities = { } return ret; }, - + /** * Check if object is instance of a class * @param obj obj Instance object @@ -538,7 +538,7 @@ var Utilities = { } return ( this.is_obj(obj) && ( obj instanceof parent ) ); }, - + /** * Check if object is class * Optionally check if class is sub-class of another class @@ -555,7 +555,7 @@ var Utilities = { } return ret; }, - + /** * Check if value is a number * @uses is_type() @@ -570,7 +570,7 @@ var Utilities = { }; return ( this.is_type(value, 'number', nonempty) && !f.nan(value) && f.finite(value) ); }, - + /** * Check if value is a integer * @uses is_type() @@ -581,7 +581,7 @@ var Utilities = { is_int: function(value, nonempty) { return ( this.is_num(value, nonempty) && Math.floor(value) === value ); }, - + /** * Check if value is scalar (string, number, boolean) * @uses is_type() @@ -592,7 +592,7 @@ var Utilities = { is_scalar: function(value, nonempty) { return ( this.is_num(value, nonempty) || this.is_string(value, nonempty) || this.is_bool(value) ); }, - + /** * Checks if value is empty * @param mixed value Value to check @@ -613,7 +613,7 @@ var Utilities = { x++; } } - + // Advanced check if ( !ret ) { // Validate type @@ -638,7 +638,7 @@ var Utilities = { // Evaluate plain object if ( Object.getOwnPropertyNames ) { // Modern browser check - ret = ( Object.getOwnPropertyNames(value).length === 0 ); + ret = ( Object.getOwnPropertyNames(value).length === 0 ); } else if ( value.hasOwnProperty ) { // Legacy browser check ret = true; @@ -658,18 +658,18 @@ var Utilities = { } return ret; }, - + /** * Check if object is a jQuery.Promise instance * Will also match (but not guarantee) jQuery.Deferred instances * @uses is_method() - * @param obj obj Object to check + * @param obj obj Object to check * @return bool TRUE if object is Promise/Deferred */ is_promise: function(obj) { return ( this.is_method(obj, ['then', 'done', 'always', 'fail', 'pipe']) ); }, - + /** * Return formatted string * @param string fmt Format template @@ -702,7 +702,7 @@ var Utilities = { params[x] = ''; } } - + // Replace all placeholders at once if single parameter set if ( params.length === 1 ) { fmt = fmt.replace(ph, params[0].toString()); @@ -721,12 +721,12 @@ var Utilities = { } return fmt; }, - + /** * Checks if key(s) exist in an object * @param object obj Object to check * @param string|array key Key(s) to check for in object - * @param bool all (optional) All keys must exist in object? (Default: TRUE) + * @param bool all (optional) All keys must exist in object? (Default: TRUE) * @return bool TRUE if key(s) exist in object */ in_obj: function(obj, key, all) { @@ -752,7 +752,7 @@ var Utilities = { } return ret; }, - + /** * Retrieve an object's keys * @param obj Object to parse @@ -776,7 +776,7 @@ var Utilities = { } return keys; }, - + /** * Find common elements of 2 or more arrays * @param array arr1 First array @@ -820,7 +820,7 @@ var Utilities = { // Return intersection results return ret; }, - + /** * Generates a GUID string. * @returns string The generated GUID. @@ -835,7 +835,7 @@ var Utilities = { } return _p8() + _p8(true) + _p8(true) + _p8(); }, - + /** * Parse URI * @param string uri URI to parse @@ -908,18 +908,18 @@ var SLB_Base = Class.extend(Base); */ var Core = { /* Properties */ - + base: true, context: [], - + /** * New object initializer * @var obj */ Class: SLB_Base, - + /* Methods */ - + /** * Init * Set variables, DOM, etc. diff --git a/client/js/dev/lib.view.js b/client/js/dev/lib.view.js index ae39673..5854f5c 100644 --- a/client/js/dev/lib.view.js +++ b/client/js/dev/lib.view.js @@ -10,7 +10,7 @@ if ( !!window.SLB && !!SLB.attach ) { (function ($) { /*-** Controller **-*/ var View = { - + /* Properties */ /** @@ -24,40 +24,40 @@ var View = { * > type: Asset type (attachment, image, etc.) */ assets: {}, - + /** * Component types that can have default instances * @var array */ component_defaults: [], - + /** * Collection of jQuery.Deferred instances added during loading routine * @var array */ loading: [], - + /** * Cache * @var object */ cache: {}, - + /** * Temporary component instances * For use by controller when no component instance is available * > Key: Component slug - * > Value: Component instance + * > Value: Component instance */ component_temps: {}, - + /* Options */ options: {}, - + /* Methods */ - + /* Init */ - + /** * Instance initialization */ @@ -68,7 +68,7 @@ var View = { // Components this.init_components(); }, - + /** * Update component references in component definitions */ @@ -96,7 +96,7 @@ var View = { } } }, - + /** * Initialize Components */ @@ -105,7 +105,7 @@ var View = { this.Viewer ]; }, - + /** * Client Initialization * @param obj options Global options @@ -116,9 +116,9 @@ var View = { $.when.apply($, this.loading).always(function() { // Set options $.extend(true, t.options, options); - + /* Event handlers */ - + // History $(window).on('popstate', function(e) { var state = e.originalEvent.state; @@ -128,14 +128,14 @@ var View = { return e.preventDefault(); } }); - + /* Set defaults */ - + // Items t.init_items(); }); }, - + /* Components */ /** @@ -147,7 +147,7 @@ var View = { can_make_default_component: function(type) { return ( -1 !== $.inArray(type, this.component_defaults) ); }, - + /** * Check if object is valid component class * @param func comp Component to check @@ -156,7 +156,7 @@ var View = { is_component: function(comp) { return ( this.util.is_class(comp, this.Component) ); }, - + /** * Retrieve collection of components of specified type * @param func type Component type @@ -175,7 +175,7 @@ var View = { } return ret; }, - + /** * Retrieve component from specific collection * @param function type Component type @@ -192,7 +192,7 @@ var View = { if ( !this.util.is_string(id) ) { id = null; } - + // Get component from collection var coll = this.get_components(type); if ( this.util.is_obj(coll) ) { @@ -201,7 +201,7 @@ var View = { ret = coll[tid]; } } - + // Default: Create default component if ( this.util.is_empty(ret) ) { if ( this.util.is_string(id) || this.can_make_default_component(type) ) { @@ -211,7 +211,7 @@ var View = { // Return component return ret; }, - + /** * Create new component instance and save to appropriate collection * @param function type Component type to create @@ -245,7 +245,7 @@ var View = { else { ret = new type(id, options); } - + // Add new component to collection if ( this.util.is_type(ret, type) ) { // Get collection @@ -265,7 +265,7 @@ var View = { // Return new component return ret; }, - + /** * Create new temporary component instance * @param function type Component type @@ -281,7 +281,7 @@ var View = { } return ret; }, - + /** * Retrieve temporary component instance * Creates new temp component instance for type if not previously created @@ -291,18 +291,18 @@ var View = { get_component_temp: function(type) { return ( this.has_component_temp(type) ) ? this.component_temps[type.prototype._slug] : this.add_component_temp(type); }, - + /** * Check if temporary component instance exists * @param function type Component type to check for - * @return bool TRUE if temp instance exists, FALSE otherwise + * @return bool TRUE if temp instance exists, FALSE otherwise */ has_component_temp: function(type) { return ( this.is_component(type) && ( type.prototype._slug in this.component_temps ) ) ? true : false; }, - + /* Properties */ - + /** * Retrieve specified options * @param array opts Array of option names @@ -323,11 +323,11 @@ var View = { if ( !( opts[x] in this.options ) ) { continue; } - ret[ opts[x] ] = this.options[ opts[x] ]; + ret[ opts[x] ] = this.options[ opts[x] ]; } return ret; }, - + /** * Retrieve option * @uses View.options @@ -344,9 +344,9 @@ var View = { } return ret; }, - + /* Viewers */ - + /** * Add viewer instance to collection * @param string id Viewer ID @@ -361,7 +361,7 @@ var View = { // Return viewer return v; }, - + /** * Retrieve all viewer instances * @return obj Viewer instances @@ -369,7 +369,7 @@ var View = { get_viewers: function() { return this.get_components(this.Viewer); }, - + /** * Check if viewer exists * @param string v Viewer ID @@ -378,7 +378,7 @@ var View = { has_viewer: function(v) { return ( this.util.is_string(v) && v in this.get_viewers() ) ? true : false; }, - + /** * Retrieve Viewer instance * Default viewer retrieved if specified viewer does not exist @@ -398,9 +398,9 @@ var View = { } return this.get_viewers()[v]; }, - + /* Items */ - + /** * Set event handlers */ @@ -414,13 +414,13 @@ var View = { } return !ret; }; - + // Get activated links var sel = this.util.format('a[href][%s="%s"]', this.util.get_attribute('active'), 1); // Add event handler $(document).on('click', sel, null, handler); }, - + /** * Retrieve cached items * @return obj Items collection @@ -428,7 +428,7 @@ var View = { get_items: function() { return this.get_components(this.Content_Item); }, - + /** * Retrieve specific Content_Item instance * @param mixed Item reference @@ -439,14 +439,14 @@ var View = { */ get_item: function(ref) { // Evaluate reference type - + // Content Item instance if ( this.util.is_type(ref, this.Content_Item) ) { return ref; } // Retrieve item instance var item = null; - + // DOM element if ( this.util.in_obj(ref, 'nodeType') ) { // Check if item instance attached to element @@ -466,7 +466,7 @@ var View = { } return item; }, - + /** * Create new item instance * @param obj el DOM element representing item @@ -475,16 +475,16 @@ var View = { add_item: function(el) { return ( new this.Content_Item(el) ); }, - + /** * Display item in viewer * @param obj el DOM element representing item - * @return bool Display result (TRUE if item displayed without issues) + * @return bool Display result (TRUE if item displayed without issues) */ show_item: function(el) { return this.get_item(el).show(); }, - + /** * Cache item instance * @uses View.get_items() to retrieve item cache @@ -500,9 +500,9 @@ var View = { // Return item instance return item; }, - + /* Content Handler */ - + /** * Retrieve content handlers * @return object Content handlers @@ -510,11 +510,11 @@ var View = { get_content_handlers: function() { return this.get_components(this.Content_Handler); }, - + /** * Find matching content handler for item * @param Content_Item|string item Item to find handler for (or ID of Handler) - * @return Content_Handler|null Matching content handler (NULL if no matching handler found) + * @return Content_Handler|null Matching content handler (NULL if no matching handler found) */ get_content_handler: function(item) { // Determine handler to retrieve @@ -523,7 +523,7 @@ var View = { var types = this.get_content_handlers(); return ( type in types ) ? types[type] : null; }, - + /** * Add/Update Content Handler * @param string id Handler ID @@ -551,9 +551,9 @@ var View = { } return hdl; }, - + /* Group */ - + /** * Add new group * @param string g Group ID @@ -569,7 +569,7 @@ var View = { return g; }, - + /** * Retrieve groups * @uses groups property @@ -578,7 +578,7 @@ var View = { get_groups: function() { return this.get_components(this.Group); }, - + /** * Retrieve specified group * New group created if not yet set @@ -591,7 +591,7 @@ var View = { get_group: function(g) { return ( !this.has_group(g) ) ? this.add_group(g) : this.get_groups()[g]; }, - + /** * Checks if group is registered * @uses get_groups() to retrieve registered groups @@ -600,9 +600,9 @@ var View = { has_group: function(g) { return ( this.util.is_string(g) && ( g in this.get_groups() ) ); }, - + /* Theme */ - + /** * Add/Update theme * @param string name Theme name @@ -616,16 +616,16 @@ var View = { } var dfr = $.Deferred(); this.loading.push(dfr); - + // Get model if it already exists var model = this.get_theme_model(id); - + // Create default attributes for new theme if ( this.util.is_empty(model) ) { // Save default model model = this.save_theme_model( {'parent': null, 'id': id} ); } - + // Add custom attributes if ( this.util.is_obj(attr) ) { // Sanitize @@ -634,22 +634,22 @@ var View = { } $.extend(model, attr); } - + // Load styles if ( this.util.in_obj(attr, 'styles') ) { this.load_styles(attr.styles); } - + // Link parent model if ( !this.util.is_obj(model.parent) ) { model.parent = this.get_theme_model(model.parent); } - + // Complete loading when all components loaded dfr.resolve(); return model; }, - + /** * Retrieve theme models * @return obj Theme models @@ -658,7 +658,7 @@ var View = { // Retrieve matching theme model return this.Theme.prototype._models; }, - + /** * Retrieve theme model * @param string id Theme to retrieve @@ -668,7 +668,7 @@ var View = { var ms = this.get_theme_models(); return ( this.util.in_obj(ms, id) ) ? ms[id] : {}; }, - + /** * Save theme model * @uses View.get_theme_models() to retrieve Theme model collection @@ -682,7 +682,7 @@ var View = { } return model; }, - + /** * Add/Update Template Tag Handler * @param string id Handler ID @@ -694,7 +694,7 @@ var View = { return false; } var hdl; - var hdls = this.get_template_tag_handlers(); + var hdls = this.get_template_tag_handlers(); if ( this.util.in_obj(hdls, id) ) { // Update existing handler hdl = hdls[id]; @@ -714,7 +714,7 @@ var View = { } return hdl; }, - + /** * Retrieve Template Tag Handler collection * @return obj Template_Tag_Handler objects @@ -722,7 +722,7 @@ var View = { get_template_tag_handlers: function() { return this.Template_Tag.prototype.handlers; }, - + /** * Retrieve template tag handler * @param string id ID of tag handler to retrieve @@ -731,12 +731,12 @@ var View = { get_template_tag_handler: function(id) { var handlers = this.get_template_tag_handlers(); // Retrieve existing handler or return new handler - return ( this.util.in_obj(handlers, id) ) ? handlers[id] : null; + return ( this.util.in_obj(handlers, id) ) ? handlers[id] : null; }, - + /** * Load styles - * @param array styles Styles to load + * @param array styles Styles to load */ load_styles: function(styles) { if ( this.util.is_array(styles) ) { @@ -757,21 +757,21 @@ var View = { /* Components */ var Component = { /*-** Properties **-*/ - + /* Internal/Configuration */ - + /** * Base name of component type * @var string */ _slug: 'component', - + /** * Component namespace - * @var string + * @var string */ _ns: null, - + /** * Valid component references for current component * @var object @@ -779,20 +779,20 @@ var Component = { * > Value (function): Data type of component */ _refs: {}, - + /** * Whether DOM element and component are connected in 1:1 relationship * Some components will be assigned to different DOM elements depending on usage * @var bool */ _reciprocal: false, - + /** * DOM Element tied to component - * @var DOM Element + * @var DOM Element */ _dom: null, - + /** * Component attributes * @var object @@ -806,25 +806,25 @@ var Component = { * @var object */ _attr_default: {}, - + /** * Flag indicates whether default attributes have previously been parsed * @var bool */ _attr_default_parsed: false, - + /** * Attributes passed to constructor * @var obj */ _attr_init: null, - + /** * Defines how parent properties should be remapped to component properties * @var object */ _attr_map: {}, - + /** * Event handlers * @var object @@ -832,7 +832,7 @@ var Component = { * > Value: array Handlers */ _events: {}, - + /** * Status management * @var object @@ -840,15 +840,15 @@ var Component = { * > Value: Status value */ _status: null, - + /** * Component ID * @var string */ _id: '', - + /* Init */ - + /** * Constructor * @param string id (optional) Component ID (Default ID will be generated if no valid ID provided) @@ -864,7 +864,7 @@ var Component = { // Call hooks this._hooks(); }, - + /** * Set Component parent to View module * @uses `_super._set_parent()` @@ -872,17 +872,17 @@ var Component = { _set_parent: function() { this._super(View); }, - + /** * Register hooks on init * Placeholder method to be overridden by child classes */ _hooks: function() {}, - + /* Methods */ - + /* Properties */ - + /** * Set instance ID * Instance ID can only be set once (will not change ID if valid ID already set) @@ -898,7 +898,7 @@ var Component = { } return this._id; }, - + /** * Retrieve instance ID * @uses id as ID base @@ -913,10 +913,10 @@ var Component = { if ( this.util.is_bool(ns) && ns ) { id = this.add_ns(id); } - + return id; }, - + /** * Get namespace * @uses _slug for namespace segment @@ -929,7 +929,7 @@ var Component = { } return this._ns; }, - + /** * Add namespace to value * @param string val Value to namespace @@ -938,7 +938,7 @@ var Component = { add_ns: function(val) { return ( this.util.is_string(val) ) ? this.get_ns() + '_' + val : ''; }, - + /** * Retrieve status * @param string id Status to retrieve @@ -952,7 +952,7 @@ var Component = { } return ret; }, - + /** * Set status * @param string id Status to retrieve @@ -977,7 +977,7 @@ var Component = { } return val; }, - + /** * Get controller object * @uses get_parent() (alias) @@ -986,9 +986,9 @@ var Component = { get_controller: function() { return this.get_parent(); }, - + /* Components */ - + /** * Check if reference exists in object * @param string ref Reference ID @@ -997,7 +997,7 @@ var Component = { has_reference: function(ref) { return ( this.util.is_string(ref) && ( ref in this ) && ( ref in this.get_references() ) ) ? true : false; }, - + /** * Retrieve object references * @uses _refs @@ -1007,7 +1007,7 @@ var Component = { get_references: function() { return this._refs; }, - + /** * Retrieve reference data type * @param string ref Reference ID @@ -1016,7 +1016,7 @@ var Component = { get_reference: function(ref) { return ( this.has_reference(ref) ) ? this._refs[ref] : null; }, - + /** * Retrieve component reference from current object * > Procedure: @@ -1035,24 +1035,24 @@ var Component = { if ( !this.has_reference(cname) ) { return c; } - + // Initialize options var opt_defaults = { check_attr: true, get_default: false }; options = $.extend({}, opt_defaults, options); - + // Get component type var ctype = this.get_reference(cname); - + // Phase 1: Check if component reference previously set if ( this.util.is_type(this[cname], ctype) ) { return this[cname]; } // If reference not set, iterate through component hierarchy until reference is found c = this[cname] = null; - + // Phase 2: Check attributes if ( options.check_attr ) { c = this.get_attribute(cname); @@ -1061,14 +1061,14 @@ var Component = { c = this.set_component(cname, c); } } - + // Phase 3: From controller (optional) if ( this.util.is_empty(c) && options.get_default ) { c = this.get_controller().get_component(ctype); } return c; }, - + /** * Sets component reference on current object * > Component property reset (set to NULL) if invalid component supplied @@ -1083,31 +1083,31 @@ var Component = { if ( !this.has_reference(name) ) { return invalid; } - + // Validate reference if ( this.util.is_empty(ref) ) { ref = invalid; } else { var ctype = this.get_reference(name); - + // Get component from controller when ID supplied if ( this.util.is_string(ref, false) ) { ref = this.get_controller().get_component(ctype, ref); } - + // Validation callback if ( !this.util.is_type(ref, ctype) || ( this.util.is_func(validate) && !validate.call(this, ref) ) ) { ref = invalid; } } - + // Set (or clear) component reference this[name] = ref; // Return value for confirmation return this[name]; }, - - + + /** * Clear component reference * @uses set_component() to handle component manipulation @@ -1118,7 +1118,7 @@ var Component = { }, /* Attributes */ - + /** * Initialize attributes * @param bool force (optional) Force full initialization of attributes (Default: FALSE) @@ -1140,7 +1140,7 @@ var Component = { $.extend(a, this.get_dom_attributes()); } }, - + /** * Generate default attributes for component * @uses View.get_options() to get values from controller @@ -1152,7 +1152,7 @@ var Component = { // Get options from controller if ( !this._attr_default_parsed && this.util.is_obj(this._attr_map) ) { var opts = this.get_controller().get_options(this.util.obj_keys(this._attr_map)); - + if ( this.util.is_obj(opts) ) { // Remap for ( var opt in this._attr_map ) { @@ -1170,7 +1170,7 @@ var Component = { } return this._attr_default; }, - + /** * Retrieve DOM attributes * @return obj DOM Attributes @@ -1196,7 +1196,7 @@ var Component = { } return attrs; }, - + /** * Retrieve all instance attributes * @uses init_attributes() to initialize attributes (if necessary) @@ -1209,7 +1209,7 @@ var Component = { // Return attributes return this._attributes; }, - + /** * Retrieve value of specified attribute for value * @param string key Attribute to retrieve @@ -1230,7 +1230,7 @@ var Component = { if ( !this.util.is_bool(enforce_type) ) { enforce_type = true; } - + // Get attribute value var ret = ( this.has_attribute(key) ) ? this.get_attributes()[key] : def; // Validate type @@ -1265,7 +1265,7 @@ var Component = { } return ret; }, - + /** * Call attribute as method * @param string attr Attribute to call @@ -1282,7 +1282,7 @@ var Component = { } return attr; }, - + /** * Check if attribute exists * @param string key Attribute name @@ -1291,7 +1291,7 @@ var Component = { has_attribute: function(key) { return ( this.util.is_string(key) && ( key in this.get_attributes() ) ); }, - + /** * Set component attributes * @param obj attributes Attributes to set @@ -1305,13 +1305,13 @@ var Component = { // Initialize attributes this.init_attributes(full); - + // Merge new/existing attributes if ( this.util.is_obj(attributes) ) { $.extend(this._attributes, attributes); } }, - + /** * Set value for a component attribute * @uses get_attributes() to retrieve attributes @@ -1325,7 +1325,7 @@ var Component = { } return val; }, - + /* DOM */ /** @@ -1336,7 +1336,7 @@ var Component = { dom_get_selector: function(element) { return ( this.util.is_string(element) ) ? '.' + this.add_ns(element) : ''; }, - + dom_get_attribute: function() { return this.util.get_attribute(this._slug); }, @@ -1357,7 +1357,7 @@ var Component = { } return el; }, - + /** * Retrieve attached DOM element * @uses _dom to retrieve attached DOM element @@ -1374,7 +1374,7 @@ var Component = { 'put': false }; options = ( this.util.is_obj(options) ) ? $.extend({}, opts_default, options) : opts_default; - + // Init Component DOM if ( options.init && !this.get_status('dom_init') ) { this.set_status('dom_init'); @@ -1394,13 +1394,13 @@ var Component = { } return $(ret); }, - + /** * Initialize DOM element * To be overridden by child classes */ dom_init: function() {}, - + /** * Wrap output in DOM element * Wrapper element created and added to main DOM element if not yet created @@ -1450,28 +1450,28 @@ var Component = { $(r).append(options.content); return $(r); }, - + /** * Check if DOM element is set for instance - * DOM is initialized before evaluation + * DOM is initialized before evaluation * @return bool TRUE if DOM element set, FALSE otherwise */ dom_has: function() { return ( !!this.dom_get().length ); }, - + /* Data */ - + /** * Retrieve key used to store data in DOM element - * @return string Data key + * @return string Data key */ get_data_key: function() { return this.get_ns(); }, - + /* Events */ - + /** * Register event handler for custom event * Structure @@ -1485,11 +1485,11 @@ var Component = { * @param function fn Event handler * @param obj options Handler registration options * > clear (bool) Clear existing event handlers before setting current handler (Default: FALSE) - * @return obj Component instance (allows chaining) + * @return obj Component instance (allows chaining) */ on: function(event, fn, options) { // Handle request types - if ( !this.util.is_string(event) || !this.util.is_func(fn) ) { + if ( !this.util.is_string(event) || !this.util.is_func(fn) ) { var t = this; var args = Array.prototype.slice.call(arguments, 1); if ( this.util.is_array(event) ) { @@ -1507,7 +1507,7 @@ var Component = { } // Options - + // Default options var options_std = { clear: false @@ -1531,7 +1531,7 @@ var Component = { es[event].push(fn); return this; }, - + /** * Trigger custom event * Event handlers are executed in the context of the current component instance @@ -1592,18 +1592,18 @@ View.Component = Component = SLB.Class.extend(Component); * @param obj options Init options */ var Viewer = { - + /* Configuration */ - + _slug: 'viewer', - + _refs: { item: 'Content_Item', theme: 'Theme' }, - + _reciprocal: true, - + _attr_default: { loop: true, animate: true, @@ -1627,7 +1627,7 @@ var Viewer = { loading: 'loading' } }, - + _attr_map: { 'theme': null, 'group_loop': 'loop', @@ -1640,40 +1640,40 @@ var Viewer = { 'slideshow_autostart': null, 'slideshow_duration': null }, - + /* References */ - + /** * Item currently loaded in viewer * @var object Content_Item */ item: null, - + /** * Queued item to be loaded once viewer is available * @var object Content_Item */ item_queued: null, - + /** * Theme used by viewer * @var object Theme */ theme: null, - + /* Properties */ - + item_working: null, - + active: false, init: false, open: false, loading: false, - + /* Methods */ - + /* Init */ - + _hooks: function() { var t = this; this @@ -1686,9 +1686,9 @@ var Viewer = { }); }); }, - + /* References */ - + /** * Retrieve item instance current attached to viewer * @return Content_Item|NULL Current item instance @@ -1696,7 +1696,7 @@ var Viewer = { get_item: function() { return this.get_component('item'); }, - + /** * Set item reference * Validates item before setting @@ -1711,7 +1711,7 @@ var Viewer = { }); return ( !this.util.is_empty(i) ); }, - + /** * Clear item from viewer * Resets item state and removes reference (if necessary) @@ -1730,7 +1730,7 @@ var Viewer = { this.clear_component('item'); } }, - + /** * Retrieve theme reference * @return object Theme reference @@ -1744,7 +1744,7 @@ var Viewer = { } return ret; }, - + /** * Set viewer's theme * @param object theme Theme object @@ -1752,9 +1752,9 @@ var Viewer = { set_theme: function(theme) { this.set_component('theme', theme); }, - + /* Properties */ - + /** * Lock the viewer * Indicates that item is currently being processed @@ -1763,7 +1763,7 @@ var Viewer = { lock: function() { return this.set_status('item_working', $.Deferred()); }, - + /** * Retrieve lock * @param bool simple (optional) Whether to return a simple status of the locked status (Default: FALSE) @@ -1791,11 +1791,11 @@ var Viewer = { } return ( full ) ? r : r.promise(); }, - + is_locked: function() { return this.get_lock(true); }, - + /** * Unlock the viewer * Any callbacks registered for this action will be executed @@ -1804,7 +1804,7 @@ var Viewer = { unlock: function() { return this.get_lock(false, true).resolve(); }, - + /** * Set Viewer active status * @param bool mode (optional) Activate or deactivate status (Default: TRUE) @@ -1816,7 +1816,7 @@ var Viewer = { } return this.set_status('active', mode); }, - + /** * Check Viewer active status * @return bool Active status @@ -1824,7 +1824,7 @@ var Viewer = { is_active: function() { return this.get_status('active'); }, - + /** * Set loading mode * @param bool mode (optional) Set (TRUE) or unset (FALSE) loading mode (Default: TRUE) @@ -1853,7 +1853,7 @@ var Viewer = { } return dfr.promise(); }, - + /** * Unset loading mode * @see set_loading() @@ -1862,7 +1862,7 @@ var Viewer = { unset_loading: function() { return this.set_loading(false); }, - + /** * Retrieve loading status * @return bool Loading status (Default: FALSE) @@ -1870,17 +1870,17 @@ var Viewer = { get_loading: function() { return ( this.util.is_bool(this.loading) ) ? this.loading : false; }, - + /** * Check if viewer is currently loading content * @return bool Loading status (Default: FALSE) */ is_loading: function() { - return this.get_loading(); + return this.get_loading(); }, - + /* Display */ - + /** * Display content in viewer * @param Content_Item item Item to show @@ -1898,7 +1898,7 @@ var Viewer = { valid = ( this.get_theme() && this.get_theme().get_template().get_layout(false) !== "" ) ? true : false; this.set_attribute(vt, valid); } - + if ( !valid ) { this.close(); return false; @@ -1931,9 +1931,9 @@ var Viewer = { }); } }, - + /* History Management */ - + history_handle: function(e) { var state = e.originalEvent.state; // Load item @@ -1947,10 +1947,10 @@ var Viewer = { // Close viewer if ( -1 !== count ) { this.close(); - } + } } }, - + history_get: function(full) { return this.get_status('history_count', full); }, @@ -1999,16 +1999,16 @@ var Viewer = { history.go( -1 * count ); } }, - + /** * Check if viewer is currently open - * Checks if node is actually visible in DOM - * @return bool TRUE if viewer is open, FALSE otherwise + * Checks if node is actually visible in DOM + * @return bool TRUE if viewer is open, FALSE otherwise */ is_open: function() { return ( this.dom_get().css('display') === 'none' ) ? false : true; }, - + /** * Load output into DOM */ @@ -2070,7 +2070,7 @@ var Viewer = { // Set classes var d = v.dom_get(); var classes = ['item_single', 'item_multi']; - var ms = ['addClass', 'removeClass']; + var ms = ['addClass', 'removeClass']; if ( !v.get_item().get_group().is_single() ) { ms.reverse(); } @@ -2101,7 +2101,7 @@ var Viewer = { // Render thm.render(); }, - + /** * Retrieve container element * Creates default container element if not yet created @@ -2123,7 +2123,7 @@ var Viewer = { } return c; }, - + /** * Custom Viewer DOM initialization */ @@ -2148,7 +2148,7 @@ var Viewer = { } thm.render(true); }, - + /** * Prepare DOM for viewer */ @@ -2156,7 +2156,7 @@ var Viewer = { var m = ( this.util.is_bool(mode) && !mode ) ? 'removeClass' : 'addClass'; $('html')[m](this.util.add_prefix('overlay')); }, - + /** * Restore DOM * Required after viewer is closed @@ -2164,9 +2164,9 @@ var Viewer = { dom_restore: function() { this.dom_prep(false); }, - + /* Layout */ - + get_layout: function() { var ret = this.dom_get('layout', { 'put': { @@ -2177,15 +2177,15 @@ var Viewer = { }); return ret; }, - + /* Animation */ - + animation_enabled: function() { return this.get_attribute('animate', true); }, - + /* Overlay */ - + /** * Determine if overlay is enabled for viewer * @return bool TRUE if overlay is enabled, FALSE otherwise @@ -2194,7 +2194,7 @@ var Viewer = { var ov = this.get_attribute('overlay_enabled'); return ( this.util.is_bool(ov) ) ? ov : false; }, - + /** * Retrieve overlay DOM element * @return jQuery Overlay element (NULL if no overlay set for viewer) @@ -2213,7 +2213,7 @@ var Viewer = { } return $(o); }, - + /** * Unload viewer */ @@ -2224,7 +2224,7 @@ var Viewer = { dfr.resolve(); return dfr.promise(); }, - + /** * Reset viewer */ @@ -2245,20 +2245,20 @@ var Viewer = { // Clear for next item this.unlock(); }, - + /* Content */ - + get_labels: function() { return this.get_attribute('labels', {}); }, - + get_label: function(name) { var lbls = this.get_labels(); return ( name in lbls ) ? lbls[name] : ''; }, - + /* Interactivity */ - + /** * Initialize event handlers upon opening lightbox */ @@ -2268,13 +2268,13 @@ var Viewer = { if ( this.open ) { return false; } - + // Control event bubbling var l = this.get_layout(); l.children().click(function(ev) { ev.stopPropagation(); }); - + /* Close */ var v = this; var close = function() { @@ -2287,7 +2287,7 @@ var Viewer = { // Fire event this.trigger('events-open'); }, - + /** * Initialize event handlers upon completing lightbox rendering */ @@ -2298,7 +2298,7 @@ var Viewer = { // Fire event this.trigger('events-complete'); }, - + keys_enable: function(mode) { if ( !this.util.is_bool(mode) ) { mode = true; @@ -2314,11 +2314,11 @@ var Viewer = { $(document).off(e); } }, - + keys_disable: function() { this.keys_enable(false); }, - + keys_control: function(ev) { var handlers = { 27: this.close, /* esc */ @@ -2335,16 +2335,16 @@ var Viewer = { return false; } }, - + /** * Check if slideshow functionality is enabled * @return bool TRUE if slideshow is enabled, FALSE otherwise */ slideshow_enabled: function() { var o = this.get_attribute('slideshow_enabled'); - return ( this.util.is_bool(o) && o && this.get_item() && !this.get_item().get_group().is_single() ) ? true : false; + return ( this.util.is_bool(o) && o && this.get_item() && !this.get_item().get_group().is_single() ) ? true : false; }, - + /** * Checks if slideshow is currently active * @return bool TRUE if slideshow is active, FALSE otherwise @@ -2352,14 +2352,14 @@ var Viewer = { slideshow_active: function() { return ( this.slideshow_enabled() && ( this.get_attribute('slideshow_active') || ( !this.init && this.get_attribute('slideshow_autostart') ) ) ) ? true : false; }, - + /** * Clear slideshow timer */ slideshow_clear_timer: function() { clearInterval(this.get_attribute('slideshow_timer')); }, - + /** * Start slideshow timer * @param function callback Callback function @@ -2367,7 +2367,7 @@ var Viewer = { slideshow_set_timer: function(callback) { this.set_attribute('slideshow_timer', setInterval(callback, this.get_attribute('slideshow_duration') * 1000)); }, - + /** * Start Slideshow */ @@ -2384,13 +2384,13 @@ var Viewer = { this.slideshow_set_timer(function() { // Pause slideshow until next item fully loaded v.slideshow_pause(); - + // Show next item v.item_next(); }); this.trigger('slideshow-start'); }, - + /** * Stop Slideshow * @param bool full (optional) Full stop (TRUE) or pause (FALSE) (Default: TRUE) @@ -2407,7 +2407,7 @@ var Viewer = { this.slideshow_clear_timer(); this.trigger('slideshow-stop'); }, - + slideshow_toggle: function() { if ( !this.slideshow_enabled() ) { return false; @@ -2419,7 +2419,7 @@ var Viewer = { } this.trigger('slideshow-toggle'); }, - + /** * Pause Slideshow * @param bool mode (optional) Pause (TRUE) or Resume (FALSE) slideshow (default: TRUE) @@ -2441,14 +2441,14 @@ var Viewer = { } this.trigger('slideshow-pause'); }, - + /** * Resume slideshow */ slideshow_resume: function() { this.slideshow_pause(false); }, - + /** * Next item */ @@ -2466,7 +2466,7 @@ var Viewer = { } g.show_next(); }, - + /** * Previous item */ @@ -2483,7 +2483,7 @@ var Viewer = { } g.show_prev(); }, - + /** * Close viewer */ @@ -2515,41 +2515,41 @@ View.Viewer = Component.extend(Viewer); */ var Group = { /* Configuration */ - + _slug: 'group', _reciprocal: true, _refs: { 'current': 'Content_Item' }, - + /* References */ - + current: null, - + /* Properties */ - + /** * Selector for getting group items - * @var string + * @var string */ selector: null, - + /* Methods */ - + /* Init */ - + _hooks: function() { var t = this; this.on(['item-prev', 'item-next'], function() { t.trigger('item-change'); }); }, - + /* Properties */ - + /** * Retrieve selector for group items - * @return string Group items selector + * @return string Group items selector */ get_selector: function() { if ( this.util.is_empty(this.selector) ) { @@ -2558,7 +2558,7 @@ var Group = { } return this.selector; }, - + /** * Retrieve group items */ @@ -2569,7 +2569,7 @@ var Group = { } return items; }, - + /** * Retrieve item at specified index * If no index specified, first item is returned @@ -2591,7 +2591,7 @@ var Group = { // Return specified item return items.get(idx); }, - + /** * Retrieve (zero-based) position of specified item in group * @param Content_Item item Item to locate in group @@ -2613,7 +2613,7 @@ var Group = { // Sanitize return ( !this.util.is_empty( this.get_current() ) ); }, - + /** * Retrieve current item * @uses Group.current @@ -2626,7 +2626,7 @@ var Group = { } return this.current; }, - + /** * Sets current group item * @param Content_Item item Item to set as current @@ -2638,7 +2638,7 @@ var Group = { this.current = item; } }, - + get_next: function(item) { // Validate if ( !this.util.is_type(item, View.Content_Item) ) { @@ -2657,7 +2657,7 @@ var Group = { } return next; }, - + get_prev: function(item) { // Validate if ( !this.util.is_type(item, View.Content_Item) ) { @@ -2677,7 +2677,7 @@ var Group = { } return prev; }, - + show_next: function(item) { if ( this.get_size() > 1 ) { // Retrieve item @@ -2697,7 +2697,7 @@ var Group = { this.trigger('item-next'); } }, - + show_prev: function(item) { if ( this.get_size() > 1 ) { // Retrieve item @@ -2717,15 +2717,15 @@ var Group = { this.trigger('item-prev'); } }, - + /** * Retrieve total number of items in group - * @return int Number of items in group + * @return int Number of items in group */ get_size: function() { return this.get_items().length; }, - + is_single: function() { return ( this.get_size() === 1 ); } @@ -2738,30 +2738,30 @@ View.Group = Component.extend(Group); * @param obj options Init options */ var Content_Handler = { - + /* Configuration */ - + _slug: 'content_handler', _refs: { 'item': 'Content_Item' }, - + /* References */ - + item: null, - + /* Properties */ - + /** * Raw layout template - * @var string + * @var string */ template: '', - + /* Methods */ - + /* Item */ - + /** * Check if item instance set for type * @uses get_item() @@ -2771,7 +2771,7 @@ var Content_Handler = { has_item: function() { return ( this.util.is_empty(this.get_item()) ) ? false : true; }, - + /** * Retrieve item instance set on type * @uses get_component() @@ -2780,7 +2780,7 @@ var Content_Handler = { get_item: function() { return this.get_component('item'); }, - + /** * Set item instance for type * Items are only meant to be set/used while item is being processed @@ -2793,7 +2793,7 @@ var Content_Handler = { var r = this.set_component('item', item); return r; }, - + /** * Clear item instance from type * Sets value to NULL @@ -2801,13 +2801,13 @@ var Content_Handler = { clear_item: function() { this.clear_component('item'); }, - + /* Evaluation */ - + /** * Check if item matches content handler * @param object item Content_Item instance to check for type match - * @return bool TRUE if type matches, FALSE otherwise + * @return bool TRUE if type matches, FALSE otherwise */ match: function(item) { // Validate @@ -2816,7 +2816,7 @@ var Content_Handler = { // Stop processing types with no matching algorithm if ( !this.util.is_empty(m) ) { // Process regex patterns - + // String-based if ( this.util.is_string(m) ) { // Create new regexp object @@ -2835,9 +2835,9 @@ var Content_Handler = { // Default return false; }, - + /* Processing/Output */ - + /** * Loads item data * @param obj item Content item to load data for @@ -2852,7 +2852,7 @@ var Content_Handler = { } return dfr.promise(); }, - + /** * Render output to display item * @param Content_Item item Item to render output for @@ -2874,7 +2874,7 @@ View.Content_Handler = Component.extend(Content_Handler); */ var Content_Item = { /* Configuration */ - + _slug: 'content_item', _reciprocal: true, _refs: { @@ -2882,7 +2882,7 @@ var Content_Item = { 'group': 'Group', 'type': 'Content_Handler' }, - + _attr_default: { source: null, permalink: null, @@ -2892,31 +2892,31 @@ var Content_Item = { internal: false, output: null }, - + /* References */ - + group: null, viewer: null, type: null, - + /* Properties */ - + data: null, loaded: null, - + /* Init */ - + _c: function(el) { // Save element to instance this.dom_set(el); // Default initialization this._super(); }, - + /* Methods */ - + /*-** Attributes **-*/ - + /** * Build default attributes * Populates attributes with asset properties (attachments) @@ -2954,9 +2954,9 @@ var Content_Item = { } return this._attr_default; }, - + /*-** Properties **-*/ - + /** * Retrieve item output * Output generated based on content handler if not previously generated @@ -2988,7 +2988,7 @@ var Content_Item = { } return dfr.promise(); }, - + /** * Cache output for future retrieval * @uses set_attribute() to cache output @@ -2998,16 +2998,16 @@ var Content_Item = { this.set_attribute('output', out); } }, - + /** * Retrieve item output * Alias for `get_output()` - * @return jQuery.Promise Deferred that is resolved when content is retrieved + * @return jQuery.Promise Deferred that is resolved when content is retrieved */ get_content: function() { return this.get_output(); }, - + /** * Retrieve item URI * @param string mode (optional) Which URI should be retrieved @@ -3040,16 +3040,16 @@ var Content_Item = { if ( this.has_attribute(prop_cached) ) { return this.get_attribute(prop_cached, ''); } - + var title = ''; // Generate title from DOM values var dom = this.dom_get(); var t = this; /** * Validate title value. - * + * * Removes default title based on user option. - * + * * @param string title Title to check. * @return string Current title or empty string (if default title set and not permitted). */ @@ -3064,19 +3064,19 @@ var Content_Item = { if ( t.get_viewer().get_attribute('title_default') ) { return title; } - + // Check if default title is used. if ( title === t.get_title_default() ) { title = ''; } return title; }; - + // DOM-based caption if ( dom.length ) { // Link title (generally must be manually-entered) title = dom.attr(prop); - + // Figcaption element if ( !title ) { title = dom.closest('figure').find('figcaption').first().html(); @@ -3087,7 +3087,7 @@ var Content_Item = { title = dom.closest('figure').find('.wp-caption-text').first().html(); } } - + // Saved attributes if ( !title ) { var props = ['caption', 'title']; @@ -3103,16 +3103,16 @@ var Content_Item = { if ( !title && dom.length ) { // Image Alt attribute title = validate( dom.find('img').first().attr('alt') ); - + // Element text if ( !title ) { title = validate( dom.get(0).innerText.trim() ); } } - + // Final validation. title = validate(title); - + // Cache retrieved value this.set_attribute(prop_cached, title); // Return value @@ -3121,9 +3121,9 @@ var Content_Item = { /** * Retrieve default title. - * + * * WordPress-generated default title for attachments is base file name (without extension). - * + * * @return string Default title. */ get_title_default: function() { @@ -3147,15 +3147,15 @@ var Content_Item = { } return val; }, - + /** * Retrieve item dimensions - * @return obj Item `width` and `height` properties (px) + * @return obj Item `width` and `height` properties (px) */ get_dimensions: function() { return $.extend({'width': 0, 'height': 0}, this.get_attribute('dimensions'), {}); }, - + /** * Save item data to instance * Item data is saved when rendered @@ -3164,11 +3164,11 @@ var Content_Item = { set_data: function(data) { this.data = data; }, - + get_data: function() { return this.data; }, - + /** * Determine gallery type * @return string|null Gallery type ID (NULL if item not in gallery) @@ -3179,7 +3179,7 @@ var Content_Item = { 'wp': '.gallery-icon', 'ngg': '.ngg-gallery-thumbnail' }; - + var dom = this.dom_get(); for ( var type in types ) { if ( dom.parent(types[type]).length > 0 ) { @@ -3189,7 +3189,7 @@ var Content_Item = { } return ret; }, - + /** * Check if current link is part of a gallery * @param string gType (optional) Gallery type to check for @@ -3208,15 +3208,15 @@ var Content_Item = { // Check for specific gallery type return ( gType === type ) ? true : false; }, - + /*-** Component References **-*/ - + /* Viewer */ - + get_viewer: function() { return this.get_component('viewer', {get_default: true}); }, - + /** * Sets item's viewer property * @uses View.get_viewer() to retrieve global viewer @@ -3227,7 +3227,7 @@ var Content_Item = { set_viewer: function(v) { return this.set_component('viewer', v); }, - + /* Group */ /** @@ -3250,7 +3250,7 @@ var Content_Item = { } return g; }, - + /** * Sets item's group property * @uses View.get_group() to retrieve global group @@ -3263,13 +3263,13 @@ var Content_Item = { if ( this.util.is_string(g) ) { g = this.get_controller().get_group(g); } - + // Set (or clear) group property this.group = ( this.util.is_type(g, View.Group) ) ? g : false; }, - + /* Content Handler */ - + /** * Retrieve item type * @uses get_component() to retrieve saved reference to Content_Handler instance @@ -3283,7 +3283,7 @@ var Content_Item = { } return t; }, - + /** * Save content handler reference * @uses set_component() to save type reference @@ -3292,7 +3292,7 @@ var Content_Item = { set_type: function(type) { return this.set_component('type', type); }, - + /** * Check if content handler exists for item * @return bool TRUE if content handler exists, FALSE otherwise @@ -3301,9 +3301,9 @@ var Content_Item = { var ret = !this.util.is_empty(this.get_type()); return ret; }, - + /* Actions */ - + /** * Display item in viewer * @uses get_viewer() to retrieve viewer instance for item @@ -3324,10 +3324,10 @@ var Content_Item = { var ret = v.show(this); return ret; }, - + /** * Load item data - * + * * Retrieves item data from external sources (if necessary) * @uses this.loaded to save loaded state * @return obj Promise that is resolved when item data is loaded @@ -3339,7 +3339,7 @@ var Content_Item = { } return this.loaded.promise(); }, - + reset: function() { this.set_attribute('options_show', null); } @@ -3351,13 +3351,13 @@ View.Content_Item = Component.extend(Content_Item); * Modeled Component */ var Modeled_Component = { - + _slug: 'modeled_component', - + /* Methods */ - + /* Attributes */ - + /** * Retrieve attribute * Gives priority to model values @@ -3391,7 +3391,7 @@ var Modeled_Component = { } return ret; }, - + /** * Get attribute recursively * Merges objects from ancestors together @@ -3423,7 +3423,7 @@ var Modeled_Component = { * @param string key Attribute to set * @param mixed val Value to set for attribute * @param bool|obj use_model (optional) Set the value on the model (Default: TRUE) - * > bool: Set attribute on current model (TRUE) or as standard attribute (FALSE) + * > bool: Set attribute on current model (TRUE) or as standard attribute (FALSE) * > obj: Model object to set attribute on * @return mixed Attribute value */ @@ -3438,7 +3438,7 @@ var Modeled_Component = { // Determine where to set attribute if ( !!use_model ) { var model = this.util.is_obj(use_model) ? use_model : this.get_model(); - + // Set attribute in model model[key] = val; } else { @@ -3448,9 +3448,9 @@ var Modeled_Component = { return val; }, - + /* Model */ - + /** * Retrieve Template model * @return obj Model (Default: Empty object) @@ -3475,7 +3475,7 @@ var Modeled_Component = { }, - + /** * Check if specified attribute exists in model * @param string key Attribute to check for @@ -3484,7 +3484,7 @@ var Modeled_Component = { in_model: function(key) { return ( this.util.in_obj(this.get_model(), key) ) ? true : false; }, - + /** * Retrieve all ancestor models * @param bool inc_current (optional) Include current model in list (Default: FALSE) @@ -3503,7 +3503,7 @@ var Modeled_Component = { } return ret; }, - + /** * Retrieve first ancestor of current theme with specified attribute * > Current model is also evaluated @@ -3556,28 +3556,28 @@ Modeled_Component = Component.extend(Modeled_Component); * Theme */ var Theme = { - + /* Configuration */ - + _slug: 'theme', _refs: { 'viewer': 'Viewer', 'template': 'Template' }, _models: {}, - + _attr_default: { template: null, model: null }, - + /* References */ - + viewer: null, template: null, - + /* Methods */ - + /** * Custom constructor * @see Component._c() @@ -3590,20 +3590,20 @@ var Theme = { } // Pass parameters to parent constructor this._super(id, attributes); - + // Set viewer instance this.set_viewer(viewer); - + // Set theme model this.set_model(id); }, - + /* Viewer */ - + get_viewer: function() { return this.get_component('viewer', {check_attr: false, get_default: true}); }, - + /** * Sets theme's viewer property * @uses View.get_viewer() to retrieve global viewer @@ -3614,9 +3614,9 @@ var Theme = { set_viewer: function(v) { return this.set_component('viewer', v); }, - + /* Template */ - + /** * Retrieve template instance * @return Template instance @@ -3632,9 +3632,9 @@ var Theme = { } return ret; }, - + /* Tags */ - + /** * Retrieve tags from template * All tags will be retrieved by default @@ -3647,7 +3647,7 @@ var Theme = { get_tags: function(name, prop) { return this.get_template().get_tags(name, prop); }, - + /** * Retrieve tag DOM elements * @see Template.dom_get_tag() @@ -3655,7 +3655,7 @@ var Theme = { dom_get_tag: function(tag, prop) { return $(this.get_template().dom_get_tag(tag, prop)); }, - + /** * Retrieve template tag CSS selector * @uses Template.get_tag_selector() @@ -3666,9 +3666,9 @@ var Theme = { get_tag_selector: function(name, prop) { return this.get_template().get_tag_selector(name, prop); }, - + /* Model */ - + /** * Retrieve theme models * @return obj Theme models @@ -3676,7 +3676,7 @@ var Theme = { get_models: function() { return this._models; }, - + /** * Retrieve specified theme model * @param string id (optional) Theme model to retrieve @@ -3702,7 +3702,7 @@ var Theme = { } return ret; }, - + /** * Set model for current theme instance * @param string id (optional) Theme ID (Default theme retrieved if ID invalid) @@ -3719,9 +3719,9 @@ var Theme = { } */ }, - + /* Properties */ - + /** * Generate class names for DOM node * @param string rtype (optional) Return data type @@ -3747,7 +3747,7 @@ var Theme = { // Return class names return cls; }, - + /** * Get custom measurement * @param string attr Measurement to retrieve @@ -3758,13 +3758,13 @@ var Theme = { var meas = null; // Validate if ( !this.util.is_string(attr) ) { - return meas; + return meas; } if ( !this.util.is_obj(def, false) ) { def = {}; } // Manage cache - var attr_cache = this.util.format('%s_cache', attr); + var attr_cache = this.util.format('%s_cache', attr); var cache = this.get_attribute(attr_cache, {}, false); var status = '_status'; var item = this.get_viewer().get_item(); @@ -3804,7 +3804,7 @@ var Theme = { // Return measurement (copy) return $.extend({}, meas); }, - + /** * Get default measurement using attribute's default handler * @param string attr Measurement attribute @@ -3828,7 +3828,7 @@ var Theme = { } return attr; }, - + /** * Retrieve theme offset * @return obj Theme offset with `width` & `height` properties @@ -3836,7 +3836,7 @@ var Theme = { get_offset: function() { return this.get_measurement('offset', { 'width': 0, 'height': 0}); }, - + /** * Generate default offset * @return obj Theme offsets with `width` & `height` properties @@ -3871,7 +3871,7 @@ var Theme = { offset[key] = -1 * val; }); } - + // Set offset offset.width += l.width(); offset.height += l.height(); @@ -3885,15 +3885,15 @@ var Theme = { vc.empty().remove(); return offset; }, - + /** * Retrieve theme margins - * @return obj Theme margin with `width` & `height` properties + * @return obj Theme margin with `width` & `height` properties */ get_margin: function() { return this.get_measurement('margin', {'width': 0, 'height': 0}); }, - + /** * Retrieve item dimensions * Dimensions are adjusted to fit window (if necessary) @@ -3926,7 +3926,7 @@ var Theme = { } return $.extend({}, dims); }, - + /** * Retrieve theme dimensions * @return obj Theme dimensions with `width` & `height` properties @@ -3939,7 +3939,7 @@ var Theme = { }); return dims; }, - + /** * Retrieve all breakpoints * @return object Breakpoints @@ -3947,7 +3947,7 @@ var Theme = { get_breakpoints: function() { return this.get_attribute_recursive('breakpoints'); }, - + /** * Get breakpoint value * @param string target Breakpoint target @@ -3963,9 +3963,9 @@ var Theme = { } return ret; }, - + /* Output */ - + /** * Render Theme output * @param bool init (optional) Initialize theme (Default: FALSE) @@ -3990,7 +3990,7 @@ var Theme = { // Render template tpl.render(init); }, - + transition: function(event, clear_queue) { var dfr = null; var attr = 'transition'; @@ -4062,10 +4062,10 @@ View.Theme = Modeled_Component.extend(Theme); */ var Template = { /* Configuration */ - + _slug: 'template', _reciprocal: true, - + _refs: { 'theme': 'Theme' }, @@ -4076,11 +4076,11 @@ var Template = { * @var string */ layout_uri: '', - + /** * Raw layout template * @var string - */ + */ layout_raw: '', /** * Parsed layout @@ -4101,17 +4101,17 @@ var Template = { */ model: null }, - + /* References */ - + theme: null, - + /* Methods */ - + _c: function(attributes) { this._super('', attributes); }, - + _hooks: function() { // TODO: Refactor to event that can save retrieved tags // (`dom_init` event called during attribute initialization so tags are not saved) @@ -4129,14 +4129,14 @@ var Template = { }); }); }, - + get_theme: function() { var ret = this.get_component('theme'); return ret; }, - + /* Output */ - + /** * Render output * @param bool init (optional) Whether to initialize layout (TRUE) or render item (FALSE) (Default: FALSE) @@ -4196,9 +4196,9 @@ var Template = { this.trigger('render-init', this.dom_get()); } }, - + /*-** Layout **-*/ - + /** * Retrieve layout * @param bool parsed (optional) TRUE retrieves parsed layout, FALSE retrieves raw layout (Default: TRUE) @@ -4213,7 +4213,7 @@ var Template = { var l = ( parsed ) ? this.parse_layout() : this.get_attribute('layout_raw', ''); return l; }, - + /** * Parse layout * Converts template tags to HTML elements @@ -4234,11 +4234,11 @@ var Template = { ret = this.parse_tags(ret); // Save parsed layout this.set_attribute(a, ret); - + // Return parsed layout return ret; }, - + /** * Sanitize layout * @param obj|string l Layout string or jQuery object @@ -4252,7 +4252,7 @@ var Template = { // Set return type var rtype = ( this.util.is_string(l) ) ? 'string' : null; /* Quarantine hard-coded tags */ - + // Create DOM structure from raw template var dom = $(l); // Find hard-coded tag nodes @@ -4274,9 +4274,9 @@ var Template = { } return l; }, - + /*-** Tags **-*/ - + /** * Extract tags from template * Tags are replaced with DOM element placeholders @@ -4301,7 +4301,7 @@ var Template = { } return l; }, - + /** * Create DOM element container for tag * @param string Tag ID (will be prefixed) @@ -4310,13 +4310,13 @@ var Template = { get_tag_container: function(tag) { // Build element var attr = this.get_tag_attribute(); - return this.util.format('', attr, encodeURI(tag)); + return this.util.format('', attr, encodeURI(tag)); }, - + get_tag_attribute: function() { return this.get_tag_temp().dom_get_attribute(); }, - + /** * Retrieve Template_Tag instance at specified index * @param int idx (optional) Index to retrieve tag from @@ -4333,7 +4333,7 @@ var Template = { } return ret; }, - + /** * Retrieve tags from template * Subset of tags may be retrieved based on parameter values @@ -4406,7 +4406,7 @@ var Template = { } return ( this.util.is_array(tags, false) ) ? tags : []; }, - + /** * Check if template contains tags * @return bool TRUE if tags exist, FALSE otherwise @@ -4414,7 +4414,7 @@ var Template = { has_tags: function() { return ( this.get_tags().length > 0 ) ? true : false; }, - + /** * Retrieve temporary tag instance * @return Template_Tag Temporary tag @@ -4422,7 +4422,7 @@ var Template = { get_tag_temp: function() { return this.get_controller().get_component_temp(View.Template_Tag); }, - + /** * Retrieve Template tag CSS selector * @uses Template.get_tag_temp() to retrieve temporary tag instance @@ -4443,18 +4443,18 @@ var Template = { tag.set_attribute('prop', prop); return tag.get_selector('full'); }, - + /*-** DOM **-*/ - + /** - * Custom DOM initialization + * Custom DOM initialization */ dom_init: function() { // Create DOM object from parsed layout this.dom_set(this.get_layout()); this.trigger('dom_init'); }, - + /** * Retrieve DOM element(s) for specified tag * @param string tag Name of tag to retrieve @@ -4480,7 +4480,7 @@ var Template = { View.Template = Modeled_Component.extend(Template); /** - * Template tag + * Template tag */ var Template_Tag = { /* Configuration */ @@ -4495,19 +4495,19 @@ var Template_Tag = { /** * Tag Handlers * Collection of Template_Tag_Handler instances - * @var obj + * @var obj */ handlers: {}, /* Methods */ - + /** * Constructor - * @param + * @param */ _c: function(tag_match) { this.parse(tag_match); }, - + /** * Set instance attributes using tag extracted from template * @param string tag_match Extracted tag match @@ -4547,7 +4547,7 @@ var Template_Tag = { // Save to instance this.set_attributes(attrs, true); }, - + /** * Render tag output * @param Content_Item item @@ -4562,7 +4562,7 @@ var Template_Tag = { return {'tag': tag, 'output': output}; }); }, - + /** * Retrieve tag name * @return string Tag name (DEFAULT: NULL) @@ -4570,14 +4570,14 @@ var Template_Tag = { get_name: function() { return this.get_attribute('name'); }, - + /** * Retrieve tag property */ get_prop: function() { return this.get_attribute('prop'); }, - + /** * Retrieve tag handler * @return Template_Tag_Handler Handler instance (Empty instance if handler does not exist) @@ -4585,7 +4585,7 @@ var Template_Tag = { get_handler: function() { return ( this.has_handler() ) ? this.handlers[this.get_name()] : new View.Template_Tag_Handler(''); }, - + /** * Check if handler exists for tag * @return bool TRUE if handler exists, FALSE otherwise @@ -4593,7 +4593,7 @@ var Template_Tag = { has_handler: function() { return ( this.get_name() in this.handlers ); }, - + /** * Generate class names for DOM node * @param string rtype (optional) Return data type @@ -4620,7 +4620,7 @@ var Template_Tag = { // Return class names return cls; }, - + /** * Generate DOM-compatible class name based with varied levels of specificity * @param int level (optional) Class name specificity @@ -4653,7 +4653,7 @@ var Template_Tag = { // Format & return return ( !this.util.is_string(cls) ) ? this.get_ns() : this.add_ns(cls); }, - + /** * Generate tag selector based on specified class name level * @param string level (optional) Class name specificity (@see get_class() for parameter values) @@ -4686,9 +4686,9 @@ var Template_Tag_Handler = { dynamic: false, props: {} }, - + /* Methods */ - + /** * Render tag output * @param Content_Item item Item currently being displayed @@ -4702,7 +4702,7 @@ var Template_Tag_Handler = { // Return promise return dfr.promise(); }, - + add_prop: function(prop, fn) { // Get attribute var a = 'props'; @@ -4719,7 +4719,7 @@ var Template_Tag_Handler = { // Save attribute this.set_attribute(a, props); }, - + handle_prop: function(prop, item, instance) { // Locate property var props = this.get_attribute('props'); diff --git a/content-handlers/image/js/dev/handler.image.js b/content-handlers/image/js/dev/handler.image.js index ca2b52e..76f3836 100644 --- a/content-handlers/image/js/dev/handler.image.js +++ b/content-handlers/image/js/dev/handler.image.js @@ -20,7 +20,7 @@ SLB.View.extend_content_handler('image', { // Resolve deferred dfr.resolve(out); }; - + // Attach event handler $(img).on('load', function(e) { handler(e); }); // Load image diff --git a/grunt/phplint.js b/grunt/phplint.js index 8769c37..f41ed8c 100644 --- a/grunt/phplint.js +++ b/grunt/phplint.js @@ -1,5 +1,5 @@ module.exports = function(grunt) { - + grunt.config('phplint', { options : { phpArgs : { diff --git a/template-tags/item/js/dev/tag.item.js b/template-tags/item/js/dev/tag.item.js index 2b3339a..c926bf1 100644 --- a/template-tags/item/js/dev/tag.item.js +++ b/template-tags/item/js/dev/tag.item.js @@ -1,7 +1,7 @@ if ( !!window.SLB && SLB.has_child('View.extend_template_tag_handler') ) {(function() { SLB.View.extend_template_tag_handler('item', { /** - * Render Item tag + * Render Item tag * @param obj item Content Item * @param obj tag Tag instance * @param obj dfr Promise to be resolved when tag is rendered diff --git a/template-tags/ui/js/dev/tag.ui.js b/template-tags/ui/js/dev/tag.ui.js index 1c8dfff..defeddd 100644 --- a/template-tags/ui/js/dev/tag.ui.js +++ b/template-tags/ui/js/dev/tag.ui.js @@ -13,28 +13,28 @@ SLB.View.extend_template_tag_handler('ui', { // Register event handlers /* Close */ - + // Close button thm.dom_get_tag('ui', 'close').click(function() { return v.close(); }); - + /* Navigation */ - + thm.dom_get_tag('ui', 'nav_next').click(function() { v.item_next(); }); thm.dom_get_tag('ui', 'nav_prev').click(function() { v.item_prev(); }); - + /* Slideshow */ - + thm.dom_get_tag('ui', 'slideshow_control').click(function() { v.slideshow_toggle(); }); }); - + v.on('slideshow-toggle', function(ev, v) { // Update slideshow control tag var tags = thm.get_tags('ui', 'slideshow_control'); diff --git a/themes/default/js/dev/client.js b/themes/default/js/dev/client.js index 5077a8e..56748c4 100644 --- a/themes/default/js/dev/client.js +++ b/themes/default/js/dev/client.js @@ -14,7 +14,7 @@ SLB.View.extend_theme('slb_default', { // Reset layout and overlay state on open var l = v.get_layout().hide(), o = v.get_overlay().hide(); - + // Clean UI var thm = this; var d = v.dom_get(); @@ -61,7 +61,7 @@ SLB.View.extend_theme('slb_default', { l.css('opacity', ''); dfr.resolve(); }; - if ( v.animation_enabled() && document.documentElement.clientWidth > this.get_breakpoint('small') ) { + if ( v.animation_enabled() && document.documentElement.clientWidth > this.get_breakpoint('small') ) { /* Standard */ var anims = { 'layout': { opacity: 0, top: $(document).scrollTop() + ( $(window).height() / 2 ) }, @@ -149,7 +149,7 @@ SLB.View.extend_theme('slb_default', { if ( pos.top < pos.top_base ) { pos.top = pos.top_base; } - + // Position/Resize viewer pos = l.animate(pos, spd).promise(); dims_item = c.animate(dims_item, spd).promise(); From 0d4b8be83c55e852d5c72c98c7ab3e772c65d269 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Wed, 11 Dec 2019 17:46:27 -1000 Subject: [PATCH 56/59] Maintenance:Remove trailing whitespace (Sass [Dev] files) * Production files regenerated (no changes) --- client/sass/admin.scss | 6 ++-- themes/baseline/sass/style.scss | 34 +++++++++--------- themes/black/sass/style.scss | 14 ++++---- themes/default/sass/style.scss | 62 ++++++++++++++++----------------- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/client/sass/admin.scss b/client/sass/admin.scss index 67dabcf..45090cb 100644 --- a/client/sass/admin.scss +++ b/client/sass/admin.scss @@ -7,19 +7,19 @@ .block { display: inline-block; } - + label.title { width: 200px; padding: 10px; } - + .input { font-size: 11px; line-height: 20px; margin-bottom: 9px; padding: 8px 10px; } - + .input select { min-width: 12em; } diff --git a/themes/baseline/sass/style.scss b/themes/baseline/sass/style.scss index f1f2f6c..ab1127d 100644 --- a/themes/baseline/sass/style.scss +++ b/themes/baseline/sass/style.scss @@ -22,7 +22,7 @@ family: arial, verdana, sans-serif; size: 12px; } - + //Reset * { margin: 0; @@ -44,13 +44,13 @@ text-align: right; } } - + //General - + a img { border: none; } - + .slb_viewer_layout { @extend %box-sizing-border-box; z-index: 2; @@ -58,7 +58,7 @@ width: 100%; text-align: center; } - + .slb_viewer_overlay { position: fixed; top: 0; @@ -68,7 +68,7 @@ min-width: 100%; background-color: #000; } - + .slb_container { @extend %box-sizing-border-box; position: relative; @@ -77,7 +77,7 @@ margin: 0 auto; padding: 16px; } - + .slb_loading { background: url('../images/loading.gif') center center no-repeat; position: absolute; @@ -91,22 +91,22 @@ line-height: 0; display: none; } - + .slb_template_tag_ui { cursor: pointer; } - + //UI - + //Content .slb_content { position: relative; } - + .slb_details { margin: 0 auto; text-align: left; - + .inner { display: table; width: 100%; @@ -115,12 +115,12 @@ display: table-caption; } } - + .slb_template_tag_item_content > * { width: 100%; height: 100%; } - + /* Single */ &.item_single { .slb_group_status, @@ -134,14 +134,14 @@ .slb_loading { display: block; } - + .slb_template_tag_ui { opacity: 0; } } - + //Media - + //Small screen @media screen and (max-width: 480px) { %vsizing { diff --git a/themes/black/sass/style.scss b/themes/black/sass/style.scss index f8d3d21..c9f67aa 100644 --- a/themes/black/sass/style.scss +++ b/themes/black/sass/style.scss @@ -1,15 +1,15 @@ #slb_viewer_wrap { .slb_theme_slb_black { - + a, a:hover { color: #fff; } - + .slb_loading { background-image: url('../images/loading.gif'); } - + .slb_container { background-color: #151515; } @@ -18,21 +18,21 @@ [dir="rtl"] & .slb_next .slb_template_tag { background-image: url('../images/nav_prev.png'); } - + .slb_next .slb_template_tag, [dir="rtl"] & .slb_prev .slb_template_tag { background-image: url('../images/nav_next.png'); } } - + .slb_data_title { color: #e3e3e3; } - + .slb_data_desc { color: #cecece; } - + .slb_group_status { color: #999; } diff --git a/themes/default/sass/style.scss b/themes/default/sass/style.scss index 229f543..6b6bd25 100644 --- a/themes/default/sass/style.scss +++ b/themes/default/sass/style.scss @@ -19,32 +19,32 @@ $ui_controls_height: 25px; #slb_viewer_wrap { .slb_theme_slb_default { - //General + //General a, a:hover { border-bottom:none; color:#000; text-decoration:underline; } - + .slb_viewer_layout { - top: 20px; + top: 20px; } - + .slb_container { box-shadow: 0 0 64px -40px #fcfcfc; border-radius: 5px; } - + .slb_loading { @extend %hide-text; } - + .slb_template_tag_ui { transition: opacity .5s; } - - //UI + + //UI .slb_controls { position: absolute; top: 8px; @@ -55,7 +55,7 @@ $ui_controls_height: 25px; right: inherit; left: 0px; } - + .slb_template_tag_ui { @extend %hide-text; width: $ui_controls_width; @@ -67,25 +67,25 @@ $ui_controls_height: 25px; float: left; } } - + .slb_template_tag_ui:hover { opacity: 0.8; } - + .slb_slideshow .slb_template_tag { background: url('../images/ui_slideshow_play.png') 0 0 no-repeat; } - + .slb_close .slb_template_tag { background: url('../images/ui_close.png') 0 0 no-repeat; } } - + &.slideshow_active .slb_controls .slb_slideshow .slb_template_tag { background: url('../images/ui_slideshow_pause.png') 0 0 no-repeat; } - - //Navigation + + //Navigation $ui_nav_pos: 45%; %ui_nav { @extend %hide-text; @@ -98,12 +98,12 @@ $ui_controls_height: 25px; background-repeat: no-repeat; opacity: 0.5; } - - //Content + + //Content .slb_content { min-height: $nav_height + $ui_controls_height; min-width: $nav_width * 2; - + .slb_prev .slb_template_tag, [dir="rtl"] & .slb_next .slb_template_tag { left: 4px; @@ -111,7 +111,7 @@ $ui_controls_height: 25px; background-image: url('../images/nav_prev.png'); background-position: left $ui_nav_pos; } - + .slb_next .slb_template_tag, [dir="rtl"] & .slb_prev .slb_template_tag { right: 4px; @@ -119,7 +119,7 @@ $ui_controls_height: 25px; background-image: url('../images/nav_next.png'); background-position: right $ui_nav_pos; } - + .slb_prev, .slb_next { .slb_template_tag { @extend %ui_nav; @@ -129,24 +129,24 @@ $ui_controls_height: 25px; } } } - + .slb_details { line-height: 1.4em; overflow: hidden; position: relative; - + .slb_data { caption-side: bottom; } - + .slb_nav { display: none; } } - - //Title + + //Title $title-size: 23px; - + .slb_data_title, .slb_group_status { font-family: 'Yanone Kaffeesatz', arial, sans-serif; font-size: $title-size; @@ -157,20 +157,20 @@ $ui_controls_height: 25px; margin-right: 0px; } } - + .slb_group_status { color: #777; font-style: italic; font-size: $title-size * .8; } - + .slb_data_desc { display: block; margin-top: 0.5em; } - + //Media - + //Small screen @media screen and (max-width: 480px) { .slb_container { @@ -181,7 +181,7 @@ $ui_controls_height: 25px; top: 3px; right: 3px; } - + %ui_nav { top: 17%; height: 79%; From 16430ee5110f27e9a6c1bff0328a1ec3e4677648 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 12 Dec 2019 12:03:20 -1000 Subject: [PATCH 57/59] Meta:Set version for new code in DocBlocks (v2.8.0) --- includes/class.field_base.php | 8 ++++---- includes/class.field_type.php | 2 +- includes/class.options.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/class.field_base.php b/includes/class.field_base.php index 41a6d12..0f4fa2d 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -449,7 +449,7 @@ private function &get_id_formats() { /** * Initializes default ID formats. * - * @since dev + * @since 2.8.0 * * @return void */ @@ -482,7 +482,7 @@ private function init_id_formats() { /** * Adds custom ID format. * - * @since dev + * @since 2.8.0 * * @param string $name Format name. * @param array $wrap @@ -1037,7 +1037,7 @@ function format($value, $context = '') { * * Only strings are formatted. * - * @since dev + * @since 2.8.0 * * @param mixed $value Value to format. * @return mixed Formatted value. @@ -1055,7 +1055,7 @@ function format_attr( $value ) { * Escapes HTML, etc. * Only strings are formatted. * - * @since dev + * @since 2.8.0 * * @param mixed $value Value to format. * @return mixed Formatted value. diff --git a/includes/class.field_type.php b/includes/class.field_type.php index b41794c..410a6a4 100644 --- a/includes/class.field_type.php +++ b/includes/class.field_type.php @@ -399,7 +399,7 @@ function build_layout($layout = 'form', $data = null) { * * Finds and replaces placeholders in a string to their full values. * - * @since dev + * @since 2.8.0 * * @param string $str String with placeholders to replace. * @param string $layout Optional. Name of layout being built. diff --git a/includes/class.options.php b/includes/class.options.php index 1191784..f9c09f2 100644 --- a/includes/class.options.php +++ b/includes/class.options.php @@ -319,7 +319,7 @@ function validate( $values = null ) { /** * Generates query variable using common base. * - * @since dev + * @since 2.8.0 * * @param string $text Optional. Text to append to base. * From 6ef04d80e4ce411af4e34b03a97710102a259495 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 12 Dec 2019 13:08:40 -1000 Subject: [PATCH 58/59] Meta:Update readme/changelog (2.8.0) --- changelog.txt | 19 +++++++++++++++++++ readme.txt | 31 ++++++++++++++++--------------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index abe9e57..ddbd50f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,22 @@ += 2.8.0 = + +* Update: WordPress 5.3+ required. +* Update: PHP 7.2+ required. +* Optimize: Link detection up to 2x faster. +* Optimize: Options data handling. +* Optimize: Default title filtering. +* Optimize: Standardize media item data structure to avoid conflicts with third-party data. +* Optimize: Load only necessary media item properties in browser. +* Optimize: Filter all media items (instead of each individual item). + * Filter Removed: `media_item_properties` (single item). + * Filter Added: `media_items` (all items). +* Fix: `area` elements included in link detection (This is Jim's Area). + += 2.7.1 = + +* Update: Confirm compatibility with WordPress 5.0+ +* Optimize: Improved support for captions generated by Block Editor. + = 2.7.0 = * Fix: Remove reference to deprecated `screen_icon()` function (The Icon of Finnegan Island) diff --git a/readme.txt b/readme.txt index f7df74f..ccc87d8 100644 --- a/readme.txt +++ b/readme.txt @@ -46,6 +46,9 @@ Options for customizing the lightbox behavior are located in the **Appearance > == Upgrade Notice == += 2.8.0 = +Faster link processing & other optimizations (WordPress 5.3+ & PHP 7.2+ required). + = 2.7.0 = Fixes & improvements. PHP 5.4+ Required. @@ -61,20 +64,18 @@ Get more information on [Simple Lightbox's official page](http://archetyped.com/ == Changelog == -= 2.7.1 = - -* Update: Confirm compatibility with WordPress 5.0+ -* Optimize: Improved support for captions generated by Block Editor. - -= 2.7.0 = - -* Fix: Remove reference to deprecated `screen_icon()` function (The Icon of Finnegan Island) -* Fix: Reset settings link initializes plugin delete confirmation -* Add: Validate requirements before initialization. -* Optimize: PHP 7.2+ Compatibility -* Optimize: Internal code optimizations -* Themes - * Add: RTL Support - * Update: Load font locally += 2.8.0 = + +* Update: WordPress 5.3+ required. +* Update: PHP 7.2+ required. +* Optimize: Link detection up to 2x faster. +* Optimize: Options data handling. +* Optimize: Default title filtering. +* Optimize: Standardize media item data structure to avoid conflicts with third-party data. +* Optimize: Load only necessary media item properties in browser. +* Optimize: Filter all media items (instead of each individual item). + * Filter Removed: `media_item_properties` (single item). + * Filter Added: `media_items` (all items). +* Fix: `area` elements included in link detection (This is Jim's Area). [See full changelog](https://github.com/archetyped/simple-lightbox/releases) \ No newline at end of file From 4f63c9655415ae2f2fcf482dced441fc7fd33f24 Mon Sep 17 00:00:00 2001 From: Archetyped Date: Thu, 12 Dec 2019 15:24:58 -1000 Subject: [PATCH 59/59] Prep release (2.8.0) * Update version. --- main.php | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.php b/main.php index 6bee50b..bbb8108 100644 --- a/main.php +++ b/main.php @@ -9,7 +9,7 @@ * Plugin Name: Simple Lightbox * Plugin URI: http://archetyped.com/tools/simple-lightbox/ * Description: The highly customizable lightbox for WordPress - * Version: 0.0.0-dev + * Version: 2.8.0 * Requires at least: 5.3 * Requires PHP: 7.2 * Text Domain: simple-lightbox diff --git a/package-lock.json b/package-lock.json index b0b5096..36e6fdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "simple-lightbox", - "version": "0.0.0-dev", + "version": "2.8.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2175a10..1072989 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-lightbox", - "version": "0.0.0-dev", + "version": "2.8.0", "title": "Simple Lightbox", "description": "The highly-customizable lightbox for WordPress", "author": "Archetyped ",