Meta Box - Version 4.1.10

Version Description

  • Allow helper functions can be used in admin area
  • Allow cloned fields to have a uniquely indexed name attribute
  • Add Swedish translation
  • Allow hidden field has its own value
  • Taxonomy field now supported by rwmb_meta function
  • Improvement in code format and field normalizing
Download this release

Release Info

Developer rilwis
Plugin Icon 128x128 Meta Box
Version 4.1.10
Comparing to
See all releases

Version 4.1.10

Files changed (88) hide show
  1. css/color.css +7 -0
  2. css/image.css +31 -0
  3. css/jqueryui/jquery-ui-timepicker-addon.css +6 -0
  4. css/jqueryui/jquery.ui.core.css +38 -0
  5. css/jqueryui/jquery.ui.datepicker.css +68 -0
  6. css/jqueryui/jquery.ui.slider.css +24 -0
  7. css/jqueryui/jquery.ui.theme.css +249 -0
  8. css/plupload-image.css +36 -0
  9. css/select.css +3 -0
  10. css/style.css +83 -0
  11. css/taxonomy.css +11 -0
  12. css/wysiwyg.css +3 -0
  13. demo/all-custom-post-types.php +38 -0
  14. demo/better-include.php +119 -0
  15. demo/demo.php +295 -0
  16. demo/include-by-ID-or-page-template.php +85 -0
  17. img/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  18. img/jqueryui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  19. img/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  20. img/jqueryui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  21. img/jqueryui/ui-bg_glass_75_dadada_1x400.png +0 -0
  22. img/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  23. img/jqueryui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  24. img/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  25. img/jqueryui/ui-icons_222222_256x240.png +0 -0
  26. img/jqueryui/ui-icons_2e83ff_256x240.png +0 -0
  27. img/jqueryui/ui-icons_454545_256x240.png +0 -0
  28. img/jqueryui/ui-icons_888888_256x240.png +0 -0
  29. img/jqueryui/ui-icons_cd0a0a_256x240.png +0 -0
  30. img/loader.gif +0 -0
  31. inc/classes/meta-box.php +692 -0
  32. inc/common.php +41 -0
  33. inc/fields/checkbox-list.php +50 -0
  34. inc/fields/checkbox.php +46 -0
  35. inc/fields/color.php +45 -0
  36. inc/fields/date.php +62 -0
  37. inc/fields/datetime.php +65 -0
  38. inc/fields/file.php +195 -0
  39. inc/fields/hidden.php +42 -0
  40. inc/fields/image.php +158 -0
  41. inc/fields/number.php +47 -0
  42. inc/fields/password.php +28 -0
  43. inc/fields/plupload-image.php +201 -0
  44. inc/fields/radio.php +36 -0
  45. inc/fields/select.php +61 -0
  46. inc/fields/slider.php +50 -0
  47. inc/fields/taxonomy.php +258 -0
  48. inc/fields/text.php +43 -0
  49. inc/fields/textarea.php +44 -0
  50. inc/fields/thickbox-image.php +113 -0
  51. inc/fields/time.php +66 -0
  52. inc/fields/wysiwyg.php +82 -0
  53. inc/helpers.php +130 -0
  54. js/clone.js +130 -0
  55. js/color.js +33 -0
  56. js/date.js +24 -0
  57. js/datetime.js +29 -0
  58. js/file.js +38 -0
  59. js/image.js +30 -0
  60. js/jquery.validate.min.js +51 -0
  61. js/jqueryui/jquery-ui-timepicker-addon.js +71 -0
  62. js/jqueryui/jquery.ui.datepicker.min.js +13 -0
  63. js/jqueryui/jquery.ui.slider.min.js +14 -0
  64. js/plupload-image.js +170 -0
  65. js/slider.js +50 -0
  66. js/taxonomy.js +27 -0
  67. js/thickbox-image.js +34 -0
  68. js/time.js +29 -0
  69. js/validate.js +25 -0
  70. lang/de_DE.mo +0 -0
  71. lang/de_DE.po +141 -0
  72. lang/default.mo +0 -0
  73. lang/default.po +124 -0
  74. lang/it_IT.mo +0 -0
  75. lang/it_IT.po +126 -0
  76. lang/nb_NO.mo +0 -0
  77. lang/nb_NO.po +149 -0
  78. lang/pt_BR.mo +0 -0
  79. lang/pt_BR.po +124 -0
  80. lang/sv_SE.mo +0 -0
  81. lang/sv_SE.po +118 -0
  82. lang/vi.mo +0 -0
  83. lang/vi.po +131 -0
  84. meta-box.php +49 -0
  85. readme.md +211 -0
  86. readme.txt +210 -0
  87. screenshot-1.png +0 -0
  88. screenshot-2.png +0 -0
