");$oldRow.after($newRow),cmb.afterRowInsert($newRow,!0),$table.find(".repeatable-grouping").length<=1?$table.find(".remove-group-row").attr("disabled","disabled"):$table.find(".remove-group-row").removeAttr("disabled"),$table.trigger("cmb2_add_row",$newRow)},cmb.addAjaxRow=function(event){event.preventDefault();var $self=$(this),tableselector="#"+$self.data("selector"),$table=$(tableselector),$emptyrow=$table.find(".empty-row"),prevNum=parseInt($emptyrow.find("[data-iterator]").data("iterator"));cmb.idNumber=prevNum+1;var $row=$emptyrow.clone();$row.newRowHousekeeping().cleanRow(prevNum),$emptyrow.removeClass("empty-row hidden").addClass("repeat-row"),$emptyrow.after($row),cmb.afterRowInsert($row),$table.trigger("cmb2_add_row",$row),$table.find(".remove-row-button").removeAttr("disabled")},cmb.removeGroupRow=function(event){event.preventDefault();var $self=$(this),$table=$("#"+$self.data("selector")),$parent=$self.parents(".repeatable-grouping"),number=$table.find(".repeatable-grouping").length;number>1&&($parent.nextAll(".repeatable-grouping").find(cmb.repeatEls).each(cmb.updateNameAttr),$parent.remove(),2>=number?$table.find(".remove-group-row").attr("disabled","disabled"):$table.find(".remove-group-row").removeAttr("disabled"),$table.trigger("cmb2_remove_row"))},cmb.removeAjaxRow=function(event){event.preventDefault();var $self=$(this),$parent=$self.parents(".cmb-row"),$table=$self.parents(".cmb-repeat-table"),number=$table.find(".cmb-row").length;number>2?($parent.hasClass("empty-row")&&$parent.prev().addClass("empty-row").removeClass("repeat-row"),$self.parents(".cmb-repeat-table .cmb-row").remove(),3===number&&$table.find(".remove-row-button").attr("disabled","disabled"),$table.trigger("cmb2_remove_row")):$self.attr("disabled","disabled")},cmb.shiftRows=function(event){event.preventDefault();var $self=$(this),$parent=$self.parents(".repeatable-grouping"),$goto=$self.hasClass("move-up")?$parent.prev(".repeatable-grouping"):$parent.next(".repeatable-grouping");if($goto.length){var inputVals=[];$parent.find(cmb.repeatEls).each(function(){var val,$element=$(this);val=$element.hasClass("cmb2_media_status")?$element.html():"checkbox"===$element.attr("type")?$element.is(":checked"):"select"===$element.prop("tagName")?$element.is(":selected"):$element.val(),inputVals.push({val:val,$:$element})}),$goto.find(cmb.repeatEls).each(function(index){var val,$element=$(this);$element.hasClass("cmb2_media_status")?(val=$element.html(),$element.html(inputVals[index].val),inputVals[index].$.html(val)):"checkbox"===$element.attr("type")?(inputVals[index].$.prop("checked",$element.is(":checked")),$element.prop("checked",inputVals[index].val)):"select"===$element.prop("tagName")?(inputVals[index].$.prop("selected",$element.is(":selected")),$element.prop("selected",inputVals[index].val)):(inputVals[index].$.val($element.val()),$element.val(inputVals[index].val))})}},cmb.initPickers=function($timePickers,$datePickers,$colorPickers){cmb.initTimePickers($timePickers),cmb.initDatePickers($datePickers),cmb.initColorPickers($colorPickers)},cmb.initTimePickers=function($selector){$selector.length&&$selector.timePicker(cmb.defaults.timePicker)},cmb.initDatePickers=function($selector){$selector.length&&($selector.datepicker("destroy"),$selector.datepicker(cmb.defaults.datePicker))},cmb.initColorPickers=function($selector){$selector.length&&("object"==typeof jQuery.wp&&"function"==typeof jQuery.wp.wpColorPicker?$selector.wpColorPicker(cmb.defaults.colorPicker):$selector.each(function(i){$(this).after(''),$("#picker-"+i).hide().farbtastic($(this))}).focus(function(){$(this).next().show()}).blur(function(){$(this).next().hide()}))},cmb.makeListSortable=function(){cmb.metabox().find(".cmb2_media_status.attach_list").sortable({cursor:"move"}).disableSelection()},cmb.maybeOembed=function(evt){var $self=$(this),type=evt.type,m={focusout:function(){setTimeout(function(){cmb.spinner(".postbox table.cmb2_metabox",!0)},2e3)},keyup:function(){var betw=function(min,max){return evt.which<=max&&evt.which>=min};(betw(48,90)||betw(96,111)||betw(8,9)||187===evt.which||190===evt.which)&&cmb.doAjax($self,evt)},paste:function(){setTimeout(function(){cmb.doAjax($self)},100)}};m[type]()},cmb.resizeoEmbeds=function(){cmb.metabox().each(function(){var $self=$(this),$tableWrap=$self.parents(".inside"),isSide=$self.parents(".inner-sidebar").length||$self.parents("#side-sortables").length,isSmall=isSide,isSmallest=!1;if(!$tableWrap.length)return!0;var tableW=$tableWrap.width();cmb.styleBreakPoint>tableW&&(isSmall=!0,isSmallest=cmb.styleBreakPoint-62>tableW),tableW=isSmall?tableW:Math.round(.82*$tableWrap.width()*.97);var newWidth=tableW-30;if(!isSmall||isSide||isSmallest||(newWidth-=75),newWidth>639)return!0;var $embeds=$self.find(".cmb-type-oembed .embed_status"),$children=$embeds.children().not(".cmb2_remove_wrapper");return $children.length?void $children.each(function(){var $self=$(this),iwidth=$self.width(),iheight=$self.height(),_newWidth=newWidth;$self.parents(".repeat-row").length&&!isSmall&&(_newWidth=newWidth-91,_newWidth=785>tableW?_newWidth-15:_newWidth);var newHeight=Math.round(_newWidth*iheight/iwidth);$self.width(_newWidth).height(newHeight)}):!0})},cmb.log=function(){l10n.script_debug&&console&&"function"==typeof console.log&&console.log.apply(console,arguments)},cmb.spinner=function($context,hide){hide?$(".cmb-spinner",$context).hide():$(".cmb-spinner",$context).show()},cmb.doAjax=function($obj){var oembed_url=$obj.val();if(!(oembed_url.length<6)){var field_id=$obj.attr("id"),$context=$obj.parents(".cmb-repeat-table .cmb-row .cmb-td");$context=$context.length?$context:$obj.parents(".cmb2_metabox .cmb-row .cmb-td");var embed_container=$(".embed_status",$context),oembed_width=$obj.width(),child_el=$(":first-child",embed_container);cmb.log("oembed_url",oembed_url,field_id),oembed_width=embed_container.length&&child_el.length?child_el.width():$obj.width(),cmb.spinner($context),$(".embed_wrap",$context).html(""),setTimeout(function(){$(".cmb2_oembed:focus").val()===oembed_url&&$.ajax({type:"post",dataType:"json",url:l10n.ajaxurl,data:{action:"cmb2_oembed_handler",oembed_url:oembed_url,oembed_width:oembed_width>300?oembed_width:300,field_id:field_id,object_id:$obj.data("objectid"),object_type:$obj.data("objecttype"),cmb2_ajax_nonce:l10n.ajax_nonce},success:function(response){cmb.log(response),cmb.spinner($context,!0),$(".embed_wrap",$context).html(response.data)}})},500)}},$(document).ready(cmb.init),cmb}(window,document,jQuery);
\ No newline at end of file
diff --git a/includes/libraries/cmb2/js/jquery.timePicker.min.js b/includes/libraries/cmb2/js/jquery.timePicker.min.js
new file mode 100644
index 0000000..e78a48d
--- /dev/null
+++ b/includes/libraries/cmb2/js/jquery.timePicker.min.js
@@ -0,0 +1,13 @@
+/**
+ * A time picker for jQuery.
+ *
+ * Dual licensed under the MIT and GPL licenses.
+ * Copyright (c) 2009 Anders Fajerson
+ *
+ * @name timePicker
+ * @author Anders Fajerson (http://perifer.se)
+ * @see http://github.com/perifer/timePicker
+ * @example $("#mytime").timePicker();
+ * @example $("#mytime").timePicker({step:30, startTime:"15:00", endTime:"18:00"});
+ */
+(function(a){function g(a){a.setFullYear(2001),a.setMonth(0),a.setDate(0);return a}function f(a,b){if(a){var c=a.split(b.separator),d=parseFloat(c[0]),e=parseFloat(c[1]);b.show24Hours||(d===12&&a.indexOf("AM")!==-1?d=0:d!==12&&a.indexOf("PM")!==-1&&(d+=12));var f=new Date(0,0,0,d,e,0);return g(f)}return null}function e(a,b){return typeof a=="object"?g(a):f(a,b)}function d(a){return(a<10?"0":"")+a}function c(a,b){var c=a.getHours(),e=b.show24Hours?c:(c+11)%12+1,f=a.getMinutes();return d(e)+b.separator+d(f)+(b.show24Hours?"":c<12?" AM":" PM")}function b(b,c,d,e){b.value=a(c).text(),a(b).change(),a.browser.msie||b.focus(),d.hide()}a.fn.timePicker=function(b){var c=a.extend({},a.fn.timePicker.defaults,b);return this.each(function(){a.timePicker(this,c)})},a.timePicker=function(b,c){var d=a(b)[0];return d.timePicker||(d.timePicker=new jQuery._timePicker(d,c))},a.timePicker.version="0.3",a._timePicker=function(d,h){var i=!1,j=!1,k=e(h.startTime,h),l=e(h.endTime,h),m="selected",n="li."+m;a(d).attr("autocomplete","OFF");var o=[],p=new Date(k);while(p<=l)o[o.length]=c(p,h),p=new Date(p.setMinutes(p.getMinutes()+h.step));var q=a(''),r=a("
");for(var s=0;s"+o[s]+"");q.append(r),q.appendTo("body").hide(),q.mouseover(function(){i=!0}).mouseout(function(){i=!1}),a("li",r).mouseover(function(){j||(a(n,q).removeClass(m),a(this).addClass(m))}).mousedown(function(){i=!0}).click(function(){b(d,this,q,h),i=!1});var t=function(){if(q.is(":visible"))return!1;a("li",q).removeClass(m);var b=a(d).offset();q.css({top:b.top+d.offsetHeight,left:b.left}),q.show();var e=d.value?f(d.value,h):k,i=k.getHours()*60+k.getMinutes(),j=e.getHours()*60+e.getMinutes()-i,n=Math.round(j/h.step),o=g(new Date(0,0,0,0,n*h.step+i,0));o=kf+q[0].offsetHeight&&(q[0].scrollTop=f+i.offsetHeight)):(e.removeClass(m),i=a("li:first",r).addClass(m)[0],q[0].scrollTop=0);return!1;case 13:if(q.is(":visible")){var k=a(n,r)[0];b(d,k,q,h)}return!1;case 27:q.hide();return!1}return!0}),a(d).keyup(function(a){j=!1}),this.getTime=function(){return f(d.value,h)},this.setTime=function(b){d.value=c(e(b,h),h),a(d).change()}},a.fn.timePicker.defaults={step:30,startTime:new Date(0,0,0,0,0,0),endTime:new Date(0,0,0,23,30,0),separator:":",show24Hours:!0}})(jQuery)
\ No newline at end of file
diff --git a/includes/libraries/cmb2/package.json b/includes/libraries/cmb2/package.json
new file mode 100644
index 0000000..d26fcf7
--- /dev/null
+++ b/includes/libraries/cmb2/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "cmb",
+ "version": "1.1.3",
+ "description": "**Contributors**:",
+ "main": "Gruntfile.js",
+ "directories": {
+ "test": "tests"
+ },
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress"
+ },
+ "author": "WebDevStudios",
+ "license": "GPLv2",
+ "bugs": {
+ "url": "https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues"
+ },
+ "homepage": "https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress",
+ "devDependencies": {
+ "grunt-phpunit": "~0.3.3",
+ "grunt": "~0.4.4",
+ "grunt-githooks": "~0.3.1",
+ "grunt-contrib-jshint": "~0.10.0",
+ "grunt-contrib-uglify": "~0.4.0",
+ "grunt-contrib-cssmin": "~0.9.0",
+ "grunt-contrib-watch": "~0.6.1",
+ "grunt-contrib-sass": "~0.7.3",
+ "grunt-csscomb": "~3.0.0-1",
+ "grunt-combine-media-queries": "~1.0.15",
+ "load-grunt-tasks": "~0.5.0",
+ "grunt-update-submodules": "~0.4.1",
+ "grunt-asciify": "~0.2.2"
+ }
+}
diff --git a/includes/libraries/cmb2/phpunit.xml b/includes/libraries/cmb2/phpunit.xml
new file mode 100644
index 0000000..e2c5507
--- /dev/null
+++ b/includes/libraries/cmb2/phpunit.xml
@@ -0,0 +1,15 @@
+
+
+
+ ./tests/
+
+
+
diff --git a/includes/libraries/cmb2/readme.md b/includes/libraries/cmb2/readme.md
new file mode 100644
index 0000000..3e9a72e
--- /dev/null
+++ b/includes/libraries/cmb2/readme.md
@@ -0,0 +1,353 @@
+# CMB 2.0 (beta) [![Build Status](https://travis-ci.org/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress.svg?branch=trunk)](https://travis-ci.org/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress)
+
+**Maintainers**:
+
+* [WebDevStudios](https://https://github.com/WebDevStudios/) // [http://webdevstudios.com](http://webdevstudios.com/)
+* [Justin Sternberg](https://github.com/jtsternberg) // [http://dsgnwrks.pro](http://dsgnwrks.pro/)
+
+**Contributors**:
+
+* [Jared Atchison](https://github.com/jaredatch) // [http://www.jaredatchison.com](http://www.jaredatchison.com/)
+* [Bill Erickson](https://github.com/billerickson) // [http://www.billerickson.net](http://www.billerickson.net/)
+* [Andrew Norcross](https://github.com/norcross) // [http://reaktivstudios.com](http://reaktivstudios.com/)
+* [Gary Jones](https://github.com/GaryJones) // [http://gamajo.com](http://gamajo.com/)
+* [Simon Fransson](https://github.com/dessibelle) // [http://dessibelle.se](http://dessibelle.se/)
+* [Leon Francis Shelhamer](https://github.com/twoelevenjay) // [http://211j.com](http://211j.com/)
+* [senicar](https://github.com/senicar)
+* [Scrent](https://github.com/Scrent)
+* [Patrick Forringer](https://github.com/destos) // [http://patrick.forringer.com](http://patrick.forringer.com/)
+* [Brad Parbs](https://github.com/bradp) // [http://bradparbs.com](http://bradparbs.com/)
+* [Greg Rickaby](https://github.com/gregrickaby) // [http://gregrickaby.com](http://gregrickaby.com/)
+* [ArchCarrier](https://github.com/ArchCarrier)
+* [Devin Walker](https://github.com/DevinWalker) // [http://wordimpress.com](http://wordimpress.com/)
+* [Randy Hoyt](https://github.com/randyhoyt) // [http://randyhoyt.com](http://randyhoyt.com/)
+* [Doug Stewart](https://github.com/zamoose) // [http://literalbarrage.org/blog](http://literalbarrage.org/blog/)
+* [Igor Jerosimić](https://github.com/IgorCode) // [http://igor.jerosimic.net](http://igor.jerosimic.net/)
+* [Joe Hoyle](https://github.com/joehoyle) // [http://www.joehoyle.co.uk](http://www.joehoyle.co.uk/)
+* [Tom Rhodes](https://github.com/tommusrhodus) // [http://www.madeinebor.com](http://www.madeinebor.com/)
+* [David O'Trakoun](https://github.com/davidosomething) // [http://davidosomething.com](http://davidosomething.com/)
+* [Phil Wylie](https://github.com/mustardBees) // [http://www.philwylie.co.uk](http://www.philwylie.co.uk/)
+* [Lisa Sabin-Wilson](https://github.com/lswilson) // [http://webdevstudios.com](http://webdevstudios.com/)
+* [Darlan ten Caten](https://github.com/darlantc) // [http://i9solucoesdigitais.com.br](http://i9solucoesdigitais.com.br/)
+* [Jan Willem](https://github.com/veelen)
+* [Luiz Henrique Almeida da Silva](https://github.com/luizhrqas) // [http://henriquealmeida.net](http://henriquealmeida.net/)
+* [TweetPJulien MauryressFr](https://github.com/TweetPressFr) // [http://tweetpressfr.github.io](http://tweetpressfr.github.io/)
+* [Gustave F. Gerhardt](https://github.com/GhostToast) // [http://ghosttoa.st](http://ghosttoa.st/)
+* [greenbrook](https://github.com/greenbrook)
+* [stellageo](https://github.com/stellageo)
+* [Patrick Garman](https://github.com/pmgarman) // [http://pmgarman.me](http://pmgarman.me/)
+* [Travis Smith](https://github.com/wpsmith) // [http://wpsmith.net](http://wpsmith.net/)
+* [Scott](https://github.com/CivicImages) // [http://scottkobewka.com](http://scottkobewka.com/)
+* [Emanuele Feliziani](https://github.com/GioSensation) // [http://gravida.pro](http://gravida.pro/)
+* [Cor van Noorloos](https://github.com/corvannoorloos) // [http://corvannoorloos.com](http://corvannoorloos.com/)
+
+**Version**: 2.0.0-beta
+**WordPress minimum version**: 3.5
+**WordPress version tested to**: 4.0
+**License**: GPLv2
+
+## Description
+
+Custom Metaboxes and Fields (CMB for short) will create metaboxes and forms with custom fields that will blow your mind.
+
+**Version 2.0 is in beta and is a complete rewrite. Much of the documentation available is inaccurate. Please follow the examples in `example-functions.php` and if you need assistance with beta-testing, please [ping me](http://twitter.com/jtsternberg). 2.0 WILL break previous versions and is not a drop-in replacement.**
+
+##### Notable Changes in 2.0
+**Change 1:** Hooks/filters work nearly the same (if not the same), but you'll be required to use the `cmb2_` instead of the original `cmb_`. This includes the main filter for adding metaboxes, `'cmb2_meta_boxes'`. The `cmb2_render{$custom_field_type}` action no longer passes the unescaped value as the first parameter.
+
+**Change 2:** The [old method for including the CMB core files](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/blob/master/example-functions.php#L406-L415) is no longer applicable and you're simply required to [include it directly](https://github.com/WebDevStudios/CMB2/blob/master/example-functions.php#L14).
+
+**Change 3:** The `'pages'` metabox parameter has been changed to `'object_types'` to more accurately reflect its purpose.
+
+##### Features:
+
+* Create metaboxes to be used on post edit screens.
+* Create forms to be used on options pages.
+* Create forms to handle user meta and display them on user profile add/edit pages.
+* Flexible API that allows you to use CMB forms almost anywhere, even on the front-end.
+* Several field types are included and are [listed below](#field-types).
+* Custom API hook that allows you to create your own field types.
+* There are numerous hooks and filters, allowing you to modify many aspects of the library (without editing it directly).
+* Repeatable fields for most field types are supported, as well as repeatable field groups.
+
+##### Field Types:
+1. [`title`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#title) An arbitrary title field *
+1. [`text`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text)
+1. [`text_small`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_small)
+1. [`text_medium`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_medium)
+1. [`text_email`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_email)
+1. [`text_url`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_url)
+1. [`text_money`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_money)
+1. [`textarea`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#textarea)
+1. [`textarea_small`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#textarea_small)
+1. [`textarea_code`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#textarea_code)
+1. [`text_date`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_date) Date Picker
+1. [`text_time`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_time) Time picker
+1. [`select_timezone`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#select_timezone) Time zone dropdown
+1. [`text_date_timestamp`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_date_timestamp) Date Picker (UNIX timestamp)
+1. [`text_datetime_timestamp`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_datetime_timestamp) Test Date/Time Picker Combo (UNIX timestamp)
+1. [`text_datetime_timestamp_timezone`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#text_datetime_timestamp_timezone) Test Date/Time Picker/Time zone Combo (serialized DateTime object)
+1. [`colorpicker`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#colorpicker) Color picker
+1. [`radio`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#radio) *
+1. [`radio_inline`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#radio_inline) *
+1. [`taxonomy_radio`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#taxonomy_radio) *
+1. [`taxonomy_radio_inline`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#taxonomy_radio_inline) *
+1. [`select`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#select)
+1. [`taxonomy_select`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#taxonomy_select) *
+1. [`checkbox`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#checkbox) *
+1. [`multicheck`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#multicheck)
+1. [`taxonomy_multicheck`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#taxonomy_multicheck) *
+1. [`taxonomy_multicheck_inline`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#taxonomy_multicheck_inline)
+1. [`wysiwyg`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#wysiwyg) (TinyMCE) *
+1. [`file`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#file) Image/File upload *†
+1. [`file_list`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#file_list) Image/File list upload
+1. [`oembed`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#oembed) Converts oembed urls (instagram, twitter, youtube, etc. [oEmbed in the Codex](https://codex.wordpress.org/Embeds))
+1. [`group`](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#group) Hybrid field that supports adding other fields as a repeatable group. *
+1. [Create your own custom field type](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#Custom)
+
+\* Not available as a repeatable field
+† Use `file_list` for repeatable
+
+[More on field types (GitHub wiki)](https://github.com/webdevstudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types)
+
+##### 3rd Party Resources
+* [CMB Attached Posts Field](https://github.com/coreymcollins/cmb-attached-posts) from [coreymcollins](https://github.com/coreymcollins): Custom field type for attaching posts to a page.
+* [CMB Field Type: Google Maps](https://github.com/mustardBees/cmb_field_map) from [mustardBees](https://github.com/mustardBees): Custom field type for Google Maps.
+ > The `pw_map` field stores the latitude/longitude values which you can then use to display a map in your theme.
+* [CMB Field Type: Select2](https://github.com/mustardBees/cmb-field-select2) from [mustardBees](https://github.com/mustardBees): Custom field types which use the [Select2](http://ivaynberg.github.io/select2/) script:
+
+ > 1. The `pw_select field` acts much like the default select field. However, it adds typeahead-style search allowing you to quickly make a selection from a large list
+ > 2. The `pw_multiselect` field allows you to select multiple values with typeahead-style search. The values can be dragged and dropped to reorder
+* [Taxonomy_MetaData](https://github.com/jtsternberg/Taxonomy_MetaData#to-use-taxonomy_metadata-with-custom-metaboxes-and-fields): WordPress Helper Class for saving pseudo-metadata for taxonomy terms. Includes an extended class for using CMB to generate the actual form fields.
+
+* [CMB Field Type: Gallery](https://github.com/mustardBees/cmb-field-gallery) from [mustardBees](https://github.com/mustardBees): Adds a WordPress gallery field.
+
+##### Contribution
+All contributions welcome. If you would like to submit a pull request, please check out the [trunk branch](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/tree/trunk) and pull request against it.
+
+##### Links
+* [Github project page](https://github.com/webdevstudios/Custom-Metaboxes-and-Fields-for-WordPress)
+* [Documentation (GitHub wiki)](https://github.com/webdevstudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki)
+
+
+## Installation
+
+1. Place the CMB directory inside of your theme or plugin.
+2. Copy (and rename if desired) `example-functions.php` into a folder *above* the CMB directory OR copy the entirety of its contents to your theme's `functions.php` file.
+2. Edit to only include the fields you need and rename the functions (CMB directory should be left unedited in order to easily update the library).
+4. Profit.
+
+## Changelog
+
+### 1.3.0
+
+**Enhancements**
+
+* Localize Date, Time, and Color picker defaults so that they can be overridden via the `cmb_localized_data` filter. ([#528](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/528))
+* Change third parameter for 'cmb_metabox_form' to be an args array. Optional arguments include `echo`, `form_format`, and `save_button`.
+* Add support for `show_option_none` argument for `taxonomy_select` and `taxonomy_radio` field types. Also adds the following filters: `cmb_all_or_nothing_types`, `cmb_taxonomy_select_default_value`, `cmb_taxonomy_select_{$this->_id()}_default_value`, `cmb_taxonomy_radio_{$this->_id()}_default_value`, `cmb_taxonomy_radio_default_value`. Props [@pmgarman](https://github.com/pmgarman), ([#569](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/569)).
+* Make the list items in the `file_list` field type drag & drop sortable. Props [twoelevenjay](https://github.com/twoelevenjay), ([#603](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/603)).
+
+**Bug Fixes**
+
+* Fixed typo in closing `` tag. Props [@CivicImages](https://github.com/CivicImages). ([#616](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/616))
+
+### 1.2.0
+
+**Enhancements**
+
+* Add support for custom date/time formats. Props [@Scrent](https://github.com/Scrent). ([#506](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/506))
+* Simplify `wysiwyg` escaping and allow it to be overridden via the `escape_cb` parameter. ([#491](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/491))
+* Add a 'Select/Deselect all' button for the `multicheck` field type.
+* Add title option for [repeatable groups](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#group). Title field takes an optional replacement hash, "{#}" that will be replaced by the row number.
+* New field parameter, `show_on_cb`, allows you to conditionally display a field via a callback. ([#47](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/47))
+* Unit testing (the beginning). Props [@brichards](https://github.com/brichards) and [@camdensegal](https://github.com/camdensegal).
+
+**Bug Fixes**
+
+* Fixed issue where remove file button wouldn't clear the url field. ([#514](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/514))
+* `wysiwyg` fields now allow underscores. Fixes some wysiwyg display issues in WordPress 3.8. Props [@lswilson](https://github.com/lswilson). ([#491](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/491))
+* Nonce field should only be added once per page. ([#521](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/521))
+* Fix `in_array` issue when a post does not have any saved terms for a taxonomy multicheck. ([#527](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/527))
+* Fixed error: 'Uninitialized string offset: 0 in cmb_Meta_Box_field.php...`. Props [@DevinWalker](https://github.com/DevinWalker). ([#539](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/539), [#549](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/549)))
+* Fix missing `file` field description. ([#543](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/543), [#547](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/547))
+
+
+
+### 1.1.3
+**Bug Fixes**
+
+* Update `cmb_get_field_value` function as it was passing the parameters to `cmb_get_field` in the wrong order.
+* Fix repeating fields not working correctly if meta key or prefix contained an integer. ([#503](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/503))
+
+### 1.1.2
+
+**Bug Fixes**
+
+* Fix issue with `cmb_Meta_Box_types.php` calling a missing method, `image_id_from_url`. ([#502](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/502))
+
+
+### 1.1.1
+
+**Bug Fixes**
+
+* Radio button values were not showing saved value. ([#500](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/500))
+
+### 1.1.0
+
+**Enhancements**
+
+* [Repeatable groups](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#group)
+* Support for more fields to be repeatable, including oEmbed field, and date, time, and color picker fields, etc.
+* Codebase has been revamped to be more modular and object-oriented.
+* New filter, `"cmb_{$element}_attributes" ` for modifying an element's attributes.
+* Every field now supports an `attributes` parameter that takes an array of attributes. [Read more](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#attributes).
+* Removed `cmb_std_filter` in favor of `cmb_default_filter`. **THIS IS A BREAKING CHANGE**
+* Better handling of labels in sidebar. They are now placed on top of the input rather than adjacent.
+* Added i18n compatibility to text_money. props [@ArchCarrier](https://github.com/ArchCarrier), ([#485](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/485))
+* New helper functions: `cmb_get_field` and `cmb_get_field_value` for getting access to CMB's field object and/or value.
+* New JavaScript events, `cmb_add_row` and `cmb_remove_row` for hooking in and manipulating the new row's data.
+* New filter, `cmb_localized_data`, for modifiying localized data passed to the CMB JS.
+
+**Bug Fixes**
+* Resolved occasional issue where only the first character of the label/value was diplayed. props [@mustardBees](https://github.com/mustardBees), ([#486](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/486))
+
+
+### 1.0.2
+
+**Enhancements**
+
+* Change the way the `'cmb_validate_{$field['type']}'` filter works.
+It is now passed a null value vs saved value. If null is returned, default sanitization will follow. **THIS IS A BREAKING CHANGE**. If you're already using this filter, take note.
+* All field types that take an option array have been simplified to take `key => value` pairs (vs `array( 'name' => 'value', 'value' => 'key', )`). This effects the 'select', 'radio', 'radio_inline' field types. The 'multicheck' field type was already using the `key => value` format. Backwards compatibility has been maintained for those using the older style.
+* Added default value option for `taxonomy_select` field type. props [@darlantc](https://github.com/darlantc), ([#473](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/473))
+* Added `preview_size` parameter for `file_list` field type. props [@IgorCode](https://github.com/IgorCode), ([#471](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/471))
+* Updated `file_list` images to be displayed horizontally instead of vertically. props [@IgorCode](https://github.com/IgorCode), ([#467](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/467))
+* Use `get_the_terms` where possible since the data is cached.
+
+**Bug Fixes**
+
+* Fixed wysiwyg escaping slashes. props [@gregrickaby](https://github.com/gregrickaby), ([#465](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/465))
+* Replaced `__DIR__`, as `dirname( __FILE__ )` is easier to maintain back-compatibility.
+* Fixed missing table styling on new posts. props [@mustardBees](https://github.com/mustardBees), ([#438](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/438))
+* Fix undeclared JS variable. [@veelen](https://github.com/veelen), ([#451](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/451))
+* Fix `file_list` errors when removing all files and saving.
+* Set correct `object_id` to be used later in `cmb_show_on` filter. [@lauravaq](https://github.com/lauravaq), ([#445](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/445))
+* Fix sanitization recursion memeory issues.
+
+### 1.0.1
+
+**Enhancements**
+
+* Now works with option pages and site settings. ([view example in wiki](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Using-CMB-to-create-an-Admin-Theme-Options-Page))
+* two filters to override the setting and getting of options, `cmb_override_option_get_$option_key` and `cmb_override_option_save_$option_key` respectively. Handy for using plugins like [WP Large Options](https://github.com/voceconnect/wp-large-options/) ([also here](http://vip.wordpress.com/plugins/wp-large-options/)).
+* Improved styling on taxonomy (\*tease\*) and options pages and for new 3.8 admin UI.
+* New sanitization class to sanitize data when saved.
+* New callback field parameter, `sanitization_cb`, for performing your own sanitization.
+* new `cmb_Meta_Box_types::esc()` method that handles escaping data for display.
+* New callback field parameter, `escape_cb`, for performing your own data escaping, as well as a new filter, `'cmb_types_esc_'. $field['type']`.
+
+**Bug Fixes**
+
+* Fixed wysiwyg editor button padding. props [@corvannoorloos](https://github.com/corvannoorloos), ([#391](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/pull/391))
+* A few php < 5.3 errors were addressed.
+* Fields with quotation marks no longer break the input/textarea fields.
+* metaboxes for Attachment pages now save correctly. Thanks [@nciske](https://github.com/nciske) for reporting. ([#412](https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/issues/412))
+* Occasionally fields wouldn't save because of the admin show_on filter.
+* Smaller images loaded to the file field type will no longer be blown up larger than their dimensions.
+
+### 1.0.0
+* Added `text_datetime_timestamp_timezone` type, a datetime combo field with an additional timezone drop down, props [@dessibelle](https://github.com/dessibelle)
+* Added `select_timezone` type, a standalone time zone select dropdown. The time zone select can be used with standalone `text_datetime_timestamp` if desired. Props [@dessibelle](https://github.com/dessibelle)
+* Added `text_url` type, a basic url field. Props [@dessibelle](https://github.com/dessibelle)
+* Added `text_email` type, a basic email field. Props [@dessibelle](https://github.com/dessibelle)
+* Added ability to display metabox fields in frontend. Default is true, but can be overriden using the `cmb_allow_frontend filter`. If set to true, an entire metabox form can be output with the `cmb_metabox_form( $meta_box, $object_id, $echo )` function. Props [@dessibelle](https://github.com/dessibelle), [@messenlehner](https://github.com/messenlehner) & [@jtsternberg](https://github.com/jtsternberg).
+* Added hook `cmb_after_table` after all metabox output. Props [@wpsmith](https://github.com/wpsmith)
+* `file_list` now works like a repeatable field. Add as many files as you want. Props [@coreymcollins](https://github.com/coreymcollins)
+* `text`, `text_small`, `text_medium`, `text_url`, `text_email`, & `text_money` fields now all have the option to be repeatable. Props [@jtsternberg](https://github.com/jtsternberg)
+* Custom metaboxes can now be added for user meta. Add them on the user add/edit screen, or in a custom user profile edit page on the front-end. Props [@tw2113](https://github.com/tw2113), [@jtsternberg](https://github.com/jtsternberg)
+
+### 0.9.4
+* Added field "before" and "after" options for each field. Solves issue with '$' not being the desired text_money monetary symbol, props [@GaryJones](https://github.com/GaryJones)
+* Added filter for 'std' default fallback value, props [@messenlehner](https://github.com/messenlehner)
+* Ensure oEmbed videos fit in their respective metaboxes, props [@jtsternberg](https://github.com/jtsternberg)
+* Fixed issue where an upload field with 'show_names' disabled wouldn't have the correct button label, props [@jtsternberg](https://github.com/jtsternberg)
+* Better file-extension check for images, props [@GhostToast](https://github.com/GhostToast)
+* New filter, `cmb_valid_img_types`, for whitelisted image file-extensions, props [@jtsternberg](https://github.com/jtsternberg)
+
+### 0.9.3
+* Added field type and field id classes to each cmb table row, props [@jtsternberg](https://github.com/jtsternberg)
+
+### 0.9.2
+* Added post type comparison to prevent storing null values for taxonomy selectors, props [@norcross](https://github.com/norcross)
+
+### 0.9.1
+* Added `oEmbed` field type with ajax display, props [@jtsternberg](https://github.com/jtsternberg)
+
+### 0.9
+* __Note: This release requires WordPress 3.3+__
+* Cleaned up scripts being queued, props [@jaredatch](https://github.com/jaredatch)
+* Cleaned up and reorganized jQuery, props [@GaryJones](https://github.com/GaryJones)
+* Use $pagenow instead of custom $current_page, props [@jaredatch](https://github.com/jaredatch)
+* Fixed CSS, removed inline styles, now all in style.css, props [@jaredatch](https://github.com/jaredatch)
+* Fixed multicheck issues (issue #48), props [@jaredatch](https://github.com/jaredatch)
+* Fixed jQuery UI datepicker CSS conflicting with WordPress UI elements, props [@jaredatch](https://github.com/jaredatch)
+* Fixed zeros not saving in fields, props [@GaryJones](https://github.com/GaryJones)
+* Fixed improper labels on radio and multicheck fields, props [@jaredatch](https://github.com/jaredatch)
+* Fixed fields not rendering properly when in sidebar, props [@jaredatch](https://github.com/jaredatch)
+* Fixed bug where datepicker triggers extra space after footer in Firefox (issue #14), props [@jaredatch](https://github.com/jaredatch)
+* Added jQuery UI datepicker packaged with 3.3 core, props [@jaredatch](https://github.com/jaredatch)
+* Added date time combo picker, props [@jaredatch](https://github.com/jaredatch)
+* Added color picker, props [@jaredatch](https://github.com/jaredatch)
+* Added readme.md markdown file, props [@jaredatch](https://github.com/jaredatch)
+
+### 0.8
+* Added jQuery timepicker, props [@norcross](https://github.com/norcross)
+* Added 'raw' textarea to convert special HTML entities back to characters, props [@norcross](https://github.com/norcross)
+* Added missing examples on example-functions.php, props [@norcross](https://github.com/norcross)
+
+### 0.7
+* Added the new wp_editor() function for the WYSIWYG dialog box, props [@jcpry](https://github.com/jcpry)
+* Created 'cmb_show_on' filter to define your own Show On Filters, props [@billerickson](https://github.com/billerickson)
+* Added page template show_on filter, props [@billerickson](https://github.com/billerickson)
+* Improvements to the 'file' field type, props [@randyhoyt](https://github.com/randyhoyt)
+* Allow for default values on 'radio' and 'radio_inline' field types, props [@billerickson](https://github.com/billerickson)
+
+### 0.6.1
+* Enabled the ability to define your own custom field types (issue #28). props [@randyhoyt](https://github.com/randyhoyt)
+
+### 0.6
+* Added the ability to limit metaboxes to certain posts by id. props [@billerickson](https://github.com/billerickson)
+
+### 0.5
+* Fixed define to prevent notices. props [@destos](https://github.com/destos)
+* Added text_date_timestap option. props [@andrewyno](https://github.com/andrewyno)
+* Fixed WYSIWYG paragraph breaking/spacing bug. props [@wpsmith](https://github.com/wpsmith)
+* Added taxonomy_radio and taxonomies_select options. props [@c3mdigital](https://github.com/c3mdigital)
+* Fixed script causing the dashboard widgets to not be collapsible.
+* Fixed various spacing and whitespace inconsistencies
+
+### 0.4
+* Think we have a release that is mostly working. We'll say the initial release :)
+
+## Known Issues
+
+* Problem inserting file url inside field for image with caption (issue #50) May be fixed, needs testing.
+* `CMB_META_BOX_URL` does not define properly in WAMP/XAMP (Windows) (issue #31) May be fixed, needs testing.
+* Metabox containing WYSIWYG editor cannot be moved (this is a TinyMCE issue)
+
+## To-do
+**Enhancements**
+
+* Fix known issues (above)
+* move timepicker and datepicker jQuery inline
+* support for multiple configurable timepickers/datepickers
+* add ability to save fields in a single custom field
+* add ability to mark fields as required
+* repeatable fields (halfway there)
+* look at possiblity of tabs
+* look at preserving taxonomy hierarchies
+* Add input attributes filter
+* Always load newest version of CMB
+* Helper function to easily get oembed from stored oEmbed field
+
diff --git a/includes/libraries/cmb2/tests/README.md b/includes/libraries/cmb2/tests/README.md
new file mode 100644
index 0000000..820011e
--- /dev/null
+++ b/includes/libraries/cmb2/tests/README.md
@@ -0,0 +1,56 @@
+# CMB Test Suite [![Build Status](https://travis-ci.org/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress.svg?branch=trunk)](https://travis-ci.org/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress)
+
+The CMB Test Suite uses PHPUnit to help us maintain the best possible code quality.
+
+Travis-CI Automated Testing
+-----------------------------
+
+The master branch of CMB is automatically tested on [travis-ci.org](http://travis-ci.org). The image above will show you the latest test's output. Travis-CI will also automatically test all new Pull Requests to make sure they will not break our build.
+
+Quick Start (For Manual Runs)
+-----------------------------
+
+### 1. Clone this repository
+```bash
+git clone git://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress.git ./
+```
+
+### 2. [Install PHPUnit](https://github.com/sebastianbergmann/phpunit#installation)
+This might be tricky. We recommend using [homebrew](http://brew.sh/) because it lets you install lots of things very easily.
+
+If you use homebrew, you can just run `brew install phpunit`.
+
+### 3. Initialize local testing environment
+If you haven't already installed the WordPress testing library, we have a helpful script to do so for you.
+
+Note: you'll need to already have `svn`, `wget`, and `mysql` available.
+
+Change to the CMB directory:
+```bash
+cd Custom-Metaboxes-and-Fields-for-WordPress
+```
+
+```bash
+bash tests/bin/install-wp-tests.sh wordpress_test root '' localhost latest
+```
+* `wordpress_test` is the name of the test database (**all data will be deleted!**)
+* `root` is the MySQL user name
+* `''` is the MySQL user password
+* `localhost` is the MySQL server host
+* `latest` is the WordPress version; could also be `3.7`, `3.6.2` etc.
+
+### 4. Run the tests manually
+Note: MySQL must be running in order for tests to run.
+```bash
+phpunit
+```
+
+### 5. Bonus Round: Run tests automatically before each commit
+All you need to do is run these two commands, and then priort to accepting any commit grunt will run phpunit.
+If a test fails, the commit will be rejected, giving you the opportunity to fix the problem first.
+
+```bash
+npm install
+grunt githooks
+```
+**Note:** You'll need to install [npm](https://www.npmjs.org/) if that's not available. You could also install this via [homebrew](http://brew.sh/) using `brew install npm`.
diff --git a/includes/libraries/cmb2/tests/bin/install-wp-tests.sh b/includes/libraries/cmb2/tests/bin/install-wp-tests.sh
new file mode 100644
index 0000000..1e39064
--- /dev/null
+++ b/includes/libraries/cmb2/tests/bin/install-wp-tests.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+if [ $# -lt 3 ]; then
+ echo "usage: $0 [db-host] [wp-version]"
+ exit 1
+fi
+
+DB_NAME=$1
+DB_USER=$2
+DB_PASS=$3
+DB_HOST=${4-localhost}
+WP_VERSION=${5-latest}
+
+WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
+WP_CORE_DIR=/tmp/wordpress/
+
+set -ex
+
+install_wp() {
+ mkdir -p $WP_CORE_DIR
+
+ if [ $WP_VERSION == 'latest' ]; then
+ local ARCHIVE_NAME='latest'
+ else
+ local ARCHIVE_NAME="wordpress-$WP_VERSION"
+ fi
+
+ wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz
+ tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
+
+ wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php
+}
+
+install_test_suite() {
+ # portable in-place argument for both GNU sed and Mac OSX sed
+ if [[ $(uname -s) == 'Darwin' ]]; then
+ local ioption='-i .bak'
+ else
+ local ioption='-i'
+ fi
+
+ # set up testing suite
+ mkdir -p $WP_TESTS_DIR
+ cd $WP_TESTS_DIR
+ svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
+
+ wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
+ sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php
+ sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php
+ sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php
+ sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php
+ sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php
+}
+
+install_db() {
+ # parse DB_HOST for port or socket references
+ local PARTS=(${DB_HOST//\:/ })
+ local DB_HOSTNAME=${PARTS[0]};
+ local DB_SOCK_OR_PORT=${PARTS[1]};
+ local EXTRA=""
+
+ if ! [ -z $DB_HOSTNAME ] ; then
+ if [[ "$DB_SOCK_OR_PORT" =~ ^[0-9]+$ ]] ; then
+ EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
+ elif ! [ -z $DB_SOCK_OR_PORT ] ; then
+ EXTRA=" --socket=$DB_SOCK_OR_PORT"
+ elif ! [ -z $DB_HOSTNAME ] ; then
+ EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
+ fi
+ fi
+
+ # create database
+ mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
+}
+
+install_wp
+install_test_suite
+install_db
diff --git a/includes/libraries/cmb2/tests/bootstrap.php b/includes/libraries/cmb2/tests/bootstrap.php
new file mode 100644
index 0000000..3e45d91
--- /dev/null
+++ b/includes/libraries/cmb2/tests/bootstrap.php
@@ -0,0 +1,14 @@
+cmb_id = 'test';
+ $this->metabox_array = array(
+ 'id' => $this->cmb_id,
+ 'fields' => array(
+ array(
+ 'name' => 'Name',
+ 'id' => 'test_test',
+ 'type' => 'text',
+ ),
+ ),
+ );
+
+ $this->metabox_array2 = array(
+ 'id' => 'test2',
+ 'fields' => array(
+ array(
+ 'name' => 'Name',
+ 'id' => 'test_test',
+ 'type' => 'text',
+ ),
+ ),
+ );
+
+ $this->option_metabox_array = array(
+ 'id' => 'options_page',
+ 'title' => 'Theme Options Metabox',
+ 'show_on' => array( 'key' => 'options-page', 'value' => array( 'theme_options', ), ),
+ 'fields' => array(
+ array(
+ 'name' => 'Site Background Color',
+ 'desc' => 'field description (optional)',
+ 'id' => 'bg_color',
+ 'type' => 'colorpicker',
+ 'default' => '#ffffff'
+ ),
+ )
+ );
+
+ $this->defaults = array(
+ 'id' => $this->cmb_id,
+ 'title' => false,
+ 'type' => false,
+ 'object_types' => array(),
+ 'context' => 'normal',
+ 'priority' => 'high',
+ 'show_names' => 1,
+ 'cmb_styles' => 1,
+ 'fields' => array(),
+ 'hookup' => 1,
+ 'new_user_section' => 'add-new-user',
+ 'show_on' => array(
+ 'key' => false,
+ 'value' => false,
+ ),
+ );
+
+ $this->cmb = new CMB2( $this->metabox_array );
+
+ $this->options_cmb = new CMB2( $this->option_metabox_array );
+
+ $this->opt_set = array(
+ 'bg_color' => '#ffffff',
+ 'my_name' => 'Justin',
+ );
+ add_option( $this->options_cmb->cmb_id, $this->opt_set );
+
+ $this->post_id = $this->factory->post->create();
+ }
+
+ public function test_cmb2_has_version_number() {
+ $this->assertTrue( defined( 'CMB2_VERSION' ) );
+ }
+
+ /**
+ * @expectedException WPDieException
+ */
+ public function test_cmb2_die_with_no_id() {
+ $cmb = new CMB2( array() );
+ }
+
+ /**
+ * @expectedException Exception
+ */
+ public function test_set_metabox_after_offlimits() {
+ $this->cmb->metabox['title'] = 'title';
+ }
+
+ public function test_defaults_set() {
+ $cmb = new CMB2( array( 'id' => $this->cmb_id ) );
+ $this->assertEquals( $cmb->meta_box, $this->defaults );
+ }
+
+ public function test_url_set() {
+ $cmb2_url = str_replace(
+ array( WP_CONTENT_DIR, WP_PLUGIN_DIR ),
+ array( WP_CONTENT_URL, WP_PLUGIN_URL ),
+ cmb2_dir()
+ );
+
+ $this->assertEquals( cmb2_utils()->url(), $cmb2_url );
+ }
+
+ public function test_cmb2_get_metabox() {
+ // Test that successful retrieval by box ID
+ $retrieve = cmb2_get_metabox( $this->cmb_id );
+ $this->assertEquals( $this->cmb, $retrieve );
+
+ // Test that successful retrieval by box Array
+ $cmb = cmb2_get_metabox( $this->metabox_array );
+ $this->assertEquals( $this->cmb, $cmb );
+
+
+ // Test successful creation of new MB
+ $cmb1 = cmb2_get_metabox( $this->metabox_array2 );
+ $cmb2 = new CMB2( $this->metabox_array2 );
+ $this->assertEquals( $cmb1, $cmb2 );
+ }
+
+ public function test_cmb2_get_field() {
+ $val_to_save = '123Abc';
+ $field_id = 'test_test';
+ $retrieved = cmb2_get_field( $this->cmb_id, $field_id, $this->post_id );
+ $this->assertInstanceOf( 'CMB2_Field', $retrieved );
+ }
+
+ public function test_cmb2_get_field_value() {
+ $val_to_save = '123Abc';
+ $field_id = 'test_test';
+ $added = add_post_meta( $this->post_id, $field_id, $val_to_save );
+
+ $retrieved = cmb2_get_field_value( $this->cmb_id, $field_id, $this->post_id );
+
+ // Test retrieved value matches value we saved
+ $this->assertEquals( $val_to_save, $retrieved );
+
+ $get = get_post_meta( $this->post_id, $field_id, 1 );
+
+ // Test retrieved value matches normal WP retrieved value
+ $this->assertEquals( $get, $retrieved );
+ }
+
+ public function test_cmb2_print_metabox_form() {
+ $form = '
+
+ ';
+
+ $form_get = cmb2_get_metabox_form( $this->cmb_id, $this->post_id );
+
+ $this->assertEquals( $this->clean_string( $form_get ), $this->clean_string( $form ) );
+ }
+
+ public function test_cmb2_options() {
+ $opts = cmb2_options( $this->options_cmb->cmb_id );
+ $this->assertEquals( $opts->get_options(), $this->opt_set );
+
+ $get = get_option( $this->options_cmb->cmb_id );
+ $val = cmb2_get_option( $this->options_cmb->cmb_id, 'my_name' );
+
+ $this->assertEquals( $this->opt_set['my_name'], $get['my_name'] );
+ $this->assertEquals( $val, $get['my_name'] );
+ $this->assertEquals( $val, $this->opt_set['my_name'] );
+
+ }
+
+ public function test_class_getters() {
+ $this->assertInstanceOf( 'CMB2_Ajax', cmb2_ajax() );
+ $this->assertInstanceOf( 'CMB2_Utils', cmb2_utils() );
+ $this->assertInstanceOf( 'CMB2_Option', cmb2_options( 'test' ) );
+ }
+
+ public function clean_string( $string ) {
+ return trim( str_ireplace( array(
+ "\n", "\r", "\t", ' ', '> <',
+ ), array(
+ '', '', '', ' ', '><',
+ ), $string ) );
+ }
+
+}