css/color.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ .rwmb-color-picker {
2
+ display: none; /* Hidden by default */
3
+ z-index: 100;
4
+ background: rgb(238, 238, 238);
5
+ border: 1px solid rgb(204, 204, 204);
6
+ position: absolute;
7
+ }
css/image.css ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Uploaded image */
2
+ .rwmb-images {
3
+ overflow: hidden;
4
+ }
5
+ .rwmb-images li {
6
+ margin: 0 10px 10px 0;
7
+ float: left;
8
+ width: 150px;
9
+ height: 150px;
10
+ text-align: center;
11
+ border: 3px solid #ccc;
12
+ cursor: move;
13
+ position: relative;
14
+ }
15
+ .rwmb-images img {
16
+ width: 150px;
17
+ height: 150px;
18
+ }
19
+ .rwmb-image-bar {
20
+ color: #fff;
21
+ font-weight: bold;
22
+ background: #000;
23
+ position: absolute;
24
+ bottom: 0;
25
+ right: 0;
26
+ padding: 5px;
27
+ }
28
+ .rwmb-image-bar a {
29
+ color: #fff;
30
+ font-weight: bold;
31
+ }
css/jqueryui/jquery-ui-timepicker-addon.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
2
+ .ui-timepicker-div dl { text-align: left; }
3
+ .ui-timepicker-div dl dt { height: 25px; }
4
+ .ui-timepicker-div dl dd { margin: -25px 10px 10px 65px; }
5
+ .ui-timepicker-div td { font-size: 90%; }
6
+ .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
css/jqueryui/jquery.ui.core.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI CSS Framework 1.8.17
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Theming/API
9
+ */
10
+
11
+ /* Layout helpers
12
+ ----------------------------------*/
13
+ .ui-helper-hidden { display: none; }
14
+ .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
15
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
16
+ .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
17
+ .ui-helper-clearfix:after { clear: both; }
18
+ .ui-helper-clearfix { zoom: 1; }
19
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
20
+
21
+
22
+ /* Interaction Cues
23
+ ----------------------------------*/
24
+ .ui-state-disabled { cursor: default !important; }
25
+
26
+
27
+ /* Icons
28
+ ----------------------------------*/
29
+
30
+ /* states and images */
31
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
32
+
33
+
34
+ /* Misc visuals
35
+ ----------------------------------*/
36
+
37
+ /* Overlays */
38
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
css/jqueryui/jquery.ui.datepicker.css ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Datepicker 1.8.17
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Datepicker#theming
9
+ */
10
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
11
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
12
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
13
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
14
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
15
+ .ui-datepicker .ui-datepicker-next { right:2px; }
16
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
17
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
18
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
19
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
20
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
21
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
22
+ .ui-datepicker select.ui-datepicker-month,
23
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
24
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
25
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
26
+ .ui-datepicker td { border: 0; padding: 1px; }
27
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
28
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
29
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
30
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
31
+
32
+ /* with multiple calendars */
33
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
34
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
35
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
36
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
37
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
38
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
39
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
40
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
41
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
42
+ .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
43
+
44
+ /* RTL support */
45
+ .ui-datepicker-rtl { direction: rtl; }
46
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
47
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
48
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
49
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
50
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
51
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
52
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
53
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
54
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
55
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
56
+
57
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
58
+ .ui-datepicker-cover {
59
+ display: none; /*sorry for IE5*/
60
+ display/**/: block; /*sorry for IE5*/
61
+ position: absolute; /*must have*/
62
+ z-index: -1; /*must have*/
63
+ filter: mask(); /*must have*/
64
+ top: -4px; /*must have*/
65
+ left: -4px; /*must have*/
66
+ width: 200px; /*must have*/
67
+ height: 200px; /*must have*/
68
+ }
css/jqueryui/jquery.ui.slider.css ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Slider 1.8.17
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Slider#theming
9
+ */
10
+ .ui-slider { position: relative; text-align: left; }
11
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
12
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
13
+
14
+ .ui-slider-horizontal { height: .8em; }
15
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
16
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
17
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
18
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
19
+
20
+ .ui-slider-vertical { width: .8em; height: 100px; }
21
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
22
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
23
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
24
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }
css/jqueryui/jquery.ui.theme.css ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ /*
4
+ * jQuery UI CSS Framework 1.8.17
5
+ *
6
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
7
+ * Dual licensed under the MIT or GPL Version 2 licenses.
8
+ * http://jquery.org/license
9
+ *
10
+ * http://docs.jquery.com/UI/Theming/API
11
+ *
12
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
13
+ */
14
+
15
+
16
+ /* Component containers
17
+ ----------------------------------*/
18
+ .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
19
+ .ui-widget .ui-widget { font-size: 1em; }
20
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
21
+ .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(../../img/jqueryui/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
22
+ .ui-widget-content a { color: #222222; }
23
+ .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(../../img/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
24
+ .ui-widget-header a { color: #222222; }
25
+
26
+ /* Interaction states
27
+ ----------------------------------*/
28
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(../../img/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
29
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
30
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(../../img/jqueryui/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
31
+ .ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
32
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(../../img/jqueryui/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
33
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
34
+ .ui-widget :active { outline: none; }
35
+
36
+ /* Interaction Cues
37
+ ----------------------------------*/
38
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(../../img/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
39
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
40
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(../../img/jqueryui/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
41
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
42
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
43
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
44
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
45
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
46
+
47
+ /* Icons
48
+ ----------------------------------*/
49
+
50
+ /* states and images */
51
+ .ui-icon { width: 16px; height: 16px; background-image: url(../../img/jqueryui/ui-icons_222222_256x240.png); }
52
+ .ui-widget-content .ui-icon {background-image: url(../../img/jqueryui/ui-icons_222222_256x240.png); }
53
+ .ui-widget-header .ui-icon {background-image: url(../../img/jqueryui/ui-icons_222222_256x240.png); }
54
+ .ui-state-default .ui-icon { background-image: url(../../img/jqueryui/ui-icons_888888_256x240.png); }
55
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(../../img/jqueryui/ui-icons_454545_256x240.png); }
56
+ .ui-state-active .ui-icon {background-image: url(../../img/jqueryui/ui-icons_454545_256x240.png); }
57
+ .ui-state-highlight .ui-icon {background-image: url(../../img/jqueryui/ui-icons_2e83ff_256x240.png); }
58
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(../../img/jqueryui/ui-icons_cd0a0a_256x240.png); }
59
+
60
+ /* positioning */
61
+ .ui-icon-carat-1-n { background-position: 0 0; }
62
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
63
+ .ui-icon-carat-1-e { background-position: -32px 0; }
64
+ .ui-icon-carat-1-se { background-position: -48px 0; }
65
+ .ui-icon-carat-1-s { background-position: -64px 0; }
66
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
67
+ .ui-icon-carat-1-w { background-position: -96px 0; }
68
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
69
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
70
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
71
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
72
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
73
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
74
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
75
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
76
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
77
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
78
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
79
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
80
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
81
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
82
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
83
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
84
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
85
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
86
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
87
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
88
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
89
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
90
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
91
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
92
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
93
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
94
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
95
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
96
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
97
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
98
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
99
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
100
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
101
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
102
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
103
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
104
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
105
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
106
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
107
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
108
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
109
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
110
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
111
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
112
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
113
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
114
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
115
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
116
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
117
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
118
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
119
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
120
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
121
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
122
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
123
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
124
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
125
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
126
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
127
+ .ui-icon-extlink { background-position: -32px -80px; }
128
+ .ui-icon-newwin { background-position: -48px -80px; }
129
+ .ui-icon-refresh { background-position: -64px -80px; }
130
+ .ui-icon-shuffle { background-position: -80px -80px; }
131
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
132
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
133
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
134
+ .ui-icon-folder-open { background-position: -16px -96px; }
135
+ .ui-icon-document { background-position: -32px -96px; }
136
+ .ui-icon-document-b { background-position: -48px -96px; }
137
+ .ui-icon-note { background-position: -64px -96px; }
138
+ .ui-icon-mail-closed { background-position: -80px -96px; }
139
+ .ui-icon-mail-open { background-position: -96px -96px; }
140
+ .ui-icon-suitcase { background-position: -112px -96px; }
141
+ .ui-icon-comment { background-position: -128px -96px; }
142
+ .ui-icon-person { background-position: -144px -96px; }
143
+ .ui-icon-print { background-position: -160px -96px; }
144
+ .ui-icon-trash { background-position: -176px -96px; }
145
+ .ui-icon-locked { background-position: -192px -96px; }
146
+ .ui-icon-unlocked { background-position: -208px -96px; }
147
+ .ui-icon-bookmark { background-position: -224px -96px; }
148
+ .ui-icon-tag { background-position: -240px -96px; }
149
+ .ui-icon-home { background-position: 0 -112px; }
150
+ .ui-icon-flag { background-position: -16px -112px; }
151
+ .ui-icon-calendar { background-position: -32px -112px; }
152
+ .ui-icon-cart { background-position: -48px -112px; }
153
+ .ui-icon-pencil { background-position: -64px -112px; }
154
+ .ui-icon-clock { background-position: -80px -112px; }
155
+ .ui-icon-disk { background-position: -96px -112px; }
156
+ .ui-icon-calculator { background-position: -112px -112px; }
157
+ .ui-icon-zoomin { background-position: -128px -112px; }
158
+ .ui-icon-zoomout { background-position: -144px -112px; }
159
+ .ui-icon-search { background-position: -160px -112px; }
160
+ .ui-icon-wrench { background-position: -176px -112px; }
161
+ .ui-icon-gear { background-position: -192px -112px; }
162
+ .ui-icon-heart { background-position: -208px -112px; }
163
+ .ui-icon-star { background-position: -224px -112px; }
164
+ .ui-icon-link { background-position: -240px -112px; }
165
+ .ui-icon-cancel { background-position: 0 -128px; }
166
+ .ui-icon-plus { background-position: -16px -128px; }
167
+ .ui-icon-plusthick { background-position: -32px -128px; }
168
+ .ui-icon-minus { background-position: -48px -128px; }
169
+ .ui-icon-minusthick { background-position: -64px -128px; }
170
+ .ui-icon-close { background-position: -80px -128px; }
171
+ .ui-icon-closethick { background-position: -96px -128px; }
172
+ .ui-icon-key { background-position: -112px -128px; }
173
+ .ui-icon-lightbulb { background-position: -128px -128px; }
174
+ .ui-icon-scissors { background-position: -144px -128px; }
175
+ .ui-icon-clipboard { background-position: -160px -128px; }
176
+ .ui-icon-copy { background-position: -176px -128px; }
177
+ .ui-icon-contact { background-position: -192px -128px; }
178
+ .ui-icon-image { background-position: -208px -128px; }
179
+ .ui-icon-video { background-position: -224px -128px; }
180
+ .ui-icon-script { background-position: -240px -128px; }
181
+ .ui-icon-alert { background-position: 0 -144px; }
182
+ .ui-icon-info { background-position: -16px -144px; }
183
+ .ui-icon-notice { background-position: -32px -144px; }
184
+ .ui-icon-help { background-position: -48px -144px; }
185
+ .ui-icon-check { background-position: -64px -144px; }
186
+ .ui-icon-bullet { background-position: -80px -144px; }
187
+ .ui-icon-radio-off { background-position: -96px -144px; }
188
+ .ui-icon-radio-on { background-position: -112px -144px; }
189
+ .ui-icon-pin-w { background-position: -128px -144px; }
190
+ .ui-icon-pin-s { background-position: -144px -144px; }
191
+ .ui-icon-play { background-position: 0 -160px; }
192
+ .ui-icon-pause { background-position: -16px -160px; }
193
+ .ui-icon-seek-next { background-position: -32px -160px; }
194
+ .ui-icon-seek-prev { background-position: -48px -160px; }
195
+ .ui-icon-seek-end { background-position: -64px -160px; }
196
+ .ui-icon-seek-start { background-position: -80px -160px; }
197
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
198
+ .ui-icon-seek-first { background-position: -80px -160px; }
199
+ .ui-icon-stop { background-position: -96px -160px; }
200
+ .ui-icon-eject { background-position: -112px -160px; }
201
+ .ui-icon-volume-off { background-position: -128px -160px; }
202
+ .ui-icon-volume-on { background-position: -144px -160px; }
203
+ .ui-icon-power { background-position: 0 -176px; }
204
+ .ui-icon-signal-diag { background-position: -16px -176px; }
205
+ .ui-icon-signal { background-position: -32px -176px; }
206
+ .ui-icon-battery-0 { background-position: -48px -176px; }
207
+ .ui-icon-battery-1 { background-position: -64px -176px; }
208
+ .ui-icon-battery-2 { background-position: -80px -176px; }
209
+ .ui-icon-battery-3 { background-position: -96px -176px; }
210
+ .ui-icon-circle-plus { background-position: 0 -192px; }
211
+ .ui-icon-circle-minus { background-position: -16px -192px; }
212
+ .ui-icon-circle-close { background-position: -32px -192px; }
213
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
214
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
215
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
216
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
217
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
218
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
219
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
220
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
221
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
222
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
223
+ .ui-icon-circle-check { background-position: -208px -192px; }
224
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
225
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
226
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
227
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
228
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
229
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
230
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
231
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
232
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
233
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
234
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
235
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
236
+
237
+
238
+ /* Misc visuals
239
+ ----------------------------------*/
240
+
241
+ /* Corner radius */
242
+ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
243
+ .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
244
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
245
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
246
+
247
+ /* Overlays */
248
+ .ui-widget-overlay { background: #aaaaaa url(../../img/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
249
+ .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(../../img/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
css/plupload-image.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.rwmb-drag-drop {
2
+ border: 4px dashed #ddd;
3
+ }
4
+ div.rwmb-drag-drop-inside {
5
+ margin: 50px auto;
6
+ }
7
+ div.rwmb-drag-drop-inside p {
8
+ text-align: center;
9
+ display: block;
10
+ font-size: 20px;
11
+ margin: 5px 0;
12
+ color: #aaa;
13
+ }
14
+
15
+ div.rwmb-image-uploading-bar {
16
+ position: absolute;
17
+ width: 100%;
18
+ height: 0%;
19
+ bottom: 0;
20
+ }
21
+
22
+ div.rwmb-image-uploading-status {
23
+ position: absolute;
24
+ }
25
+
26
+ li.rwmb-image-error {
27
+ border: 3px solid #c00;
28
+ background: #903838;
29
+ }
30
+ .rwmb-image-uploading-status .rwmb-loader {
31
+ width: 64px;
32
+ height: 64px;
33
+ top: 43px;
34
+ left: 43px;
35
+ position: relative;
36
+ }
css/select.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ #post-body .rwmb-select {
2
+ height: auto;
3
+ }
css/style.css ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* =Styles for 'normal' meta boxes
2
+ -------------------------------------------------------------- */
3
+
4
+ /* BEGIN jquery.validate styles */
5
+ label.error {
6
+ padding-left: 3px;
7
+ color: red;
8
+ }
9
+
10
+ input.error, textarea.error, select.error {
11
+ border: #CC0000 solid 1px !important;
12
+ background-color: #FFEBE8 !important;
13
+ }
14
+ /* END jquery.validate styles */
15
+
16
+ .rwmb-field {
17
+ margin: 10px 0;
18
+ }
19
+ .rwmb-label,
20
+ .rwmb-input {
21
+ display: inline-block;
22
+ vertical-align: top;
23
+ }
24
+ .rwmb-label {
25
+ width: 24%;
26
+ }
27
+ .rwmb-label > .required
28
+ {
29
+ color: red;
30
+ font-weight:bold;
31
+ }
32
+ /* 75% if field has label, 100% if no label */
33
+ .rwmb-input {
34
+ width: 100%;
35
+ }
36
+ .rwmb-label ~ .rwmb-input {
37
+ width: 75%;
38
+ }
39
+ .rwmb-input h4 {
40
+ margin-top: 0;
41
+ }
42
+ .rwmb-textarea {
43
+ resize: vertical;
44
+ }
45
+ .rwmb-clone {
46
+ min-height: 24px;
47
+ }
48
+ .rwmb-clone > input[type="radio"],
49
+ .rwmb-clone > input[type="checkbox"] {
50
+ margin: 6px 0 0 4px;
51
+ }
52
+ /* fix width to not overlap button for cloned sliders */
53
+ .rwmb-clone .rwmb-slider {
54
+ width: 80%;
55
+ margin: 6px 0 0;
56
+ }
57
+ /* fix buttons after sliders */
58
+ .clearfix + .rwmb-button {
59
+ margin-top: -16px;
60
+ }
61
+ .rwmb-button {
62
+ display: inline;
63
+ float: right;
64
+ }
65
+ /* Hidden labels, :input fields, buttons */
66
+ .rwmb-label.hidden,
67
+ .rwmb-input.hidden,
68
+ .hidden .rwmb-button {
69
+ display: none;
70
+ }
71
+
72
+ /* Fix empty block below admin footer (issue #24) */
73
+ #ui-datepicker-div {
74
+ display: none;
75
+ }
76
+
77
+ /* =Styles for 'side' meta boxes
78
+ -------------------------------------------------------------- */
79
+
80
+ #side-sortables .rwmb-label,
81
+ #side-sortables .rwmb-input {
82
+ width: 100%;
83
+ }
css/taxonomy.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ li ul.rw-taxonomy-tree {
2
+ margin-left: 15px;
3
+ margin-top: 5px;
4
+ }
5
+
6
+ .rw-taxonomy-tree.active{
7
+ display:inline-block;
8
+ }
9
+ .rw-taxonomy-tree.disabled{
10
+ display:none;
11
+ }
css/wysiwyg.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .rwmb-field .mceIframeContainer {
2
+ background: #fff;
3
+ }
demo/all-custom-post-types.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // This file shows a demo for register meta boxes for ALL custom post types
4
+
5
+ add_action( 'admin_init', 'YOUR_PREFIX_register_meta_boxes' );
6
+
7
+ function YOUR_PREFIX_register_meta_boxes()
8
+ {
9
+ if ( ! class_exists( 'RW_Meta_Box' ) )
10
+ return;
11
+
12
+ $prefix = 'YOUR_PREFIX_';
13
+ $meta_boxes = array();
14
+
15
+ $post_types = get_post_types();
16
+
17
+ // 1st meta box
18
+ $meta_boxes[] = array(
19
+ 'id' => 'personal',
20
+ 'title' => 'Personal Information',
21
+ 'pages' => $post_types,
22
+
23
+ 'fields' => array(
24
+ array(
25
+ 'name' => 'Full name',
26
+ 'id' => $prefix . 'fname',
27
+ 'type' => 'text',
28
+ ),
29
+ // Other fields go here
30
+ )
31
+ );
32
+ // Other meta boxes go here
33
+
34
+ foreach ( $meta_boxes as $meta_box )
35
+ {
36
+ new RW_Meta_Box( $meta_box );
37
+ }
38
+ }
demo/better-include.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file show you an improvement of better include meta box in some pages
4
+ * based on post ID, post slug, page template and page parent
5
+ *
6
+ * @author Charlie Rosenbury <charlie@40digits.com>
7
+ */
8
+
9
+ $prefix = 'rw_';
10
+
11
+ global $meta_boxes;
12
+
13
+ $meta_boxes = array();
14
+
15
+ $meta_boxes[] = array(
16
+ 'title' => 'Meta Box Title',
17
+ 'fields' => array(
18
+ array(
19
+ 'name' => 'Your images',
20
+ 'id' => "{$prefix}img",
21
+ 'type' => 'plupload_image',
22
+ ),
23
+ ),
24
+ 'only_on' => array(
25
+ 'id' => array( 1, 2 ),
26
+ // 'slug' => array( 'news', 'blog' ),
27
+ 'template' => array( 'fullwidth.php', 'simple.php' ),
28
+ 'parent' => array( 10 )
29
+ ),
30
+ );
31
+
32
+ /**
33
+ * Register meta boxes
34
+ *
35
+ * @return void
36
+ */
37
+ function rw_register_meta_boxes()
38
+ {
39
+ global $meta_boxes;
40
+
41
+ // Make sure there's no errors when the plugin is deactivated or during upgrade
42
+ if ( class_exists( 'RW_Meta_Box' ) ) {
43
+ foreach ( $meta_boxes as $meta_box ) {
44
+ if ( isset( $meta_box['only_on'] ) && ! rw_maybe_include( $meta_box['only_on'] ) ) {
45
+ continue;
46
+ }
47
+
48
+ new RW_Meta_Box( $meta_box );
49
+ }
50
+ }
51
+ }
52
+
53
+ add_action( 'admin_init', 'rw_register_meta_boxes' );
54
+
55
+ /**
56
+ * Check if meta boxes is included
57
+ *
58
+ * @return bool
59
+ */
60
+ function rw_maybe_include( $conditions ) {
61
+ // Include in back-end only
62
+ if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN ) {
63
+ return false;
64
+ }
65
+
66
+ // Always include for ajax
67
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
68
+ return true;
69
+ }
70
+
71
+ if ( isset( $_GET['post'] ) ) {
72
+ $post_id = $_GET['post'];
73
+ }
74
+ elseif ( isset( $_POST['post_ID'] ) ) {
75
+ $post_id = $_POST['post_ID'];
76
+ }
77
+ else {
78
+ $post_id = false;
79
+ }
80
+
81
+ $post_id = (int) $post_id;
82
+ $post = get_post( $post_id );
83
+
84
+ foreach ( $conditions as $cond => $v ) {
85
+ // Catch non-arrays too
86
+ if ( ! is_array( $v ) ) {
87
+ $v = array( $v );
88
+ }
89
+
90
+ switch ( $cond ) {
91
+ case 'id':
92
+ if ( in_array( $post_id, $v ) ) {
93
+ return true;
94
+ }
95
+ break;
96
+ case 'parent':
97
+ $post_parent = $post->post_parent;
98
+ if ( in_array( $post_parent, $v ) ) {
99
+ return true;
100
+ }
101
+ break;
102
+ case 'slug':
103
+ $post_slug = $post->post_name;
104
+ if ( in_array( $post_slug, $v ) ) {
105
+ return true;
106
+ }
107
+ break;
108
+ case 'template':
109
+ $template = get_post_meta( $post_id, '_wp_page_template', true );
110
+ if ( in_array( $template, $v ) ) {
111
+ return true;
112
+ }
113
+ break;
114
+ }
115
+ }
116
+
117
+ // If no condition matched
118
+ return false;
119
+ }
demo/demo.php ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Registering meta boxes
4
+ *
5
+ * All the definitions of meta boxes are listed below with comments.
6
+ * Please read them CAREFULLY.
7
+ *
8
+ * You also should read the changelog to know what has been changed before updating.
9
+ *
10
+ * For more information, please visit:
11
+ * @link http://www.deluxeblogtips.com/meta-box/
12
+ */
13
+
14
+ /********************* META BOX DEFINITIONS ***********************/
15
+
16
+ /**
17
+ * Prefix of meta keys (optional)
18
+ * Use underscore (_) at the beginning to make keys hidden
19
+ * Alt.: You also can make prefix empty to disable it
20
+ */
21
+ // Better has an underscore as last sign
22
+ $prefix = 'YOUR_PREFIX_';
23
+
24
+ global $meta_boxes;
25
+
26
+ $meta_boxes = array();
27
+
28
+ // 1st meta box
29
+ $meta_boxes[] = array(
30
+ // Meta box id, UNIQUE per meta box. Optional since 4.1.5
31
+ 'id' => 'personal',
32
+
33
+ // Meta box title - Will appear at the drag and drop handle bar. Required.
34
+ 'title' => 'Personal Information',
35
+
36
+ // Post types, accept custom post types as well - DEFAULT is array('post'). Optional.
37
+ 'pages' => array( 'post', 'slider' ),
38
+
39
+ // Where the meta box appear: normal (default), advanced, side. Optional.
40
+ 'context' => 'normal',
41
+
42
+ // Order of meta box: high (default), low. Optional.
43
+ 'priority' => 'high',
44
+
45
+ // List of meta fields
46
+ 'fields' => array(
47
+ // TEXT
48
+ array(
49
+ // Field name - Will be used as label
50
+ 'name' => 'Full name',
51
+ // Field ID, i.e. the meta key
52
+ 'id' => $prefix . 'fname',
53
+ // Field description (optional)
54
+ 'desc' => 'Format: First Last',
55
+ // CLONES: Add to make the field cloneable (i.e. have multiple value)
56
+ 'clone' => true,
57
+ 'type' => 'text',
58
+ // Default value (optional)
59
+ 'std' => 'Anh Tran',
60
+ ),
61
+ // DATE
62
+ array(
63
+ 'name' => 'Day of Birth',
64
+ 'id' => "{$prefix}dob",
65
+ 'type' => 'date',
66
+ // Date format, default yy-mm-dd. Optional. See: http://goo.gl/po8vf
67
+ 'format' => 'd MM, yy',
68
+ ),
69
+ // RADIO BUTTONS
70
+ array(
71
+ 'name' => 'Gender',
72
+ 'id' => "{$prefix}gender",
73
+ 'type' => 'radio',
74
+ // Array of 'value' => 'Label' pairs for radio options.
75
+ // Note: the 'key' is stored in meta field, not the 'value'
76
+ 'options' => array(
77
+ 'm' => 'Male',
78
+ 'f' => 'Female',
79
+ ),
80
+ 'std' => 'm',
81
+ 'desc' => 'Need an explaination?',
82
+ ),
83
+ // TEXTAREA
84
+ array(
85
+ 'name' => 'Bio',
86
+ 'desc' => "What's your professions? What have you done so far?",
87
+ 'id' => "{$prefix}bio",
88
+ 'type' => 'textarea',
89
+ 'std' => "I'm a special agent from Vietnam.",
90
+ 'cols' => '40',
91
+ 'rows' => '8',
92
+ ),
93
+ // SELECT BOX
94
+ array(
95
+ 'name' => 'Where do you live?',
96
+ 'id' => "{$prefix}place",
97
+ 'type' => 'select',
98
+ // Array of 'value' => 'Label' pairs for select box
99
+ 'options' => array(
100
+ 'usa' => 'USA',
101
+ 'vn' => 'Vietnam',
102
+ ),
103
+ // Select multiple values, optional. Default is false.
104
+ 'multiple' => true,
105
+ // Default value, can be string (single value) or array (for both single and multiple values)
106
+ 'std' => array( 'vn' ),
107
+ 'desc' => 'Select the current place, not in the past',
108
+ ),
109
+ // CHECKBOX
110
+ array(
111
+ 'name' => 'About WordPress',
112
+ 'id' => "{$prefix}love_wp",
113
+ 'type' => 'checkbox',
114
+ 'desc' => 'I love WordPress',
115
+ // Value can be 0 or 1
116
+ 'std' => 1,
117
+ ),
118
+ // HIDDEN
119
+ array(
120
+ 'id' => "{$prefix}invisible",
121
+ 'type' => 'hidden',
122
+ // Hidden field must have predefined value
123
+ 'std' => "No, I'm visible",
124
+ ),
125
+ // PASSWORD
126
+ array(
127
+ 'name' => 'Your favorite password',
128
+ 'id' => "{$prefix}pass",
129
+ 'type' => 'password',
130
+ ),
131
+ // CONFIRM PASSWORD
132
+ array(
133
+ 'name' => 'Confirm your password',
134
+ 'id' => "{$prefix}pass_confirm",
135
+ 'type' => 'password',
136
+ ),
137
+ ),
138
+ 'validation' => array(
139
+ 'rules' => array(
140
+ // optionally make post/page title required
141
+ 'post_title' => array(
142
+ 'required' => true,
143
+ ),
144
+ $prefix . 'fname' => array(
145
+ 'required' => true,
146
+ ),
147
+ "{$prefix}pass" => array(
148
+ 'required' => true,
149
+ 'minlength' => 7,
150
+ ),
151
+ ),
152
+ // optional override of default jquery.validate messages
153
+ 'messages' => array(
154
+ $prefix . 'fname' => array(
155
+ 'required' => 'Your name is required',
156
+ ),
157
+ "{$prefix}pass" => array(
158
+ 'required' => 'Password is required',
159
+ 'minlength' => 'Password must be at least 7 characters',
160
+ ),
161
+ )
162
+ )
163
+ );
164
+
165
+ // 2nd meta box
166
+ $meta_boxes[] = array(
167
+ 'id' => 'additional',
168
+ 'title' => 'Additional Information',
169
+ 'pages' => array( 'post', 'film', 'slider' ),
170
+
171
+ 'fields' => array(
172
+ // WYSIWYG/RICH TEXT EDITOR
173
+ array(
174
+ 'name' => 'Your thoughts about Deluxe Blog Tips',
175
+ 'id' => "{$prefix}thoughts",
176
+ 'type' => 'wysiwyg',
177
+ 'std' => "It's great!",
178
+ 'desc' => 'Do you think so?',
179
+ ),
180
+ // FILE UPLOAD
181
+ array(
182
+ 'name' => 'Upload your source code',
183
+ 'desc' => 'Any modified code, or extending code',
184
+ 'id' => "{$prefix}code",
185
+ 'type' => 'file',
186
+ ),
187
+ // IMAGE UPLOAD
188
+ array(
189
+ 'name' => 'Screenshots',
190
+ 'desc' => 'Screenshots of problems, warnings, etc.',
191
+ 'id' => "{$prefix}screenshot",
192
+ 'type' => 'image',
193
+ ),
194
+ // PLUPLOAD IMAGE UPLOAD (WP 3.3+)
195
+ array(
196
+ 'name' => 'Screenshots (plupload)',
197
+ 'desc' => 'Screenshots of problems, warnings, etc.',
198
+ 'id' => "{$prefix}screenshot2",
199
+ 'type' => 'plupload_image',
200
+ 'max_file_uploads' => 4,
201
+ ),
202
+ // THICKBOX IMAGE UPLOAD (WP 3.3+)
203
+ array(
204
+ 'name' => 'Screenshots (thickbox upload)',
205
+ 'desc' => 'Screenshots of problems, warnings, etc.',
206
+ 'id' => "{$prefix}screenshot3",
207
+ 'type' => 'thickbox_image',
208
+ )
209
+ )
210
+ );
211
+
212
+ // 3rd meta box
213
+ $meta_boxes[] = array(
214
+ 'id' => 'survey',
215
+ 'title' => 'Survey',
216
+ 'pages' => array( 'post', 'slider', 'page' ),
217
+
218
+ 'fields' => array(
219
+ // COLOR
220
+ array(
221
+ 'name' => 'Your favorite color',
222
+ 'id' => "{$prefix}color",
223
+ 'type' => 'color',
224
+ ),
225
+ // CHECKBOX LIST
226
+ array(
227
+ 'name' => 'Your hobby',
228
+ 'id' => "{$prefix}hobby",
229
+ 'type' => 'checkbox_list',
230
+ // Options of checkboxes, in format 'value' => 'Label'
231
+ 'options' => array(
232
+ 'reading' => 'Books',
233
+ 'sport' => 'Gym, Boxing',
234
+ ),
235
+ 'desc' => 'What do you do in free time?',
236
+ ),
237
+ // TIME
238
+ array(
239
+ 'name' => 'When do you get up?',
240
+ 'id' => "{$prefix}getdown",
241
+ 'type' => 'time',
242
+ // Time format, default hh:mm. Optional. @link See: http://goo.gl/hXHWz
243
+ 'format' => 'hh:mm:ss',
244
+ ),
245
+ // DATETIME
246
+ array(
247
+ 'name' => 'When were you born?',
248
+ 'id' => "{$prefix}born_time",
249
+ 'type' => 'datetime',
250
+ // Time format, default yy-mm-dd hh:mm. Optional. @link See: http://goo.gl/hXHWz
251
+ 'format' => 'hh:mm:ss',
252
+ ),
253
+ // TAXONOMY
254
+ array(
255
+ 'name' => 'Categories',
256
+ 'id' => "{$prefix}cats",
257
+ 'type' => 'taxonomy',
258
+ 'options' => array(
259
+ // Taxonomy name
260
+ 'taxonomy' => 'category',
261
+ // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree' or 'select'. Optional
262
+ 'type' => 'select_tree',
263
+ // Additional arguments for get_terms() function. Optional
264
+ 'args' => array()
265
+ ),
266
+ 'desc' => 'Choose One Category',
267
+ ),
268
+ )
269
+ );
270
+
271
+
272
+ /********************* META BOX REGISTERING ***********************/
273
+
274
+ /**
275
+ * Register meta boxes
276
+ *
277
+ * @return void
278
+ */
279
+ function YOUR_PREFIX_register_meta_boxes()
280
+ {
281
+ global $meta_boxes;
282
+
283
+ // Make sure there's no errors when the plugin is deactivated or during upgrade
284
+ if ( class_exists( 'RW_Meta_Box' ) )
285
+ {
286
+ foreach ( $meta_boxes as $meta_box )
287
+ {
288
+ new RW_Meta_Box( $meta_box );
289
+ }
290
+ }
291
+ }
292
+ // Hook to 'admin_init' to make sure the meta box class is loaded before
293
+ // (in case using the meta box class in another plugin)
294
+ // This is also helpful for some conditionals like checking page template, categories, etc.
295
+ add_action( 'admin_init', 'YOUR_PREFIX_register_meta_boxes' );
demo/include-by-ID-or-page-template.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $prefix = 'rw_';
3
+
4
+ global $meta_boxes;
5
+ $meta_boxes = array();
6
+ $meta_boxes[] = array(
7
+ 'id' => 'any_id',
8
+ 'title' => 'Meta Box Title',
9
+ 'pages' => array( 'post' ),
10
+ 'fields' => array(
11
+
12
+ // IMAGE UPLOAD
13
+ array(
14
+ 'name' => 'Your images',
15
+ 'id' => "{$prefix}img",
16
+ 'type' => 'plupload_image',
17
+ ),
18
+ ),
19
+ );
20
+
21
+ /**
22
+ * Register meta boxes
23
+ *
24
+ * @return void
25
+ */
26
+ function rw_register_meta_boxes()
27
+ {
28
+ global $meta_boxes;
29
+
30
+ // Make sure there's no errors when the plugin is deactivated or during upgrade
31
+ if ( ! class_exists( 'RW_Meta_Box' ) )
32
+ return;
33
+
34
+ // Register meta boxes only for some posts/pages
35
+ if ( ! rw_maybe_include() )
36
+ return;
37
+
38
+ foreach ( $meta_boxes as $meta_box )
39
+ {
40
+ new RW_Meta_Box( $meta_box );
41
+ }
42
+ }
43
+
44
+ add_action( 'admin_init', 'rw_register_meta_boxes' );
45
+
46
+ /**
47
+ * Check if meta boxes is included
48
+ *
49
+ * @return bool
50
+ */
51
+ function rw_maybe_include()
52
+ {
53
+ // Include in back-end only
54
+ if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN )
55
+ return false;
56
+
57
+ // Always include for ajax
58
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
59
+ return true;
60
+
61
+ // Check for post IDs
62
+ $checked_post_IDs = array( 61, 63, 65, 67, 2 );
63
+
64
+ if ( isset( $_GET['post'] ) )
65
+ $post_id = $_GET['post'];
66
+ elseif ( isset( $_POST['post_ID'] ) )
67
+ $post_id = $_POST['post_ID'];
68
+ else
69
+ $post_id = false;
70
+
71
+ $post_id = (int) $post_id;
72
+
73
+ if ( in_array( $post_id, $checked_post_IDs ) )
74
+ return true;
75
+
76
+ // Check for page template
77
+ $checked_templates = array( 'full-width.php', 'sidebar-page.php' );
78
+
79
+ $template = get_post_meta( $post_id, '_wp_page_template', true );
80
+ if ( in_array( $template, $checked_templates ) )
81
+ return true;
82
+
83
+ // If no condition matched
84
+ return false;
85
+ }
img/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png ADDED
Binary file
img/jqueryui/ui-bg_flat_75_ffffff_40x100.png ADDED
Binary file
img/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png ADDED
Binary file
img/jqueryui/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
img/jqueryui/ui-bg_glass_75_dadada_1x400.png ADDED
Binary file
img/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png ADDED
Binary file
img/jqueryui/ui-bg_glass_95_fef1ec_1x400.png ADDED
Binary file
img/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png ADDED
Binary file
img/jqueryui/ui-icons_222222_256x240.png ADDED
Binary file
img/jqueryui/ui-icons_2e83ff_256x240.png ADDED
Binary file
img/jqueryui/ui-icons_454545_256x240.png ADDED
Binary file
img/jqueryui/ui-icons_888888_256x240.png ADDED
Binary file
img/jqueryui/ui-icons_cd0a0a_256x240.png ADDED
Binary file
img/loader.gif ADDED
Binary file
inc/classes/meta-box.php ADDED
@@ -0,0 +1,692 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ // Meta Box Class
6
+ if ( ! class_exists( 'RW_Meta_Box' ) )
7
+ {
8
+ /**
9
+ * A class to rapid develop meta boxes for custom & built in content types
10
+ * Piggybacks on WordPress
11
+ *
12
+ * @author Rilwis
13
+ * @author Co-Authors @see https://github.com/rilwis/meta-box
14
+ * @license GNU GPL2+
15
+ * @package RW Meta Box
16
+ */
17
+ class RW_Meta_Box
18
+ {
19
+ /**
20
+ * Meta box information
21
+ */
22
+ var $meta_box;
23
+
24
+ /**
25
+ * Fields information
26
+ */
27
+ var $fields;
28
+
29
+ /**
30
+ * Contains all field types of current meta box
31
+ */
32
+ var $types;
33
+
34
+ /**
35
+ * Validation information
36
+ */
37
+ var $validation;
38
+
39
+ /**
40
+ * Create meta box based on given data
41
+ *
42
+ * @see demo/demo.php file for details
43
+ *
44
+ * @param array $meta_box Meta box definition
45
+ *
46
+ * @return \RW_Meta_Box
47
+ */
48
+ function __construct( $meta_box )
49
+ {
50
+ // Run script only in admin area
51
+ if ( ! is_admin() )
52
+ return;
53
+
54
+ // Assign meta box values to local variables and add it's missed values
55
+ $this->meta_box = self::normalize( $meta_box );
56
+ $this->fields = &$this->meta_box['fields'];
57
+ $this->validation = &$this->meta_box['validation'];
58
+
59
+ // List of meta box field types
60
+ $this->types = array_unique( wp_list_pluck( $this->fields, 'type' ) );
61
+
62
+ // Enqueue common styles and scripts
63
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
64
+
65
+ foreach ( $this->types as $type )
66
+ {
67
+ $class = self::get_class_name( $type );
68
+
69
+ // Add additional actions for fields
70
+ if ( method_exists( $class, 'add_actions' ) )
71
+ call_user_func( array( $class, 'add_actions' ) );
72
+ }
73
+
74
+ // Add meta box
75
+ foreach ( $this->meta_box['pages'] as $page )
76
+ {
77
+ add_action( "add_meta_boxes_{$page}", array( $this, 'add_meta_boxes' ) );
78
+ }
79
+
80
+ // Save post meta
81
+ add_action( 'save_post', array( $this, 'save_post' ) );
82
+ }
83
+
84
+ /**
85
+ * Enqueue common styles
86
+ *
87
+ * @return void
88
+ */
89
+ function admin_enqueue_scripts()
90
+ {
91
+ $screen = get_current_screen();
92
+
93
+ // Enqueue scripts and styles for registered pages (post types) only
94
+ if ( 'post' != $screen->base || ! in_array( $screen->post_type, $this->meta_box['pages'] ) )
95
+ return;
96
+
97
+ wp_enqueue_style( 'rwmb', RWMB_CSS_URL . 'style.css', RWMB_VER );
98
+
99
+ // Load clone script conditionally
100
+ $has_clone = false;
101
+ foreach ( $this->fields as $field )
102
+ {
103
+ if ( self::is_cloneable( $field ) )
104
+ $has_clone = true;
105
+
106
+ // Enqueue scripts and styles for fields
107
+ $class = self::get_class_name( $field['type'] );
108
+ if ( method_exists( $class, 'admin_enqueue_scripts' ) )
109
+ call_user_func( array( $class, 'admin_enqueue_scripts' ) );
110
+ }
111
+
112
+ if ( $has_clone ) {
113
+ wp_enqueue_script( 'rwmb-clone', RWMB_JS_URL . 'clone.js', array( 'jquery' ), RWMB_VER, true );
114
+ }
115
+
116
+ if ( $this->validation ) {
117
+ wp_enqueue_script( 'jquery-validate', RWMB_JS_URL . 'jquery.validate.min.js', array( 'jquery' ), RWMB_VER, true );
118
+ wp_enqueue_script( 'rwmb-validate', RWMB_JS_URL . 'validate.js', array( 'jquery-validate' ), RWMB_VER, true );
119
+ }
120
+ }
121
+
122
+ /**************************************************
123
+ SHOW META BOX
124
+ **************************************************/
125
+
126
+ /**
127
+ * Add meta box for multiple post types
128
+ *
129
+ * @return void
130
+ */
131
+ function add_meta_boxes()
132
+ {
133
+ foreach ( $this->meta_box['pages'] as $page )
134
+ {
135
+ // Allow users to show/hide meta boxes
136
+ // 1st action applies to all meta boxes
137
+ // 2nd action applies to only current meta box
138
+ $show = true;
139
+ $show = apply_filters( 'rwmb_show', $show, $this->meta_box );
140
+ $show = apply_filters( "rwmb_show_{$this->meta_box['id']}", $show, $this->meta_box );
141
+ if ( !$show )
142
+ continue;
143
+
144
+ add_meta_box(
145
+ $this->meta_box['id'],
146
+ $this->meta_box['title'],
147
+ array( $this, 'show' ),
148
+ $page,
149
+ $this->meta_box['context'],
150
+ $this->meta_box['priority']
151
+ );
152
+ }
153
+ }
154
+
155
+ /**
156
+ * Callback function to show fields in meta box
157
+ *
158
+ * @return void
159
+ */
160
+ public function show()
161
+ {
162
+ global $post;
163
+
164
+ $saved = self::has_been_saved( $post->ID, $this->fields );
165
+
166
+ wp_nonce_field( "rwmb-save-{$this->meta_box['id']}", "nonce_{$this->meta_box['id']}" );
167
+
168
+ // Allow users to add custom code before meta box content
169
+ // 1st action applies to all meta boxes
170
+ // 2nd action applies to only current meta box
171
+ do_action( 'rwmb_before' );
172
+ do_action( "rwmb_before_{$this->meta_box['id']}" );
173
+
174
+ foreach ( $this->fields as $field )
175
+ {
176
+ $group = ""; // Empty the clone-group field
177
+ $type = $field['type'];
178
+ $id = $field['id'];
179
+ $meta = self::apply_field_class_filters( $field, 'meta', '', $post->ID, $saved );
180
+ $meta = apply_filters( "rwmb_{$type}_meta", $meta );
181
+ $meta = apply_filters( "rwmb_{$id}_meta", $meta );
182
+
183
+ $begin = self::apply_field_class_filters( $field, 'begin_html', '', $meta );
184
+
185
+ // Apply filter to field begin HTML
186
+ // 1st filter applies to all fields
187
+ // 2nd filter applies to all fields with the same type
188
+ // 3rd filter applies to current field only
189
+ $begin = apply_filters( 'rwmb_begin_html', $begin, $field, $meta );
190
+ $begin = apply_filters( "rwmb_{$type}_begin_html", $begin, $field, $meta );
191
+ $begin = apply_filters( "rwmb_{$id}_begin_html", $begin, $field, $meta );
192
+
193
+ // Separate code for clonable and non-cloneable fields to make easy to maintain
194
+
195
+ // Cloneable fields
196
+ if ( self::is_cloneable( $field ) )
197
+ {
198
+ if ( isset( $field['clone-group'] ) )
199
+ $group = " clone-group='{$field['clone-group']}'";
200
+
201
+ if ( ! is_array( $field['field_name'] ) )
202
+ $field['field_name'] = (array) $field['field_name'];
203
+
204
+ $meta = (array) $meta;
205
+
206
+ foreach ( array_keys( $meta ) as $i )
207
+ $field['field_name'][$i] = $field['id'] . "[{$i}]";
208
+
209
+ $field_html = '';
210
+
211
+ $index = 0;
212
+ foreach ( $meta as $meta_data )
213
+ {
214
+ if ( is_array( $field['field_name'] ) )
215
+ {
216
+ $subfield = $field;
217
+ $subfield['field_name'] = $field['field_name'][$index];
218
+ }
219
+ else
220
+ $subfield = $field;
221
+
222
+ add_filter( "rwmb_{$id}_html", array( $this, 'add_delete_clone_button' ), 10, 3 );
223
+
224
+ // Wrap field HTML in a div with class="rwmb-clone" if needed
225
+ $input_html = '<div class="rwmb-clone">';
226
+
227
+ // Call separated methods for displaying each type of field
228
+ $input_html .= self::apply_field_class_filters( $subfield, 'html', '', $meta_data );
229
+
230
+ // Apply filter to field HTML
231
+ // 1st filter applies to all fields with the same type
232
+ // 2nd filter applies to current field only
233
+ $input_html = apply_filters( "rwmb_{$type}_html", $input_html, $field, $meta_data );
234
+ $input_html = apply_filters( "rwmb_{$id}_html", $input_html, $field, $meta_data );
235
+
236
+ $input_html .= '</div>';
237
+
238
+ $field_html .= $input_html;
239
+ $index++;
240
+ }
241
+ }
242
+ // Non-cloneable fields
243
+ else
244
+ {
245
+ // Call separated methods for displaying each type of field
246
+ $field_html = self::apply_field_class_filters( $field, 'html', '', $meta );
247
+
248
+ // Apply filter to field HTML
249
+ // 1st filter applies to all fields with the same type
250
+ // 2nd filter applies to current field only
251
+ $field_html = apply_filters( "rwmb_{$type}_html", $field_html, $field, $meta );
252
+ $field_html = apply_filters( "rwmb_{$id}_html", $field_html, $field, $meta );
253
+ }
254
+
255
+ $end = self::apply_field_class_filters( $field, 'end_html', '', $meta );
256
+
257
+ // Apply filter to field end HTML
258
+ // 1st filter applies to all fields
259
+ // 2nd filter applies to all fields with the same type
260
+ // 3rd filter applies to current field only
261
+ $end = apply_filters( 'rwmb_end_html', $end, $field, $meta );
262
+ $end = apply_filters( "rwmb_{$type}_end_html", $end, $field, $meta );
263
+ $end = apply_filters( "rwmb_{$id}_end_html", $end, $field, $meta );
264
+
265
+ // Apply filter to field wrapper
266
+ // This allow users to change whole HTML markup of the field wrapper (i.e. table row)
267
+ // 1st filter applies to all fields with the same type
268
+ // 2nd filter applies to current field only
269
+ $html = apply_filters( "rwmb_{$type}_wrapper_html", "{$begin}{$field_html}{$end}", $field, $meta );
270
+ $html = apply_filters( "rwmb_{$id}_wrapper_html", $html, $field, $meta );
271
+
272
+ // Display label and input in DIV and allow user-defined classes to be appended
273
+ $class = 'rwmb-field';
274
+ if ( isset( $field['required'] ) && $field['required'] )
275
+ $class .= ' required';
276
+ if ( isset( $field['class'] ) )
277
+ $class = $this->add_cssclass( $field['class'], $class );
278
+
279
+ // Hide the div if field has 'hidden' type
280
+ if ( 'hidden' === $field['type'] )
281
+ $class = $this->add_cssclass( 'hidden', $class );
282
+ echo "<div class='{$class}'{$group}>{$html}</div>";
283
+ }
284
+
285
+ // Include validation settings for this meta-box
286
+ if ( isset( $this->validation ) && $this->validation )
287
+ {
288
+ echo '
289
+ <script type="text/javascript">
290
+ if ( typeof rwmb == "undefined" )
291
+ {
292
+ var rwmb = {
293
+ validationOptions : jQuery.parseJSON( \'' . json_encode( $this->validation ) . '\' ),
294
+ summaryMessage : "' . __( 'Please correct the errors highlighted below and try again.', 'rwmb' ) . '"
295
+ };
296
+ }
297
+ else
298
+ {
299
+ var tempOptions = jQuery.parseJSON( \'' . json_encode( $this->validation ) . '\' );
300
+ jQuery.each( tempOptions.rules, function( k, v )
301
+ {
302
+ rwmb.validationOptions.rules[k] = v;
303
+ });
304
+ jQuery.each( tempOptions.messages, function( k, v )
305
+ {
306
+ rwmb.validationOptions.messages[k] = v;
307
+ });
308
+ };
309
+ </script>
310
+ ';
311
+ }
312
+
313
+ // Allow users to add custom code after meta box content
314
+ // 1st action applies to all meta boxes
315
+ // 2nd action applies to only current meta box
316
+ do_action( 'rwmb_after' );
317
+ do_action( "rwmb_after_{$this->meta_box['id']}" );
318
+ }
319
+
320
+ /**
321
+ * Show begin HTML markup for fields
322
+ *
323
+ * @param string $html
324
+ * @param mixed $meta
325
+ * @param array $field
326
+ *
327
+ * @return string
328
+ */
329
+ static function begin_html( $html, $meta, $field )
330
+ {
331
+ $class = 'rwmb-label';
332
+
333
+ if ( ! empty( $field['class'] ) )
334
+ $class = self::add_cssclass( $field['class'], $class );
335
+
336
+ if ( empty( $field['name'] ) )
337
+ return '<div class="rwmb-input">';
338
+
339
+ $html = <<<HTML
340
+ <div class="{$class}">
341
+ <label for="{$field['id']}">{$field['name']}</label>
342
+ </div>
343
+ <div class="rwmb-input">
344
+ HTML;
345
+
346
+ return $html;
347
+ }
348
+
349
+ /**
350
+ * Show end HTML markup for fields
351
+ *
352
+ * @param string $html
353
+ * @param mixed $meta
354
+ * @param array $field
355
+ *
356
+ * @return string
357
+ */
358
+ static function end_html( $html, $meta, $field )
359
+ {
360
+ $id = $field['id'];
361
+
362
+ $button = '';
363
+ if ( self::is_cloneable( $field ) )
364
+ $button = '<a href="#" class="rwmb-button button-primary add-clone">' . __( '+', 'rwmb' ) . '</a>';
365
+
366
+ $desc = ! empty( $field['desc'] ) ? "<p id='{$id}_description' class='description'>{$field['desc']}</p>" : '';
367
+
368
+ // Closes the container
369
+ $html = "{$button}{$desc}</div>";
370
+
371
+ return $html;
372
+ }
373
+
374
+ /**
375
+ * Callback function to add clone buttons on demand
376
+ * Hooks on the flight into the "rwmb_{$field_id}_html" filter before the closing div
377
+ *
378
+ * @param string $html
379
+ * @param array $field
380
+ * @param mixed $meta_data
381
+ *
382
+ * @return string $html
383
+ */
384
+ static function add_delete_clone_button( $html, $field, $meta_data )
385
+ {
386
+ $id = $field['id'];
387
+
388
+ $button = '<a href="#" class="rwmb-button button-secondary remove-clone">' . __( '&#8211;', 'rwmb' ) . '</a>';
389
+
390
+ return "{$html}{$button}";
391
+ }
392
+
393
+ /**
394
+ * Standard meta retrieval
395
+ *
396
+ * @param mixed $meta
397
+ * @param int $post_id
398
+ * @param array $field
399
+ * @param bool $saved
400
+ *
401
+ * @return mixed
402
+ */
403
+ static function meta( $meta, $post_id, $saved, $field )
404
+ {
405
+ $meta = get_post_meta( $post_id, $field['id'], !$field['multiple'] );
406
+
407
+ // Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
408
+ $meta = ( !$saved && '' === $meta || array() === $meta ) ? $field['std'] : $meta;
409
+
410
+ // Escape attributes for non-wysiwyg fields
411
+ if ( 'wysiwyg' !== $field['type'] )
412
+ $meta = is_array( $meta ) ? array_map( 'esc_attr', $meta ) : esc_attr( $meta );
413
+
414
+ return $meta;
415
+ }
416
+
417
+ /**************************************************
418
+ SAVE META BOX
419
+ **************************************************/
420
+
421
+ /**
422
+ * Save data from meta box
423
+ *
424
+ * @param int $post_id Post ID
425
+ *
426
+ * @return int|void
427
+ */
428
+ function save_post( $post_id )
429
+ {
430
+ global $post_type;
431
+ $post_type_object = get_post_type_object( $post_type );
432
+
433
+ // Check whether:
434
+ // - the post is autosaved
435
+ // - the post is a revision
436
+ // - current post type is supported
437
+ // - user has proper capability
438
+ if (
439
+ ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
440
+ || ( ! isset( $_POST['post_ID'] ) || $post_id != $_POST['post_ID'] )
441
+ || ( ! in_array( $post_type, $this->meta_box['pages'] ) )
442
+ || ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )
443
+ )
444
+ {
445
+ return $post_id;
446
+ }
447
+
448
+ // Verify nonce
449
+ check_admin_referer( "rwmb-save-{$this->meta_box['id']}", "nonce_{$this->meta_box['id']}" );
450
+
451
+ foreach ( $this->fields as $field )
452
+ {
453
+ $name = $field['id'];
454
+ $old = get_post_meta( $post_id, $name, !$field['multiple'] );
455
+ $new = isset( $_POST[$name] ) ? $_POST[$name] : ( $field['multiple'] ? array() : '' );
456
+
457
+ // Allow field class change the value
458
+ $new = self::apply_field_class_filters( $field, 'value', $new, $old, $post_id );
459
+
460
+ // Use filter to change field value
461
+ // 1st filter applies to all fields with the same type
462
+ // 2nd filter applies to current field only
463
+ $new = apply_filters( "rwmb_{$field['type']}_value", $new, $field, $old );
464
+ $new = apply_filters( "rwmb_{$name}_value", $new, $field, $old );
465
+
466
+ // Call defined method to save meta value, if there's no methods, call common one
467
+ self::do_field_class_actions( $field, 'save', $new, $old, $post_id );
468
+ }
469
+ }
470
+
471
+ /**
472
+ * Common functions for saving field
473
+ *
474
+ * @param mixed $new
475
+ * @param mixed $old
476
+ * @param int $post_id
477
+ * @param array $field
478
+ *
479
+ * @return void
480
+ */
481
+ static function save( $new, $old, $post_id, $field )
482
+ {
483
+ $name = $field['id'];
484
+
485
+ delete_post_meta( $post_id, $name );
486
+ if ( '' === $new || array() === $new )
487
+ return;
488
+
489
+ if ( $field['multiple'] )
490
+ {
491
+ foreach ( $new as $add_new )
492
+ {
493
+ add_post_meta( $post_id, $name, $add_new, false );
494
+ }
495
+ }
496
+ else
497
+ {
498
+ update_post_meta( $post_id, $name, $new );
499
+ }
500
+ }
501
+
502
+ /**************************************************
503
+ HELPER FUNCTIONS
504
+ **************************************************/
505
+
506
+ /**
507
+ * Normalize parameters for meta box
508
+ *
509
+ * @param array $meta_box Meta box definition
510
+ *
511
+ * @return array $meta_box Normalized meta box
512
+ */
513
+ static function normalize( $meta_box )
514
+ {
515
+ // Set default values for meta box
516
+ $meta_box = wp_parse_args(
517
+ $meta_box, array(
518
+ 'id' => sanitize_title( $meta_box['title'] ),
519
+ 'context' => 'normal',
520
+ 'priority' => 'high',
521
+ 'pages' => array( 'post' )
522
+ )
523
+ );
524
+
525
+ // Set default values for fields
526
+ foreach ( $meta_box['fields'] as &$field )
527
+ {
528
+ $field = wp_parse_args(
529
+ $field, array(
530
+ 'multiple' => false,
531
+ 'clone' => false,
532
+ 'std' => '',
533
+ 'desc' => '',
534
+ 'format' => '',
535
+ )
536
+ );
537
+
538
+ // Allow field class add/change default field values
539
+ $field = self::apply_field_class_filters( $field, 'normalize_field', $field );
540
+
541
+ // Allow field class to manually change field_name
542
+ // @see taxonomy.php for example
543
+ if ( ! isset( $field['field_name'] ) )
544
+ $field['field_name'] = $field['id'] . ( $field['multiple'] || $field['clone'] ? '[0]' : '' );
545
+ }
546
+
547
+ return $meta_box;
548
+ }
549
+
550
+ /**
551
+ * Get field class name
552
+ *
553
+ * @param string $type Field type
554
+ *
555
+ * @return bool|string Field class name OR false on failure
556
+ */
557
+ static function get_class_name( $type )
558
+ {
559
+ $type = ucwords( $type );
560
+ $class = "RWMB_{$type}_Field";
561
+
562
+ if ( class_exists( $class ) )
563
+ return $class;
564
+
565
+ return false;
566
+ }
567
+
568
+ /**
569
+ * Apply filters by field class, fallback to RW_Meta_Box method
570
+ *
571
+ * @param array $field
572
+ * @param string $method_name
573
+ * @param mixed $value
574
+ *
575
+ * @return mixed $value
576
+ */
577
+ static function apply_field_class_filters( $field, $method_name, $value )
578
+ {
579
+ $args = array_slice( func_get_args(), 2 );
580
+ $args[] = $field;
581
+
582
+ // Call: field class method
583
+ // Fallback: RW_Meta_Box method
584
+ $class = self::get_class_name( $field['type'] );
585
+ if ( method_exists( $class, $method_name ) )
586
+ {
587
+ $value = call_user_func_array( array( $class, $method_name ), $args );
588
+ }
589
+ elseif ( method_exists( __CLASS__, $method_name ) )
590
+ {
591
+ $value = call_user_func_array( array( __CLASS__, $method_name ), $args );
592
+ }
593
+
594
+ return $value;
595
+ }
596
+
597
+ /**
598
+ * Call field class method for actions, fallback to RW_Meta_Box method
599
+ *
600
+ * @param array $field
601
+ * @param string $method_name
602
+ *
603
+ * @return mixed
604
+ */
605
+ static function do_field_class_actions( $field, $method_name )
606
+ {
607
+ $args = array_slice( func_get_args(), 2 );
608
+ $args[] = $field;
609
+
610
+ // Call: field class method
611
+ // Fallback: RW_Meta_Box method
612
+ $class = self::get_class_name( $field['type'] );
613
+ if ( method_exists( $class, $method_name ) )
614
+ {
615
+ call_user_func_array( array( $class, $method_name ), $args );
616
+ }
617
+ elseif ( method_exists( __CLASS__, $method_name ) )
618
+ {
619
+ call_user_func_array( array( __CLASS__, $method_name ), $args );
620
+ }
621
+ }
622
+
623
+ /**
624
+ * Format Ajax response
625
+ *
626
+ * @param string $message
627
+ * @param string $status
628
+ *
629
+ * @return void
630
+ */
631
+ static function ajax_response( $message, $status )
632
+ {
633
+ $response = array( 'what' => 'meta-box' );
634
+ $response['data'] = 'error' === $status ? new WP_Error( 'error', $message ) : $message;
635
+ $x = new WP_Ajax_Response( $response );
636
+ $x->send();
637
+ }
638
+
639
+ /**
640
+ * Check if meta box has been saved
641
+ * This helps saving empty value in meta fields (for text box, check box, etc.)
642
+ *
643
+ * @param int $post_id
644
+ * @param array $fields
645
+ *
646
+ * @return bool
647
+ */
648
+ static function has_been_saved( $post_id, $fields )
649
+ {
650
+ $saved = false;
651
+ foreach ( $fields as $field )
652
+ {
653
+ if ( get_post_meta( $post_id, $field['id'], !$field['multiple'] ) )
654
+ {
655
+ $saved = true;
656
+ break;
657
+ }
658
+ }
659
+ return $saved;
660
+ }
661
+
662
+ /**
663
+ * Adds a css class
664
+ * Mainly a copy of the core admin menu function
665
+ * As the core function is only meant to be used by core internally,
666
+ * We copy it here - in case core changes functionality or drops the function.
667
+ *
668
+ * @param string $add
669
+ * @param string $class | Class name - Default: empty
670
+ *
671
+ * @return string $class
672
+ */
673
+ static function add_cssclass( $add, $class = '' )
674
+ {
675
+ $class .= empty( $class ) ? $add : " {$add}";
676
+
677
+ return $class;
678
+ }
679
+
680
+ /**
681
+ * Helper function to check for multi/clone field IDs
682
+ *
683
+ * @param array $field
684
+ *
685
+ * @return bool False if no cloneable
686
+ */
687
+ static function is_cloneable( $field )
688
+ {
689
+ return $field['clone'];
690
+ }
691
+ }
692
+ }
inc/common.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Common' ) )
6
+ {
7
+ /**
8
+ * Common functions for the plugin
9
+ * Independent from meta box/field classes
10
+ */
11
+ class RWMB_Common
12
+ {
13
+ /**
14
+ * Do actions when class is loaded
15
+ *
16
+ * @return void
17
+ */
18
+ static function on_load()
19
+ {
20
+ self::load_textdomain();
21
+ }
22
+
23
+ /**
24
+ * Load plugin translation
25
+ *
26
+ * @return void
27
+ */
28
+ static function load_textdomain()
29
+ {
30
+ // l18n translation files
31
+ $locale = get_locale();
32
+ $dir = trailingslashit( RWMB_DIR . 'lang' );
33
+ $mofile = "{$dir}{$locale}.mo";
34
+
35
+ // In themes/plugins/mu-plugins directory
36
+ load_textdomain( 'rwmb', $mofile );
37
+ }
38
+ }
39
+
40
+ RWMB_Common::on_load();
41
+ }
inc/fields/checkbox-list.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Checkbox_List_Field' ) )
6
+ {
7
+ class RWMB_Checkbox_List_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ if ( ! is_array( $meta ) )
21
+ $meta = (array) $meta;
22
+
23
+ $html = array();
24
+ $name = "name='{$field['field_name']}'";
25
+
26
+ foreach ( $field['options'] as $key => $value )
27
+ {
28
+ $val = " value='{$key}'";
29
+ $checked = checked( in_array( $key, $meta ), true, false );
30
+ $html[] = "<label><input type='checkbox' class='rwmb-checkbox-list'{$name}{$val}{$checked} /> {$value}</label>";
31
+ }
32
+ return implode( '<br />', $html );
33
+ }
34
+
35
+ /**
36
+ * Normalize parameters for field
37
+ *
38
+ * @param array $field
39
+ *
40
+ * @return array
41
+ */
42
+ static function normalize_field( $field )
43
+ {
44
+ $field['multiple'] = true;
45
+ $field['std'] = empty( $field['std'] ) ? array() : $field['std'];
46
+ $field['field_name'] = "{$field['id']}[]";
47
+ return $field;
48
+ }
49
+ }
50
+ }
inc/fields/checkbox.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Checkbox_Field' ) )
6
+ {
7
+ class RWMB_Checkbox_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ $checked = checked( ! empty( $meta ), true, false );
21
+ $name = "name='{$field['field_name']}'";
22
+ $id = " id='{$field['id']}'";
23
+ $html = "<input type='checkbox' class='rwmb-checkbox'{$name}{$id}{$checked} />";
24
+
25
+ return $html;
26
+ }
27
+
28
+ /**
29
+ * Set the value of checkbox to 1 or 0 instead of 'checked' and empty string
30
+ * This prevents using default value once the checkbox has been unchecked
31
+ *
32
+ * @link https://github.com/rilwis/meta-box/issues/6
33
+ *
34
+ * @param mixed $new
35
+ * @param mixed $old
36
+ * @param int $post_id
37
+ * @param array $field
38
+ *
39
+ * @return int
40
+ */
41
+ static function value( $new, $old, $post_id, $field )
42
+ {
43
+ return empty( $new ) ? 0 : 1;
44
+ }
45
+ }
46
+ }
inc/fields/color.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Color_Field' ) )
6
+ {
7
+ class RWMB_Color_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ wp_enqueue_style( 'rwmb-color', RWMB_CSS_URL.'color.css', array( 'farbtastic' ), RWMB_VER );
17
+ wp_enqueue_script( 'rwmb-color', RWMB_JS_URL.'color.js', array( 'farbtastic' ), RWMB_VER, true );
18
+ }
19
+
20
+ /**
21
+ * Get field HTML
22
+ *
23
+ * @param string $html
24
+ * @param mixed $meta
25
+ * @param array $field
26
+ *
27
+ * @return string
28
+ */
29
+ static function html( $html, $meta, $field )
30
+ {
31
+ if ( empty( $meta ) )
32
+ $meta = '#';
33
+ $name = " name='{$field['field_name']}'";
34
+ $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'";
35
+ $value = " value='{$meta}'";
36
+
37
+ $html = <<<HTML
38
+ <input class="rwmb-color" type="text"{$name}{$id}{$value} size="8" />
39
+ <div class="rwmb-color-picker"></div>
40
+ HTML;
41
+
42
+ return $html;
43
+ }
44
+ }
45
+ }
inc/fields/date.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Date_Field' ) )
6
+ {
7
+ class RWMB_Date_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ $url = RWMB_CSS_URL . 'jqueryui';
17
+ wp_register_style( 'jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17' );
18
+ wp_register_style( 'jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17' );
19
+ wp_enqueue_style( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' );
20
+
21
+ $url = RWMB_JS_URL . 'jqueryui';
22
+ wp_register_script( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.min.js", array( 'jquery-ui-core' ), '1.8.17', true );
23
+ wp_enqueue_script( 'rwmb-date', RWMB_JS_URL . 'date.js', array( 'jquery-ui-datepicker' ), RWMB_VER, true );
24
+ }
25
+
26
+ /**
27
+ * Get field HTML
28
+ *
29
+ * @param string $html
30
+ * @param mixed $meta
31
+ * @param array $field
32
+ *
33
+ * @return string
34
+ */
35
+ static function html( $html, $meta, $field )
36
+ {
37
+ $name = " name='{$field['field_name']}'";
38
+ $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'";
39
+ $value = " value='{$meta}'";
40
+ $size = " size='{$field['size']}'";
41
+ $format = " rel='{$field['format']}'";
42
+
43
+ $html = "<input type='text' class='rwmb-date'{$name}{$id}{$value}{$size}{$format} />";
44
+
45
+ return $html;
46
+ }
47
+
48
+ /**
49
+ * Normalize parameters for field
50
+ *
51
+ * @param array $field
52
+ *
53
+ * @return array
54
+ */
55
+ static function normalize_field( $field )
56
+ {
57
+ $field['format'] = empty( $field['format'] ) ? 'yy-mm-dd' : $field['format'];
58
+ $field['size'] = empty( $field['size'] ) ? 10 : $field['size'];
59
+ return $field;
60
+ }
61
+ }
62
+ }
inc/fields/datetime.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Datetime_Field' ) )
6
+ {
7
+ class RWMB_Datetime_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts( )
15
+ {
16
+ $url = RWMB_CSS_URL . 'jqueryui';
17
+ wp_register_style( 'jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17' );
18
+ wp_register_style( 'jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17' );
19
+ wp_register_style( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' );
20
+ wp_register_style( 'jquery-ui-slider', "{$url}/jquery.ui.slider.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' );
21
+ wp_enqueue_style( 'jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.css", array( 'jquery-ui-datepicker', 'jquery-ui-slider' ), '0.9.7' );
22
+
23
+ $url = RWMB_JS_URL . 'jqueryui';
24
+ wp_register_script( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.min.js", array( 'jquery-ui-core' ), '1.8.17', true );
25
+ wp_register_script( 'jquery-ui-slider', "{$url}/jquery.ui.slider.min.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse' ), '1.8.17', true );
26
+ wp_register_script( 'jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.js", array( 'jquery-ui-datepicker', 'jquery-ui-slider' ), '0.9.7', true );
27
+ wp_enqueue_script( 'rwmb-datetime', RWMB_JS_URL . 'datetime.js', array( 'jquery-ui-timepicker' ), RWMB_VER, true );
28
+ }
29
+
30
+ /**
31
+ * Get field HTML
32
+ *
33
+ * @param string $html
34
+ * @param mixed $meta
35
+ * @param array $field
36
+ *
37
+ * @return string
38
+ */
39
+ static function html( $html, $meta, $field )
40
+ {
41
+ $name = " name='{$field['field_name']}'";
42
+ $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'";
43
+ $value = " value='{$meta}'";
44
+ $size = " size='{$field['size']}'";
45
+ $format = " rel='{$field['format']}'";
46
+ $html .= "<input type='text' class='rwmb-datetime'{$name}{$id}{$value}{$size}{$format} />";
47
+
48
+ return $html;
49
+ }
50
+
51
+ /**
52
+ * Normalize parameters for field
53
+ *
54
+ * @param array $field
55
+ *
56
+ * @return array
57
+ */
58
+ static function normalize_field( $field )
59
+ {
60
+ $field['format'] = empty( $field['format'] ) ? 'yy-mm-dd hh:ss' : $field['format'];
61
+ $field['size'] = empty( $field['size'] ) ? 20 : $field['size'];
62
+ return $field;
63
+ }
64
+ }
65
+ }
inc/fields/file.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_File_Field' ) )
6
+ {
7
+ class RWMB_File_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ wp_enqueue_script( 'rwmb-file', RWMB_JS_URL . 'file.js', array( 'jquery', 'wp-ajax-response' ), RWMB_VER, true );
17
+ }
18
+
19
+ /**
20
+ * Add actions
21
+ *
22
+ * @return void
23
+ */
24
+ static function add_actions()
25
+ {
26
+ // Add data encoding type for file uploading
27
+ add_action( 'post_edit_form_tag', array( __CLASS__, 'post_edit_form_tag' ) );
28
+
29
+ // Delete file via Ajax
30
+ add_action( 'wp_ajax_rwmb_delete_file', array( __CLASS__, 'wp_ajax_delete_file' ) );
31
+ }
32
+
33
+ /**
34
+ * Add data encoding type for file uploading
35
+ *
36
+ * @return void
37
+ */
38
+ static function post_edit_form_tag()
39
+ {
40
+ echo ' enctype="multipart/form-data"';
41
+ }
42
+
43
+ /**
44
+ * Ajax callback for deleting files.
45
+ * Modified from a function used by "Verve Meta Boxes" plugin
46
+ *
47
+ * @link http://goo.gl/LzYSq
48
+ * @return void
49
+ */
50
+ static function wp_ajax_delete_file()
51
+ {
52
+ $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0;
53
+ $field_id = isset( $_POST['field_id'] ) ? $_POST['field_id'] : 0;
54
+ $attachment_id = isset( $_POST['attachment_id'] ) ? intval( $_POST['attachment_id'] ) : 0;
55
+
56
+ check_admin_referer( "rwmb-delete-file_{$field_id}" );
57
+
58
+ $ok = delete_post_meta( $post_id, $field_id, $attachment_id );
59
+ $ok = $ok && wp_delete_attachment( $attachment_id );
60
+
61
+ if ( $ok )
62
+ RW_Meta_Box::ajax_response( '', 'success' );
63
+ else
64
+ RW_Meta_Box::ajax_response( __( 'Error: Cannot delete file', 'rwmb' ), 'error' );
65
+ }
66
+
67
+ /**
68
+ * Get field HTML
69
+ *
70
+ * @param string $html
71
+ * @param mixed $meta
72
+ * @param array $field
73
+ *
74
+ * @return string
75
+ */
76
+ static function html( $html, $meta, $field )
77
+ {
78
+ $i18n_msg = _x( 'Uploaded files', 'file upload', 'rwmb' );
79
+ $i18n_del_file = _x( 'Delete this file', 'file upload', 'rwmb' );
80
+ $i18n_delete = _x( 'Delete', 'file upload', 'rwmb' );
81
+ $i18n_title = _x( 'Upload files', 'file upload', 'rwmb' );
82
+ $i18n_more = _x( '+ Add new file', 'file upload', 'rwmb' );
83
+
84
+ $html = wp_nonce_field( "rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false );
85
+ $html .= "<input type='hidden' class='field-id' value='{$field['id']}' />";
86
+
87
+ // Uploaded files
88
+ if ( ! empty( $meta ) )
89
+ {
90
+ $html .= "<h4>{$i18n_msg}</h4>";
91
+ $html .= '<ol class="rwmb-uploaded">';
92
+
93
+ foreach ( $meta as $attachment_id )
94
+ {
95
+ $attachment = wp_get_attachment_link( $attachment_id );
96
+ $html .= "<li>{$attachment} (<a title='{$i18n_del_file}' class='rwmb-delete-file' href='#' rel='{$attachment_id}'>{$i18n_delete}</a>)</li>";
97
+ }
98
+
99
+ $html .= '</ol>';
100
+ }
101
+
102
+ // Show form upload
103
+ $html .= "
104
+ <h4>{$i18n_title}</h4>
105
+ <div class='new-files'>
106
+ <div class='file-input'><input type='file' name='{$field['id']}[]' /></div>
107
+ <a class='rwmb-add-file' href='#'><strong>{$i18n_more}</strong></a>
108
+ </div>
109
+ ";
110
+
111
+ return $html;
112
+ }
113
+
114
+ /**
115
+ * Save file field
116
+ *
117
+ * @param mixed $new
118
+ * @param mixed $old
119
+ * @param int $post_id
120
+ * @param array $field
121
+ */
122
+ static function save( $new, $old, $post_id, $field )
123
+ {
124
+ $name = $field['id'];
125
+ if ( empty( $_FILES[ $name ] ) )
126
+ return;
127
+
128
+ $files = self::fix_file_array( $_FILES[ $name ] );
129
+
130
+ foreach ( $files as $file_item )
131
+ {
132
+ $file = wp_handle_upload( $file_item, array( 'test_form' => false ) );
133
+
134
+ if ( ! isset( $file['file'] ) )
135
+ continue;
136
+
137
+ $file_name = $file['file'];
138
+
139
+ $attachment = array(
140
+ 'post_mime_type' => $file['type'],
141
+ 'guid' => $file['url'],
142
+ 'post_parent' => $post_id,
143
+ 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $file_name ) ),
144
+ 'post_content' => '',
145
+ );
146
+ $id = wp_insert_attachment( $attachment, $file_name, $post_id );
147
+
148
+ if ( ! is_wp_error( $id ) )
149
+ {
150
+ wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file_name ) );
151
+
152
+ // Save file ID in meta field
153
+ add_post_meta( $post_id, $name, $id, false );
154
+ }
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Fixes the odd indexing of multiple file uploads from the format:
160
+ * $_FILES['field']['key']['index']
161
+ * To the more standard and appropriate:
162
+ * $_FILES['field']['index']['key']
163
+ *
164
+ * @param array $files
165
+ *
166
+ * @return array
167
+ */
168
+ static function fix_file_array( $files )
169
+ {
170
+ $output = array();
171
+ foreach ( $files as $key => $list )
172
+ {
173
+ foreach ( $list as $index => $value )
174
+ {
175
+ $output[$index][$key] = $value;
176
+ }
177
+ }
178
+ return $output;
179
+ }
180
+
181
+ /**
182
+ * Normalize parameters for field
183
+ *
184
+ * @param array $field
185
+ *
186
+ * @return array
187
+ */
188
+ static function normalize_field( $field )
189
+ {
190
+ $field['multiple'] = true;
191
+ $field['std'] = empty( $field['std'] ) ? array() : $field['std'];
192
+ return $field;
193
+ }
194
+ }
195
+ }
inc/fields/hidden.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Hidden_Field' ) )
6
+ {
7
+ class RWMB_Hidden_Field
8
+ {
9
+ /**
10
+ * Show begin HTML markup for fields
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function begin_html( $html, $meta, $field )
19
+ {
20
+ return '<div class="hidden">';
21
+ }
22
+
23
+ /**
24
+ * Get field HTML
25
+ *
26
+ * @param string $html
27
+ * @param mixed $meta
28
+ * @param array $field
29
+ *
30
+ * @return string
31
+ */
32
+ static function html( $html, $meta, $field )
33
+ {
34
+ $val = " value='{$meta}'";
35
+ $name = " name='{$field['field_name']}'";
36
+ $id = " id='{$field['id']}'";
37
+ $html .= "<input type='hidden' class='rwmb-hidden'{$name}{$id}{$val} />";
38
+
39
+ return $html;
40
+ }
41
+ }
42
+ }
inc/fields/image.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Image_Field' ) )
6
+ {
7
+ class RWMB_Image_Field extends RWMB_File_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ // Enqueue same scripts and styles as for file field
17
+ parent::admin_enqueue_scripts();
18
+
19
+ wp_enqueue_style( 'rwmb-image', RWMB_CSS_URL . 'image.css', array(), RWMB_VER );
20
+
21
+ wp_enqueue_script( 'rwmb-image', RWMB_JS_URL . 'image.js', array( 'jquery-ui-sortable', 'wp-ajax-response' ), RWMB_VER, true );
22
+ }
23
+
24
+ /**
25
+ * Add actions
26
+ *
27
+ * @return void
28
+ */
29
+ static function add_actions()
30
+ {
31
+ // Do same actions as file field
32
+ parent::add_actions();
33
+
34
+ // Reorder images via Ajax
35
+ add_action( 'wp_ajax_rwmb_reorder_images', array( __CLASS__, 'wp_ajax_reorder_images' ) );
36
+ }
37
+
38
+ /**
39
+ * Ajax callback for reordering images
40
+ *
41
+ * @return void
42
+ */
43
+ static function wp_ajax_reorder_images()
44
+ {
45
+ $field_id = isset( $_POST['field_id'] ) ? $_POST['field_id'] : 0;
46
+ $order = isset( $_POST['order'] ) ? $_POST['order'] : 0;
47
+
48
+ check_admin_referer( "rwmb-reorder-images_{$field_id}" );
49
+
50
+ parse_str( $order, $items );
51
+ $items = $items['item'];
52
+ $order = 1;
53
+
54
+ foreach ( $items as $item )
55
+ {
56
+ wp_update_post(
57
+ array(
58
+ 'ID' => $item,
59
+ 'menu_order' => $order++,
60
+ )
61
+ );
62
+ }
63
+
64
+ RW_Meta_Box::ajax_response( __( 'Order saved', 'rwmb' ), 'success' );
65
+ }
66
+
67
+ /**
68
+ * Get field HTML
69
+ *
70
+ * @param string $html
71
+ * @param mixed $meta
72
+ * @param array $field
73
+ *
74
+ * @return string
75
+ */
76
+ static function html( $html, $meta, $field )
77
+ {
78
+ global $wpdb;
79
+
80
+ $i18n_msg = _x( 'Uploaded files', 'image upload', 'rwmb' );
81
+ $i18n_del_file = _x( 'Delete this file', 'image upload', 'rwmb' );
82
+ $i18n_delete = _x( 'Delete', 'image upload', 'rwmb' );
83
+ $i18n_edit = _x( 'Edit', 'image upload', 'rwmb' );
84
+ $i18n_title = _x( 'Upload files', 'image upload', 'rwmb' );
85
+ $i18n_more = _x( '+ Add new image', 'image upload', 'rwmb' );
86
+
87
+ $html = wp_nonce_field( "rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false );
88
+ $html .= wp_nonce_field( "rwmb-reorder-images_{$field['id']}", "nonce-reorder-images_{$field['id']}", false, false );
89
+ $html .= "<input type='hidden' class='field-id' value='{$field['id']}' />";
90
+
91
+ // Uploaded images
92
+ if ( ! empty( $meta ) )
93
+ {
94
+ $html .= "<h4>{$i18n_msg}</h4>";
95
+ $html .= "<ul class='rwmb-images rwmb-uploaded'>";
96
+
97
+ foreach ( $meta as $image )
98
+ {
99
+ $src = wp_get_attachment_image_src( $image, 'thumbnail' );
100
+ $src = $src[0];
101
+ $link = get_edit_post_link( $image );
102
+
103
+ $html .= "<li id='item_{$image}'>
104
+ <img src='{$src}' />
105
+ <div class='rwmb-image-bar'>
106
+ <a title='{$i18n_edit}' class='rwmb-edit-file' href='{$link}' target='_blank'>{$i18n_edit}</a> |
107
+ <a title='{$i18n_del_file}' class='rwmb-delete-file' href='#' rel='{$image}'>{$i18n_delete}</a>
108
+ </div>
109
+ </li>";
110
+ }
111
+
112
+ $html .= '</ul>';
113
+ }
114
+
115
+ // Show form upload
116
+ $html .= "
117
+ <h4>{$i18n_title}</h4>
118
+ <div class='new-files'>
119
+ <div class='file-input'><input type='file' name='{$field['id']}[]' /></div>
120
+ <a class='rwmb-add-file' href='#'><strong>{$i18n_more}</strong></a>
121
+ </div>";
122
+
123
+ return $html;
124
+ }
125
+
126
+ /**
127
+ * Standard meta retrieval
128
+ *
129
+ * @param mixed $meta
130
+ * @param int $post_id
131
+ * @param array $field
132
+ * @param bool $saved
133
+ *
134
+ * @return mixed
135
+ */
136
+ static function meta( $meta, $post_id, $saved, $field )
137
+ {
138
+ global $wpdb;
139
+
140
+ $meta = RW_Meta_Box::meta( $meta, $post_id, $saved, $field );
141
+
142
+ if ( empty( $meta ) )
143
+ return array();
144
+
145
+ $meta = implode( ',' , $meta );
146
+
147
+ // Re-arrange images with 'menu_order'
148
+ $meta = $wpdb->get_col( "
149
+ SELECT ID FROM {$wpdb->posts}
150
+ WHERE post_type = 'attachment'
151
+ AND ID in ({$meta})
152
+ ORDER BY menu_order ASC
153
+ " );
154
+
155
+ return (array) $meta;
156
+ }
157
+ }
158
+ }
inc/fields/number.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Number_Field' ) )
6
+ {
7
+ class RWMB_Number_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ $name = " name='{$field['field_name']}'";
21
+ $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'";
22
+ $value = " value='{$meta}'";
23
+ $step = " step='{$field['step']}'";
24
+ $min = " min='{$field['min']}'";
25
+
26
+ $html .= "<input type='number' class='rwmb-number'{$name}{$id}{$value}{$step}{$min} />";
27
+
28
+ return $html;
29
+ }
30
+
31
+ /**
32
+ * Normalize parameters for field
33
+ *
34
+ * @param array $field
35
+ *
36
+ * @return array
37
+ */
38
+ static function normalize_field( $field )
39
+ {
40
+ if ( empty( $field['step'] ) )
41
+ $field['step'] = 1;
42
+ if ( empty( $field['min'] ) )
43
+ $field['min'] = 0;
44
+ return $field;
45
+ }
46
+ }
47
+ }
inc/fields/password.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Password_Field' ) )
6
+ {
7
+ class RWMB_Password_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ $val = " value='{$meta}'";
21
+ $name = "name='{$field['field_name']}'";
22
+ $id = " id='{$field['id']}'";
23
+ $html .= "<input type='password' class='rwmb-password'{$name}{$id}{$val} size='30' />";
24
+
25
+ return $html;
26
+ }
27
+ }
28
+ }
inc/fields/plupload-image.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Plupload_Image_Field' ) )
6
+ {
7
+ class RWMB_Plupload_Image_Field extends RWMB_Image_Field
8
+ {
9
+ /**
10
+ * Add field actions
11
+ *
12
+ * @return void
13
+ */
14
+ static function add_actions()
15
+ {
16
+ parent::add_actions();
17
+ add_action( 'wp_ajax_plupload_image_upload', array( __CLASS__, 'handle_upload' ) );
18
+ }
19
+
20
+ /**
21
+ * Upload
22
+ * Ajax callback function
23
+ *
24
+ * @return string Error or (XML-)response
25
+ */
26
+ static function handle_upload()
27
+ {
28
+ check_admin_referer( 'rwmb-upload-images_' . $_REQUEST['field_id'] );
29
+
30
+ $post_id = 0;
31
+ if ( is_numeric( $_REQUEST['post_id'] ) )
32
+ $post_id = (int) $_REQUEST['post_id'];
33
+
34
+ // You can use WP's wp_handle_upload() function:
35
+ $file = $_FILES['async-upload'];
36
+ $file_attr = wp_handle_upload(
37
+ $file, array(
38
+ 'test_form' => true,
39
+ 'action' => 'plupload_image_upload',
40
+ )
41
+ );
42
+ $attachment = array(
43
+ 'guid' => $file_attr['url'],
44
+ 'post_mime_type' => $file_attr['type'],
45
+ 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $file['name'] ) ),
46
+ 'post_content' => '',
47
+ 'post_status' => 'inherit',
48
+ );
49
+
50
+ // Adds file as attachment to WordPress
51
+ $id = wp_insert_attachment( $attachment, $file_attr['file'], $post_id );
52
+ if ( ! is_wp_error( $id ) )
53
+ {
54
+ wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file_attr['file'] ) );
55
+
56
+ // Save file ID in meta field
57
+ if ( isset( $_REQUEST['field_id'] ) )
58
+ add_post_meta( $post_id, $_REQUEST['field_id'], $id, false );
59
+
60
+ $response = new WP_Ajax_Response();
61
+ $response->add(
62
+ array(
63
+ 'what' => 'rwmb_image_response',
64
+ 'data' => self::img_html( $id ),
65
+ )
66
+ );
67
+ $response->send();
68
+ }
69
+
70
+ exit;
71
+ }
72
+
73
+ /**
74
+ * Enqueue scripts and styles
75
+ *
76
+ * @return void
77
+ */
78
+ static function admin_enqueue_scripts()
79
+ {
80
+ // Enqueue same scripts and styles as for file field
81
+ parent::admin_enqueue_scripts();
82
+ wp_enqueue_style( 'rwmb-plupload-image', RWMB_CSS_URL . 'plupload-image.css', array(), RWMB_VER );
83
+ wp_enqueue_script( 'rwmb-plupload-image', RWMB_JS_URL . 'plupload-image.js', array( 'jquery-ui-sortable', 'wp-ajax-response', 'plupload-all' ), RWMB_VER, true );
84
+ wp_localize_script( 'rwmb-plupload-image', 'RWMB', array( 'url' => RWMB_URL ) );
85
+ wp_localize_script(
86
+ 'rwmb-plupload-image', 'rwmb_plupload_defaults', array(
87
+ 'runtimes' => 'html5,silverlight,flash,html4',
88
+ 'file_data_name' => 'async-upload',
89
+ 'multiple_queues' => true,
90
+ 'max_file_size' => wp_max_upload_size() . 'b',
91
+ 'url' => admin_url( 'admin-ajax.php' ),
92
+ 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
93
+ 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
94
+ 'filters' => array(
95
+ array(
96
+ 'title' => _x( 'Allowed Image Files', 'image upload', 'rwmb' ),
97
+ 'extensions' => 'jpg,jpeg,gif,png',
98
+ ),
99
+ ),
100
+ 'multipart' => true,
101
+ 'urlstream_upload' => true,
102
+ )
103
+ );
104
+ }
105
+
106
+ /**
107
+ * Get image html
108
+ *
109
+ * @param int $img_id
110
+ *
111
+ * @return string
112
+ */
113
+ static function img_html( $img_id )
114
+ {
115
+ $i18n_del_file = _x( 'Delete this file', 'image upload', 'rwmb' );
116
+ $i18n_delete = _x( 'Delete', 'image upload', 'rwmb' );
117
+ $i18n_edit = _x( 'Edit', 'image upload', 'rwmb' );
118
+
119
+ $src = wp_get_attachment_image_src( $img_id, 'thumbnail' );
120
+ $src = $src[0];
121
+ $link = get_edit_post_link( $img_id );
122
+
123
+ $html = <<<HTML
124
+ <li id='item_{$img_id}'>
125
+ <img src='{$src}' />
126
+ <div class='rwmb-image-bar'>
127
+ <a title='{$i18n_edit}' class='rwmb-edit-file' href='{$link}' target='_blank'>{$i18n_edit}</a> |
128
+ <a title='{$i18n_del_file}' class='rwmb-delete-file' href='#' rel='{$img_id}'>{$i18n_delete}</a>
129
+ </div>
130
+ </li>
131
+ HTML;
132
+ return $html;
133
+ }
134
+
135
+ /**
136
+ * Get field HTML
137
+ *
138
+ * @param string $html
139
+ * @param mixed $meta
140
+ * @param array $field
141
+ *
142
+ * @return string
143
+ */
144
+ static function html( $html, $meta, $field )
145
+ {
146
+ if ( ! is_array( $meta ) )
147
+ $meta = ( array ) $meta;
148
+
149
+ $i18n_msg = _x( 'Uploaded files', 'image upload', 'rwmb' );
150
+ $i18n_title = _x( 'Upload files', 'image upload', 'rwmb' );
151
+
152
+ // Filter to change the drag & drop box background string
153
+ $i18n_drop = apply_filters( 'rwmb_upload_drop_string', _x( 'Drop images here', 'image upload', 'rwmb' ) );
154
+ $i18n_or = _x( 'or', 'image upload', 'rwmb' );
155
+ $i18n_select = _x( 'Select Files', 'image upload', 'rwmb' );
156
+ $img_prefix = $field['id'];
157
+
158
+ $html = wp_nonce_field( "rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false );
159
+ $html .= wp_nonce_field( "rwmb-reorder-images_{$field['id']}", "nonce-reorder-images_{$field['id']}", false, false );
160
+ $html .= wp_nonce_field( "rwmb-upload-images_{$field['id']}", "nonce-upload-images_{$field['id']}", false, false );
161
+ $html .= "<input type='hidden' class='field-id rwmb-image-prefix' value='{$field['id']}' />";
162
+
163
+ // Uploaded images
164
+ $html .= "<div id='{$img_prefix}-container'>";
165
+
166
+ // Check for max_file_uploads
167
+ $class = 'rwmb-drag-drop hide-if-no-js';
168
+ if ( ! empty( $field['max_file_uploads'] ) )
169
+ {
170
+ $max_file_uploads = (int) $field['max_file_uploads'];
171
+ $html .= "<input class='max_file_uploads' type='hidden' value='{$max_file_uploads}' />";
172
+ if ( count( $meta ) >= $max_file_uploads )
173
+ $class = RW_Meta_Box::add_cssclass( 'hidden', $class );
174
+ }
175
+
176
+ $html .= "<h4 class='rwmb-uploaded-title'>{$i18n_msg}</h4>";
177
+ $html .= "<ul class='rwmb-images rwmb-uploaded'>";
178
+ foreach ( $meta as $image )
179
+ {
180
+ $html .= self::img_html( $image );
181
+ }
182
+ $html .= '</ul>';
183
+
184
+ // Show form upload
185
+ $html .= "
186
+ <h4>{$i18n_title}</h4>
187
+ <div id='{$img_prefix}-dragdrop' class='{$class}'>
188
+ <div class = 'rwmb-drag-drop-inside'>
189
+ <p>{$i18n_drop}</p>
190
+ <p>{$i18n_or}</p>
191
+ <p><input id='{$img_prefix}-browse-button' type='button' value='{$i18n_select}' class='button' /></p>
192
+ </div>
193
+ </div>
194
+ ";
195
+
196
+ $html .= '</div>';
197
+
198
+ return $html;
199
+ }
200
+ }
201
+ }
inc/fields/radio.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Radio_Field' ) )
6
+ {
7
+ class RWMB_Radio_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ $html = '';
21
+ $name = "name='{$field['field_name']}'";
22
+
23
+ foreach ( $field['options'] as $key => $label )
24
+ {
25
+ $id = strstr( $field['id'], '[]' ) ? str_replace( '[]', "-{$key}[]", $field['id'] ) : $field['id'];
26
+ $id = " id='{$id}'";
27
+ $value = " value='{$key}'";
28
+ $checked = checked( $meta, $key, false );
29
+
30
+ $html .= "<label><input type='radio' class='rwmb-radio'{$name}{$id}{$value}{$checked} /> {$label}</label> ";
31
+ }
32
+
33
+ return $html;
34
+ }
35
+ }
36
+ }
inc/fields/select.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Select_Field' ) )
6
+ {
7
+ class RWMB_Select_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts( )
15
+ {
16
+ wp_enqueue_style( 'rwmb-select', RWMB_CSS_URL.'select.css', RWMB_VER );
17
+ }
18
+
19
+ /**
20
+ * Get field HTML
21
+ *
22
+ * @param string $html
23
+ * @param mixed $meta
24
+ * @param array $field
25
+ *
26
+ * @return string
27
+ */
28
+ static function html( $html, $meta, $field )
29
+ {
30
+ if ( ! is_array( $meta ) )
31
+ $meta = (array) $meta;
32
+
33
+ $name = " name='{$field['field_name']}'";
34
+ $id = " id='{$field['id']}'";
35
+ $multiple = $field['multiple'] ? " multiple='multiple'" : '' ;
36
+
37
+ $html = "<select class='rwmb-select'{$name}{$id}{$multiple}>";
38
+ foreach ( $field['options'] as $key => $value )
39
+ {
40
+ $selected = selected( in_array( $key, $meta ), true, false );
41
+ $html .= "<option value='{$key}'{$selected}>{$value}</option>";
42
+ }
43
+ $html .= '</select>';
44
+
45
+ return $html;
46
+ }
47
+
48
+ /**
49
+ * Normalize parameters for field
50
+ *
51
+ * @param array $field
52
+ *
53
+ * @return array
54
+ */
55
+ static function normalize_field( $field )
56
+ {
57
+ $field['multiple'] = false;
58
+ return $field;
59
+ }
60
+ }
61
+ }
inc/fields/slider.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Slider_Field' ) )
6
+ {
7
+ class RWMB_Slider_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ $url = RWMB_CSS_URL . 'jqueryui';
17
+ wp_enqueue_style( 'jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17' );
18
+ wp_enqueue_style( 'jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17' );
19
+
20
+ $url = RWMB_JS_URL . 'jqueryui';
21
+ wp_enqueue_script( 'jquery-ui-slider', "{$url}/jquery.ui.slider.min.js", array( 'jquery-ui-core' ), '1.8.17', true );
22
+ wp_enqueue_script( 'rwmb-slider', RWMB_JS_URL . 'slider.js', array( 'jquery-ui-slider' ), RWMB_VER, true );
23
+ }
24
+
25
+ /**
26
+ * Get div HTML
27
+ *
28
+ * @param string $html
29
+ * @param mixed $meta
30
+ * @param array $field
31
+ *
32
+ * @return string
33
+ */
34
+ static function html( $html, $meta, $field )
35
+ {
36
+ $id = " id='{$field['id']}'";
37
+ $name = "name='{$field['field_name']}'";
38
+ $val = " value='{$meta}'";
39
+ $for = " for='{$field['id']}'";
40
+ $format = " rel='{$field['format']}'";
41
+ $html .= "
42
+ <div class='clearfix'>
43
+ <div class='rwmb-slider'{$format}{$id}></div>
44
+ <input type='hidden'{$name}{$val} />
45
+ </div>";
46
+
47
+ return $html;
48
+ }
49
+ }
50
+ }
inc/fields/taxonomy.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Taxonomy_Field' ) )
6
+ {
7
+ class RWMB_Taxonomy_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ wp_enqueue_style(
17
+ 'rwmb-taxonomy',
18
+ RWMB_CSS_URL . 'taxonomy.css',
19
+ RWMB_VER
20
+ );
21
+ wp_enqueue_script(
22
+ 'rwmb-taxonomy',
23
+ RWMB_JS_URL . 'taxonomy.js',
24
+ array( 'jquery', 'wp-ajax-response' ),
25
+ RWMB_VER,
26
+ true
27
+ );
28
+ }
29
+
30
+ /**
31
+ * Add default value for 'taxonomy' field
32
+ *
33
+ * @param $field
34
+ *
35
+ * @return array
36
+ */
37
+ static function normalize_field( $field )
38
+ {
39
+ // Default query arguments for get_terms() function
40
+ $default_args = array(
41
+ 'hide_empty' => false,
42
+ );
43
+
44
+ if ( ! isset( $field['options']['args'] ) )
45
+ $field['options']['args'] = $default_args;
46
+ else
47
+ $field['options']['args'] = wp_parse_args( $field['options']['args'], $default_args );
48
+
49
+ // Show field as checkbox list by default
50
+ if ( ! isset( $field['options']['type'] ) )
51
+ $field['options']['type'] = 'checkbox_list';
52
+
53
+ // If field is shown as checkbox list, add multiple value
54
+ if ( in_array( $field['options']['type'], array( 'checkbox_list', 'checkbox_tree' ) ) )
55
+ {
56
+ $field['multiple'] = true;
57
+ $field['field_name'] = "{$field['id']}[]";
58
+ }
59
+
60
+ // For select tree: display it as a normal select box (no multiple attribute), but allows to save multiple values
61
+ if ( 'select_tree' == $field['options']['type'] )
62
+ $field['field_name'] = "{$field['id']}[]";
63
+
64
+ if ( in_array( $field['options']['type'], array( 'checkbox_tree', 'select_tree' ) ) )
65
+ {
66
+ if ( isset( $field['options']['args']['parent'] ) )
67
+ {
68
+ $field['options']['parent'] = $field['options']['args']['parent'];
69
+ unset( $field['options']['args']['parent'] );
70
+ }
71
+ else
72
+ {
73
+ $field['options']['parent'] = 0;
74
+ }
75
+ }
76
+
77
+ return $field;
78
+ }
79
+
80
+ /**
81
+ * Get field HTML
82
+ *
83
+ * @param $html
84
+ * @param $field
85
+ * @param $meta
86
+ *
87
+ * @return string
88
+ */
89
+ static function html( $html, $meta, $field )
90
+ {
91
+
92
+ $options = $field['options'];
93
+ $terms = get_terms( $options['taxonomy'], $options['args'] );
94
+
95
+ $html = '';
96
+ // Checkbox LIST
97
+ if ( 'checkbox_list' === $options['type'] )
98
+ {
99
+ $html = array();
100
+ foreach ( $terms as $term )
101
+ {
102
+ $checked = checked( in_array( $term->slug, $meta ), true, false );
103
+ $html[] = "<label><input type='checkbox' name='{$field['field_name']}' value='{$term->slug}'{$checked} /> {$term->name}</label>";
104
+ }
105
+ $html = implode( '<br />', $html );
106
+ }
107
+ // Checkbox TREE
108
+ elseif ( 'checkbox_tree' === $options['type'] )
109
+ {
110
+ $elements = self::process_terms( $terms );
111
+ $html .= self::walk_checkbox_tree( $meta, $field, $elements, $field['options']['parent'], true );
112
+ }
113
+ // Select TREE
114
+ elseif ( 'select_tree' === $options['type'] )
115
+ {
116
+ $elements = self::process_terms( $terms );
117
+ $html .= self::walk_select_tree( $meta, $field, $elements, $field['options']['parent'], '', true );
118
+ }
119
+ // Select
120
+ else
121
+ {
122
+ $multiple = $field['multiple'] ? " multiple='multiple' style='height: auto;'" : '';
123
+ $html .= "<select name='{$field['field_name']}'{$multiple}>";
124
+ foreach ( $terms as $term )
125
+ {
126
+ $selected = selected( in_array( $term->slug, $meta ), true, false );
127
+ $html .= "<option value='{$term->slug}'{$selected}>{$term->name}</option>";
128
+ }
129
+ $html .= '</select>';
130
+ }
131
+
132
+ return $html;
133
+ }
134
+
135
+ /**
136
+ * Walker for displaying checkboxes in treeformat
137
+ *
138
+ * @param $meta
139
+ * @param $field
140
+ * @param $elements
141
+ * @param int $parent
142
+ * @param bool $active
143
+ *
144
+ * @return string
145
+ */
146
+ static function walk_checkbox_tree( $meta, $field, $elements, $parent = 0, $active = false )
147
+ {
148
+ if ( ! isset( $elements[$parent] ) )
149
+ return;
150
+ $terms = $elements[$parent];
151
+ $hidden = ( !$active ? 'hidden' : '' );
152
+
153
+ $html = "<ul class = 'rw-taxonomy-tree {$hidden}'>";
154
+ foreach ( $terms as $term )
155
+ {
156
+ $checked = checked( in_array( $term->slug, $meta ), true, false );
157
+ $html .= "<li><label><input type='checkbox' name='{$field['field_name']}' value='{$term->slug}'{$checked} /> {$term->name}</label>";
158
+ $html .= self::walk_checkbox_tree( $meta, $field, $elements, $term->term_id, ( in_array( $term->slug, $meta ) ) && $active ) . '</li>';
159
+ }
160
+ $html .= '</ul>';
161
+
162
+ return $html;
163
+ }
164
+
165
+ /**
166
+ * Walker for displaying select in treeformat
167
+ *
168
+ * @param $meta
169
+ * @param $field
170
+ * @param $elements
171
+ * @param int $parent
172
+ * @param string $parent_slug
173
+ * @param bool $active
174
+ *
175
+ * @return string
176
+ */
177
+ static function walk_select_tree( $meta, $field, $elements, $parent = 0, $parent_slug = '', $active = false )
178
+ {
179
+ if ( ! isset( $elements[$parent] ) )
180
+ return;
181
+ $terms = $elements[$parent];
182
+ $hidden = $active ? 'active' : 'disabled';
183
+ $disabled = disabled( $active, false, false );
184
+ $multiple = $field['multiple'] ? " multiple='multiple' style='height: auto;'" : '';
185
+ $id = empty( $parent_slug ) ? '' : " id='rwmb-taxonomy-{$parent_slug}'";
186
+
187
+ $html = "<div{$id} class='rw-taxonomy-tree {$hidden}'>";
188
+ $html .= "<select name='{$field['field_name']}'{$disabled}{$multiple}>";
189
+ $html .= "<option value=''>None</option>";
190
+ foreach ( $terms as $term )
191
+ {
192
+ $selected = selected( in_array( $term->slug, $meta ), true, false );
193
+ $html .= "<option value='{$term->slug}'{$selected}>{$term->name}</option>";
194
+ }
195
+ $html .= '</select>';
196
+ foreach ( $terms as $term )
197
+ {
198
+ $html .= self::walk_select_tree( $meta, $field, $elements, $term->term_id, $term->slug, in_array( $term->slug, $meta ) && $active ) . '</li>';
199
+ }
200
+ $html .= '</div>';
201
+
202
+ return $html;
203
+ }
204
+
205
+ /**
206
+ * Processes terms into indexed array for walker functions
207
+ *
208
+ * @param $terms
209
+ *
210
+ * @internal param $field
211
+ * @return array
212
+ */
213
+ static function process_terms( $terms )
214
+ {
215
+ $elements = array();
216
+ foreach ( $terms as $term )
217
+ {
218
+ $elements[$term->parent][] = $term;
219
+ }
220
+ return $elements;
221
+ }
222
+
223
+ /**
224
+ * Save post taxonomy
225
+ *
226
+ * @param $post_id
227
+ * @param $field
228
+ * @param $old
229
+ *
230
+ * @param $new
231
+ */
232
+ static function save( $new, $old, $post_id, $field )
233
+ {
234
+ wp_set_object_terms( $post_id, $new, $field['options']['taxonomy'] );
235
+ }
236
+
237
+ /**
238
+ * Standard meta retrieval
239
+ *
240
+ * @param mixed $meta
241
+ * @param int $post_id
242
+ * @param array $field
243
+ * @param bool $saved
244
+ *
245
+ * @return mixed
246
+ */
247
+ static function meta( $meta, $post_id, $saved, $field )
248
+ {
249
+ $options = $field['options'];
250
+
251
+ $meta = wp_get_post_terms( $post_id, $options['taxonomy'] );
252
+ $meta = is_array( $meta ) ? $meta : (array) $meta;
253
+ $meta = wp_list_pluck( $meta, 'slug' );
254
+
255
+ return $meta;
256
+ }
257
+ } // END Class RWMB_Taxonomy_Field
258
+ } // endif;
inc/fields/text.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Text_Field' ) )
6
+ {
7
+ class RWMB_Text_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ $name = " name='{$field['field_name']}'";
21
+ $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'";
22
+ $value = " value='{$meta}'";
23
+ $size = " size='{$field['size']}'";
24
+
25
+ $html .= "<input type='text' class='rwmb-text'{$name}{$id}{$value}{$size} />";
26
+
27
+ return $html;
28
+ }
29
+
30
+ /**
31
+ * Normalize parameters for field
32
+ *
33
+ * @param array $field
34
+ *
35
+ * @return array
36
+ */
37
+ static function normalize_field( $field )
38
+ {
39
+ $field['size'] = empty( $field['size'] ) ? 30 : $field['size'];
40
+ return $field;
41
+ }
42
+ }
43
+ }
inc/fields/textarea.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Textarea_Field' ) )
6
+ {
7
+ class RWMB_Textarea_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ $name = " name='{$field['field_name']}'";
21
+ $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'";
22
+ $cols = " cols='{$field['cols']}'";
23
+ $rows = " rows='{$field['rows']}'";
24
+
25
+ $html .= "<textarea class='rwmb-textarea large-text'{$name}{$id}{$cols}{$rows}>{$meta}</textarea>";
26
+
27
+ return $html;
28
+ }
29
+
30
+ /**
31
+ * Normalize parameters for field
32
+ *
33
+ * @param array $field
34
+ *
35
+ * @return array
36
+ */
37
+ static function normalize_field( $field )
38
+ {
39
+ $field['cols'] = empty( $field['cols'] ) ? 60 : $field['cols'];
40
+ $field['rows'] = empty( $field['rows'] ) ? 4 : $field['rows'];
41
+ return $field;
42
+ }
43
+ }
44
+ }
inc/fields/thickbox-image.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Thickbox_Image_Field' ) )
6
+ {
7
+ class RWMB_Thickbox_Image_Field extends RWMB_Image_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ parent::admin_enqueue_scripts();
17
+
18
+ add_thickbox();
19
+ wp_enqueue_script( 'media-upload' );
20
+
21
+ wp_enqueue_script( 'rwmb-thickbox-image', RWMB_JS_URL . 'thickbox-image.js', array( 'jquery' ), RWMB_VER, true );
22
+ }
23
+
24
+ /**
25
+ * Get field HTML
26
+ *
27
+ * @param string $html
28
+ * @param mixed $meta
29
+ * @param array $field
30
+ *
31
+ * @return string
32
+ */
33
+ static function html( $html, $meta, $field )
34
+ {
35
+ global $wpdb;
36
+
37
+ $i18n_msg = _x( 'Uploaded files', 'image upload', 'rwmb' );
38
+ $i18n_delete = _x( 'Delete', 'image upload', 'rwmb' );
39
+ $i18n_edit = _x( 'Edit', 'image upload', 'rwmb' );
40
+ $i18n_upload = _x( 'Upload image', 'image upload', 'rwmb' );
41
+
42
+ $html = wp_nonce_field( "rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false );
43
+ $html .= wp_nonce_field( "rwmb-reorder-images_{$field['id']}", "nonce-reorder-images_{$field['id']}", false, false );
44
+ $html .= "<input type='hidden' class='field-id' value='{$field['id']}' />";
45
+
46
+ // Uploaded images
47
+ if ( ! empty( $meta ) )
48
+ {
49
+ $html .= "<h4>{$i18n_msg}</h4>";
50
+ $html .= "<ul class='rwmb-images rwmb-uploaded'>";
51
+
52
+ // Change $meta order using the posts 'menu_order'
53
+ // $meta_menu_order = array();
54
+ // foreach ( $meta as $post_id )
55
+ // {
56
+ // $post_meta = get_post( $post_id );
57
+ // $meta_menu_order[$post_meta->menu_order] = $post_id;
58
+ // }
59
+ // ksort( $meta_menu_order );
60
+ // $meta = $meta_menu_order;
61
+
62
+ foreach ( $meta as $image )
63
+ {
64
+ $src = wp_get_attachment_image_src( $image, 'thumbnail' );
65
+ $src = $src[0];
66
+ $link = get_edit_post_link( $image );
67
+
68
+ $html .= "<li id='item_{$image}'>
69
+ <img src='{$src}' />
70
+ <div class='rwmb-image-bar'>
71
+ <a title='{$i18n_edit}' class='rwmb-edit-file' href='{$link}' target='_blank'>{$i18n_edit}</a> |
72
+ <a title='{$i18n_delete}' class='rwmb-delete-file' href='#' rel='{$image}'>{$i18n_delete}</a>
73
+ </div>
74
+ </li>";
75
+ }
76
+
77
+ $html .= '</ul>';
78
+ }
79
+ else
80
+ {
81
+ // Place holder for images
82
+ $html .= "<ul class='rwmb-images rwmb-uploaded'></ul>";
83
+ }
84
+
85
+ // Show form upload
86
+ $html .= "<a href='#' class='button-secondary rwmb-thickbox-upload' rel='{$field['id']}'>{$i18n_upload}</a>";
87
+
88
+ return $html;
89
+ }
90
+
91
+ /**
92
+ * Save file field
93
+ *
94
+ * @param mixed $new
95
+ * @param mixed $old
96
+ * @param int $post_id
97
+ * @param array $field
98
+ */
99
+ static function save( $new, $old, $post_id, $field )
100
+ {
101
+ if ( ! is_array( $new ) || empty( $new ) )
102
+ return;
103
+
104
+ $name = $field['id'];
105
+ $images = (array) get_post_meta( $post_id, $name, false );
106
+ foreach ( $new as $add_new )
107
+ {
108
+ if ( ! in_array( $add_new, $images ) )
109
+ add_post_meta( $post_id, $name, $add_new, false );
110
+ }
111
+ }
112
+ }
113
+ }
inc/fields/time.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Time_Field' ) )
6
+ {
7
+ class RWMB_Time_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts( )
15
+ {
16
+ $url = RWMB_CSS_URL . 'jqueryui';
17
+ wp_register_style( 'jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17' );
18
+ wp_register_style( 'jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17' );
19
+ wp_register_style( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' );
20
+ wp_register_style( 'jquery-ui-slider', "{$url}/jquery.ui.slider.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' );
21
+ wp_enqueue_style( 'jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.css", array( 'jquery-ui-datepicker', 'jquery-ui-slider' ), '0.9.7' );
22
+
23
+ $url = RWMB_JS_URL . 'jqueryui';
24
+ wp_register_script( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.min.js", array( 'jquery-ui-core' ), '1.8.17', true );
25
+ wp_register_script( 'jquery-ui-slider', "{$url}/jquery.ui.slider.min.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse' ), '1.8.17', true );
26
+ wp_register_script( 'jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.js", array( 'jquery-ui-datepicker', 'jquery-ui-slider' ), '0.9.7', true );
27
+ wp_enqueue_script( 'rwmb-time', RWMB_JS_URL.'time.js', array( 'jquery-ui-timepicker' ), RWMB_VER, true );
28
+ }
29
+
30
+ /**
31
+ * Get field HTML
32
+ *
33
+ * @param string $html
34
+ * @param mixed $meta
35
+ * @param array $field
36
+ *
37
+ * @return string
38
+ */
39
+ static function html( $html, $meta, $field )
40
+ {
41
+ $name = " name='{$field['field_name']}'";
42
+ $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'";
43
+ $value = " value='{$meta}'";
44
+ $size = " size='{$field['size']}'";
45
+ $format = " rel='{$field['format']}'";
46
+
47
+ $html .= "<input type='text' class='rwmb-time'{$name}{$id}{$value}{$size}{$format} />";
48
+
49
+ return $html;
50
+ }
51
+
52
+ /**
53
+ * Normalize parameters for field
54
+ *
55
+ * @param array $field
56
+ *
57
+ * @return array
58
+ */
59
+ static function normalize_field( $field )
60
+ {
61
+ $field['format'] = empty( $field['format'] ) ? 'hh:mm' : $field['format'];
62
+ $field['size'] = empty( $field['size'] ) ? 10 : $field['size'];
63
+ return $field;
64
+ }
65
+ }
66
+ }
inc/fields/wysiwyg.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'RWMB_Wysiwyg_Field' ) )
6
+ {
7
+ class RWMB_Wysiwyg_Field
8
+ {
9
+ /**
10
+ * Enqueue scripts and styles
11
+ *
12
+ * @return void
13
+ */
14
+ static function admin_enqueue_scripts()
15
+ {
16
+ wp_enqueue_style( 'rwmb-meta-box-wysiwyg', RWMB_CSS_URL.'wysiwyg.css', RWMB_VER );
17
+ }
18
+
19
+ /**
20
+ * Add field actions
21
+ *
22
+ * @return void
23
+ */
24
+ static function add_actions()
25
+ {
26
+ // Add TinyMCE script for WP version < 3.3
27
+ global $wp_version;
28
+
29
+ if ( version_compare( $wp_version, '3.2.1' ) < 1 )
30
+ {
31
+ add_action( 'admin_print_footer-post.php', 'wp_tiny_mce', 25 );
32
+ add_action( 'admin_print_footer-post-new.php', 'wp_tiny_mce', 25 );
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Change field value on save
38
+ *
39
+ * @param mixed $new
40
+ * @param mixed $old
41
+ * @param int $post_id
42
+ * @param array $field
43
+ *
44
+ * @return string
45
+ */
46
+ static function value( $new, $old, $post_id, $field )
47
+ {
48
+ return wpautop( $new );
49
+ }
50
+
51
+ /**
52
+ * Get field HTML
53
+ *
54
+ * @param string $html
55
+ * @param mixed $meta
56
+ * @param array $field
57
+ *
58
+ * @return string
59
+ */
60
+ static function html( $html, $meta, $field )
61
+ {
62
+ global $wp_version;
63
+ $name = "name='{$field['field_name']}'";
64
+
65
+ if ( version_compare( $wp_version, '3.2.1' ) < 1 )
66
+ {
67
+ return "<textarea class='rwmb-wysiwyg theEditor large-text' {$name} id='{$field['id']}' cols='60' rows='10'>$meta</textarea>";
68
+ }
69
+ else
70
+ {
71
+ // Apply filter to wp_editor() settings
72
+ $editor_settings = apply_filters( 'rwmb_wysiwyg_settings', array( 'editor_class' => 'rwmb-wysiwyg' ), 10, 1 );
73
+ // Using output buffering because wp_editor() echos directly
74
+ ob_start();
75
+ // Use new wp_editor() since WP 3.3
76
+ wp_editor( $meta, $field['id'], $editor_settings );
77
+
78
+ return ob_get_clean();
79
+ }
80
+ }
81
+ }
82
+ }
inc/helpers.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file contains all helpers/public functions
4
+ * that can be used both on the back-end or front-end
5
+ */
6
+
7
+ // Prevent loading this file directly
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
+ /**
11
+ * Get post meta
12
+ *
13
+ * @param string $key Meta key. Required.
14
+ * @param int|null $post_id Post ID. null for current post. Optional
15
+ * @param array $args Array of arguments. Optional.
16
+ *
17
+ * @return mixed
18
+ */
19
+ function rwmb_meta( $key, $args = array(), $post_id = null )
20
+ {
21
+ $post_id = empty( $post_id ) ? get_the_ID() : $post_id;
22
+
23
+ $args = wp_parse_args( $args, array(
24
+ 'type' => 'text',
25
+ ) );
26
+
27
+ // Set 'multiple' for fields based on 'type'
28
+ $args['multiple'] = in_array( $args['type'], array( 'checkbox_list', 'file', 'image', 'plupload_image', 'thickbox_image' ) );
29
+
30
+ $meta = get_post_meta( $post_id, $key, !$args['multiple'] );
31
+
32
+ // Get uploaded files info
33
+ if ( 'file' == $args['type'] )
34
+ {
35
+ if ( is_array( $meta ) && ! empty( $meta ) )
36
+ {
37
+ $files = array();
38
+ foreach ( $meta as $id )
39
+ {
40
+ $files[$id] = rwmb_file_info( $id );
41
+ }
42
+ $meta = $files;
43
+ }
44
+ }
45
+
46
+ // Get uploaded images info
47
+ elseif ( in_array( $args['type'], array( 'image', 'plupload_image', 'thickbox_image' ) ) )
48
+ {
49
+ if ( is_array( $meta ) && ! empty( $meta ) )
50
+ {
51
+ global $wpdb;
52
+ $meta = implode( ',' , $meta );
53
+
54
+ // Re-arrange images with 'menu_order'
55
+ $meta = $wpdb->get_col( "
56
+ SELECT ID FROM {$wpdb->posts}
57
+ WHERE post_type = 'attachment'
58
+ AND ID in ({$meta})
59
+ ORDER BY menu_order ASC
60
+ " );
61
+
62
+ $images = array();
63
+ foreach ( $meta as $id )
64
+ {
65
+ $images[$id] = rwmb_image_info( $id, $args );
66
+ }
67
+ $meta = $images;
68
+ }
69
+ }
70
+
71
+ // Get post terms
72
+ elseif ( 'taxonomy' == $args['type'] )
73
+ {
74
+ $meta = emtpy( $args['taxonomy'] ) ? array() : wp_get_post_terms( $post_id, $args['taxonomy'] );
75
+ }
76
+
77
+ return $meta;
78
+ }
79
+
80
+ /**
81
+ * Get uploaded file information
82
+ *
83
+ * @param int $id Attachment file ID (post ID). Required.
84
+ *
85
+ * @return array|bool False if file not found. Array of (id, name, path, url) on success
86
+ */
87
+ function rwmb_file_info( $id )
88
+ {
89
+ $path = get_attached_file( $id );
90
+ return array(
91
+ 'name' => basename( $path ),
92
+ 'path' => $path,
93
+ 'url' => wp_get_attachment_url( $id ),
94
+ 'title' => get_the_title( $id ),
95
+ );
96
+ }
97
+
98
+ /**
99
+ * Get uploaded image information
100
+ *
101
+ * @param int $id Attachment image ID (post ID). Required.
102
+ * @param array $args Array of arguments (for size). Required.
103
+ *
104
+ * @return array|bool False if file not found. Array of (id, name, path, url) on success
105
+ */
106
+ function rwmb_image_info( $id, $args = array() )
107
+ {
108
+ $args = wp_parse_args( $args, array(
109
+ 'size' => 'thumbnail',
110
+ ) );
111
+
112
+ $img_src = wp_get_attachment_image_src( $id, $args['size'] );
113
+ if ( empty( $img_src ) )
114
+ return false;
115
+
116
+ $attachment = &get_post( $id );
117
+ $path = get_attached_file( $id );
118
+ return array(
119
+ 'name' => basename( $path ),
120
+ 'path' => $path,
121
+ 'url' => $img_src[0],
122
+ 'width' => $img_src[1],
123
+ 'height' => $img_src[2],
124
+ 'full_url' => wp_get_attachment_url( $id ),
125
+ 'title' => $attachment->post_title,
126
+ 'caption' => $attachment->post_excerpt,
127
+ 'description' => $attachment->post_content,
128
+ 'alt' => get_post_meta( $id, '_wp_attachment_image_alt', true ),
129
+ );
130
+ }
js/clone.js ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function ($)
2
+ {
3
+ /**
4
+ * Hide remove buttons when there's only 1 of them
5
+ *
6
+ * @param $el jQuery element. If not supplied, the function will applies for all fields
7
+ *
8
+ * @return void
9
+ */
10
+ function toggle_remove_buttons( $el )
11
+ {
12
+ if ( ! $el )
13
+ $el = $( '.rwmb-field' );
14
+ $el.each( function()
15
+ {
16
+ var $remove_buttons = $( this ).find( '.remove-clone' );
17
+ if ( $remove_buttons.length < 2 )
18
+ $remove_buttons.hide();
19
+ else
20
+ $remove_buttons.show();
21
+ } );
22
+ }
23
+
24
+ // Call it on first run
25
+ toggle_remove_buttons();
26
+
27
+ function add_cloned_fields( $input )
28
+ {
29
+ var $clone_last = $input.find( '.rwmb-clone:last' ),
30
+ $clone = $clone_last.clone( true );
31
+
32
+ $clone.insertAfter( $clone_last );
33
+
34
+ // Reset value
35
+ $clone.find( ':input' ).val( '' );
36
+
37
+ // Get the field name, and increment
38
+ var $index = $clone.find( ':input' ).attr("name").replace(/\[([0-9]+)\]$/,
39
+ function(str, p1, p2, p3)
40
+ {
41
+ return mystr = '[' + (parseInt(p1) +1) + ']';
42
+ });
43
+
44
+ // Update the "name" attribute
45
+ $clone.find( ':input' ).attr("name", $index);
46
+
47
+ // Toggle remove buttons
48
+ toggle_remove_buttons( $input );
49
+
50
+ // Fix color picker
51
+ if ( 'function' === typeof rwmb_update_color_picker )
52
+ rwmb_update_color_picker();
53
+
54
+ // Fix date picker
55
+ if ( 'function' === typeof rwmb_update_date_picker )
56
+ rwmb_update_date_picker();
57
+
58
+ // Fix time picker
59
+ if ( 'function' === typeof rwmb_update_time_picker )
60
+ rwmb_update_time_picker();
61
+
62
+ // Fix datetime picker
63
+ if ( 'function' === typeof rwmb_update_datetime_picker )
64
+ rwmb_update_datetime_picker();
65
+ }
66
+
67
+ // Add more clones
68
+ $( '.add-clone' ).click( function ()
69
+ {
70
+ var $input = $( this ).parents( '.rwmb-input' );
71
+ var $clone_group = $( this ).parents( '.rwmb-field' ).attr("clone-group");
72
+
73
+ // If the field is part of a clone group, get all fields in that
74
+ // group and itterate over them
75
+ if ( $clone_group )
76
+ {
77
+ // Get the parent metabox and then find the matching
78
+ // clone-group elements inside
79
+ var $metabox = $( this ).parents( '.inside' );
80
+ var $clone_group_list = $metabox.find( 'div[clone-group="' + $clone_group + '"]' );
81
+
82
+ $.each($clone_group_list.find( '.rwmb-input' ),
83
+ function(key, value) {
84
+ add_cloned_fields( $(value) );
85
+ });
86
+ }
87
+ else
88
+ add_cloned_fields( $input );
89
+
90
+ return false;
91
+ } );
92
+
93
+ // Remove clones
94
+ $( '.rwmb-input' ).delegate( '.remove-clone', 'click', function()
95
+ {
96
+ var $this = $( this ),
97
+ $input = $this.parents( '.rwmb-input' );
98
+ var $clone_group = $( this ).parents( '.rwmb-field' ).attr("clone-group");
99
+
100
+ // Remove clone only if there're 2 or more of them
101
+ if ( $input.find( '.rwmb-clone' ).length > 1 )
102
+ {
103
+ if ( $clone_group )
104
+ {
105
+ // Get the parent metabox and then find the matching
106
+ // clone-group elements inside
107
+ var $metabox = $( this ).parents( '.inside' );
108
+ var $clone_group_list = $metabox.find( 'div[clone-group="' + $clone_group + '"]' );
109
+ var $index = $this.parent().index();
110
+
111
+ $.each($clone_group_list.find( '.rwmb-input' ),
112
+ function(key, value) {
113
+ $(value).children( '.rwmb-clone' ).eq($index).remove();
114
+
115
+ // Toggle remove buttons
116
+ toggle_remove_buttons( $(value) );
117
+ });
118
+ }
119
+ else
120
+ {
121
+ $this.parent().remove();
122
+
123
+ // Toggle remove buttons
124
+ toggle_remove_buttons( $input );
125
+ }
126
+ }
127
+
128
+ return false;
129
+ } );
130
+ } );
js/color.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Update color picker element
3
+ * Used for static & dynamic added elements (when clone)
4
+ */
5
+ function rwmb_update_color_picker()
6
+ {
7
+ var $ = jQuery;
8
+ $( '.rwmb-color-picker' ).each( function()
9
+ {
10
+ var $this = $( this ),
11
+ $input = $this.siblings( 'input.rwmb-color' );
12
+
13
+ // Make sure the value is displayed
14
+ if ( ! $input.val() )
15
+ $input.val( '#' );
16
+
17
+ $this.farbtastic( $input );
18
+ } );
19
+ }
20
+
21
+ jQuery( document ).ready( function($)
22
+ {
23
+ $( '.rwmb-color' ).focus( function()
24
+ {
25
+ $( this ).siblings( '.rwmb-color-picker' ).show();
26
+ return false;
27
+ } ).blur( function() {
28
+ $( this ).siblings( '.rwmb-color-picker' ).hide();
29
+ return false;
30
+ } );
31
+
32
+ rwmb_update_color_picker();
33
+ } );
js/date.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Update date picker element
3
+ * Used for static & dynamic added elements (when clone)
4
+ */
5
+ function rwmb_update_date_picker()
6
+ {
7
+ var $ = jQuery;
8
+
9
+ $( '.rwmb-date' ).each( function()
10
+ {
11
+ var $this = $( this ),
12
+ format = $this.attr( 'rel' );
13
+
14
+ $this.removeClass('hasDatepicker').attr('id', '').datepicker( {
15
+ showButtonPanel: true,
16
+ dateFormat: format
17
+ } );
18
+ } );
19
+ }
20
+
21
+ jQuery( document ).ready( function($)
22
+ {
23
+ rwmb_update_date_picker();
24
+ } );
js/datetime.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Update datetime picker element
3
+ * Used for static & dynamic added elements (when clone)
4
+ */
5
+ function rwmb_update_datetime_picker()
6
+ {
7
+ var $ = jQuery;
8
+
9
+ $( '.rwmb-datetime' ).each( function()
10
+ {
11
+ var $this = $( this ),
12
+ format = $this.attr( 'rel' ),
13
+ show_amppm = /t/i.test(format),
14
+ show_second = /:s/.test(format),
15
+ show_millisec = /:l/.test(format);
16
+
17
+ $this.removeClass('hasDatepicker').attr('id', '').datetimepicker( {
18
+ showSecond : show_second,
19
+ showMillisec: show_millisec,
20
+ timeFormat : format,
21
+ ampm : show_amppm,
22
+ } );
23
+ } );
24
+ }
25
+
26
+ jQuery( document ).ready( function($)
27
+ {
28
+ rwmb_update_datetime_picker();
29
+ } );
js/file.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($)
2
+ {
3
+ // Add more file
4
+ $( '.rwmb-add-file' ).click( function()
5
+ {
6
+ var $this = $( this ), $first = $this.parent().find( '.file-input:first' );
7
+
8
+ $first.clone().insertBefore( $this );
9
+
10
+ return false;
11
+ } );
12
+
13
+ // Delete file via Ajax
14
+ $( '.rwmb-uploaded' ).delegate( '.rwmb-delete-file', 'click', function()
15
+ {
16
+ var $this = $(this),
17
+ $parent = $this.closest( 'li' ),
18
+ field_id = $this.parents( '.rwmb-field' ).find( '.field-id' ).val(),
19
+ data = {
20
+ action : 'rwmb_delete_file',
21
+ _wpnonce : $('#nonce-delete-file_' + field_id).val(),
22
+ post_id : $('#post_ID').val(),
23
+ field_id : field_id,
24
+ attachment_id: $this.attr('rel')
25
+ };
26
+
27
+ $.post( ajaxurl, data, function( r )
28
+ {
29
+ var res = wpAjax.parseAjaxResponse( r, 'ajax-response' );
30
+ if ( res.errors )
31
+ alert( res.responses[0].errors[0].message );
32
+ else
33
+ $parent.remove();
34
+ }, 'xml' );
35
+
36
+ return false;
37
+ } );
38
+ } );
js/image.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($)
2
+ {
3
+ // Reorder images
4
+ $( '.rwmb-images' ).each( function()
5
+ {
6
+ var $this = $(this),
7
+ field_id = $this.parents( '.rwmb-field' ).find( '.field-id' ).val(),
8
+ data = {
9
+ action : 'rwmb_reorder_images',
10
+ _wpnonce: $('#nonce-reorder-images_' + field_id).val(),
11
+ post_id : $('#post_ID').val(),
12
+ field_id: field_id
13
+ };
14
+ $this.sortable(
15
+ {
16
+ placeholder: 'ui-state-highlight',
17
+ items: 'li',
18
+ update: function () {
19
+ data.order = $this.sortable( 'serialize' );
20
+
21
+ $.post( ajaxurl, data, function( r )
22
+ {
23
+ var res = wpAjax.parseAjaxResponse( r, 'ajax-response' );
24
+ if ( res.errors )
25
+ alert( res.responses[0].errors[0].message );
26
+ }, 'xml' );
27
+ }
28
+ } );
29
+ } );
30
+ } );
js/jquery.validate.min.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * jQuery Validation Plugin 1.9.0
3
+ *
4
+ * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
5
+ * http://docs.jquery.com/Plugins/Validation
6
+ *
7
+ * Copyright (c) 2006 - 2011 Jörn Zaefferer
8
+ *
9
+ * Dual licensed under the MIT and GPL licenses:
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ * http://www.gnu.org/licenses/gpl.html
12
+ */
13
+ (function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;this.attr("novalidate","novalidate");b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){a=this.find("input, button");a.filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&a.filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
14
+ b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
15
+ else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
16
+ return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
17
+ b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
18
+ validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
19
+ onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,
20
+ a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),
21
+ minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator"),g="on"+e.type.replace(/^validate/,
22
+ "");f.settings[g]&&f.settings[g].call(f,this[0],e)}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=
23
+ this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",a).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",
24
+ a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(a){this.lastElement=
25
+ a=this.validationTargetFor(this.clean(a));this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,function(d){return!(d.name in a)})}this.settings.showErrors?
26
+ this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==
27
+ 0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
28
+ a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
29
+ prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.validationTargetFor(this.clean(a));var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+
30
+ a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==undefined)return arguments[a]},defaultMessage:function(a,
31
+ b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]=
32
+ d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);
33
+ if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
34
+ d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=
35
+ this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];return a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,
36
+ e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
37
+ c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
38
+ false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
39
+ a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e;if(e=d==="required"&&typeof c.fn.prop==="function"?a.prop(d):a.attr(d))b[d]=e;else if(a[0].getAttribute("type")===d)b[d]=true}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};
40
+ var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?
41
+ e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;
42
+ return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,
43
+ b)>0;default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,
44
+ mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,
45
+ b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)},
46
+ url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
47
+ date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 -]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
48
+ 0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
49
+ (function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
50
+ (function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
51
+ b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);
js/jqueryui/jquery-ui-timepicker-addon.js ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery timepicker addon
3
+ * By: Trent Richardson [http://trentrichardson.com]
4
+ * Version 0.9.7
5
+ * Last Modified: 10/02/2011
6
+ *
7
+ * Copyright 2011 Trent Richardson
8
+ * Dual licensed under the MIT and GPL licenses.
9
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11
+ *
12
+ * HERES THE CSS:
13
+ * .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
14
+ * .ui-timepicker-div dl { text-align: left; }
15
+ * .ui-timepicker-div dl dt { height: 25px; }
16
+ * .ui-timepicker-div dl dd { margin: -25px 10px 10px 65px; }
17
+ * .ui-timepicker-div td { font-size: 90%; }
18
+ * .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
19
+ */
20
+
21
+ (function(e){function m(){this.regional=[];this.regional[""]={currentText:"Now",closeText:"Done",ampm:false,amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"hh:mm tt",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",timezoneText:"Time Zone"};this._defaults={showButtonPanel:true,timeOnly:false,showHour:true,showMinute:true,showSecond:false,showMillisec:false,showTimezone:false,showTime:true,stepHour:0.05,stepMinute:0.05,
22
+ stepSecond:0.05,stepMillisec:0.5,hour:0,minute:0,second:0,millisec:0,timezone:"+0000",hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,minDateTime:null,maxDateTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,alwaysSetTime:true,separator:" ",altFieldTimeOnly:true,showTimepicker:true,timezoneIso8609:false,timezoneList:null};e.extend(this._defaults,this.regional[""])}e.extend(e.ui,{timepicker:{version:"0.9.7"}});e.extend(m.prototype,
23
+ {$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,timezone_select:null,hour:0,minute:0,second:0,millisec:0,timezone:"+0000",hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,setDefaults:function(c){var a=this._defaults,
24
+ c=c||{};e.extend(a,c);for(var b in c)if(c[b]===null||c[b]===void 0)a[b]=c[b];return this},_newInst:function(c,a){var b=new m,d={},f;for(f in this._defaults){var g=c.attr("time:"+f);if(g)try{d[f]=eval(g)}catch(j){d[f]=g}}b._defaults=e.extend({},this._defaults,d,a,{beforeShow:function(c,d){e.isFunction(a.beforeShow)&&a.beforeShow(c,d,b)},onChangeMonthYear:function(d,f,g){b._updateDateTime(g);e.isFunction(a.onChangeMonthYear)&&a.onChangeMonthYear.call(c[0],d,f,g,b)},onClose:function(d,f){b.timeDefined===
25
+ true&&c.val()!=""&&b._updateDateTime(f);e.isFunction(a.onClose)&&a.onClose.call(c[0],d,f,b)},timepicker:b});b.amNames=e.map(b._defaults.amNames,function(a){return a.toUpperCase()});b.pmNames=e.map(b._defaults.pmNames,function(a){return a.toUpperCase()});if(b._defaults.timezoneList===null){d=[];for(f=-11;f<=12;f++)d.push((f>=0?"+":"-")+("0"+Math.abs(f).toString()).slice(-2)+"00");b._defaults.timezoneIso8609&&(d=e.map(d,function(a){return a=="+0000"?"Z":a.substring(0,3)+":"+a.substring(3)}));b._defaults.timezoneList=
26
+ d}b.hour=b._defaults.hour;b.minute=b._defaults.minute;b.second=b._defaults.second;b.millisec=b._defaults.millisec;b.ampm="";b.$input=c;if(a.altField)b.$altInput=e(a.altField).css({cursor:"pointer"}).focus(function(){c.trigger("focus")});if(b._defaults.minDate==0||b._defaults.minDateTime==0)b._defaults.minDate=new Date;if(b._defaults.maxDate==0||b._defaults.maxDateTime==0)b._defaults.maxDate=new Date;if(b._defaults.minDate!==void 0&&b._defaults.minDate instanceof Date)b._defaults.minDateTime=new Date(b._defaults.minDate.getTime());
27
+ if(b._defaults.minDateTime!==void 0&&b._defaults.minDateTime instanceof Date)b._defaults.minDate=new Date(b._defaults.minDateTime.getTime());if(b._defaults.maxDate!==void 0&&b._defaults.maxDate instanceof Date)b._defaults.maxDateTime=new Date(b._defaults.maxDate.getTime());if(b._defaults.maxDateTime!==void 0&&b._defaults.maxDateTime instanceof Date)b._defaults.maxDate=new Date(b._defaults.maxDateTime.getTime());return b},_addTimePicker:function(c){this.timeDefined=this._parseTime(this.$altInput&&
28
+ this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this._limitMinMaxDateTime(c,false);this._injectTimePicker()},_parseTime:function(c,a){var b=this._defaults.timeFormat.toString().replace(/h{1,2}/ig,"(\\d?\\d)").replace(/m{1,2}/ig,"(\\d?\\d)").replace(/s{1,2}/ig,"(\\d?\\d)").replace(/l{1}/ig,"(\\d?\\d?\\d)").replace(/t{1,2}/ig,this._getPatternAmpm()).replace(/z{1}/ig,"(z|[-+]\\d\\d:?\\d\\d)?").replace(/\s/g,"\\s?")+this._defaults.timeSuffix+"$",d=this._getFormatPositions(),
29
+ f="";if(!this.inst)this.inst=e.datepicker._getInst(this.$input[0]);if(a||!this._defaults.timeOnly)b=".{"+e.datepicker._get(this.inst,"dateFormat").length+",}"+this._defaults.separator.replace(RegExp("[.*+?|()\\[\\]{}\\\\]","g"),"\\$&")+b;if(b=c.match(RegExp(b,"i"))){if(d.t!==-1)b[d.t]===void 0||b[d.t].length===0?this.ampm=f="":(f=e.inArray(b[d.t].toUpperCase(),this.amNames)!==-1?"AM":"PM",this.ampm=this._defaults[f=="AM"?"amNames":"pmNames"][0]);if(d.h!==-1)this.hour=f=="AM"&&b[d.h]=="12"?0:f=="PM"&&
30
+ b[d.h]!="12"?(parseFloat(b[d.h])+12).toFixed(0):Number(b[d.h]);if(d.m!==-1)this.minute=Number(b[d.m]);if(d.s!==-1)this.second=Number(b[d.s]);if(d.l!==-1)this.millisec=Number(b[d.l]);if(d.z!==-1&&b[d.z]!==void 0){d=b[d.z].toUpperCase();switch(d.length){case 1:d=this._defaults.timezoneIso8609?"Z":"+0000";break;case 5:this._defaults.timezoneIso8609&&(d=d.substring(1)=="0000"?"Z":d.substring(0,3)+":"+d.substring(3));break;case 6:this._defaults.timezoneIso8609?d.substring(1)=="00:00"&&(d="Z"):d=d=="Z"||
31
+ d.substring(1)=="00:00"?"+0000":d.replace(/:/,"")}this.timezone=d}return true}return false},_getPatternAmpm:function(){var c=[];o=this._defaults;o.amNames&&e.merge(c,o.amNames);o.pmNames&&e.merge(c,o.pmNames);c=e.map(c,function(a){return a.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")});return"("+c.join("|")+")?"},_getFormatPositions:function(){var c=this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z)/g),a={h:-1,m:-1,s:-1,l:-1,t:-1,z:-1};if(c)for(var b=0;b<c.length;b++)a[c[b].toString().charAt(0)]==
32
+ -1&&(a[c[b].toString().charAt(0)]=b+1);return a},_injectTimePicker:function(){var c=this.inst.dpDiv,a=this._defaults,b=this,d=(a.hourMax-(a.hourMax-a.hourMin)%a.stepHour).toFixed(0),f=(a.minuteMax-(a.minuteMax-a.minuteMin)%a.stepMinute).toFixed(0),g=(a.secondMax-(a.secondMax-a.secondMin)%a.stepSecond).toFixed(0),j=(a.millisecMax-(a.millisecMax-a.millisecMin)%a.stepMillisec).toFixed(0),h=this.inst.id.toString().replace(/([^A-Za-z0-9_])/g,"");if(c.find("div#ui-timepicker-div-"+h).length===0&&a.showTimepicker){var i=
33
+ '<div class="ui-timepicker-div" id="ui-timepicker-div-'+h+'"><dl><dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_'+h+'"'+(a.showTime?"":' style="display:none;"')+">"+a.timeText+'</dt><dd class="ui_tpicker_time" id="ui_tpicker_time_'+h+'"'+(a.showTime?"":' style="display:none;"')+'></dd><dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_'+h+'"'+(a.showHour?"":' style="display:none;"')+">"+a.hourText+"</dt>",q=0,r=0,m=0,s=0,l;if(a.showHour&&a.hourGrid>0){i+='<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_'+
34
+ h+'"'+(a.showHour?"":' style="display:none;"')+'></div><div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';for(var k=a.hourMin;k<=d;k+=parseInt(a.hourGrid,10)){q++;var n=a.ampm&&k>12?k-12:k;n<10&&(n="0"+n);a.ampm&&(k==0?n="12a":n+=k<12?"a":"p");i+="<td>"+n+"</td>"}i+="</tr></table></div></dd>"}else i+='<dd class="ui_tpicker_hour" id="ui_tpicker_hour_'+h+'"'+(a.showHour?"":' style="display:none;"')+"></dd>";i+='<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_'+
35
+ h+'"'+(a.showMinute?"":' style="display:none;"')+">"+a.minuteText+"</dt>";if(a.showMinute&&a.minuteGrid>0){i+='<dd class="ui_tpicker_minute ui_tpicker_minute_'+a.minuteGrid+'"><div id="ui_tpicker_minute_'+h+'"'+(a.showMinute?"":' style="display:none;"')+'></div><div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';for(k=a.minuteMin;k<=f;k+=parseInt(a.minuteGrid,10))r++,i+="<td>"+(k<10?"0":"")+k+"</td>";i+="</tr></table></div></dd>"}else i+='<dd class="ui_tpicker_minute" id="ui_tpicker_minute_'+
36
+ h+'"'+(a.showMinute?"":' style="display:none;"')+"></dd>";i+='<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_'+h+'"'+(a.showSecond?"":' style="display:none;"')+">"+a.secondText+"</dt>";if(a.showSecond&&a.secondGrid>0){i+='<dd class="ui_tpicker_second ui_tpicker_second_'+a.secondGrid+'"><div id="ui_tpicker_second_'+h+'"'+(a.showSecond?"":' style="display:none;"')+'></div><div style="padding-left: 1px"><table><tr>';for(var p=a.secondMin;p<=g;p+=parseInt(a.secondGrid,10))m++,i+="<td>"+
37
+ (p<10?"0":"")+p+"</td>";i+="</tr></table></div></dd>"}else i+='<dd class="ui_tpicker_second" id="ui_tpicker_second_'+h+'"'+(a.showSecond?"":' style="display:none;"')+"></dd>";i+='<dt class="ui_tpicker_millisec_label" id="ui_tpicker_millisec_label_'+h+'"'+(a.showMillisec?"":' style="display:none;"')+">"+a.millisecText+"</dt>";if(a.showMillisec&&a.millisecGrid>0){i+='<dd class="ui_tpicker_millisec ui_tpicker_millisec_'+a.millisecGrid+'"><div id="ui_tpicker_millisec_'+h+'"'+(a.showMillisec?"":' style="display:none;"')+
38
+ '></div><div style="padding-left: 1px"><table><tr>';for(k=a.millisecMin;k<=j;k+=parseInt(a.millisecGrid,10))s++,i+="<td>"+(k<10?"0":"")+p+"</td>";i+="</tr></table></div></dd>"}else i+='<dd class="ui_tpicker_millisec" id="ui_tpicker_millisec_'+h+'"'+(a.showMillisec?"":' style="display:none;"')+"></dd>";i+='<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_'+h+'"'+(a.showTimezone?"":' style="display:none;"')+">"+a.timezoneText+"</dt>";i+='<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_'+
39
+ h+'"'+(a.showTimezone?"":' style="display:none;"')+"></dd>";i+="</dl></div>";$tp=e(i);a.timeOnly===true&&($tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+a.timeOnlyTitle+"</div></div>"),c.find(".ui-datepicker-header, .ui-datepicker-calendar").hide());this.hour_slider=$tp.find("#ui_tpicker_hour_"+h).slider({orientation:"horizontal",value:this.hour,min:a.hourMin,max:d,step:a.stepHour,slide:function(a,c){b.hour_slider.slider("option","value",
40
+ c.value);b._onTimeChange()}});this.minute_slider=$tp.find("#ui_tpicker_minute_"+h).slider({orientation:"horizontal",value:this.minute,min:a.minuteMin,max:f,step:a.stepMinute,slide:function(a,c){b.minute_slider.slider("option","value",c.value);b._onTimeChange()}});this.second_slider=$tp.find("#ui_tpicker_second_"+h).slider({orientation:"horizontal",value:this.second,min:a.secondMin,max:g,step:a.stepSecond,slide:function(a,c){b.second_slider.slider("option","value",c.value);b._onTimeChange()}});this.millisec_slider=
41
+ $tp.find("#ui_tpicker_millisec_"+h).slider({orientation:"horizontal",value:this.millisec,min:a.millisecMin,max:j,step:a.stepMillisec,slide:function(a,c){b.millisec_slider.slider("option","value",c.value);b._onTimeChange()}});this.timezone_select=$tp.find("#ui_tpicker_timezone_"+h).append("<select></select>").find("select");e.fn.append.apply(this.timezone_select,e.map(a.timezoneList,function(a){return e("<option />").val(typeof a=="object"?a.value:a).text(typeof a=="object"?a.label:a)}));this.timezone_select.val(typeof this.timezone!=
42
+ "undefined"&&this.timezone!=null&&this.timezone!=""?this.timezone:a.timezone);this.timezone_select.change(function(){b._onTimeChange()});a.showHour&&a.hourGrid>0&&(l=100*q*a.hourGrid/(d-a.hourMin),$tp.find(".ui_tpicker_hour table").css({width:l+"%",marginLeft:l/(-2*q)+"%",borderCollapse:"collapse"}).find("td").each(function(){e(this).click(function(){var c=e(this).html();if(a.ampm)var d=c.substring(2).toLowerCase(),c=parseInt(c.substring(0,2),10),c=d=="a"?c==12?0:c:c==12?12:c+12;b.hour_slider.slider("option",
43
+ "value",c);b._onTimeChange();b._onSelectHandler()}).css({cursor:"pointer",width:100/q+"%",textAlign:"center",overflow:"hidden"})}));a.showMinute&&a.minuteGrid>0&&(l=100*r*a.minuteGrid/(f-a.minuteMin),$tp.find(".ui_tpicker_minute table").css({width:l+"%",marginLeft:l/(-2*r)+"%",borderCollapse:"collapse"}).find("td").each(function(){e(this).click(function(){b.minute_slider.slider("option","value",e(this).html());b._onTimeChange();b._onSelectHandler()}).css({cursor:"pointer",width:100/r+"%",textAlign:"center",
44
+ overflow:"hidden"})}));a.showSecond&&a.secondGrid>0&&$tp.find(".ui_tpicker_second table").css({width:l+"%",marginLeft:l/(-2*m)+"%",borderCollapse:"collapse"}).find("td").each(function(){e(this).click(function(){b.second_slider.slider("option","value",e(this).html());b._onTimeChange();b._onSelectHandler()}).css({cursor:"pointer",width:100/m+"%",textAlign:"center",overflow:"hidden"})});a.showMillisec&&a.millisecGrid>0&&$tp.find(".ui_tpicker_millisec table").css({width:l+"%",marginLeft:l/(-2*s)+"%",
45
+ borderCollapse:"collapse"}).find("td").each(function(){e(this).click(function(){b.millisec_slider.slider("option","value",e(this).html());b._onTimeChange();b._onSelectHandler()}).css({cursor:"pointer",width:100/s+"%",textAlign:"center",overflow:"hidden"})});d=c.find(".ui-datepicker-buttonpane");d.length?d.before($tp):c.append($tp);this.$timeObj=$tp.find("#ui_tpicker_time_"+h);if(this.inst!==null)c=this.timeDefined,this._onTimeChange(),this.timeDefined=c;c=function(){b._onSelectHandler()};this.hour_slider.bind("slidestop",
46
+ c);this.minute_slider.bind("slidestop",c);this.second_slider.bind("slidestop",c);this.millisec_slider.bind("slidestop",c)}},_limitMinMaxDateTime:function(c,a){var b=this._defaults,d=new Date(c.selectedYear,c.selectedMonth,c.selectedDay);if(this._defaults.showTimepicker){if(e.datepicker._get(c,"minDateTime")!==null&&e.datepicker._get(c,"minDateTime")!==void 0&&d){var f=e.datepicker._get(c,"minDateTime"),g=new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0);if(this.hourMinOriginal===null||this.minuteMinOriginal===
47
+ null||this.secondMinOriginal===null||this.millisecMinOriginal===null)this.hourMinOriginal=b.hourMin,this.minuteMinOriginal=b.minuteMin,this.secondMinOriginal=b.secondMin,this.millisecMinOriginal=b.millisecMin;if(c.settings.timeOnly||g.getTime()==d.getTime())if(this._defaults.hourMin=f.getHours(),this.hour<=this._defaults.hourMin)if(this.hour=this._defaults.hourMin,this._defaults.minuteMin=f.getMinutes(),this.minute<=this._defaults.minuteMin)this.minute=this._defaults.minuteMin,this._defaults.secondMin=
48
+ f.getSeconds();else if(this.second<=this._defaults.secondMin)this.second=this._defaults.secondMin,this._defaults.millisecMin=f.getMilliseconds();else{if(this.millisec<this._defaults.millisecMin)this.millisec=this._defaults.millisecMin;this._defaults.millisecMin=this.millisecMinOriginal}else this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal;else this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=
49
+ this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal}if(e.datepicker._get(c,"maxDateTime")!==null&&e.datepicker._get(c,"maxDateTime")!==void 0&&d){f=e.datepicker._get(c,"maxDateTime");g=new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0);if(this.hourMaxOriginal===null||this.minuteMaxOriginal===null||this.secondMaxOriginal===null)this.hourMaxOriginal=b.hourMax,this.minuteMaxOriginal=b.minuteMax,this.secondMaxOriginal=b.secondMax,
50
+ this.millisecMaxOriginal=b.millisecMax;if(c.settings.timeOnly||g.getTime()==d.getTime())if(this._defaults.hourMax=f.getHours(),this.hour>=this._defaults.hourMax)if(this.hour=this._defaults.hourMax,this._defaults.minuteMax=f.getMinutes(),this.minute>=this._defaults.minuteMax)this.minute=this._defaults.minuteMax,this._defaults.secondMax=f.getSeconds();else if(this.second>=this._defaults.secondMax)this.second=this._defaults.secondMax,this._defaults.millisecMax=f.getMilliseconds();else{if(this.millisec>
51
+ this._defaults.millisecMax)this.millisec=this._defaults.millisecMax;this._defaults.millisecMax=this.millisecMaxOriginal}else this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal;else this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal}a!==void 0&&a===true&&(b=(this._defaults.hourMax-
52
+ (this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour).toFixed(0),d=(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute).toFixed(0),f=(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond).toFixed(0),g=(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec).toFixed(0),this.hour_slider&&this.hour_slider.slider("option",{min:this._defaults.hourMin,
53
+ max:b}).slider("value",this.hour),this.minute_slider&&this.minute_slider.slider("option",{min:this._defaults.minuteMin,max:d}).slider("value",this.minute),this.second_slider&&this.second_slider.slider("option",{min:this._defaults.secondMin,max:f}).slider("value",this.second),this.millisec_slider&&this.millisec_slider.slider("option",{min:this._defaults.millisecMin,max:g}).slider("value",this.millisec))}},_onTimeChange:function(){var c=this.hour_slider?this.hour_slider.slider("value"):false,a=this.minute_slider?
54
+ this.minute_slider.slider("value"):false,b=this.second_slider?this.second_slider.slider("value"):false,d=this.millisec_slider?this.millisec_slider.slider("value"):false,f=this.timezone_select?this.timezone_select.val():false,g=this._defaults;typeof c=="object"&&(c=false);typeof a=="object"&&(a=false);typeof b=="object"&&(b=false);typeof d=="object"&&(d=false);typeof f=="object"&&(f=false);c!==false&&(c=parseInt(c,10));a!==false&&(a=parseInt(a,10));b!==false&&(b=parseInt(b,10));d!==false&&(d=parseInt(d,
55
+ 10));var j=g[c<12?"amNames":"pmNames"][0],h=c!=this.hour||a!=this.minute||b!=this.second||d!=this.millisec||this.ampm.length>0&&c<12!=(e.inArray(this.ampm.toUpperCase(),this.amNames)!==-1)||f!=this.timezone;if(h){if(c!==false)this.hour=c;if(a!==false)this.minute=a;if(b!==false)this.second=b;if(d!==false)this.millisec=d;if(f!==false)this.timezone=f;if(!this.inst)this.inst=e.datepicker._getInst(this.$input[0]);this._limitMinMaxDateTime(this.inst,true)}if(g.ampm)this.ampm=j;this._formatTime();this.$timeObj&&
56
+ this.$timeObj.text(this.formattedTime+g.timeSuffix);this.timeDefined=true;h&&this._updateDateTime()},_onSelectHandler:function(){var c=this._defaults.onSelect,a=this.$input?this.$input[0]:null;c&&a&&c.apply(a,[this.formattedDateTime,this])},_formatTime:function(c,a,b){if(b==void 0)b=this._defaults.ampm;var c=c||{hour:this.hour,minute:this.minute,second:this.second,millisec:this.millisec,ampm:this.ampm,timezone:this.timezone},d=(a||this._defaults.timeFormat).toString(),f=parseInt(c.hour,10);b&&(!e.inArray(c.ampm.toUpperCase(),
57
+ this.amNames)!==-1&&(f%=12),f===0&&(f=12));d=d.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz])/g,function(a){switch(a.toLowerCase()){case "hh":return("0"+f).slice(-2);case "h":return f;case "mm":return("0"+c.minute).slice(-2);case "m":return c.minute;case "ss":return("0"+c.second).slice(-2);case "s":return c.second;case "l":return("00"+c.millisec).slice(-3);case "z":return c.timezone;case "t":case "tt":if(b){var d=c.ampm;a.length==1&&(d=d.charAt(0));return a.charAt(0)=="T"?d.toUpperCase():d.toLowerCase()}return""}});
58
+ if(arguments.length)return d;else this.formattedTime=d},_updateDateTime:function(c){c=this.inst||c;dt=new Date(c.selectedYear,c.selectedMonth,c.selectedDay);dateFmt=e.datepicker._get(c,"dateFormat");formatCfg=e.datepicker._getFormatConfig(c);timeAvailable=dt!==null&&this.timeDefined;var a=this.formattedDate=e.datepicker.formatDate(dateFmt,dt===null?new Date:dt,formatCfg);if(!(c.lastVal!==void 0&&c.lastVal.length>0&&this.$input.val().length===0)){if(this._defaults.timeOnly===true)a=this.formattedTime;
59
+ else if(this._defaults.timeOnly!==true&&(this._defaults.alwaysSetTime||timeAvailable))a+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix;this.formattedDateTime=a;this._defaults.showTimepicker?this.$altInput&&this._defaults.altFieldTimeOnly===true?(this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate)):(this.$altInput&&this.$altInput.val(a),this.$input.val(a)):this.$input.val(this.formattedDate);this.$input.trigger("change")}}});e.fn.extend({timepicker:function(c){var c=
60
+ c||{},a=arguments;typeof c=="object"&&(a[0]=e.extend(c,{timeOnly:true}));return e(this).each(function(){e.fn.datetimepicker.apply(e(this),a)})},datetimepicker:function(c){var c=c||{},a=arguments;return typeof c=="string"?c=="getDate"?e.fn.datepicker.apply(e(this[0]),a):this.each(function(){var b=e(this);b.datepicker.apply(b,a)}):this.each(function(){var a=e(this);a.datepicker(e.timepicker._newInst(a,c)._defaults)})}});e.datepicker._base_selectDate=e.datepicker._selectDate;e.datepicker._selectDate=
61
+ function(c,a){var b=this._getInst(e(c)[0]),d=this._get(b,"timepicker");d?(d._limitMinMaxDateTime(b,true),b.inline=b.stay_open=true,this._base_selectDate(c,a),b.inline=b.stay_open=false,this._notifyChange(b),this._updateDatepicker(b)):this._base_selectDate(c,a)};e.datepicker._base_updateDatepicker=e.datepicker._updateDatepicker;e.datepicker._updateDatepicker=function(c){var a=c.input[0];if(!e.datepicker._curInst||!(e.datepicker._curInst!=c&&e.datepicker._datepickerShowing&&e.datepicker._lastInput!=
62
+ a))if(typeof c.stay_open!=="boolean"||c.stay_open===false)this._base_updateDatepicker(c),(a=this._get(c,"timepicker"))&&a._addTimePicker(c)};e.datepicker._base_doKeyPress=e.datepicker._doKeyPress;e.datepicker._doKeyPress=function(c){var a=e.datepicker._getInst(c.target),b=e.datepicker._get(a,"timepicker");if(b&&e.datepicker._get(a,"constrainInput")){var d=b._defaults.ampm,a=e.datepicker._possibleChars(e.datepicker._get(a,"dateFormat")),b=b._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,
63
+ d?"APM":"").replace(/Tt/g,d?"AaPpMm":"").replace(/tT/g,d?"AaPpMm":"").replace(/T/g,d?"AP":"").replace(/tt/g,d?"apm":"").replace(/t/g,d?"ap":"")+" "+b._defaults.separator+b._defaults.timeSuffix+(b._defaults.showTimezone?b._defaults.timezoneList.join(""):"")+b._defaults.amNames.join("")+b._defaults.pmNames.join("")+a,d=String.fromCharCode(c.charCode===void 0?c.keyCode:c.charCode);return c.ctrlKey||d<" "||!a||b.indexOf(d)>-1}return e.datepicker._base_doKeyPress(c)};e.datepicker._base_doKeyUp=e.datepicker._doKeyUp;
64
+ e.datepicker._doKeyUp=function(c){var a=e.datepicker._getInst(c.target),b=e.datepicker._get(a,"timepicker");if(b&&b._defaults.timeOnly&&a.input.val()!=a.lastVal)try{e.datepicker._updateDatepicker(a)}catch(d){e.datepicker.log(d)}return e.datepicker._base_doKeyUp(c)};e.datepicker._base_gotoToday=e.datepicker._gotoToday;e.datepicker._gotoToday=function(c){var a=this._getInst(e(c)[0]),b=a.dpDiv;this._base_gotoToday(c);var c=new Date,d=this._get(a,"timepicker");if(d._defaults.showTimezone&&d.timezone_select){var f=
65
+ c.getTimezoneOffset(),g=f>0?"-":"+",f=Math.abs(f),j=f%60,f=g+("0"+(f-j)/60).slice(-2)+("0"+j).slice(-2);d._defaults.timezoneIso8609&&(f=f.substring(0,3)+":"+f.substring(3));d.timezone_select.val(f)}this._setTime(a,c);e(".ui-datepicker-today",b).click()};e.datepicker._disableTimepickerDatepicker=function(c){var a=this._getInst(c),b=this._get(a,"timepicker");e(c).datepicker("getDate");if(b)b._defaults.showTimepicker=false,b._updateDateTime(a)};e.datepicker._enableTimepickerDatepicker=function(c){var a=
66
+ this._getInst(c),b=this._get(a,"timepicker");e(c).datepicker("getDate");if(b)b._defaults.showTimepicker=true,b._addTimePicker(a),b._updateDateTime(a)};e.datepicker._setTime=function(c,a){var b=this._get(c,"timepicker");if(b){var d=b._defaults,e=a?a.getHours():d.hour,g=a?a.getMinutes():d.minute,j=a?a.getSeconds():d.second,h=a?a.getMilliseconds():d.millisec;if(e<d.hourMin||e>d.hourMax||g<d.minuteMin||g>d.minuteMax||j<d.secondMin||j>d.secondMax||h<d.millisecMin||h>d.millisecMax)e=d.hourMin,g=d.minuteMin,
67
+ j=d.secondMin,h=d.millisecMin;b.hour=e;b.minute=g;b.second=j;b.millisec=h;b.hour_slider&&b.hour_slider.slider("value",e);b.minute_slider&&b.minute_slider.slider("value",g);b.second_slider&&b.second_slider.slider("value",j);b.millisec_slider&&b.millisec_slider.slider("value",h);b._onTimeChange();b._updateDateTime(c)}};e.datepicker._setTimeDatepicker=function(c,a,b){var c=this._getInst(c),d=this._get(c,"timepicker");d&&(this._setDateFromField(c),a&&(typeof a=="string"?(d._parseTime(a,b),a=new Date,
68
+ a.setHours(d.hour,d.minute,d.second,d.millisec)):a=new Date(a.getTime()),a.toString()=="Invalid Date"&&(a=void 0),this._setTime(c,a)))};e.datepicker._base_setDateDatepicker=e.datepicker._setDateDatepicker;e.datepicker._setDateDatepicker=function(c,a){var b=this._getInst(c),d=a instanceof Date?new Date(a.getTime()):a;this._updateDatepicker(b);this._base_setDateDatepicker.apply(this,arguments);this._setTimeDatepicker(c,d,true)};e.datepicker._base_getDateDatepicker=e.datepicker._getDateDatepicker;e.datepicker._getDateDatepicker=
69
+ function(c,a){var b=this._getInst(c),d=this._get(b,"timepicker");return d?(this._setDateFromField(b,a),(b=this._getDate(b))&&d._parseTime(e(c).val(),d.timeOnly)&&b.setHours(d.hour,d.minute,d.second,d.millisec),b):this._base_getDateDatepicker(c,a)};e.datepicker._base_parseDate=e.datepicker.parseDate;e.datepicker.parseDate=function(c,a,b){var d;try{d=this._base_parseDate(c,a,b)}catch(e){d=this._base_parseDate(c,a.substring(0,a.length-(e.length-e.indexOf(":")-2)),b)}return d};e.datepicker._base_formatDate=
70
+ e.datepicker._formatDate;e.datepicker._formatDate=function(c,a,b,d){var e=this._get(c,"timepicker");return e?(a&&this._base_formatDate(c,a,b,d),e._updateDateTime(),e.$input.val()):this._base_formatDate(c)};e.datepicker._base_optionDatepicker=e.datepicker._optionDatepicker;e.datepicker._optionDatepicker=function(c,a,b){var d=this._get(this._getInst(c),"timepicker");if(d){var e,g,j;if(typeof a=="string")a==="minDate"||a==="minDateTime"?e=b:a==="maxDate"||a==="maxDateTime"?g=b:a==="onSelect"&&(j=b);
71
+ else if(typeof a=="object")if(a.minDate)e=a.minDate;else if(a.minDateTime)e=a.minDateTime;else if(a.maxDate)g=a.maxDate;else if(a.maxDateTime)g=a.maxDateTime;if(e)e=e==0?new Date:new Date(e),d._defaults.minDate=e,d._defaults.minDateTime=e;else if(g)g=g==0?new Date:new Date(g),d._defaults.maxDate=g,d._defaults.maxDateTime=g;else if(j)d._defaults.onSelect=j}this._base_optionDatepicker(c,a,b)};e.timepicker=new m;e.timepicker.version="0.9.7"})(jQuery);
js/jqueryui/jquery.ui.datepicker.min.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Datepicker 1.8.17
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Datepicker
9
+ *
10
+ * Depends:
11
+ * jquery.ui.core.js
12
+ */(function($,undefined){function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);!c.length||c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);!$.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])&&!!d.length&&(d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover"))})}function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}$.extend($.ui,{datepicker:{version:"1.8.17"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){extendRemove(this._defaults,a||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a))},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$('<span class="'+this._appendClass+'">'+c+"</span>"),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('<button type="button"></button>').addClass(this._triggerClass).html(g==""?f:$("<img/>").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){$.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._showDatepicker(a[0]);return!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;d<a.length;d++)a[d].length>b&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block"))},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+g+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f);return this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})}},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(a){try{return $.data(a,PROP_NAME)}catch(b){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(a,b,c){var d=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?$.extend({},$.datepicker._defaults):d?b=="all"?$.extend({},d.settings):this._get(d,b):null;var e=b||{};typeof b=="string"&&(e={},e[b]=c);if(d){this._curInst==d&&this._hideDatepicker();var f=this._getDateDatepicker(a,!0),g=this._getMinMaxDate(d,"min"),h=this._getMinMaxDate(d,"max");extendRemove(d.settings,e),g!==null&&e.dateFormat!==undefined&&e.minDate===undefined&&(d.settings.minDate=this._formatDate(d,g)),h!==null&&e.dateFormat!==undefined&&e.maxDate===undefined&&(d.settings.maxDate=this._formatDate(d,h)),this._attachments($(a),d),this._autoSize(d),this._setDate(d,f),this._updateAlternate(d),this._updateDatepicker(d)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){var b=this._getInst(a);b&&this._updateDatepicker(b)},_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);c&&!c.inline&&this._setDateFromField(c,b);return c?this._getDate(c):null},_doKeyDown:function(a){var b=$.datepicker._getInst(a.target),c=!0,d=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if($.datepicker._datepickerShowing)switch(a.keyCode){case 9:$.datepicker._hideDatepicker(),c=!1;break;case 13:var e=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",b.dpDiv);e[0]&&$.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,e[0]);var f=$.datepicker._get(b,"onSelect");if(f){var g=$.datepicker._formatDate(b);f.apply(b.input?b.input[0]:null,[g,b])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&$.datepicker._clearDate(a.target),c=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&$.datepicker._gotoToday(a.target),c=a.ctrlKey||a.metaKey;break;case 37:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?1:-1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,-7,"D"),c=a.ctrlKey||a.metaKey;break;case 39:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?-1:1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,7,"D"),c=a.ctrlKey||a.metaKey;break;default:c=!1}else a.keyCode==36&&a.ctrlKey?$.datepicker._showDatepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var b=$.datepicker._getInst(a.target);if($.datepicker._get(b,"constrainInput")){var c=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),d=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||d<" "||!c||c.indexOf(d)>-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(a){$.datepicker.log(a)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if(!$.datepicker._isDisabledDatepicker(a)&&$.datepicker._lastInput!=a){var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){e|=$(this).css("position")=="fixed";return!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0);return b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=$.data(a,PROP_NAME))&&this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=this,f=function(){$.datepicker._tidyDialog(b),e._curInst=null};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,f):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,f),c||f(),this._datepickerShowing=!1;var g=this._get(b,"onClose");g&&g.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!!$.datepicker._curInst){var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);this._isDisabledDatepicker(d[0])||(this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e))},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if(!$(d).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(e[0])){var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0),b.setDate(1);return Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1<a.length&&a.charAt(s+1)==b;c&&s++;return c},o=function(a){var c=n(a),d=a=="@"?14:a=="!"?20:a=="y"&&c?4:a=="o"?3:2,e=new RegExp("^\\d{1,"+d+"}"),f=b.substring(r).match(e);if(!f)throw"Missing number at position "+r;r+=f[0].length;return parseInt(f[0],10)},p=function(a,c,d){var e=$.map(n(a)?d:c,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;$.each(e,function(a,c){var d=c[1];if(b.substr(r,d.length).toLowerCase()==d.toLowerCase()){f=c[0],r+=d.length;return!1}});if(f!=-1)return f+1;throw"Unknown name at position "+r},q=function(){if(b.charAt(r)!=a.charAt(s))throw"Unexpected literal at position "+r;r++},r=0;for(var s=0;s<a.length;s++)if(m)a.charAt(s)=="'"&&!n("'")?m=!1:q();else switch(a.charAt(s)){case"d":k=o("d");break;case"D":p("D",e,f);break;case"o":l=o("o");break;case"m":j=o("m");break;case"M":j=p("M",g,h);break;case"y":i=o("y");break;case"@":var t=new Date(o("@"));i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"!":var t=new Date((o("!")-this._ticksTo1970)/1e4);i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"'":n("'")?q():m=!0;break;default:q()}if(r<b.length)throw"Extra/unparsed characters found in date: "+b.substring(r);i==-1?i=(new Date).getFullYear():i<100&&(i+=(new Date).getFullYear()-(new Date).getFullYear()%100+(i<=d?0:-100));if(l>-1){j=1,k=l;for(;;){var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+1<a.length&&a.charAt(m+1)==b;c&&m++;return c},i=function(a,b,c){var d=""+b;if(h(a))while(d.length<c)d="0"+d;return d},j=function(a,b,c,d){return h(a)?d[b]:c[b]},k="",l=!1;if(b)for(var m=0;m<a.length;m++)if(l)a.charAt(m)=="'"&&!h("'")?l=!1:k+=a.charAt(m);else switch(a.charAt(m)){case"d":k+=i("d",b.getDate(),2);break;case"D":k+=j("D",b.getDay(),d,e);break;case"o":k+=i("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":k+=i("m",b.getMonth()+1,2);break;case"M":k+=j("M",b.getMonth(),f,g);break;case"y":k+=h("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case"@":k+=b.getTime();break;case"!":k+=b.getTime()*1e4+this._ticksTo1970;break;case"'":h("'")?k+="'":l=!0;break;default:k+=a.charAt(m)}return k},_possibleChars:function(a){var b="",c=!1,d=function(b){var c=e+1<a.length&&a.charAt(e+1)==b;c&&e++;return c};for(var e=0;e<a.length;e++)if(c)a.charAt(e)=="'"&&!d("'")?c=!1:b+=a.charAt(e);else switch(a.charAt(e)){case"d":case"m":case"y":case"@":b+="0123456789";break;case"D":case"M":return null;case"'":d("'")?b+="'":c=!0;break;default:b+=a.charAt(e)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e,f;e=f=this._getDefaultDate(a);var g=this._getFormatConfig(a);try{e=this.parseDate(c,d,g)||f}catch(h){this.log(h),d=b?"":d}a.selectedDay=e.getDate(),a.drawMonth=a.selectedMonth=e.getMonth(),a.drawYear=a.selectedYear=e.getFullYear(),a.currentDay=d?e.getDate():0,a.currentMonth=d?e.getMonth():0,a.currentYear=d?e.getFullYear():0,this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var d=function(a){var b=new Date;b.setDate(b.getDate()+a);return b},e=function(b){try{return $.datepicker.parseDate($.datepicker._get(a,"dateFormat"),b,$.datepicker._getFormatConfig(a))}catch(c){}var d=(b.toLowerCase().match(/^c/)?$.datepicker._getDate(a):null)||new Date,e=d.getFullYear(),f=d.getMonth(),g=d.getDate(),h=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,i=h.exec(b);while(i){switch(i[2]||"d"){case"d":case"D":g+=parseInt(i[1],10);break;case"w":case"W":g+=parseInt(i[1],10)*7;break;case"m":case"M":f+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f));break;case"y":case"Y":e+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f))}i=h.exec(b)}return new Date(e,f,g)},f=b==null||b===""?c:typeof b=="string"?e(b):typeof b=="number"?isNaN(b)?c:d(b):new Date(b.getTime());f=f&&f.toString()=="Invalid Date"?c:f,f&&(f.setHours(0),f.setMinutes(0),f.setSeconds(0),f.setMilliseconds(0));return this._daylightSavingAdjust(f)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&p<l?l:p;while(this._daylightSavingAdjust(new Date(o,n,1))>p)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+a.id+"', -"+i+", 'M');\""+' title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>":e?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+a.id+"', +"+i+", 'M');\""+' title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":e?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+dpuuid+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>",x=d?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?w:"")+(this._isInRange(a,v)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._gotoToday('#"+a.id+"');\""+">"+u+"</button>":"")+(c?"":w)+"</div>":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L<g[0];L++){var M="";this.maxRows=4;for(var N=0;N<g[1];N++){var O=this._daylightSavingAdjust(new Date(o,n,a.selectedDay)),P=" ui-corner-all",Q="";if(j){Q+='<div class="ui-datepicker-group';if(g[1]>1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+P+'">'+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var R=z?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="<th"+((S+y+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+A[T]+'">'+C[T]+"</span></th>"}Q+=R+"</tr></thead><tbody>";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z<X;Z++){Q+="<tr>";var _=z?'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(Y)+"</td>":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Y<l||m&&Y>m;_+='<td class="'+((S+y+6)%7>=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!bb||G)&&ba[2]?' title="'+ba[2]+'"':"")+(bc?"":' onclick="DP_jQuery_'+dpuuid+".datepicker._selectDay('#"+a.id+"',"+Y.getMonth()+","+Y.getFullYear()+', this);return false;"')+">"+(bb&&!G?"&#xa0;":bc?'<span class="ui-state-default">'+Y.getDate()+"</span>":'<a class="ui-state-default'+(Y.getTime()==b.getTime()?" ui-state-highlight":"")+(Y.getTime()==k.getTime()?" ui-state-active":"")+(bb?" ui-priority-secondary":"")+'" href="#">'+Y.getDate()+"</a>")+"</td>",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+"</tr>"}n++,n>11&&(n=0,o++),Q+="</tbody></table>"+(j?"</div>"+(g[0]>0&&N==g[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),M+=Q}K+=M}K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),a._keyEvent=!1;return K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this
13
+ ._get(a,"showMonthAfterYear"),l='<div class="ui-datepicker-title">',m="";if(f||!i)m+='<span class="ui-datepicker-month">'+g[b]+"</span>";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" "+">";for(var p=0;p<12;p++)(!n||p>=d.getMonth())&&(!o||p<=e.getMonth())&&(m+='<option value="'+p+'"'+(p==b?' selected="selected"':"")+">"+h[p]+"</option>");m+="</select>"}k||(l+=m+(f||!i||!j?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+='<span class="ui-datepicker-year">'+c+"</span>";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" "+">";for(;t<=u;t++)a.yearshtml+='<option value="'+t+'"'+(t==c?' selected="selected"':"")+">"+t+"</option>";a.yearshtml+="</select>",l+=a.yearshtml,a.yearshtml=null}}l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?"&#xa0;":"")+m),l+="</div>";return l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&b<c?c:b;e=d&&e>d?d:e;return e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)})},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.17",window["DP_jQuery_"+dpuuid]=$})(jQuery)
js/jqueryui/jquery.ui.slider.min.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Slider 1.8.17
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Slider
9
+ *
10
+ * Depends:
11
+ * jquery.ui.core.js
12
+ * jquery.ui.mouse.js
13
+ * jquery.ui.widget.js
14
+ */(function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;i<g;i+=1)h.push(f);this.handles=e.add(a(h.join("")).appendTo(b.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){d.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){d.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")}),this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)}),this.handles.keydown(function(d){var e=!0,f=a(this).data("index.ui-slider-handle"),g,h,i,j;if(!b.options.disabled){switch(d.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:e=!1;if(!b._keySliding){b._keySliding=!0,a(this).addClass("ui-state-active"),g=b._start(d,f);if(g===!1)return}}j=b.options.step,b.options.values&&b.options.values.length?h=i=b.values(f):h=i=b.value();switch(d.keyCode){case a.ui.keyCode.HOME:i=b._valueMin();break;case a.ui.keyCode.END:i=b._valueMax();break;case a.ui.keyCode.PAGE_UP:i=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.PAGE_DOWN:i=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(h===b._valueMax())return;i=b._trimAlignValue(h+j);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(h===b._valueMin())return;i=b._trimAlignValue(h-j)}b._slide(d,f,i);return e}}).keyup(function(c){var d=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,d),b._change(c,d),a(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy();return this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h,i,j,k,l;if(c.disabled)return!1;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),d={x:b.pageX,y:b.pageY},e=this._normValueFromMouse(d),f=this._valueMax()-this._valueMin()+1,h=this,this.handles.each(function(b){var c=Math.abs(e-h.values(b));f>c&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i);if(j===!1)return!1;this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0;return!0},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);this._slide(a,this._handleIndex,c);return!1},_mouseStop:function(a){this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1;return!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e;return this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values());return this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c<d)&&(c=d),c!==this.values(b)&&(e=this.values(),e[b]=c,f=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e}),d=this.values(b?0:1),f!==!1&&this.values(b,c,!0))):c!==this.value()&&(f=this._trigger("slide",a,{handle:this.handles[b],value:c}),f!==!1&&this.value(c))},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("change",a,c)}},value:function(a){if(arguments.length)this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);else return this._value()},values:function(b,c){var d,e,f;if(arguments.length>1)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()}},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length),a.Widget.prototype._setOption.apply(this,arguments);switch(b){case"disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){var a=this.options.value;a=this._trimAlignValue(a);return a},_values:function(a){var b,c,d;if(arguments.length){b=this.options.values[a],b=this._trimAlignValue(b);return b}c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;Math.abs(c)*2>=b&&(d+=c>0?b:-b);return parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery)
js/plupload-image.js ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($)
2
+ {
3
+ // Object containing all the plupload uploaders
4
+ var rwmb_image_uploaders = {},
5
+ max;
6
+
7
+ // Hide "Uploaded files" title as long as there are no files uploaded
8
+ // Note that we can have multiple upload forms in the page, so relative path to current element is important
9
+ $( '.rwmb-uploaded' ).each( function()
10
+ {
11
+ var $this = $(this),
12
+ $lis = $this.children(),
13
+ $title = $this.siblings( '.rwmb-uploaded-title' );
14
+ if ( 0 == $lis.length )
15
+ {
16
+ $title.addClass( 'hidden' );
17
+ $this.addClass( 'hidden' );
18
+ }
19
+ } );
20
+
21
+ // Hide "Uploaded files" title if there are no files uploaded after deleting files
22
+ $( '.rwmb-images' ).on( 'click', '.rwmb-delete-file', function()
23
+ {
24
+ // Check if we need to show drop target
25
+ var $images = $(this).parents( '.rwmb-images' ),
26
+ uploaded = $images.children().length - 1, // -1 for the one we just deleted
27
+ $dragndrop = $images.siblings( '.rwmb-drag-drop' );
28
+
29
+ if ( 0 == uploaded )
30
+ {
31
+ $images.siblings( '.rwmb-uploaded-title' ).addClass( 'hidden' );
32
+ $images.addClass( 'hidden' );
33
+ }
34
+
35
+ // After delete files, show the Drag & Drop section
36
+ $dragndrop.show();
37
+ } );
38
+
39
+ // Using all the image prefixes
40
+ $( 'input:hidden.rwmb-image-prefix' ).each( function()
41
+ {
42
+ var prefix = $( this ).val(),
43
+ nonce = $( '#nonce-upload-images_' + prefix ).val();
44
+
45
+ // Adding container, browser button and drag ang drop area
46
+ rwmb_plupload_init = $.extend( {
47
+ container : prefix + '-container',
48
+ browse_button: prefix + '-browse-button',
49
+ drop_element : prefix + '-dragdrop'
50
+ }, rwmb_plupload_defaults );
51
+
52
+ // Add field_id to the ajax call
53
+ rwmb_plupload_init['multipart_params'] = {
54
+ action : 'plupload_image_upload',
55
+ field_id: prefix,
56
+ _wpnonce: nonce,
57
+ post_id : $( '#post_ID' ).val()
58
+ };
59
+
60
+ // Create new uploader
61
+ rwmb_image_uploaders[prefix] = new plupload.Uploader( rwmb_plupload_init );
62
+ rwmb_image_uploaders[prefix].init();
63
+
64
+ rwmb_image_uploaders[prefix].bind( 'FilesAdded', function( up, files )
65
+ {
66
+ var max_file_uploads = $( '#' + this.settings.container + ' .max_file_uploads' ).val(),
67
+ uploaded = $( '#' + this.settings.container + ' .rwmb-uploaded' ).children().length,
68
+ msg = 'You may only upload ' + max_file_uploads + ' file';
69
+
70
+ if ( max_file_uploads > 1 )
71
+ msg += 's';
72
+
73
+ // Remove files from queue if exceed max file uploads
74
+ if ( ( uploaded + files.length ) > max_file_uploads )
75
+ {
76
+ for ( var i = files.length; i--; )
77
+ {
78
+ up.removeFile( files[i] );
79
+ }
80
+ alert( msg );
81
+ return false;
82
+ }
83
+
84
+ // Hide drag & drop section if reach max file uploads
85
+ if ( ( uploaded + files.length ) == max_file_uploads )
86
+ $( '#' + this.settings.container ).find( '.rwmb-drag-drop' ).hide();
87
+
88
+ max = parseInt( up.settings.max_file_size, 10 );
89
+
90
+ // Upload files
91
+ plupload.each( files, function( file )
92
+ {
93
+ add_loading( up, file );
94
+ add_throbber( file );
95
+ if ( file.size >= max )
96
+ remove_error( file );
97
+ } );
98
+ up.refresh();
99
+ up.start();
100
+ } );
101
+
102
+ rwmb_image_uploaders[prefix].bind( 'Error', function( up, e )
103
+ {
104
+ add_loading( up, e.file );
105
+ remove_error( e.file );
106
+ up.removeFile( e.file );
107
+ } );
108
+
109
+ rwmb_image_uploaders[prefix].bind( 'UploadProgress', function( up, file )
110
+ {
111
+ var $uploaded = $( '#' + this.settings.container + ' .rwmb-uploaded' ),
112
+ $uploaded_title = $( '#' + this.settings.container + ' .rwmb-uploaded-title' );
113
+
114
+ // Update the loading div
115
+ $( 'div.rwmb-image-uploading-bar', 'li#' + file.id ).css( 'height', file.percent + '%' );
116
+
117
+ // Show them all
118
+ $uploaded.removeClass( 'hidden' );
119
+ $uploaded_title.removeClass( 'hidden' );
120
+ } );
121
+
122
+ rwmb_image_uploaders[prefix].bind( 'FileUploaded', function( up, file, response )
123
+ {
124
+ var res = wpAjax.parseAjaxResponse( $.parseXML( response.response ), 'ajax-response' );
125
+ false === res.errors ? $( 'li#' + file.id ).replaceWith( res.responses[0].data ) : remove_error( file );
126
+ } );
127
+ });
128
+
129
+ /**
130
+ * Helper functions
131
+ */
132
+
133
+ /**
134
+ * Removes li element if there is an error with the file
135
+ *
136
+ * @return void
137
+ */
138
+ function remove_error( file )
139
+ {
140
+ $( 'li#' + file.id )
141
+ .addClass( 'rwmb-image-error' )
142
+ .delay( 1600 )
143
+ .fadeOut( 'slow', function()
144
+ {
145
+ $(this).remove();
146
+ }
147
+ );
148
+ }
149
+
150
+ /**
151
+ * Adds loading li element
152
+ *
153
+ * @return void
154
+ */
155
+ function add_loading( up, file )
156
+ {
157
+ $list = $( '#' + up.settings.container ).find( 'ul' );
158
+ $list.append( "<li id='" + file.id + "'><div class='rwmb-image-uploading-bar'></div><div id='" + file.id + "-throbber' class='rwmb-image-uploading-status'></div></li>" );
159
+ }
160
+
161
+ /**
162
+ * Adds loading throbber while waiting for a response
163
+ *
164
+ * @return void
165
+ */
166
+ function add_throbber( file )
167
+ {
168
+ $( '#' + file.id + '-throbber' ).html( "<img class='rwmb-loader' height='64' width='64' src='" + RWMB.url + "img/loader.gif'/>" );
169
+ }
170
+ });
js/slider.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($)
2
+ {
3
+ var
4
+ id = null
5
+ ,el = null
6
+ ,input = null
7
+ ,label = null
8
+ ,format = null
9
+ ,value = null
10
+ ,update = null
11
+ ;
12
+ $( '.rwmb-slider' ).each( function( i, val )
13
+ {
14
+ id = $( val ).attr( 'id' );
15
+ el = $( '#' + id );
16
+ input = $( '[name=' + id + ']' );
17
+ label = $( '[for=' + id + ']' );
18
+ format = $( el ).attr( 'rel' );
19
+
20
+ $( label ).append( ': <span id="' + id + '-label"></span>' );
21
+ update = $( '#' + id + '-label' );
22
+
23
+ if (
24
+ ! $( input ).val()
25
+ || 'undefined' === $( input ).val()
26
+ || null === typeof $( input ).val()
27
+ )
28
+ {
29
+ $( input ).val( $( el ).slider( "values", 0 ) );
30
+ $( update ).text( "0" );
31
+ }
32
+ else
33
+ {
34
+ value = $( input ).val();
35
+ $( update ).text( value );
36
+ }
37
+ if ( 0 < format.length )
38
+ $( update ).append( ' ' + format );
39
+
40
+ el.slider(
41
+ {
42
+ value: value,
43
+ slide: function( event, ui )
44
+ {
45
+ $( input ).val( ui.value );
46
+ $( update ).text( ui.value + ' ' + format );
47
+ }
48
+ } );
49
+ });
50
+ } );
js/taxonomy.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($)
2
+ {
3
+ $( '.rw-taxonomy-tree input:checkbox' ).change( function()
4
+ {
5
+ var $this = $( this ),
6
+ $childList = $this.parent().siblings( '.rw-taxonomy-tree' );
7
+ if ( $this.is( ':checked' ) )
8
+ $childList.removeClass( 'hidden' );
9
+ else
10
+ {
11
+ $('input', $childList).removeAttr('checked');
12
+ $childList.addClass( 'hidden' );
13
+ }
14
+ } );
15
+
16
+ $( '.rw-taxonomy-tree select' ).change( function()
17
+ {
18
+ var $this = $( this ),
19
+ $childList = $this.parent().find( 'div.rw-taxonomy-tree' ),
20
+ $value = $this.val();
21
+ $childList.removeClass('active').addClass('disabled').find('select').each(function(){
22
+ $(this).val($('options:first', this).val()).attr("disabled", "disabled")
23
+ });
24
+ $childList.filter('#rwmb-taxonomy-' + $value).removeClass('disabled').addClass('active').children('select').removeAttr('disabled');
25
+
26
+ } );
27
+ } );
js/thickbox-image.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($)
2
+ {
3
+ // Reorder images
4
+ $( '.rwmb-thickbox-upload' ).click( function()
5
+ {
6
+ var $this = $(this),
7
+ $holder = $this.siblings( '.rwmb-images' ),
8
+ post_id = $('#post_ID').val(),
9
+ field_id = $this.attr('rel'),
10
+ backup = window.send_to_editor;
11
+ window.send_to_editor = function(html) {
12
+ var $img = $('<div />').append(html).find('img'),
13
+ url = $img.attr('src'),
14
+ img_class = $img.attr('class'),
15
+ id = parseInt(img_class.replace(/\D/g, ''), 10);
16
+
17
+ html = '<li id="item_' + id + '">';
18
+ html += '<img src="' + url + '" />';
19
+ html += '<div class="rwmb-image-bar">';
20
+ html += '<a class="rwmb-delete-file" href="#" rel="' + id + '">Delete</a>';
21
+ html += '</div>';
22
+ html += '<input type="hidden" name="' + field_id + '[]" value="' + id + '" />';
23
+ html += '</li>';
24
+
25
+ $holder.append($(html)).removeClass('hidden');
26
+
27
+ tb_remove();
28
+ window.send_to_editor = backup;
29
+ }
30
+ tb_show('', 'media-upload.php?post_id=' + post_id + '&TB_iframe=true');
31
+
32
+ return false;
33
+ } );
34
+ } );
js/time.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Update datetime picker element
3
+ * Used for static & dynamic added elements (when clone)
4
+ */
5
+ function rwmb_update_time_picker()
6
+ {
7
+ var $ = jQuery;
8
+
9
+ $( '.rwmb-time' ).each( function()
10
+ {
11
+ var $this = $( this ),
12
+ format = $this.attr( 'rel' ),
13
+ show_amppm = /t/i.test(format),
14
+ show_second = /:s/.test(format),
15
+ show_millisec = /:l/.test(format);
16
+
17
+ $this.removeClass('hasDatepicker').attr('id', '').timepicker( {
18
+ showSecond : show_second,
19
+ showMillisec: show_millisec,
20
+ timeFormat : format,
21
+ ampm : show_amppm,
22
+ } );
23
+ } );
24
+ }
25
+
26
+ jQuery( document ).ready( function($)
27
+ {
28
+ rwmb_update_time_picker();
29
+ } );
js/validate.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function ($) {
2
+
3
+ $(document).ready(function() {
4
+
5
+ // required field styling
6
+ $.each(rwmb.validationOptions.rules, function(k, v) {
7
+ if (v['required']) {
8
+ var label = $('#' + k).parent().siblings('.rwmb-label');
9
+ $(label).find('label').css('font-weight','bold');
10
+ $(label).append('<span class="required">*</span>');
11
+ }
12
+ });
13
+
14
+ rwmb.validationOptions.invalidHandler = function(form, validator) {
15
+ // re-enable the submit (publish/update) button and hide the ajax indicator
16
+ $('#publish').removeClass('button-primary-disabled');
17
+ $('#ajax-loading').attr('style','');
18
+ $('form#post').siblings('#message').remove();
19
+ $('form#post').before('<div id="message" class="error"><p>' + rwmb.summaryMessage + '</p></div>');
20
+ };
21
+ $('form#post').validate(rwmb.validationOptions);
22
+
23
+ });
24
+
25
+ });
lang/de_DE.mo ADDED
Binary file
lang/de_DE.po ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-03-02 14:08+0700\n"
6
+ "PO-Revision-Date: 2012-03-02 14:08+0700\n"
7
+ "Last-Translator: name <email@domain.com>\n"
8
+ "Language-Team: Franz Josef Kaiser <24-7@gmx.net>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: German\n"
15
+ "X-Poedit-Country: AUSTRIA\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:334
21
+ msgid "+"
22
+ msgstr ""
23
+
24
+ #: ../meta-box.php:358
25
+ msgid "&#8211;"
26
+ msgstr ""
27
+
28
+ #: ../meta-box.php:691
29
+ msgid "RW_Meta_Box Debug:"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/color.php:45
33
+ msgid "Select a color"
34
+ msgstr "Farbe wählen"
35
+
36
+ #: ../inc/fields/file.php:69
37
+ msgid "Error: Cannot delete file"
38
+ msgstr "Fehler: Datei kann nicht gelöscht werden"
39
+
40
+ #: ../inc/fields/file.php:83
41
+ #, fuzzy
42
+ msgctxt "file upload"
43
+ msgid "Uploaded files"
44
+ msgstr "Dateien fertig geladen"
45
+
46
+ #: ../inc/fields/file.php:84
47
+ msgctxt "file upload"
48
+ msgid "Delete this file"
49
+ msgstr "Datei löschen"
50
+
51
+ #: ../inc/fields/file.php:85
52
+ #, fuzzy
53
+ msgctxt "file upload"
54
+ msgid "Delete"
55
+ msgstr "Löschen"
56
+
57
+ #: ../inc/fields/file.php:86
58
+ msgctxt "file upload"
59
+ msgid "Upload files"
60
+ msgstr "Datei hochladen"
61
+
62
+ #: ../inc/fields/file.php:87
63
+ msgctxt "file upload"
64
+ msgid "Add another file"
65
+ msgstr "Weitere Datei"
66
+
67
+ #: ../inc/fields/image.php:68
68
+ #, fuzzy
69
+ msgid "Order saved"
70
+ msgstr "Reihenfolge gespeichert"
71
+
72
+ #: ../inc/fields/image.php:84
73
+ #: ../inc/fields/plupload-image.php:178
74
+ #, fuzzy
75
+ msgctxt "image upload"
76
+ msgid "Uploaded files"
77
+ msgstr "Dateien fertig geladen"
78
+
79
+ #: ../inc/fields/image.php:85
80
+ #: ../inc/fields/plupload-image.php:140
81
+ msgctxt "image upload"
82
+ msgid "Delete this file"
83
+ msgstr "Datei löschen"
84
+
85
+ #: ../inc/fields/image.php:86
86
+ #: ../inc/fields/plupload-image.php:141
87
+ #, fuzzy
88
+ msgctxt "image upload"
89
+ msgid "Delete"
90
+ msgstr "Löschen"
91
+
92
+ #: ../inc/fields/image.php:87
93
+ #: ../inc/fields/plupload-image.php:142
94
+ msgctxt "image upload"
95
+ msgid "Edit"
96
+ msgstr ""
97
+
98
+ #: ../inc/fields/image.php:88
99
+ #: ../inc/fields/plupload-image.php:179
100
+ msgctxt "image upload"
101
+ msgid "Upload files"
102
+ msgstr "Dateien hochladen"
103
+
104
+ #: ../inc/fields/image.php:89
105
+ #: ../inc/fields/plupload-image.php:180
106
+ msgctxt "image upload"
107
+ msgid "Add another file"
108
+ msgstr "Weitere Datei"
109
+
110
+ #: ../inc/fields/plupload-image.php:112
111
+ msgctxt "image upload"
112
+ msgid "Allowed Image Files"
113
+ msgstr ""
114
+
115
+ #: ../inc/fields/plupload-image.php:183
116
+ msgctxt "image upload"
117
+ msgid "Drop images here"
118
+ msgstr ""
119
+
120
+ #: ../inc/fields/plupload-image.php:184
121
+ msgctxt "image upload"
122
+ msgid "or"
123
+ msgstr ""
124
+
125
+ #: ../inc/fields/plupload-image.php:185
126
+ #, fuzzy
127
+ msgctxt "image upload"
128
+ msgid "Select Files"
129
+ msgstr "Farbe wählen"
130
+
131
+ #~ msgid "Cannot delete file. Something's wrong."
132
+ #~ msgstr "Fehler: Datei kann nicht gelöscht werden."
133
+
134
+ #~ msgid "Upload new files"
135
+ #~ msgstr "Neue Dateien hochladen"
136
+
137
+ #~ msgid "Uploaded images"
138
+ #~ msgstr "Bilder fertig geladen"
139
+
140
+ #~ msgid "Upload new images"
141
+ #~ msgstr "Neue Bilder hochladen"
lang/default.mo ADDED
Binary file
lang/default.po ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
+ "PO-Revision-Date: 2012-06-03 15:09+0700\n"
7
+ "Last-Translator: Rilwis <rilwis@gmail.com>\n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: VIET NAM\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:79
21
+ msgid "RW_Meta_Box Debug:"
22
+ msgstr ""
23
+
24
+ #: ../inc/classes/meta-box.php:316
25
+ msgid "+"
26
+ msgstr ""
27
+
28
+ #: ../inc/classes/meta-box.php:340
29
+ msgid "&#8211;"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/file.php:69
33
+ msgid "Error: Cannot delete file"
34
+ msgstr ""
35
+
36
+ #: ../inc/fields/file.php:83
37
+ msgctxt "file upload"
38
+ msgid "Uploaded files"
39
+ msgstr ""
40
+
41
+ #: ../inc/fields/file.php:84
42
+ msgctxt "file upload"
43
+ msgid "Delete this file"
44
+ msgstr ""
45
+
46
+ #: ../inc/fields/file.php:85
47
+ msgctxt "file upload"
48
+ msgid "Delete"
49
+ msgstr ""
50
+
51
+ #: ../inc/fields/file.php:86
52
+ msgctxt "file upload"
53
+ msgid "Upload files"
54
+ msgstr ""
55
+
56
+ #: ../inc/fields/file.php:87
57
+ msgctxt "file upload"
58
+ msgid "+ Add new file"
59
+ msgstr ""
60
+
61
+ #: ../inc/fields/image.php:75
62
+ msgid "Order saved"
63
+ msgstr ""
64
+
65
+ #: ../inc/fields/image.php:91
66
+ #: ../inc/fields/plupload-image.php:156
67
+ msgctxt "image upload"
68
+ msgid "Uploaded files"
69
+ msgstr ""
70
+
71
+ #: ../inc/fields/image.php:92
72
+ #: ../inc/fields/plupload-image.php:112
73
+ msgctxt "image upload"
74
+ msgid "Delete this file"
75
+ msgstr ""
76
+
77
+ #: ../inc/fields/image.php:93
78
+ #: ../inc/fields/plupload-image.php:113
79
+ msgctxt "image upload"
80
+ msgid "Delete"
81
+ msgstr ""
82
+
83
+ #: ../inc/fields/image.php:94
84
+ #: ../inc/fields/plupload-image.php:114
85
+ msgctxt "image upload"
86
+ msgid "Edit"
87
+ msgstr ""
88
+
89
+ #: ../inc/fields/image.php:95
90
+ #: ../inc/fields/plupload-image.php:157
91
+ msgctxt "image upload"
92
+ msgid "Upload files"
93
+ msgstr ""
94
+
95
+ #: ../inc/fields/image.php:96
96
+ msgctxt "image upload"
97
+ msgid "+ Add new image"
98
+ msgstr ""
99
+
100
+ #: ../inc/fields/plupload-image.php:95
101
+ msgctxt "image upload"
102
+ msgid "Allowed Image Files"
103
+ msgstr ""
104
+
105
+ #: ../inc/fields/plupload-image.php:160
106
+ msgctxt "image upload"
107
+ msgid "Drop images here"
108
+ msgstr ""
109
+
110
+ #: ../inc/fields/plupload-image.php:161
111
+ msgctxt "image upload"
112
+ msgid "or"
113
+ msgstr ""
114
+
115
+ #: ../inc/fields/plupload-image.php:162
116
+ msgctxt "image upload"
117
+ msgid "Select Files"
118
+ msgstr ""
119
+
120
+ #: ../inc/fields/thickbox-image.php:45
121
+ msgctxt "image upload"
122
+ msgid "Upload image"
123
+ msgstr ""
124
+
lang/it_IT.mo ADDED
Binary file
lang/it_IT.po ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-03-02 14:08+0700\n"
6
+ "PO-Revision-Date: 2012-03-02 14:08+0700\n"
7
+ "Last-Translator: name <email@domain.com>\n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2;_x:2c,1\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
+ "X-Poedit-SearchPath-0: ..\n"
19
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
20
+
21
+ #: ../meta-box.php:334
22
+ msgid "+"
23
+ msgstr ""
24
+
25
+ #: ../meta-box.php:358
26
+ msgid "&#8211;"
27
+ msgstr ""
28
+
29
+ #: ../meta-box.php:691
30
+ msgid "RW_Meta_Box Debug:"
31
+ msgstr ""
32
+
33
+ #: ../inc/fields/color.php:45
34
+ msgid "Select a color"
35
+ msgstr "Seleziona un colore"
36
+
37
+ #: ../inc/fields/file.php:69
38
+ msgid "Error: Cannot delete file"
39
+ msgstr "Errore: impossibile cancellare il file"
40
+
41
+ #: ../inc/fields/file.php:83
42
+ msgctxt "file upload"
43
+ msgid "Uploaded files"
44
+ msgstr "Carica i files"
45
+
46
+ #: ../inc/fields/file.php:84
47
+ msgctxt "file upload"
48
+ msgid "Delete this file"
49
+ msgstr "Elimina file"
50
+
51
+ #: ../inc/fields/file.php:85
52
+ msgctxt "file upload"
53
+ msgid "Delete"
54
+ msgstr "Elimina"
55
+
56
+ #: ../inc/fields/file.php:86
57
+ msgctxt "file upload"
58
+ msgid "Upload files"
59
+ msgstr "Carica files"
60
+
61
+ #: ../inc/fields/file.php:87
62
+ msgctxt "file upload"
63
+ msgid "Add another file"
64
+ msgstr "Aggiungi altro file"
65
+
66
+ #: ../inc/fields/image.php:68
67
+ msgid "Order saved"
68
+ msgstr "Ordine salvato"
69
+
70
+ #: ../inc/fields/image.php:84
71
+ #: ../inc/fields/plupload-image.php:178
72
+ msgctxt "image upload"
73
+ msgid "Uploaded files"
74
+ msgstr "Files caricati"
75
+
76
+ #: ../inc/fields/image.php:85
77
+ #: ../inc/fields/plupload-image.php:140
78
+ msgctxt "image upload"
79
+ msgid "Delete this file"
80
+ msgstr "Elimina file"
81
+
82
+ #: ../inc/fields/image.php:86
83
+ #: ../inc/fields/plupload-image.php:141
84
+ msgctxt "image upload"
85
+ msgid "Delete"
86
+ msgstr "Cancella"
87
+
88
+ #: ../inc/fields/image.php:87
89
+ #: ../inc/fields/plupload-image.php:142
90
+ msgctxt "image upload"
91
+ msgid "Edit"
92
+ msgstr ""
93
+
94
+ #: ../inc/fields/image.php:88
95
+ #: ../inc/fields/plupload-image.php:179
96
+ msgctxt "image upload"
97
+ msgid "Upload files"
98
+ msgstr "Carica files"
99
+
100
+ #: ../inc/fields/image.php:89
101
+ #: ../inc/fields/plupload-image.php:180
102
+ msgctxt "image upload"
103
+ msgid "Add another file"
104
+ msgstr "Aggiungi altro file"
105
+
106
+ #: ../inc/fields/plupload-image.php:112
107
+ msgctxt "image upload"
108
+ msgid "Allowed Image Files"
109
+ msgstr ""
110
+
111
+ #: ../inc/fields/plupload-image.php:183
112
+ msgctxt "image upload"
113
+ msgid "Drop images here"
114
+ msgstr ""
115
+
116
+ #: ../inc/fields/plupload-image.php:184
117
+ msgctxt "image upload"
118
+ msgid "or"
119
+ msgstr ""
120
+
121
+ #: ../inc/fields/plupload-image.php:185
122
+ #, fuzzy
123
+ msgctxt "image upload"
124
+ msgid "Select Files"
125
+ msgstr "Seleziona un colore"
126
+
lang/nb_NO.mo ADDED
Binary file
lang/nb_NO.po ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-03-02 14:08+0700\n"
6
+ "PO-Revision-Date: 2012-03-05 22:32+0100\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: Magnus Kolstad <mrkolby@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2;_x:2c,1\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: Norwegian (Bokmål)\n"
15
+ "X-Poedit-Country: Norwegian\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
+ "X-Poedit-SearchPath-0: ..\n"
19
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
20
+
21
+ #: ../meta-box.php:334
22
+ msgid "+"
23
+ msgstr "+"
24
+
25
+ #: ../meta-box.php:358
26
+ msgid "&#8211;"
27
+ msgstr "&#8211;"
28
+
29
+ #: ../meta-box.php:691
30
+ msgid "RW_Meta_Box Debug:"
31
+ msgstr "RW_Meta_Box-debug"
32
+
33
+ #: ../inc/fields/color.php:45
34
+ msgid "Select a color"
35
+ msgstr "Velg en farge"
36
+
37
+ #: ../inc/fields/file.php:69
38
+ msgid "Error: Cannot delete file"
39
+ msgstr "Feil: Kan ikke slette fil"
40
+
41
+ #: ../inc/fields/file.php:83
42
+ msgctxt "file upload"
43
+ msgid "Uploaded files"
44
+ msgstr "Opplastede filer"
45
+
46
+ #: ../inc/fields/file.php:84
47
+ msgctxt "file upload"
48
+ msgid "Delete this file"
49
+ msgstr "Slett denne filen"
50
+
51
+ #: ../inc/fields/file.php:85
52
+ msgctxt "file upload"
53
+ msgid "Delete"
54
+ msgstr "Slett"
55
+
56
+ #: ../inc/fields/file.php:86
57
+ msgctxt "file upload"
58
+ msgid "Upload files"
59
+ msgstr "Last opp filer"
60
+
61
+ #: ../inc/fields/file.php:87
62
+ msgctxt "file upload"
63
+ msgid "Add another file"
64
+ msgstr "Legg til en fil"
65
+
66
+ #: ../inc/fields/image.php:68
67
+ msgid "Order saved"
68
+ msgstr "Sortering lagret"
69
+
70
+ #: ../inc/fields/image.php:84
71
+ #: ../inc/fields/plupload-image.php:178
72
+ msgctxt "image upload"
73
+ msgid "Uploaded files"
74
+ msgstr "Opplastede filer"
75
+
76
+ #: ../inc/fields/image.php:85
77
+ #: ../inc/fields/plupload-image.php:140
78
+ msgctxt "image upload"
79
+ msgid "Delete this file"
80
+ msgstr "Slett denne filen"
81
+
82
+ #: ../inc/fields/image.php:86
83
+ #: ../inc/fields/plupload-image.php:141
84
+ msgctxt "image upload"
85
+ msgid "Delete"
86
+ msgstr "Slett"
87
+
88
+ #: ../inc/fields/image.php:87
89
+ #: ../inc/fields/plupload-image.php:142
90
+ msgctxt "image upload"
91
+ msgid "Edit"
92
+ msgstr "Endre"
93
+
94
+ #: ../inc/fields/image.php:88
95
+ #: ../inc/fields/plupload-image.php:179
96
+ msgctxt "image upload"
97
+ msgid "Upload files"
98
+ msgstr "Last opp filer"
99
+
100
+ #: ../inc/fields/image.php:89
101
+ #: ../inc/fields/plupload-image.php:180
102
+ msgctxt "image upload"
103
+ msgid "Add another file"
104
+ msgstr "Legg til en fil"
105
+
106
+ #: ../inc/fields/plupload-image.php:112
107
+ msgctxt "image upload"
108
+ msgid "Allowed Image Files"
109
+ msgstr "Tillate bilde-filer"
110
+
111
+ #: ../inc/fields/plupload-image.php:183
112
+ msgctxt "image upload"
113
+ msgid "Drop images here"
114
+ msgstr "Slipp bildene her"
115
+
116
+ #: ../inc/fields/plupload-image.php:184
117
+ msgctxt "image upload"
118
+ msgid "or"
119
+ msgstr "eller"
120
+
121
+ #: ../inc/fields/plupload-image.php:185
122
+ #, fuzzy
123
+ msgctxt "image upload"
124
+ msgid "Select Files"
125
+ msgstr "Velg en farge"
126
+
127
+ #~ msgid "Cannot delete file. Something's wrong."
128
+ #~ msgstr "Kan ikke slette filen. Noe er galt."
129
+
130
+ #~ msgid "Uploaded files"
131
+ #~ msgstr "Opplastede filer."
132
+
133
+ #~ msgid "Delete"
134
+ #~ msgstr "Slett"
135
+
136
+ #~ msgid "Upload new files"
137
+ #~ msgstr "Last opp nye filer"
138
+
139
+ #~ msgid "Add more file"
140
+ #~ msgstr "Legg til flere filer"
141
+
142
+ #~ msgid "Uploaded images"
143
+ #~ msgstr "Opplastede bilder"
144
+
145
+ #~ msgid "Delete this image"
146
+ #~ msgstr "Slett dette bildet"
147
+
148
+ #~ msgid "Upload new images"
149
+ #~ msgstr "Last opp nye bilder"
lang/pt_BR.mo ADDED
Binary file
lang/pt_BR.po ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-03-02 14:08+0700\n"
6
+ "PO-Revision-Date: 2012-03-19 02:59-0300\n"
7
+ "Last-Translator: name <email@domain.com>\n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: VIET NAM\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:334
21
+ msgid "+"
22
+ msgstr ""
23
+
24
+ #: ../meta-box.php:358
25
+ msgid "&#8211;"
26
+ msgstr ""
27
+
28
+ #: ../meta-box.php:691
29
+ msgid "RW_Meta_Box Debug:"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/color.php:45
33
+ msgid "Select a color"
34
+ msgstr "Selecione a cor"
35
+
36
+ #: ../inc/fields/file.php:69
37
+ msgid "Error: Cannot delete file"
38
+ msgstr ""
39
+
40
+ #: ../inc/fields/file.php:83
41
+ msgctxt "file upload"
42
+ msgid "Uploaded files"
43
+ msgstr "Arquivos carregados"
44
+
45
+ #: ../inc/fields/file.php:84
46
+ msgctxt "file upload"
47
+ msgid "Delete this file"
48
+ msgstr "Deletar esse arquivo"
49
+
50
+ #: ../inc/fields/file.php:85
51
+ msgctxt "file upload"
52
+ msgid "Delete"
53
+ msgstr "Deletar"
54
+
55
+ #: ../inc/fields/file.php:86
56
+ msgctxt "file upload"
57
+ msgid "Upload files"
58
+ msgstr "Carregar arquivos"
59
+
60
+ #: ../inc/fields/file.php:87
61
+ msgctxt "file upload"
62
+ msgid "Add another file"
63
+ msgstr "Adicionar outro arquivo"
64
+
65
+ #: ../inc/fields/image.php:68
66
+ msgid "Order saved"
67
+ msgstr "Salvar ordem"
68
+
69
+ #: ../inc/fields/image.php:84
70
+ #: ../inc/fields/plupload-image.php:178
71
+ msgctxt "image upload"
72
+ msgid "Uploaded files"
73
+ msgstr "Arquivos carregados"
74
+
75
+ #: ../inc/fields/image.php:85
76
+ #: ../inc/fields/plupload-image.php:140
77
+ msgctxt "image upload"
78
+ msgid "Delete this file"
79
+ msgstr "Deletar esse arquivo"
80
+
81
+ #: ../inc/fields/image.php:86
82
+ #: ../inc/fields/plupload-image.php:141
83
+ msgctxt "image upload"
84
+ msgid "Delete"
85
+ msgstr "Deletar"
86
+
87
+ #: ../inc/fields/image.php:87
88
+ #: ../inc/fields/plupload-image.php:142
89
+ msgctxt "image upload"
90
+ msgid "Edit"
91
+ msgstr "Editar"
92
+
93
+ #: ../inc/fields/image.php:88
94
+ #: ../inc/fields/plupload-image.php:179
95
+ msgctxt "image upload"
96
+ msgid "Upload files"
97
+ msgstr "Carregar arquivos"
98
+
99
+ #: ../inc/fields/image.php:89
100
+ #: ../inc/fields/plupload-image.php:180
101
+ msgctxt "image upload"
102
+ msgid "Add another file"
103
+ msgstr "Adicionar outro arquivo"
104
+
105
+ #: ../inc/fields/plupload-image.php:112
106
+ msgctxt "image upload"
107
+ msgid "Allowed Image Files"
108
+ msgstr "Arquivos de imagem permetidos"
109
+
110
+ #: ../inc/fields/plupload-image.php:183
111
+ msgctxt "image upload"
112
+ msgid "Drop images here"
113
+ msgstr "Largue as imagens aqui"
114
+
115
+ #: ../inc/fields/plupload-image.php:184
116
+ msgctxt "image upload"
117
+ msgid "or"
118
+ msgstr "ou"
119
+
120
+ #: ../inc/fields/plupload-image.php:185
121
+ msgctxt "image upload"
122
+ msgid "Select Files"
123
+ msgstr "Selecione os arquivos"
124
+
lang/sv_SE.mo ADDED
Binary file
lang/sv_SE.po ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
+ "PO-Revision-Date: 2012-08-09 16:15+0100\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
13
+ "_nx_noop:1,2\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "Language: en_VN\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:79
21
+ msgid "RW_Meta_Box Debug:"
22
+ msgstr ""
23
+
24
+ #: ../inc/classes/meta-box.php:316
25
+ msgid "+"
26
+ msgstr ""
27
+
28
+ #: ../inc/classes/meta-box.php:340
29
+ msgid "&#8211;"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/file.php:69
33
+ msgid "Error: Cannot delete file"
34
+ msgstr "Fel: Kan inte radera filen"
35
+
36
+ #: ../inc/fields/file.php:83
37
+ msgctxt "file upload"
38
+ msgid "Uploaded files"
39
+ msgstr "Uppladdade filer"
40
+
41
+ #: ../inc/fields/file.php:84
42
+ msgctxt "file upload"
43
+ msgid "Delete this file"
44
+ msgstr "Radera den här filen"
45
+
46
+ #: ../inc/fields/file.php:85
47
+ msgctxt "file upload"
48
+ msgid "Delete"
49
+ msgstr "Radera"
50
+
51
+ #: ../inc/fields/file.php:86
52
+ msgctxt "file upload"
53
+ msgid "Upload files"
54
+ msgstr "Ladda upp"
55
+
56
+ #: ../inc/fields/file.php:87
57
+ msgctxt "file upload"
58
+ msgid "+ Add new file"
59
+ msgstr "+ Lägg till ny fil"
60
+
61
+ #: ../inc/fields/image.php:75
62
+ msgid "Order saved"
63
+ msgstr "Ordning sparad"
64
+
65
+ #: ../inc/fields/image.php:91 ../inc/fields/plupload-image.php:156
66
+ msgctxt "image upload"
67
+ msgid "Uploaded files"
68
+ msgstr "Uppladdade filer"
69
+
70
+ #: ../inc/fields/image.php:92 ../inc/fields/plupload-image.php:112
71
+ msgctxt "image upload"
72
+ msgid "Delete this file"
73
+ msgstr "Radera den här filen"
74
+
75
+ #: ../inc/fields/image.php:93 ../inc/fields/plupload-image.php:113
76
+ msgctxt "image upload"
77
+ msgid "Delete"
78
+ msgstr "Radera"
79
+
80
+ #: ../inc/fields/image.php:94 ../inc/fields/plupload-image.php:114
81
+ msgctxt "image upload"
82
+ msgid "Edit"
83
+ msgstr "Redigera"
84
+
85
+ #: ../inc/fields/image.php:95 ../inc/fields/plupload-image.php:157
86
+ msgctxt "image upload"
87
+ msgid "Upload files"
88
+ msgstr "Ladda upp filer"
89
+
90
+ #: ../inc/fields/image.php:96
91
+ msgctxt "image upload"
92
+ msgid "+ Add new image"
93
+ msgstr "+ Lägg till ny bild"
94
+
95
+ #: ../inc/fields/plupload-image.php:95
96
+ msgctxt "image upload"
97
+ msgid "Allowed Image Files"
98
+ msgstr "Tillåtna bildformat"
99
+
100
+ #: ../inc/fields/plupload-image.php:160
101
+ msgctxt "image upload"
102
+ msgid "Drop images here"
103
+ msgstr "Släpp bilder här"
104
+
105
+ #: ../inc/fields/plupload-image.php:161
106
+ msgctxt "image upload"
107
+ msgid "or"
108
+ msgstr "eller"
109
+
110
+ #: ../inc/fields/plupload-image.php:162
111
+ msgctxt "image upload"
112
+ msgid "Select Files"
113
+ msgstr "Välj filer"
114
+
115
+ #: ../inc/fields/thickbox-image.php:45
116
+ msgctxt "image upload"
117
+ msgid "Upload image"
118
+ msgstr "Ladda upp bild"
lang/vi.mo ADDED
Binary file
lang/vi.po ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:10+0700\n"
6
+ "PO-Revision-Date: 2012-06-03 15:10+0700\n"
7
+ "Last-Translator: Rilwis <rilwis@gmail.com>\n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: VIET NAM\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:79
21
+ msgid "RW_Meta_Box Debug:"
22
+ msgstr ""
23
+
24
+ #: ../inc/classes/meta-box.php:316
25
+ msgid "+"
26
+ msgstr ""
27
+
28
+ #: ../inc/classes/meta-box.php:340
29
+ msgid "&#8211;"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/file.php:69
33
+ msgid "Error: Cannot delete file"
34
+ msgstr "Lỗi: Không xóa được file"
35
+
36
+ #: ../inc/fields/file.php:83
37
+ msgctxt "file upload"
38
+ msgid "Uploaded files"
39
+ msgstr "Các file đã tải lên"
40
+
41
+ #: ../inc/fields/file.php:84
42
+ msgctxt "file upload"
43
+ msgid "Delete this file"
44
+ msgstr "Xóa file"
45
+
46
+ #: ../inc/fields/file.php:85
47
+ msgctxt "file upload"
48
+ msgid "Delete"
49
+ msgstr "Xóa"
50
+
51
+ #: ../inc/fields/file.php:86
52
+ msgctxt "file upload"
53
+ msgid "Upload files"
54
+ msgstr "Tải file"
55
+
56
+ #: ../inc/fields/file.php:87
57
+ msgctxt "file upload"
58
+ msgid "+ Add new file"
59
+ msgstr "+ Thêm file mới"
60
+
61
+ #: ../inc/fields/image.php:75
62
+ msgid "Order saved"
63
+ msgstr "Đã lưu thứ tự"
64
+
65
+ #: ../inc/fields/image.php:91
66
+ #: ../inc/fields/plupload-image.php:156
67
+ msgctxt "image upload"
68
+ msgid "Uploaded files"
69
+ msgstr "Các file đã tải lên"
70
+
71
+ #: ../inc/fields/image.php:92
72
+ #: ../inc/fields/plupload-image.php:112
73
+ msgctxt "image upload"
74
+ msgid "Delete this file"
75
+ msgstr "Xóa file"
76
+
77
+ #: ../inc/fields/image.php:93
78
+ #: ../inc/fields/plupload-image.php:113
79
+ msgctxt "image upload"
80
+ msgid "Delete"
81
+ msgstr "Xóa"
82
+
83
+ #: ../inc/fields/image.php:94
84
+ #: ../inc/fields/plupload-image.php:114
85
+ msgctxt "image upload"
86
+ msgid "Edit"
87
+ msgstr "Sửa"
88
+
89
+ #: ../inc/fields/image.php:95
90
+ #: ../inc/fields/plupload-image.php:157
91
+ msgctxt "image upload"
92
+ msgid "Upload files"
93
+ msgstr "Tải file"
94
+
95
+ #: ../inc/fields/image.php:96
96
+ msgctxt "image upload"
97
+ msgid "+ Add new image"
98
+ msgstr "+ Thêm hình mới"
99
+
100
+ #: ../inc/fields/plupload-image.php:95
101
+ msgctxt "image upload"
102
+ msgid "Allowed Image Files"
103
+ msgstr "Các file hình ảnh được cho phép"
104
+
105
+ #: ../inc/fields/plupload-image.php:160
106
+ msgctxt "image upload"
107
+ msgid "Drop images here"
108
+ msgstr "Kéo thả hình ảnh vào đây"
109
+
110
+ #: ../inc/fields/plupload-image.php:161
111
+ msgctxt "image upload"
112
+ msgid "or"
113
+ msgstr "hoặc"
114
+
115
+ #: ../inc/fields/plupload-image.php:162
116
+ msgctxt "image upload"
117
+ msgid "Select Files"
118
+ msgstr "Chọn file"
119
+
120
+ #: ../inc/fields/thickbox-image.php:45
121
+ #, fuzzy
122
+ msgctxt "image upload"
123
+ msgid "Upload image"
124
+ msgstr "Tải file"
125
+
126
+ #~ msgid "Select a color"
127
+ #~ msgstr "Chọn một màu"
128
+ #~ msgctxt "image upload"
129
+
130
+ #~ msgid "Add another file"
131
+ #~ msgstr "Thêm file mới"
meta-box.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Meta Box
4
+ Plugin URI: http://www.deluxeblogtips.com/meta-box
5
+ Description: Create meta box for editing pages in WordPress. Compatible with custom post types since WP 3.0
6
+ Version: 4.1.10
7
+ Author: Rilwis
8
+ Author URI: http://www.deluxeblogtips.com
9
+ License: GPL2+
10
+ */
11
+
12
+ // Prevent loading this file directly
13
+ defined( 'ABSPATH' ) || exit;
14
+
15
+ // Script version, used to add version for scripts and styles
16
+ define( 'RWMB_VER', '4.1.9' );
17
+
18
+ // Define plugin URLs, for fast enqueuing scripts and styles
19
+ if ( ! defined( 'RWMB_URL' ) )
20
+ define( 'RWMB_URL', plugin_dir_url( __FILE__ ) );
21
+ define( 'RWMB_JS_URL', trailingslashit( RWMB_URL . 'js' ) );
22
+ define( 'RWMB_CSS_URL', trailingslashit( RWMB_URL . 'css' ) );
23
+
24
+ // Plugin paths, for including files
25
+ if ( ! defined( 'RWMB_DIR' ) )
26
+ define( 'RWMB_DIR', plugin_dir_path( __FILE__ ) );
27
+ define( 'RWMB_INC_DIR', trailingslashit( RWMB_DIR . 'inc' ) );
28
+ define( 'RWMB_FIELDS_DIR', trailingslashit( RWMB_INC_DIR . 'fields' ) );
29
+ define( 'RWMB_CLASSES_DIR', trailingslashit( RWMB_INC_DIR . 'classes' ) );
30
+
31
+ // Optimize code for loading plugin files ONLY on admin side
32
+ // @see http://www.deluxeblogtips.com/?p=345
33
+
34
+ // Helper function to retrieve meta value
35
+ require_once RWMB_INC_DIR . 'helpers.php';
36
+
37
+ if ( is_admin() )
38
+ {
39
+ require_once RWMB_INC_DIR . 'common.php';
40
+
41
+ // Field classes
42
+ foreach ( glob( RWMB_FIELDS_DIR . '*.php' ) as $file )
43
+ {
44
+ require_once $file;
45
+ }
46
+
47
+ // Main file
48
+ require_once RWMB_CLASSES_DIR . 'meta-box.php';
49
+ }
readme.md ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [Project Page](http://www.deluxeblogtips.com/meta-box/) | [Getting Started](http://www.deluxeblogtips.com/meta-box/getting-started/) | [Support Forums](http://www.deluxeblogtips.com/forums/) | [Donate](http://www.deluxeblogtips.com/donate/)
2
+
3
+ ***
4
+
5
+ ## Plugin Information
6
+
7
+ Meta Box plugin provides an API to easily implement custom meta boxes in editing pages (add new/edit post) in WordPress. It works with custom post types and supports various field types.
8
+
9
+ ### Features
10
+
11
+ * Easily registers multiple custom meta boxes for posts, pages or custom post types
12
+ * Has built-in hooks which allow you to change the appearance and behavior of meta boxes
13
+ * Easily integrated with themes
14
+
15
+ ### Supported fields
16
+
17
+ - checkbox_list
18
+ - checkbox
19
+ - color
20
+ - date
21
+ - datetime
22
+ - file
23
+ - hidden
24
+ - image
25
+ - password
26
+ - plupload_image
27
+ - radio
28
+ - select
29
+ - slider
30
+ - taxonomy
31
+ - text
32
+ - textarea
33
+ - thickbox_image
34
+ - time
35
+ - wysiwyg
36
+
37
+ ***
38
+
39
+ ## Installation
40
+
41
+ 1. Unzip the download package
42
+ 1. Upload `meta-box` to the `/wp-content/plugins/` directory
43
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
44
+
45
+ To getting started with the plugin API, please read [this tutorial](http://www.deluxeblogtips.com/meta-box/getting-started/).
46
+
47
+ ***
48
+
49
+ ## Contributors
50
+
51
+ - [Tran Ngoc Tuan Anh a.k.a Rilwis](http://www.deluxeblogtips.com/) - Initial & lead developer
52
+ - [Franz Josef Kaiser](http://unserkaiser.com)
53
+ - Omnicia
54
+ - ruanmer
55
+ - PerWiklander
56
+ - funkedgeek
57
+
58
+ [See full list of angels!](https://github.com/rilwis/meta-box/contributors)
59
+
60
+ ***
61
+
62
+ ## Changelog
63
+
64
+ #### 4.1.10
65
+ * Allow helper functions can be used in admin area
66
+ * Allow cloned fields to have a uniquely indexed `name` attribute
67
+ * Add Swedish translation
68
+ * Allow hidden field has its own value
69
+ * Taxonomy field now supported by `rwmb_meta` function
70
+ * Improvement in code format and field normalizing
71
+
72
+ #### 4.1.9
73
+ * Add helper function to retrieve meta values
74
+ * Add basic validation (JS based)
75
+ * Fix image reorder bug
76
+ * Fix `select_tree` option for taxonomy field
77
+ * Fix not showing loading image for 1st image using plupload
78
+
79
+ #### 4.1.8
80
+ * Add missed JS file for thickbox image
81
+
82
+ #### 4.1.7
83
+ * Quick fix for thickbox image
84
+
85
+ #### 4.1.6
86
+ * Quick fix for checkbox list and multiple/clonable fields
87
+
88
+ #### 4.1.5
89
+ * Taxonomy field is now in core
90
+ * Add demo for including meta boxes for specific posts based on IDs or page templates
91
+ * Meta box ID is now optional
92
+ * Add `thickbox_image` field for uploading image with WP style
93
+ * Fix `guid` for uploaded images
94
+
95
+ #### 4.1.4
96
+ * Fix taxonomy field
97
+
98
+ #### 4.1.3
99
+ * Support max_file_uploads for plupload_image
100
+ * Better enqueue styles and scripts
101
+ * Store images in correct order after re-order
102
+ * Fix cloning color, date, time, datetime fields
103
+
104
+ #### 4.1.2
105
+ * Improve taxonomy field
106
+ * Add filter to wp_editor
107
+ * Add more options for time field
108
+ * Improve plupload_image field
109
+ * Fix translation, use string for textdomain
110
+
111
+ #### 4.1.1
112
+ * Fix translation
113
+ * Change jQueryUI theme to 'smoothness'
114
+ * Add more demos in the `demo` folder
115
+
116
+ #### 4.1
117
+ * Added jQuery UI slider field
118
+ * Added new Plupload file uploader
119
+ * Added new checkbox list
120
+ * Fix empty jQuery UI div seen in FF in admin footer area
121
+ * Fix style for 'side' meta box
122
+
123
+ #### 4.0.2
124
+ * Reformat code to make more readable
125
+ * Fix bugs of checkbox field and date field
126
+
127
+ #### 4.0.1
128
+ * Change `format_response()` to `ajax_response()` and use WP_Ajax_Response class to control the ajax response
129
+ * Use `wp_editor()` built-in with WP 3.3 (with fallback)
130
+
131
+ #### 4.0
132
+ * strongly refactor code
133
+ * create/check better nonce for each meta box
134
+ * use local JS/CSS libs instead of remote files for better control if conflict occurs
135
+ * separate field functions (enqueue scripts and styles, add actions, show, save) into separated classes
136
+ * use filters to let user change HTML of fields
137
+ * use filters to validate/change field values instead of validation class
138
+ * don't use Ajax on image upload as it's buggy and complicated. Revert to default upload
139
+
140
+ #### 3.2.2
141
+ * fix WYSIWYG field for custom post type without 'editor' support. Thanks Jamie, Eugene and Selin Online. [link](http://disq.us/2hzgsk)
142
+ * change some helper function to static as they're shared between objects
143
+
144
+ #### 3.2.1
145
+ * fix code for getting script's url in Windows
146
+ * make meta box id is optional
147
+
148
+ #### 3.2
149
+ * move js and css codes to separated files (rewrite js code for fields, too)
150
+ * allow to add multiple images to image meta field with selection, modified from "Fast Insert Image" plugin
151
+ * remove 'style' attibutes for fields as all CSS rules now can be put in the 'meta=box.css' file. All fields now has the class 'rw=$type', and table cells have class 'rwmb=label' and 'rwmb=field'
152
+ * allow to use file uploader for images as well, regarding [link](http://disq.us/1k2lwf)
153
+ * when delete uploaded images, they're not deleted from the server (in case you insert them from the media, not the uploader). Also remove hook to delete all attachments when delete post. Regarding [link](http://disq.us/1nppyi)
154
+ * change hook for adding meta box to 'add_meta_boxes', according Codex. Required WP 3.0+
155
+ * fix image uploading when custom post type doesn't support "editor"
156
+ * fix show many alerts when delete files, regarding [link](http://disq.us/1lolgb)
157
+ * fix js comma missing bug when implement multiple fields with same type
158
+ * fix order of uploaded images, thank Onur
159
+ * fix deleting new uploaded image
160
+ * fix bug when save meta value = zero (0), regarding [link](http://disq.us/1tg008)
161
+ * some minor changes such as = add 'id' attribute to fields, show uploaded images as thumbnail, add script to header of post.php and post=new.php only
162
+
163
+ #### 3.1
164
+ * use thickbox for image uploading, allow user edit title, caption or crop, rotate image (credit to Stewart Duffy, idea from Jaace http =//disq.us/1bu64d)
165
+ * allow to reorder uploaded images (credit to Kai)
166
+ * save attach ID instead of url (credit to Stewart Duffy)
167
+ * escape fields value (credit to Stewart Duffy)
168
+ * add 'style' attribute to fields, allow user quick style fields (like height, width, etc.) (credit to Anders Larsson [link](http://disq.us/1eg4kp))
169
+ * wrap ajax callbacks into the class
170
+ * fix jquery UI conflict (for time picker, color picker, contextual help)
171
+ * fix notice error for checking post type
172
+
173
+ #### 3.0.1
174
+ * save uploaded images and files' urls in meta fields
175
+ * fix date picker bug to not show saved value [link](http://disq.us/1cg6mx)
176
+ * fix check_admin_referer for non=supported post types [link](http://goo.gl/B6cah)
177
+ * refactor code for showing fields
178
+
179
+ #### 3.0
180
+ * separate functions for checking, displaying and saving each type of field; allow developers easily extend the class
181
+ * add 'checkbox_list' (credit to Jan Fabry [link](http://goo.gl/9sDAx)), 'color', 'date', 'time' types. The 'taxonomy' type is added as an example of extending class (credit to Manny Fresh [link](http://goo.gl/goGfm))
182
+ * show uploaded files as well as allow to add/delete attached files
183
+ * delete attached files when post is deleted (credit to Kai [link](http://goo.gl/9gfvd))
184
+ * validation function MUST return the value instead of true, false
185
+ * change the way of definition 'radio', 'select' field type to make it more simpler, allow multiple selection of select box
186
+ * improved some codes, fix code to not show warnings when in debugging mode
187
+
188
+ #### 2.4.1
189
+ * fix bug of not receiving value for select box
190
+
191
+ #### 2.4
192
+ * (image upload features are credit to Kai [link](http://twitter.com/ungestaltbar))
193
+ * change image upload using meta fields to using default WP gallery
194
+ * add delete button for images, using ajax
195
+ * allow to upload multiple images
196
+ * add validation for meta fields
197
+
198
+ #### 2.3
199
+ * add wysiwyg editor type, improve check for upload fields, change context and priority attributes to optional
200
+
201
+ #### 2.2
202
+ * add enctype to post form (fix upload bug), thanks to [link](http://goo.gl/PWWNf)
203
+
204
+ #### 2.1
205
+ * add file upload, image upload support
206
+
207
+ #### 2.0
208
+ * oop code, support multiple post types, multiple meta boxes
209
+
210
+ #### 1.0
211
+ * procedural code
readme.txt ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Meta Box ===
2
+ Contributors: rilwis, franz-josef-kaiser, Omnicia, funkedgeek, PerWiklander, ruanmer
3
+ Donate link: http://www.deluxeblogtips.com/donate
4
+ Tags: meta-box, custom-fields, custom-field, meta, meta-boxes
5
+ Requires at least: 3.0
6
+ Tested up to: 3.4.1
7
+ Stable tag: 4.1.10
8
+
9
+ Meta Box plugin helps you easily implement multiple meta boxes in editing pages in WordPress. Works with custom post types and various field types.
10
+
11
+ == Description ==
12
+
13
+ Meta Box plugin provides an API to easily implement custom meta boxes in editing pages (add new/edit post) in WordPress. It works with custom post types and supports various field types.
14
+
15
+ **Features**
16
+
17
+ * Easily registers multiple custom meta boxes for posts, pages or custom post types
18
+ * Has built-in hooks which allow you to change the appearance and behavior of meta boxes
19
+ * Easily integrated with themes
20
+
21
+ **Supported fields**
22
+
23
+ - checkbox_list
24
+ - checkbox
25
+ - color
26
+ - date
27
+ - datetime
28
+ - file
29
+ - hidden
30
+ - image
31
+ - password
32
+ - plupload_image
33
+ - radio
34
+ - select
35
+ - slider
36
+ - taxonomy
37
+ - text
38
+ - textarea
39
+ - thickbox_image
40
+ - time
41
+ - wysiwyg
42
+
43
+ [Project Page](http://www.deluxeblogtips.com/meta-box/) | [Getting Started](http://www.deluxeblogtips.com/meta-box/getting-started/) | [Support Forums](http://www.deluxeblogtips.com/forums/) | [Donate](http://www.deluxeblogtips.com/donate/)
44
+
45
+ == Installation ==
46
+
47
+ 1. Unzip the download package
48
+ 1. Upload `meta-box` to the `/wp-content/plugins/` directory
49
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
50
+
51
+ To getting started with the plugin API, please read [this tutorial](http://www.deluxeblogtips.com/meta-box/getting-started/).
52
+
53
+ == Frequently Asked Questions ==
54
+
55
+ == Screenshots ==
56
+ 1. Basic fields
57
+ 2. Advanced fields
58
+
59
+ == Changelog ==
60
+
61
+ = 4.1.10 =
62
+ * Allow helper functions can be used in admin area
63
+ * Allow cloned fields to have a uniquely indexed `name` attribute
64
+ * Add Swedish translation
65
+ * Allow hidden field has its own value
66
+ * Taxonomy field now supported by `rwmb_meta` function
67
+ * Improvement in code format and field normalizing
68
+
69
+ = 4.1.9 =
70
+ * Add helper function to retrieve meta values
71
+ * Add basic validation (JS based)
72
+ * Fix image reorder bug
73
+ * Fix `select_tree` option for taxonomy field
74
+ * Fix not showing loading image for 1st image using plupload
75
+
76
+ = 4.1.8 =
77
+ * Add missed JS file for thickbox image
78
+
79
+ = 4.1.7 =
80
+ * Quick fix for thickbox image
81
+
82
+ = 4.1.6 =
83
+ * Quick fix for checkbox list and multiple/clonable fields
84
+
85
+ = 4.1.5 =
86
+ * Taxonomy field is now in core
87
+ * Add demo for including meta boxes for specific posts based on IDs or page templates
88
+ * Meta box ID is now optional
89
+ * Add `thickbox_image` field for uploading image with WP style
90
+ * Fix `guid` for uploaded images
91
+
92
+ = 4.1.4 =
93
+ * Fix taxonomy field
94
+
95
+ = 4.1.3 =
96
+ * Support max_file_uploads for plupload_image
97
+ * Better enqueue styles & scripts
98
+ * Store images in correct order after re-order
99
+ * Fix cloning color, date, time, datetime fields
100
+
101
+ = 4.1.2 =
102
+ * Improve taxonomy field
103
+ * Add filter to wp_editor
104
+ * Add more options for time field
105
+ * Improve plupload_image field
106
+ * Fix translation, use string for textdomain
107
+
108
+ = 4.1.1 =
109
+ * Fix translation
110
+ * Change jQueryUI theme to 'smoothness'
111
+ * Add more demos in the `demo` folder
112
+
113
+ = 4.1 =
114
+ * Added jQuery UI slider field
115
+ * Added new Plupload file uploader
116
+ * Added new checkbox list
117
+ * Fix empty jQuery UI div seen in FF in admin footer area
118
+ * Fix style for 'side' meta box
119
+
120
+ = 4.0.2 =
121
+ * Reformat code to make more readable
122
+ * Fix bugs of checkbox field and date field
123
+
124
+ = 4.0.1 =
125
+ * Change format_response() to ajax_response() and use WP_Ajax_Response class to control the ajax response
126
+ * Use wp_editor() built-in with WP 3.3 (with fallback)
127
+
128
+ = 4.0 =
129
+ * strongly refactor code
130
+ * create/check better nonce for each meta box
131
+ * use local JS/CSS libs instead of remote files for better control if conflict occurs
132
+ * separate field functions (enqueue scripts and styles, add actions, show, save) into separated classes
133
+ * use filters to let user change HTML of fields
134
+ * use filters to validate/change field values instead of validation class
135
+ * don't use Ajax on image upload as it's buggy and complicated. Revert to default upload
136
+
137
+ = 3.2.2 =
138
+ * fix WYSIWYG field for custom post type without 'editor' support. Thanks Jamie, Eugene and Selin Online. (http =//disq.us/2hzgsk)
139
+ * change some helper function to static as they're shared between objects
140
+
141
+ = 3.2.1 =
142
+ * fix code for getting script's url in Windows
143
+ * make meta box id is optional
144
+
145
+ = 3.2 =
146
+ * move js and css codes to separated files (rewrite js code for fields, too)
147
+ * allow to add multiple images to image meta field with selection, modified from "Fast Insert Image" plugin
148
+ * remove 'style' attibutes for fields as all CSS rules now can be put in the 'meta=box.css' file. All fields now has the class 'rw=$type', and table cells have class 'rwmb=label' and 'rwmb=field'
149
+ * allow to use file uploader for images as well, regarding http =//disq.us/1k2lwf
150
+ * when delete uploaded images, they're not deleted from the server (in case you insert them from the media, not the uploader). Also remove hook to delete all attachments when delete post. Regarding http =//disq.us/1nppyi
151
+ * change hook for adding meta box to 'add_meta_boxes', according Codex. Required WP 3.0+
152
+ * fix image uploading when custom post type doesn't support "editor"
153
+ * fix show many alerts when delete files, regarding http =//disq.us/1lolgb
154
+ * fix js comma missing bug when implement multiple fields with same type
155
+ * fix order of uploaded images, thank Onur
156
+ * fix deleting new uploaded image
157
+ * fix bug when save meta value = zero (0), regarding http =//disq.us/1tg008
158
+ * some minor changes such as = add 'id' attribute to fields, show uploaded images as thumbnail, add script to header of post.php and post=new.php only
159
+
160
+ = 3.1 =
161
+ * use thickbox for image uploading, allow user edit title, caption or crop, rotate image (credit to Stewart Duffy, idea from Jaace http =//disq.us/1bu64d)
162
+ * allow to reorder uploaded images (credit to Kai)
163
+ * save attach ID instead of url (credit to Stewart Duffy)
164
+ * escape fields value (credit to Stewart Duffy)
165
+ * add 'style' attribute to fields, allow user quick style fields (like height, width, etc.) (credit to Anders Larsson http =//disq.us/1eg4kp)
166
+ * wrap ajax callbacks into the class
167
+ * fix jquery UI conflict (for time picker, color picker, contextual help)
168
+ * fix notice error for checking post type
169
+
170
+ = 3.0.1 =
171
+ * save uploaded images and files' urls in meta fields
172
+ * fix date picker bug to not show saved value (http =//disq.us/1cg6mx)
173
+ * fix check_admin_referer for non=supported post types (http =//goo.gl/B6cah)
174
+ * refactor code for showing fields
175
+
176
+ = 3.0 =
177
+ * separate functions for checking, displaying and saving each type of field; allow developers easily extend the class
178
+ * add 'checkbox_list' (credit to Jan Fabry http =//goo.gl/9sDAx), 'color', 'date', 'time' types. The 'taxonomy' type is added as an example of extending class (credit to Manny Fresh http =//goo.gl/goGfm)
179
+ * show uploaded files as well as allow to add/delete attached files
180
+ * delete attached files when post is deleted (credit to Kai http =//goo.gl/9gfvd)
181
+ * validation function MUST return the value instead of true, false
182
+ * change the way of definition 'radio', 'select' field type to make it more simpler, allow multiple selection of select box
183
+ * improved some codes, fix code to not show warnings when in debugging mode
184
+
185
+ = 2.4.1 =
186
+ * fix bug of not receiving value for select box
187
+
188
+ = 2.4 =
189
+ * (image upload features are credit to Kai http =//twitter.com/ungestaltbar)
190
+ * change image upload using meta fields to using default WP gallery
191
+ * add delete button for images, using ajax
192
+ * allow to upload multiple images
193
+ * add validation for meta fields
194
+
195
+ = 2.3 =
196
+ * add wysiwyg editor type, improve check for upload fields, change context and priority attributes to optional
197
+
198
+ = 2.2 =
199
+ * add enctype to post form (fix upload bug), thanks to http =//goo.gl/PWWNf
200
+
201
+ = 2.1 =
202
+ * add file upload, image upload support
203
+
204
+ = 2.0 =
205
+ * oop code, support multiple post types, multiple meta boxes
206
+
207
+ = 1.0 =
208
+ * procedural code
209
+
210
+ == Upgrade Notice ==
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file