OptionTree - Version 2.2.0

Version Description

  • Added the Gallery option type.
  • Added the On/Off option type.
  • Replaced the old Color Picker with the default WP Color Picker.
  • Added UI support for WordPress 3.8. Contributors via github @AlxMedia, and @valendesigns.
  • Added support for conditional toggling of settings fields. Contributors via github @maimairel, @valendesigns, @doitmax, and @imangm.
  • Replaced the OptionTree image icon with a font version.
  • Added 'background-size' to the Background option type.
  • Added fallback text when displaying posts without titles in various option types.
  • Added filter 'ot_recognized_background_fields' to show/hide fields for background option types.
  • Added filter 'ot_filter_description' that allows the theme option descriptions to be filtered before being displayed.
  • Added subfolder compatibility in theme mode. Contributors via github @doitmax, and @valendesigns.
  • Fixed a bug caused by using 'home_url' when loading dynamic CSS files.
  • Fixed an issue where you could not save metabox text field values as "0". Contributors via github @sparkdevelopment, and @valendesigns.
  • Fixed the broken localization directory path in theme mode. Contributors via github @youri--, and @valendesigns.
  • Fixed missing custom class for the Numeric Slider. Contributors via github @doitmax.
  • Added filter 'ot_type_category_checkbox_query' which allows you to filter the get_categories() args for Category Checkbox.
  • Added filter 'ot_type_category_select_query' which allows you to filter the get_categories() args for Category Select.
  • Added filter 'ot_type_taxonomy_checkbox_query' which allows you to filter the get_categories() args for Taxonomy Checkbox.
  • Added filter 'ot_type_taxonomy_select_query' which allows you to filter the get_categories() args for Taxonomy Select.
  • Added the 'ot_echo_option' function. Contributors via github @joshlevinson.
  • Added filter 'ot_theme_options_contextual_help' which allows you to filter the Contextual Help on the Theme Options page.
  • Added filter 'ot_theme_options_sections' which allows you to filter the Sections on the Theme Options page. Contributors via github @joshlevinson.
  • Added filter 'ot_theme_options_settings' which allows you to filter the Settings on the Theme Options page. Contributors via github @joshlevinson.
Download this release

Release Info

Developer valendesigns
Plugin Icon wp plugin OptionTree
Version 2.2.0
Comparing to
See all releases

Code changes from version 2.1.4 to 2.2.0

assets/css/ot-admin.css CHANGED
@@ -1,3 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /* --------------------------------------------------
2
  :: Screen Meta & Menu Icon
3
  ---------------------------------------------------*/
@@ -61,7 +125,6 @@
61
  min-width: 535px;
62
  overflow: hidden;
63
  position: relative;
64
- background-image: -webkit-linear-gradient(bottom, #373737, #464646 5px);
65
  -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
66
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
67
  -webkit-border-radius: 4px 4px 0 0;
@@ -84,25 +147,15 @@
84
  color: #fafafa;
85
  }
86
  #option-tree-header #option-tree-logo a {
87
- background: transparent url(../images/ot-logo.png) no-repeat 13px center;
88
  border-right: 1px solid #333;
89
- display: block;
90
  float: left;
91
  height: 24px;
92
- line-height: 24px;
93
  padding: 3px 12px 3px 13px;
94
- text-indent: -9999px;
95
- width: 24px;
96
  }
97
  #option-tree-header li#option-tree-logo:hover {
98
  color: #fafafa;
99
  background-color: #3a3a3a;
100
- background-image: -ms-linear-gradient(bottom,#3a3a3a,#222);
101
- background-image: -moz-linear-gradient(bottom,#3a3a3a,#222);
102
- background-image: -o-linear-gradient(bottom,#3a3a3a,#222);
103
- background-image: -webkit-gradient(linear,left bottom,left top,from(#3a3a3a),to(#222));
104
- background-image: -webkit-linear-gradient(bottom,#3a3a3a,#222);
105
- background-image: linear-gradient(bottom,#3a3a3a,#222);
106
  -webkit-border-top-left-radius: 5px;
107
  -moz-border-radius-topleft: 5px;
108
  border-top-left-radius: 5px;
@@ -180,11 +233,13 @@
180
  /* --------------------------------------------------
181
  :: Format Settings
182
  ---------------------------------------------------*/
183
- .format-settings {
184
- padding: 10px 0 20px 0;
185
  position: relative;
186
  width: 100%;
187
  }
 
 
 
188
 
189
  /* --------------------------------------------------
190
  :: Format Setting Label
@@ -318,18 +373,22 @@
318
  position: absolute;
319
  top: 10px;
320
  }
321
-
322
  @media only screen and (max-width: 900px) {
323
-
324
  .format-setting .description,
325
  .format-setting .format-setting-inner {
326
  width: 100%;
327
  }
328
-
329
  .format-setting .description {
330
  padding-top: 0px;
331
  };
332
  }
 
 
 
 
 
 
 
333
 
334
  /* --------------------------------------------------
335
  :: Code formatting
@@ -543,7 +602,7 @@ div.option-tree-ui-media-wrap {
543
  border-bottom-right-radius: 3px;
544
  border-bottom-left-radius: 3px;
545
  }
546
- li ul .format-settings {
547
  padding: 0 0 10px 0;
548
  }
549
  li ul .format-setting-label {
@@ -591,11 +650,6 @@ li ul .format-setting-label {
591
  /* --------------------------------------------------
592
  :: Select
593
  ---------------------------------------------------*/
594
- .select-group {
595
- margin-right: 53px;
596
- overflow: hidden;
597
- width: auto;
598
- }
599
  .select-wrapper {
600
  background: #fff url(../images/ot-select.png) no-repeat right center;
601
  border: 1px solid #ccc;
@@ -648,9 +702,10 @@ select.option-tree-ui-select option {
648
  min-width: 124px;
649
  }
650
  .type-measurement select.option-tree-ui-select {
651
- min-width: 68px !important;
652
  }
653
  .type-measurement .select-wrapper {
 
654
  position: absolute;
655
  right: 0px;
656
  top: 0px;
@@ -812,198 +867,43 @@ select.option-tree-ui-select option {
812
  :: Colorpicker
813
  ---------------------------------------------------*/
814
  .option-tree-ui-colorpicker-input-wrap {
815
- margin-right: 53px;
816
- position: relative;
817
- width: auto;
818
- }
819
- .format-settings .cp_box {
820
- background: #f1f1f1;
821
- border: 1px solid #ccc;
822
- bottom: 5px;
823
- height: 27px;
824
- position: absolute;
825
- right: -53px;
826
- width: 46px;
827
- -moz-border-radius: 2px;
828
- -webkit-border-radius: 2px;
829
- border-radius: 2px;
830
  }
831
- .ot_colorpicker {
832
- width: 342px;
833
- height: 170px;
834
- overflow: hidden;
835
- position: absolute;
836
- background: #fafafa url(../images/colorpicker/color_bg.png);
837
- font-family: Arial, Helvetica, sans-serif;
838
  display: none;
839
- border: 1px solid #bbb;
840
- -moz-border-radius: 2px;
841
- -webkit-border-radius: 2px;
842
- border-radius: 2px;
843
- -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
844
- box-shadow: 0 1px 3px rgba(0,0,0,0.05);
845
- z-index: 100;
846
- }
847
- .ot_colorpicker .colorpicker_color {
848
- width: 150px;
849
- height: 150px;
850
- left: 10px;
851
- top: 10px;
852
- position: absolute;
853
- background: #f00;
854
- overflow: hidden;
855
- cursor: crosshair;
856
- }
857
- .ot_colorpicker .colorpicker_color div {
858
- position: absolute;
859
- top: 0;
860
- left: 0;
861
- width: 150px;
862
- height: 150px;
863
- background: url(../images/colorpicker/color_overlay.png);
864
- }
865
- .ot_colorpicker .colorpicker_color div div {
866
- position: absolute;
867
- top: 0;
868
- left: 0;
869
- width: 11px;
870
- height: 11px;
871
- overflow: hidden;
872
- background: url(../images/colorpicker/color_select.gif);
873
- margin: -5px 0 0 -5px;
874
- }
875
- .ot_colorpicker .colorpicker_hue {
876
- position: absolute;
877
- top: 10px;
878
- left: 164px;
879
- width: 35px;
880
- height: 150px;
881
- cursor: n-resize;
882
- }
883
- .ot_colorpicker .colorpicker_hue div {
884
- position: absolute;
885
- width: 35px;
886
- height: 9px;
887
- overflow: hidden;
888
- background: url(../images/colorpicker/color_indicator.png) left top;
889
- margin: -5px 0 0 0;
890
- }
891
- .ot_colorpicker .colorpicker_new_color {
892
- position: absolute;
893
- width: 60px;
894
- height: 30px;
895
- right: 80px;
896
- top: 10px;
897
- background: #f00;
898
- }
899
- .ot_colorpicker .colorpicker_current_color {
900
- position: absolute;
901
- width: 60px;
902
- height: 30px;
903
- right: 10px;
904
- top: 10px;
905
- background: #f00;
906
- }
907
- .ot_colorpicker input {
908
- background-color: transparent !important;
909
- border: 1px solid transparent !important;
910
- position: absolute !important;
911
- font-size: 10px !important;
912
- font-family: Arial, Helvetica, sans-serif !important;
913
- color: #666 !important;
914
- top: 0px !important;
915
- right: 12px !important;
916
- text-align: right !important;
917
- margin: 0 !important;
918
- padding: 0 !important;
919
- height: 22px !important;
920
- line-height: 22px !important;
921
  }
922
- .ot_colorpicker .colorpicker_hex {
923
- position: absolute;
924
- width: 72px;
925
- height: 22px;
926
- background: url(../images/colorpicker/color_hex.png) top;
927
- left: 201px;
928
- bottom: 9px;
929
- }
930
- .ot_colorpicker .colorpicker_hex input {
931
- left: 13px;
932
- height: 22px;
933
- line-height: 22px;
934
- padding: 10px;
935
- }
936
- .ot_colorpicker .colorpicker_field {
937
- height: 22px;
938
- width: 62px;
939
- background-position: top;
940
- position: absolute;
941
- }
942
- .ot_colorpicker .colorpicker_field span {
943
- position: absolute;
944
- width: 12px;
945
- height: 22px;
946
- overflow: hidden;
947
- top: 0;
948
- right: 0;
949
- cursor: n-resize;
950
- }
951
- .ot_colorpicker .colorpicker_rgb_r {
952
- background-image: url(../images/colorpicker/color_rgb_r.png);
953
- top: 49px;
954
- left: 201px;
955
- }
956
- .ot_colorpicker .colorpicker_rgb_g {
957
- background-image: url(../images/colorpicker/color_rgb_g.png);
958
- top: 79px;
959
- left: 201px;
960
- }
961
- .ot_colorpicker .colorpicker_rgb_b {
962
- background-image: url(../images/colorpicker/color_rgb_b.png);
963
- top: 109px;
964
- left: 201px;
965
- }
966
- .ot_colorpicker .colorpicker_hsb_h {
967
- background-image: url(../images/colorpicker/color_hsb_h.png);
968
- top: 49px;
969
- right: 9px;
970
- }
971
- .ot_colorpicker .colorpicker_hsb_s {
972
- background-image: url(../images/colorpicker/color_hsb_s.png);
973
- top: 79px;
974
- right: 9px;
975
- }
976
- .ot_colorpicker .colorpicker_hsb_b {
977
- background-image: url(../images/colorpicker/color_hsb_b.png);
978
- top: 109px;
979
- right: 9px;
980
- }
981
- .ot_colorpicker .colorpicker_submit {
982
- position: absolute;
983
- width: 16px;
984
- height: 16px;
985
- background: url(../images/colorpicker/color_wheel.png) top;
986
- right: 10px;
987
- bottom: 10px;
988
- overflow: hidden;
989
- }
990
- .ot_colorpicker .colorpicker_focus {
991
- background-position: center;
992
- }
993
- .ot_colorpicker .colorpicker_hex.colorpicker_focus {
994
- background-position: bottom;
995
  }
996
- .ot_colorpicker .colorpicker_submit.colorpicker_focus {
997
- background-position: bottom;
 
 
 
 
 
 
998
  }
999
- .ot_colorpicker .colorpicker_slider {
1000
- background-position: bottom;
1001
  }
1002
-
1003
- @media not screen and (1) {
1004
- .format-settings .cp_box {
1005
- height: 26px;
1006
- };
 
1007
  }
1008
 
1009
  /* --------------------------------------------------
@@ -1373,4 +1273,271 @@ button.option-tree-ui-button .icon {
1373
  .option-tree-ui-button.active .pencil,
1374
  .option-tree-ui-button.active .check {
1375
  background-position: -54px -0px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1376
  }
1
+ /* --------------------------------------------------
2
+ :: OptionTree Font
3
+ ---------------------------------------------------*/
4
+ [class^="ot-icon-"],
5
+ [class*=" ot-icon-"] {
6
+ font-family: "option-tree-font";
7
+ speak: none;
8
+ font-style: normal;
9
+ font-weight: normal;
10
+ font-variant: normal;
11
+ text-transform: none;
12
+ line-height: 1;
13
+ -webkit-font-smoothing: antialiased;
14
+ -moz-osx-font-smoothing: grayscale;
15
+ }
16
+ .ot-icon-long-arrow-down:before {
17
+ content: "\e770";
18
+ }
19
+ .ot-icon-long-arrow-up:before {
20
+ content: "\e771";
21
+ }
22
+ .ot-icon-long-arrow-left:before {
23
+ content: "\e772";
24
+ }
25
+ .ot-icon-long-arrow-right:before {
26
+ content: "\e773";
27
+ }
28
+ .ot-icon-angle-right:before {
29
+ content: "\e774";
30
+ }
31
+ .ot-icon-angle-left:before {
32
+ content: "\e775";
33
+ }
34
+ .ot-icon-angle-up:before {
35
+ content: "\e776";
36
+ }
37
+ .ot-icon-angle-down:before {
38
+ content: "\e777";
39
+ }
40
+ .ot-icon-resize-vertical:before {
41
+ content: "\e778";
42
+ }
43
+ .ot-icon-resize-horizontal:before {
44
+ content: "\e779";
45
+ }
46
+ .ot-icon-fullscreen:before {
47
+ content: "\e780";
48
+ }
49
+ .ot-icon-plus-sign:before {
50
+ content: "\e781";
51
+ }
52
+ .ot-icon-minus-sign:before {
53
+ content: "\e782";
54
+ }
55
+ .ot-icon-ok-sign:before {
56
+ content: "\e783";
57
+ }
58
+ .ot-icon-circle:before {
59
+ content: "\e784";
60
+ }
61
+ .ot-icon-option-tree:before {
62
+ content: "\e785";
63
+ }
64
+
65
  /* --------------------------------------------------
66
  :: Screen Meta & Menu Icon
67
  ---------------------------------------------------*/
125
  min-width: 535px;
126
  overflow: hidden;
127
  position: relative;
 
128
  -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.05);
129
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
130
  -webkit-border-radius: 4px 4px 0 0;
147
  color: #fafafa;
148
  }
149
  #option-tree-header #option-tree-logo a {
 
150
  border-right: 1px solid #333;
 
151
  float: left;
152
  height: 24px;
 
153
  padding: 3px 12px 3px 13px;
154
+ width: 20px;
 
155
  }
156
  #option-tree-header li#option-tree-logo:hover {
157
  color: #fafafa;
158
  background-color: #3a3a3a;
 
 
 
 
 
 
159
  -webkit-border-top-left-radius: 5px;
160
  -moz-border-radius-topleft: 5px;
161
  border-top-left-radius: 5px;
233
  /* --------------------------------------------------
234
  :: Format Settings
235
  ---------------------------------------------------*/
236
+ .format-settings {
 
237
  position: relative;
238
  width: 100%;
239
  }
240
+ .format-setting-wrap {
241
+ padding: 10px 0 20px 0;
242
+ }
243
 
244
  /* --------------------------------------------------
245
  :: Format Setting Label
373
  position: absolute;
374
  top: 10px;
375
  }
 
376
  @media only screen and (max-width: 900px) {
 
377
  .format-setting .description,
378
  .format-setting .format-setting-inner {
379
  width: 100%;
380
  }
 
381
  .format-setting .description {
382
  padding-top: 0px;
383
  };
384
  }
385
+ .ot-background-group {
386
+ overflow: hidden;
387
+ width: auto;
388
+ }
389
+ .ot-background-size-input {
390
+ max-width: 110px;
391
+ }
392
 
393
  /* --------------------------------------------------
394
  :: Code formatting
602
  border-bottom-right-radius: 3px;
603
  border-bottom-left-radius: 3px;
604
  }
605
+ li ul .format-setting-wrap {
606
  padding: 0 0 10px 0;
607
  }
608
  li ul .format-setting-label {
650
  /* --------------------------------------------------
651
  :: Select
652
  ---------------------------------------------------*/
 
 
 
 
 
653
  .select-wrapper {
654
  background: #fff url(../images/ot-select.png) no-repeat right center;
655
  border: 1px solid #ccc;
702
  min-width: 124px;
703
  }
704
  .type-measurement select.option-tree-ui-select {
705
+ min-width: 73px !important;
706
  }
707
  .type-measurement .select-wrapper {
708
+ margin-right: 0;
709
  position: absolute;
710
  right: 0px;
711
  top: 0px;
867
  :: Colorpicker
868
  ---------------------------------------------------*/
869
  .option-tree-ui-colorpicker-input-wrap {
870
+ float: left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
871
  }
872
+ .hide-color-picker {
 
 
 
 
 
 
873
  display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874
  }
875
+ .option-tree-ui-colorpicker-input-wrap .wp-color-picker,
876
+ .option-tree-ui-colorpicker-input-wrap .wp-picker-default,
877
+ .option-tree-ui-colorpicker-input-wrap .wp-picker-clear {
878
+ border-color: #ccc;
879
+ height: 29px !important;
880
+ line-height: 27px !important;
881
+ margin-top: 0px;
882
+ -webkit-border-radius: 2px;
883
+ -moz-border-radius: 2px;
884
+ border-radius: 2px;
885
+ -webkit-box-shadow: none;
886
+ -moz-box-shadow: none;
887
+ box-shadow: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  }
889
+ .option-tree-ui-colorpicker-input-wrap .wp-color-result {
890
+ height: 27px;
891
+ outline: 0;
892
+ margin: 0 5px 5px 0px;
893
+ top: 0px;
894
+ -webkit-box-shadow: none;
895
+ -moz-box-shadow: none;
896
+ box-shadow: none;
897
  }
898
+ .option-tree-ui-colorpicker-input-wrap .wp-color-result:after {
899
+ line-height: 27px;
900
  }
901
+ .option-tree-ui-colorpicker-input-wrap .wp-picker-container .iris-picker {
902
+ border-color: #ccc;
903
+ margin: 0px 5px 5px 0;
904
+ -webkit-border-radius: 2px;
905
+ -moz-border-radius: 2px;
906
+ border-radius: 2px;
907
  }
908
 
909
  /* --------------------------------------------------
1273
  .option-tree-ui-button.active .pencil,
1274
  .option-tree-ui-button.active .check {
1275
  background-position: -54px -0px;
1276
+ }
1277
+
1278
+ /* --------------------------------------------------
1279
+ :: WP 3.8 Fixes (via Github @AlxMedia)
1280
+ ---------------------------------------------------*/
1281
+ #option-tree-settings-api #poststuff,
1282
+ #option-tree-settings-api #post-body-content {
1283
+ min-width: 0;
1284
+ }
1285
+ #option-tree-settings-api #poststuff h3 {
1286
+ font-family: inherit !important;
1287
+ }
1288
+ #option-tree-settings-api .postbox {
1289
+ -webkit-box-shadow: none;
1290
+ -moz-box-shadow: none;
1291
+ box-shadow: none;
1292
+ }
1293
+ #option-tree-settings-api p input[type="checkbox"],
1294
+ #option-tree-settings-api p input[type="radio"] {
1295
+ margin-top: 2px;
1296
+ }
1297
+ #option-tree-settings-api .format-setting.type-checkbox p,
1298
+ #option-tree-settings-api .format-setting.type-radio p {
1299
+ margin: 0.3em 0 !important;
1300
+ }
1301
+ input.option-tree-ui-upload-input,
1302
+ input.option-tree-ui-input {
1303
+ padding-top: 5px;
1304
+ padding-bottom: 5px;
1305
+ }
1306
+ @media screen and ( max-width: 782px ) {
1307
+ #option-tree-settings-api p input[type="checkbox"],
1308
+ #option-tree-settings-api p input[type="radio"] {
1309
+ margin-top: -3px;
1310
+ }
1311
+ }
1312
+
1313
+ /* --------------------------------------------------
1314
+ :: Gallery
1315
+ ---------------------------------------------------*/
1316
+ ul.ot-gallery-list {
1317
+ float: left;
1318
+ margin: 0;
1319
+ width: 100%;
1320
+ }
1321
+ ul.ot-gallery-list li {
1322
+ background: none repeat scroll 0 0 white;
1323
+ border: 1px solid #bbbbbb;
1324
+ float: left;
1325
+ margin: 0px 10px 10px 0;
1326
+ padding: 4px;
1327
+ -webkit-border-radius: 3px;
1328
+ -moz-border-radius: 3px;
1329
+ border-radius: 3px;
1330
+ }
1331
+ ul.ot-gallery-list li img {
1332
+ display: block;
1333
+ margin: 0;
1334
+ }
1335
+
1336
+ .ot-gallery-buttons {
1337
+ float: left;
1338
+ width: 100%;
1339
+ }
1340
+ .ot-gallery-buttons a.option-tree-ui-button {
1341
+ margin-top: 0px;
1342
+ margin-bottom: 0px;
1343
+ }
1344
+
1345
+ /* --------------------------------------------------
1346
+ :: On/Off Switch
1347
+ ---------------------------------------------------*/
1348
+ .on-off-switch .slide-button {
1349
+ display: none;
1350
+ }
1351
+ @media only screen {
1352
+ .on-off-switch {
1353
+ background-color: white;
1354
+ border: 1px solid #cccccc;
1355
+ color: #333333;
1356
+ display: block;
1357
+ font-family: sans-serif;
1358
+ font-size: 12px;
1359
+ font-weight: normal;
1360
+ height: 27px;
1361
+ position: relative;
1362
+ padding: 0;
1363
+ text-align: center;
1364
+ text-transform: uppercase;
1365
+ width: 100px;
1366
+ -webkit-border-radius: 2px;
1367
+ -moz-border-radius: 2px;
1368
+ border-radius: 2px;
1369
+ -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
1370
+ -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
1371
+ box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
1372
+ }
1373
+ .on-off-switch * {
1374
+ -webkit-box-sizing: border-box;
1375
+ -moz-box-sizing: border-box;
1376
+ -ms-box-sizing: border-box;
1377
+ -o-box-sizing: border-box;
1378
+ box-sizing: border-box;
1379
+ }
1380
+ .on-off-switch input {
1381
+ position: absolute;
1382
+ opacity: 0;
1383
+ }
1384
+ .on-off-switch label {
1385
+ cursor: pointer;
1386
+ float: left;
1387
+ height: 27px;
1388
+ line-height: 27px;
1389
+ margin: 0;
1390
+ position: relative;
1391
+ text-align: center;
1392
+ vertical-align: middle;
1393
+ width: 50px;
1394
+ z-index: 2;
1395
+ }
1396
+ .on-off-switch input:last-of-type + label {
1397
+ color: #333333;
1398
+ }
1399
+ .on-off-switch input:checked + label {
1400
+ color: white;
1401
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
1402
+ }
1403
+ .on-off-switch input:focus + label {
1404
+ outline: none;
1405
+ }
1406
+ .on-off-switch .slide-button {
1407
+ border: 1px solid #21759b;
1408
+ border-bottom-color: #1e6a8d;
1409
+ color: white;
1410
+ display: block;
1411
+ height: 29px;
1412
+ left: -1px;
1413
+ padding: 0;
1414
+ position: absolute;
1415
+ text-decoration: none;
1416
+ top: -1px;
1417
+ width: 51px;
1418
+ z-index: 1;
1419
+ background-color: #2688b4;
1420
+ background-image: -moz-linear-gradient(top, #2a95c5, #21759b);
1421
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#2a95c5), to(#21759b));
1422
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
1423
+ background-image: -o-linear-gradient(top, #2a95c5, #21759b);
1424
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
1425
+ background-repeat: repeat-x;
1426
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ie-hex-str($startColor)', endColorstr='#ie-hex-str($endColor)', GradientType=0);
1427
+ -webkit-border-radius: 3px;
1428
+ -moz-border-radius: 3px;
1429
+ border-radius: 3px;
1430
+ -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
1431
+ -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
1432
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
1433
+ -webkit-transition: all 0.1s ease-out;
1434
+ -moz-transition: all 0.1s ease-out;
1435
+ -o-transition: all 0.1s ease-out;
1436
+ transition: all 0.1s ease-out;
1437
+ }
1438
+ .on-off-switch input:last-of-type:checked ~ .slide-button {
1439
+ border-color: #9b3221;
1440
+ border-bottom-color: #8d2e1e;
1441
+ left: 50px;
1442
+ background-color: #b43a26;
1443
+ background-image: -moz-linear-gradient(top, #c5402a, #9b3221);
1444
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#c5402a), to(#9b3221));
1445
+ background-image: -webkit-linear-gradient(top, #c5402a, #9b3221);
1446
+ background-image: -o-linear-gradient(top, #c5402a, #9b3221);
1447
+ background-image: linear-gradient(to bottom, #c5402a, #9b3221);
1448
+ background-repeat: repeat-x;
1449
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ie-hex-str($startColor)', endColorstr='#ie-hex-str($endColor)', GradientType=0);
1450
+ }
1451
+ .on-off-switch {
1452
+ -webkit-animation: bugfix infinite 1s;
1453
+ }
1454
+ @-webkit-keyframes bugfix {
1455
+ from {
1456
+ position: relative;
1457
+ }
1458
+ to {
1459
+ position: relative;
1460
+ }
1461
+ }
1462
+ }
1463
+
1464
+ /* --------------------------------------------------
1465
+ :: Simple Input Append & Prepend
1466
+ ---------------------------------------------------*/
1467
+ .ot-input-append,
1468
+ .ot-input-prepend {
1469
+ display: inline-block;
1470
+ vertical-align: middle;
1471
+ font-size: 0;
1472
+ white-space: nowrap;
1473
+ }
1474
+ .ot-input-append input {
1475
+ position: relative;
1476
+ margin-bottom: 0;
1477
+ *margin-left: 0;
1478
+ vertical-align: top;
1479
+ -webkit-border-radius: 0 2px 2px 0;
1480
+ -moz-border-radius: 0 2px 2px 0;
1481
+ border-radius: 0 2px 2px 0;
1482
+ }
1483
+ .ot-input-append input:focus,
1484
+ .ot-input-prepend input:focus {
1485
+ z-index: 2;
1486
+ }
1487
+ .ot-input-append .ot-add-on,
1488
+ .ot-input-prepend .ot-add-on {
1489
+ display: inline-block;
1490
+ width: auto;
1491
+ height: 27px;
1492
+ line-height: 28px;
1493
+ min-width: 16px;
1494
+ padding: 0 6px;
1495
+ font-size: 16px;
1496
+ font-weight: normal;
1497
+ text-align: center;
1498
+ text-shadow: 0 1px 0 white;
1499
+ background-color: #f7f7f7;
1500
+ border: 1px solid #ccc;
1501
+ }
1502
+ .ot-input-prepend input {
1503
+ border-left: 0 !important;
1504
+ }
1505
+ .ot-input-prepend .ot-add-on:first-child {
1506
+ -webkit-border-radius: 2px 0 0 2px;
1507
+ -moz-border-radius: 2px 0 0 2px;
1508
+ border-radius: 2px 0 0 2px;
1509
+ }
1510
+ .ot-input-append input {
1511
+ border-right: 0 !important;
1512
+ -webkit-border-radius: 2px 0 0 2px;
1513
+ -moz-border-radius: 2px 0 0 2px;
1514
+ border-radius: 2px 0 0 2px;
1515
+ }
1516
+ .ot-input-append input + .btn-group .btn:first-child {
1517
+ -webkit-border-top-left-radius: 0;
1518
+ -moz-border-radius-topleft: 0;
1519
+ border-top-left-radius: 0;
1520
+ -webkit-border-bottom-left-radius: 0;
1521
+ -moz-border-radius-bottomleft: 0;
1522
+ border-bottom-left-radius: 0;
1523
+ }
1524
+ .ot-input-append .ot-add-on:last-child {
1525
+ -webkit-border-radius: 0 2px 2px 0;
1526
+ -moz-border-radius: 0 2px 2px 0;
1527
+ border-radius: 0 2px 2px 0;
1528
+ }
1529
+ .ot-input-prepend.ot-input-append input {
1530
+ -webkit-border-radius: 0;
1531
+ -moz-border-radius: 0;
1532
+ border-radius: 0;
1533
+ }
1534
+ .ot-input-prepend.ot-input-append .ot-add-on:first-child {
1535
+ -webkit-border-radius: 2px 0 0 2px;
1536
+ -moz-border-radius: 2px 0 0 2px;
1537
+ border-radius: 2px 0 0 2px;
1538
+ }
1539
+ .ot-input-prepend.ot-input-append .ot-add-on:last-child {
1540
+ -webkit-border-radius: 0 2px 2px 0;
1541
+ -moz-border-radius: 0 2px 2px 0;
1542
+ border-radius: 0 2px 2px 0;
1543
  }
assets/fonts/option-tree-font.eot ADDED
Binary file
assets/fonts/option-tree-font.svg ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="option-tree-font" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" d="" horiz-adv-x="512" />
10
+ <glyph unicode="&#xe770;" d="M437.143 208.571q4.571-10.857-2.857-20l-200-219.429q-5.714-5.714-13.143-5.714-8 0-13.714 5.714l-202.857 219.429q-7.429 9.143-2.857 20 5.143 10.857 16.571 10.857h128v713.143q0 8 5.143 13.143t13.143 5.143h109.714q8 0 13.143-5.143t5.143-13.143v-713.143h128q12 0 16.571-10.857z" horiz-adv-x="439" />
11
+ <glyph unicode="&#xe771;" d="M437.143 669.143q-5.143-10.857-16.571-10.857h-128v-713.143q0-8-5.143-13.143t-13.143-5.143h-109.714q-8 0-13.143 5.143t-5.143 13.143v713.143h-128q-12 0-16.571 10.857t2.857 20l200 219.429q5.714 5.714 13.143 5.714 8 0 13.714-5.714l202.857-219.429q7.429-9.143 2.857-20z" horiz-adv-x="439" />
12
+ <glyph unicode="&#xe772;" d="M1024 493.714v-109.714q0-8-5.143-13.143t-13.143-5.143h-713.143v-128q0-12-10.857-16.571t-20 2.857l-219.429 200q-5.714 5.714-5.714 13.143 0 8 5.714 13.714l219.429 202.286q9.143 8 20 3.429 10.857-5.143 10.857-16.571v-128h713.143q8 0 13.143-5.143t5.143-13.143z" />
13
+ <glyph unicode="&#xe773;" d="M987.429 440.571q0-8-5.714-13.714l-219.429-202.286q-9.143-8-20-3.429-10.857 5.143-10.857 16.571v128h-713.143q-8 0-13.143 5.143t-5.143 13.143v109.714q0 8 5.143 13.143t13.143 5.143h713.143v128q0 12 10.857 16.571t20-2.857l219.429-200q5.714-5.714 5.714-13.143z" />
14
+ <glyph unicode="&#xe774;" d="M340 402.286q0-7.429-5.714-13.143l-266.286-266.286q-5.714-5.714-13.143-5.714t-13.143 5.714l-28.571 28.571q-5.714 5.714-5.714 13.143t5.714 13.143l224.571 224.571-224.571 224.571q-5.714 5.714-5.714 13.143t5.714 13.143l28.571 28.571q5.714 5.714 13.143 5.714t13.143-5.714l266.286-266.286q5.714-5.714 5.714-13.143z" horiz-adv-x="366" />
15
+ <glyph unicode="&#xe775;" d="M358.286 640q0-7.429-5.714-13.143l-224.571-224.571 224.571-224.571q5.714-5.714 5.714-13.143t-5.714-13.143l-28.571-28.571q-5.714-5.714-13.143-5.714t-13.143 5.714l-266.286 266.286q-5.714 5.714-5.714 13.143t5.714 13.143l266.286 266.286q5.714 5.714 13.143 5.714t13.143-5.714l28.571-28.571q5.714-5.714 5.714-13.143z" horiz-adv-x="366" />
16
+ <glyph unicode="&#xe776;" d="M614.286 274.286q0-7.429-5.714-13.143l-28.571-28.571q-5.714-5.714-13.143-5.714t-13.143 5.714l-224.571 224.571-224.571-224.571q-5.714-5.714-13.143-5.714t-13.143 5.714l-28.571 28.571q-5.714 5.714-5.714 13.143t5.714 13.143l266.286 266.286q5.714 5.714 13.143 5.714t13.143-5.714l266.286-266.286q5.714-5.714 5.714-13.143z" horiz-adv-x="658" />
17
+ <glyph unicode="&#xe777;" d="M614.286 530.286q0-7.429-5.714-13.143l-266.286-266.286q-5.714-5.714-13.143-5.714t-13.143 5.714l-266.286 266.286q-5.714 5.714-5.714 13.143t5.714 13.143l28.571 28.571q5.714 5.714 13.143 5.714t13.143-5.714l224.571-224.571 224.571 224.571q5.714 5.714 13.143 5.714t13.143-5.714l28.571-28.571q5.714-5.714 5.714-13.143z" horiz-adv-x="658" />
18
+ <glyph unicode="&#xe778;" d="M402.286 768q0-14.857-10.857-25.714t-25.714-10.857h-73.143v-585.143h73.143q14.857 0 25.714-10.857t10.857-25.714-10.857-25.714l-146.286-146.286q-10.857-10.857-25.714-10.857t-25.714 10.857l-146.286 146.286q-10.857 10.857-10.857 25.714t10.857 25.714 25.714 10.857h73.143v585.143h-73.143q-14.857 0-25.714 10.857t-10.857 25.714 10.857 25.714l146.286 146.286q10.857 10.857 25.714 10.857t25.714-10.857l146.286-146.286q10.857-10.857 10.857-25.714z" horiz-adv-x="439" />
19
+ <glyph unicode="&#xe779;" d="M1024 438.857q0-14.857-10.857-25.714l-146.286-146.286q-10.857-10.857-25.714-10.857t-25.714 10.857-10.857 25.714v73.143h-585.143v-73.143q0-14.857-10.857-25.714t-25.714-10.857-25.714 10.857l-146.286 146.286q-10.857 10.857-10.857 25.714t10.857 25.714l146.286 146.286q10.857 10.857 25.714 10.857t25.714-10.857 10.857-25.714v-73.143h585.143v73.143q0 14.857 10.857 25.714t25.714 10.857 25.714-10.857l146.286-146.286q10.857-10.857 10.857-25.714z" />
20
+ <glyph unicode="&#xe780;" d="M733.143 641.714l-202.857-202.857 202.857-202.857 82.286 82.286q16.571 17.714 40 8 22.286-9.714 22.286-33.714v-256q0-14.857-10.857-25.714t-25.714-10.857h-256q-24 0-33.714 22.857-9.714 22.286 8 39.429l82.286 82.286-202.857 202.857-202.857-202.857 82.286-82.286q17.714-17.143 8-39.429-9.714-22.857-33.714-22.857h-256q-14.857 0-25.714 10.857t-10.857 25.714v256q0 24 22.857 33.714 22.286 9.714 39.429-8l82.286-82.286 202.857 202.857-202.857 202.857-82.286-82.286q-10.857-10.857-25.714-10.857-6.857 0-13.714 2.857-22.857 9.714-22.857 33.714v256q0 14.857 10.857 25.714t25.714 10.857h256q24 0 33.714-22.857 9.714-22.286-8-39.429l-82.286-82.286 202.857-202.857 202.857 202.857-82.286 82.286q-17.714 17.143-8 39.429 9.714 22.857 33.714 22.857h256q14.857 0 25.714-10.857t10.857-25.714v-256q0-24-22.286-33.714-7.429-2.857-14.286-2.857-14.857 0-25.714 10.857z" horiz-adv-x="878" />
21
+ <glyph unicode="&#xe781;" d="M694.857 402.286v73.143q0 14.857-10.857 25.714t-25.714 10.857h-146.286v146.286q0 14.857-10.857 25.714t-25.714 10.857h-73.143q-14.857 0-25.714-10.857t-10.857-25.714v-146.286h-146.286q-14.857 0-25.714-10.857t-10.857-25.714v-73.143q0-14.857 10.857-25.714t25.714-10.857h146.286v-146.286q0-14.857 10.857-25.714t25.714-10.857h73.143q14.857 0 25.714 10.857t10.857 25.714v146.286h146.286q14.857 0 25.714 10.857t10.857 25.714zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" horiz-adv-x="878" />
22
+ <glyph unicode="&#xe782;" d="M694.857 402.286v73.143q0 14.857-10.857 25.714t-25.714 10.857h-438.857q-14.857 0-25.714-10.857t-10.857-25.714v-73.143q0-14.857 10.857-25.714t25.714-10.857h438.857q14.857 0 25.714 10.857t10.857 25.714zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" horiz-adv-x="878" />
23
+ <glyph unicode="&#xe783;" d="M733.714 531.428q0 16-10.286 26.286l-52 51.429q-10.857 10.857-25.714 10.857t-25.714-10.857l-233.143-232.571-129.143 129.143q-10.857 10.857-25.714 10.857t-25.714-10.857l-52-51.429q-10.286-10.286-10.286-26.286 0-15.429 10.286-25.714l206.857-206.857q10.857-10.857 25.714-10.857 15.429 0 26.286 10.857l310.286 310.286q10.286 10.286 10.286 25.714zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" horiz-adv-x="878" />
24
+ <glyph unicode="&#xe784;" d="M877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" horiz-adv-x="878" />
25
+ <glyph unicode="&#xe785;" d="M511.99-64c-282.309 0-511.99 229.681-511.99 512.020 0 282.299 229.681 511.98 511.99 511.98 282.329 0 512.010-229.681 512.010-511.98 0-282.338-229.681-512.020-512.010-512.020zM511.99 904.251c-251.569 0-456.241-204.672-456.241-456.231 0-251.589 204.672-456.271 456.241-456.271 251.55 0 456.212 204.682 456.212 456.271 0 251.559-204.662 456.231-456.212 456.231zM438.597 145.881c0 0.876 0 457.59 0 457.59h-75.845c-29.637 0-54.223-2.462-73.738-7.375-19.535-4.923-36.697-18.412-51.515-40.438-14.828-22.055-23.276-56.015-25.374-101.937h-49.684v175.429c-26.929-53.209-42.201-113.339-42.201-177.063 0-177.546 117.849-327.532 279.562-376.133 14.1-1.812 38.666 4.46 38.794 69.927zM794.91 374.252c-37.809-0.305-68.401 31.99-68.401 71.454 0 39.473 30.592 71.483 68.401 71.483 2.028 0 4.027-0.128 5.986-0.305-0.138 3.121-0.798 6.105-1.851 8.862 0.010 0 0.010 0 0.020 0-4.106 11.569-8.93 21.465-14.503 29.637-14.818 21.858-30.779 35.338-47.852 40.438-17.083 5.11-36.775 7.66-59.087 7.66h-92.219v-457.945c0.030-70.37 29.46-71.995 43.323-68.874 2.274 0.709 4.519 1.497 6.774 2.235 0.030 0.020 0.167 0.098 0.187 0.108 0.049 0 0.079 0.020 0.118 0.020 0 0-0.059-0.030-0.158-0.069 156.859 51.515 270.159 199.060 270.159 373.14 0 68.047-17.319 132.047-47.774 187.845 0-22.518 0-192.817 0-194.225 0.020-37.268-20.51-71.119-63.124-71.463zM513.024 844.879c-138.801 0-260.687-72.054-330.555-180.736h661.1c-69.849 108.672-191.744 180.736-330.545 180.736z" />
26
+ </font></defs></svg>
assets/fonts/option-tree-font.ttf ADDED
Binary file
assets/fonts/option-tree-font.woff ADDED
Binary file
assets/images/colorpicker/color_bg.png DELETED
Binary file
assets/images/colorpicker/color_hex.png DELETED
Binary file
assets/images/colorpicker/color_hsb_b.png DELETED
Binary file
assets/images/colorpicker/color_hsb_h.png DELETED
Binary file
assets/images/colorpicker/color_hsb_s.png DELETED
Binary file
assets/images/colorpicker/color_indicator.png DELETED
Binary file
assets/images/colorpicker/color_overlay.png DELETED
Binary file
assets/images/colorpicker/color_rgb_b.png DELETED
Binary file
assets/images/colorpicker/color_rgb_g.png DELETED
Binary file
assets/images/colorpicker/color_rgb_r.png DELETED
Binary file
assets/images/colorpicker/color_select.gif DELETED
Binary file
assets/images/colorpicker/color_wheel.png DELETED
Binary file
assets/images/ot-logo-mini.png DELETED
Binary file
assets/images/ot-logo.png DELETED
Binary file
assets/js/ot-admin.js CHANGED
@@ -17,6 +17,7 @@
17
  this.init_edit_title()
18
  this.init_edit_id();
19
  this.init_activate_layout();
 
20
  this.init_upload();
21
  this.init_upload_remove();
22
  this.init_numeric_slider();
@@ -24,7 +25,6 @@
24
  this.init_radio_image_select();
25
  this.init_select_wrapper();
26
  this.fix_upload_parent();
27
- this.fix_colorpicker();
28
  this.fix_textarea();
29
  this.replicate_ajax();
30
  this.reset_settings();
@@ -80,27 +80,27 @@
80
  });
81
  },
82
  init_add: function() {
83
- $('.option-tree-section-add').live('click', function(e) {
84
  e.preventDefault();
85
  OT_UI.add(this,'section');
86
  });
87
- $('.option-tree-setting-add').live('click', function(e) {
88
  e.preventDefault();
89
  OT_UI.add(this,'setting');
90
  });
91
- $('.option-tree-help-add').live('click', function(e) {
92
  e.preventDefault();
93
  OT_UI.add(this,'the_contextual_help');
94
  });
95
- $('.option-tree-choice-add').live('click', function(e) {
96
  e.preventDefault();
97
  OT_UI.add(this,'choice');
98
  });
99
- $('.option-tree-list-item-add').live('click', function(e) {
100
  e.preventDefault();
101
  OT_UI.add(this,'list_item');
102
  });
103
- $('.option-tree-list-item-setting-add').live('click', function(e) {
104
  e.preventDefault();
105
  if ( $(this).parents('ul').parents('ul').hasClass('ui-sortable') ) {
106
  alert(option_tree.setting_limit);
@@ -110,7 +110,7 @@
110
  });
111
  },
112
  init_edit: function() {
113
- $('.option-tree-setting-edit').live('click', function(e) {
114
  e.preventDefault();
115
  if ( $(this).parents().hasClass('option-tree-setting-body') ) {
116
  OT_UI.init_remove_active($(this),'child');
@@ -124,7 +124,7 @@
124
  });
125
  },
126
  init_remove: function() {
127
- $('.option-tree-setting-remove').live('click', function(event) {
128
  event.preventDefault();
129
  if ( $(this).parents('li').hasClass('ui-state-disabled') ) {
130
  alert(option_tree.remove_no);
@@ -142,23 +142,23 @@
142
  });
143
  },
144
  init_edit_title: function() {
145
- $('.option-tree-setting-title').live('keyup', function() {
146
  OT_UI.edit_title(this);
147
  });
148
  },
149
  init_edit_id: function() {
150
- $('.section-id').live('keyup', function(){
151
  OT_UI.update_id(this);
152
  });
153
  },
154
  init_activate_layout: function() {
155
- $('.option-tree-layout-activate').live('click', function() {
156
  var active = $(this).parents('.option-tree-setting').find('.open').text();
157
  $('.option-tree-layout-activate').removeClass('active');
158
  $(this).toggleClass('active');
159
  $('.active-layout-input').attr({'value':active});
160
  });
161
- $('#option-tree-options-layouts-form select').live('change', function() {
162
  var agree = confirm(option_tree.activate_layout_agree);
163
  if (agree) {
164
  $('#option-tree-options-layouts-form').submit();
@@ -288,6 +288,97 @@
288
  last_section = section;
289
  });
290
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  init_upload: function() {
292
  $(document).on('click', '.ot_upload_media', function() {
293
  var field_id = $(this).parent('.option-tree-ui-upload-parent').find('input').attr('id'),
@@ -353,7 +444,7 @@
353
  });
354
  },
355
  init_upload_remove: function() {
356
- $('.option-tree-ui-remove-media').live('click', function(event) {
357
  event.preventDefault();
358
  var agree = confirm(option_tree.remove_agree);
359
  if (agree) {
@@ -402,6 +493,9 @@
402
  value: value,
403
  slide: function(event, ui) {
404
  hidden.add(helper).val(ui.value);
 
 
 
405
  }
406
  });
407
  });
@@ -430,10 +524,10 @@
430
  });
431
  },
432
  init_radio_image_select: function() {
433
- $('.option-tree-ui-radio-image').live('click', function() {
434
  $(this).closest('.type-radio-image').find('.option-tree-ui-radio-image').removeClass('option-tree-ui-radio-image-selected');
435
  $(this).toggleClass('option-tree-ui-radio-image-selected');
436
- $(this).parent().find('.option-tree-ui-radio').attr('checked', true);
437
  });
438
  },
439
  init_select_wrapper: function() {
@@ -443,34 +537,18 @@
443
  $(this).parent('.select-wrapper').prepend('<span>' + $(this).find('option:selected').text() + '</span>');
444
  }
445
  });
446
- $('.option-tree-ui-select').live('change', function () {
447
  $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
448
- });
449
- $('.option-tree-ui-select').bind($.browser.msie ? 'click' : 'change', function(event) {
450
  $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
451
  });
452
  },
453
  bind_colorpicker: function(field_id) {
454
- $('#'+field_id).ColorPicker({
455
- onSubmit: function(hsb, hex, rgb) {
456
- $('#'+field_id).val('#'+hex);
457
- },
458
- onBeforeShow: function () {
459
- $(this).ColorPickerSetColor(this.value);
460
- return false;
461
- },
462
- onChange: function (hsb, hex, rgb) {
463
- var bc = $.inArray(hex, [ 'FFFFFF', 'FFF', 'ffffff', 'fff' ]) != -1 ? 'ccc' : hex;
464
- $('#cp_'+field_id).css({'backgroundColor':'#'+hex,'borderColor':'#'+bc});
465
- $('#cp_'+field_id).prev('input').attr('value', '#'+hex);
466
- }
467
- })
468
- .bind('keyup', function(){
469
- $(this).ColorPickerSetColor(this.value);
470
- });
471
  },
472
  fix_upload_parent: function() {
473
- $('.option-tree-ui-upload-input').live('focus blur', function(){
474
  $(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
475
  OT_UI.init_upload_fix(this);
476
  });
@@ -479,19 +557,6 @@
479
  $(e).parent().parent().find('.option-tree-ui-upload-input').attr('value','');
480
  $(e).parent('.option-tree-ui-media-wrap').remove();
481
  },
482
- fix_colorpicker: function() {
483
- $('.cp_input').live('blur', function() {
484
- $('.cp_input').each( function(index, el) {
485
- var val = $(el).val();
486
- var reg = /^[A-Fa-f0-9]{6}$/;
487
- if( reg.test(val) && val != '' ) {
488
- $(el).attr('value', '#'+val)
489
- } else if ( val == '' ) {
490
- $(this).next('.cp_box').css({'background':'#f1f1f1','border-color':'#ccc'});
491
- }
492
- });
493
- });
494
- },
495
  fix_textarea: function() {
496
  $('.wp-editor-area').focus( function(){
497
  $(this).parent('div').css({borderColor:'#bbb'});
@@ -511,7 +576,7 @@
511
  }, 3000 );
512
  },
513
  reset_settings: function() {
514
- $(".reset-settings").live("click", function(event){
515
  var agree = confirm(option_tree.reset_agree);
516
  if (agree) {
517
  return true;
@@ -536,4 +601,133 @@
536
  $(document).ready( function() {
537
  OT_UI.init();
538
  });
539
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  this.init_edit_title()
18
  this.init_edit_id();
19
  this.init_activate_layout();
20
+ this.init_conditions();
21
  this.init_upload();
22
  this.init_upload_remove();
23
  this.init_numeric_slider();
25
  this.init_radio_image_select();
26
  this.init_select_wrapper();
27
  this.fix_upload_parent();
 
28
  this.fix_textarea();
29
  this.replicate_ajax();
30
  this.reset_settings();
80
  });
81
  },
82
  init_add: function() {
83
+ $(document).on('click', '.option-tree-section-add', function(e) {
84
  e.preventDefault();
85
  OT_UI.add(this,'section');
86
  });
87
+ $(document).on('click', '.option-tree-setting-add', function(e) {
88
  e.preventDefault();
89
  OT_UI.add(this,'setting');
90
  });
91
+ $(document).on('click', '.option-tree-help-add', function(e) {
92
  e.preventDefault();
93
  OT_UI.add(this,'the_contextual_help');
94
  });
95
+ $(document).on('click', '.option-tree-choice-add', function(e) {
96
  e.preventDefault();
97
  OT_UI.add(this,'choice');
98
  });
99
+ $(document).on('click', '.option-tree-list-item-add', function(e) {
100
  e.preventDefault();
101
  OT_UI.add(this,'list_item');
102
  });
103
+ $(document).on('click', '.option-tree-list-item-setting-add', function(e) {
104
  e.preventDefault();
105
  if ( $(this).parents('ul').parents('ul').hasClass('ui-sortable') ) {
106
  alert(option_tree.setting_limit);
110
  });
111
  },
112
  init_edit: function() {
113
+ $(document).on('click', '.option-tree-setting-edit', function(e) {
114
  e.preventDefault();
115
  if ( $(this).parents().hasClass('option-tree-setting-body') ) {
116
  OT_UI.init_remove_active($(this),'child');
124
  });
125
  },
126
  init_remove: function() {
127
+ $(document).on('click', '.option-tree-setting-remove', function(event) {
128
  event.preventDefault();
129
  if ( $(this).parents('li').hasClass('ui-state-disabled') ) {
130
  alert(option_tree.remove_no);
142
  });
143
  },
144
  init_edit_title: function() {
145
+ $(document).on('keyup', '.option-tree-setting-title', function() {
146
  OT_UI.edit_title(this);
147
  });
148
  },
149
  init_edit_id: function() {
150
+ $(document).on('keyup', '.section-id', function(){
151
  OT_UI.update_id(this);
152
  });
153
  },
154
  init_activate_layout: function() {
155
+ $(document).on('click', '.option-tree-layout-activate', function() {
156
  var active = $(this).parents('.option-tree-setting').find('.open').text();
157
  $('.option-tree-layout-activate').removeClass('active');
158
  $(this).toggleClass('active');
159
  $('.active-layout-input').attr({'value':active});
160
  });
161
+ $(document).on('change', '#option-tree-options-layouts-form select', function() {
162
  var agree = confirm(option_tree.activate_layout_agree);
163
  if (agree) {
164
  $('#option-tree-options-layouts-form').submit();
288
  last_section = section;
289
  });
290
  },
291
+ match_conditions: function(condition) {
292
+ var match;
293
+ var regex = /(.+?):(is|not|contains|less_than|less_than_or_equal_to|greater_than|greater_than_or_equal_to)\((.+?)\),?/g;
294
+ var conditions = [];
295
+
296
+ while( match = regex.exec( condition ) ) {
297
+ conditions.push({
298
+ 'check': match[1],
299
+ 'rule': match[2],
300
+ 'value': match[3]
301
+ });
302
+ }
303
+
304
+ return conditions;
305
+ },
306
+ parse_condition: function() {
307
+ $( '.format-settings[id^="setting_"][data-condition]' ).each(function() {
308
+
309
+ var passed;
310
+ var conditions = OT_UI.match_conditions( $( this ).data( 'condition' ) );
311
+ var operator = ( $( this ).data( 'operator' ) || 'and' ).toLowerCase();
312
+
313
+ $.each( conditions, function( index, condition ) {
314
+
315
+ var target = $( '#setting_' + condition.check );
316
+ var targetEl = !! target.length && target.find( 'select, input[type="radio"]:checked, input.ot-numeric-slider-hidden-input' ).first();
317
+
318
+ if( ! target.length || ! targetEl.length ) {
319
+ return;
320
+ }
321
+
322
+ var v1 = targetEl.val().toString();
323
+ var v2 = condition.value.toString();
324
+ var result;
325
+
326
+ switch( condition.rule ) {
327
+ case 'less_than':
328
+ result = ( v1 < v2 );
329
+ break;
330
+ case 'less_than_or_equal_to':
331
+ result = ( v1 <= v2 );
332
+ break;
333
+ case 'greater_than':
334
+ result = ( v1 > v2 );
335
+ break;
336
+ case 'greater_than_or_equal_to':
337
+ result = ( v1 >= v2 );
338
+ break;
339
+ case 'contains':
340
+ result = ( v2.indexOf(v1) !== -1 ? true : false );
341
+ break;
342
+ case 'is':
343
+ result = ( v1 == v2 );
344
+ break;
345
+ case 'not':
346
+ result = ( v1 != v2 );
347
+ break;
348
+ }
349
+
350
+ if( 'undefined' == typeof passed ) {
351
+ passed = result;
352
+ }
353
+
354
+ switch( operator ) {
355
+ case 'or':
356
+ passed = ( passed || result );
357
+ break;
358
+ case 'and':
359
+ default:
360
+ passed = ( passed && result );
361
+ break;
362
+ }
363
+
364
+ });
365
+
366
+ if ( passed ) {
367
+ $(this).animate({opacity: 'show' , height: 'show'}, 200);
368
+ } else {
369
+ $(this).animate({opacity: 'hide' , height: 'hide'}, 200);
370
+ }
371
+
372
+ delete passed;
373
+
374
+ });
375
+ },
376
+ init_conditions: function() {
377
+ $( document ).on( 'change.conditionals', '.format-settings[id^="setting_"] select, .format-settings[id^="setting_"] input[type="radio"]:checked, .format-settings[id^="setting_"] input.ot-numeric-slider-hidden-input', function( e ) {
378
+ OT_UI.parse_condition();
379
+ });
380
+ $(OT_UI.parse_condition());
381
+ },
382
  init_upload: function() {
383
  $(document).on('click', '.ot_upload_media', function() {
384
  var field_id = $(this).parent('.option-tree-ui-upload-parent').find('input').attr('id'),
444
  });
445
  },
446
  init_upload_remove: function() {
447
+ $(document).on('click', '.option-tree-ui-remove-media', function(event) {
448
  event.preventDefault();
449
  var agree = confirm(option_tree.remove_agree);
450
  if (agree) {
493
  value: value,
494
  slide: function(event, ui) {
495
  hidden.add(helper).val(ui.value);
496
+ },
497
+ change: function() {
498
+ $(OT_UI.init_conditions());
499
  }
500
  });
501
  });
524
  });
525
  },
526
  init_radio_image_select: function() {
527
+ $(document).on('click', '.option-tree-ui-radio-image', function() {
528
  $(this).closest('.type-radio-image').find('.option-tree-ui-radio-image').removeClass('option-tree-ui-radio-image-selected');
529
  $(this).toggleClass('option-tree-ui-radio-image-selected');
530
+ $(this).parent().find('.option-tree-ui-radio').prop('checked', true).trigger('change');
531
  });
532
  },
533
  init_select_wrapper: function() {
537
  $(this).parent('.select-wrapper').prepend('<span>' + $(this).find('option:selected').text() + '</span>');
538
  }
539
  });
540
+ $(document).on('change', '.option-tree-ui-select', function () {
541
  $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
542
+ })
543
+ $(document).on($.browser.msie ? 'click' : 'change', '.option-tree-ui-select', function(event) {
544
  $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
545
  });
546
  },
547
  bind_colorpicker: function(field_id) {
548
+ $('#'+field_id).wpColorPicker();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  },
550
  fix_upload_parent: function() {
551
+ $(document).on('focus blur', '.option-tree-ui-upload-input', function(){
552
  $(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
553
  OT_UI.init_upload_fix(this);
554
  });
557
  $(e).parent().parent().find('.option-tree-ui-upload-input').attr('value','');
558
  $(e).parent('.option-tree-ui-media-wrap').remove();
559
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  fix_textarea: function() {
561
  $('.wp-editor-area').focus( function(){
562
  $(this).parent('div').css({borderColor:'#bbb'});
576
  }, 3000 );
577
  },
578
  reset_settings: function() {
579
+ $(document).on("click", ".reset-settings", function(event){
580
  var agree = confirm(option_tree.reset_agree);
581
  if (agree) {
582
  return true;
601
  $(document).ready( function() {
602
  OT_UI.init();
603
  });
604
+ })(jQuery);
605
+
606
+ /* Gallery*/
607
+ !function ($) {
608
+
609
+ ot_gallery = {
610
+
611
+ frame: function (elm) {
612
+
613
+ if ( this._frame )
614
+ return this._frame
615
+
616
+ var selection = this.select(elm)
617
+
618
+ this._frame = wp.media({
619
+ id: 'ot-gallery-frame'
620
+ , frame: 'post'
621
+ , state: 'gallery-edit'
622
+ , title: wp.media.view.l10n.editGalleryTitle
623
+ , editing: true
624
+ , multiple: true
625
+ , selection: selection
626
+ })
627
+
628
+ this._frame.on('update', function () {
629
+ var controller = ot_gallery._frame.states.get('gallery-edit')
630
+ , library = controller.get('library')
631
+ , ids = library.pluck('id')
632
+ , parent = $(elm).parents('.format-setting-inner')
633
+ , input = parent.children('.ot-gallery-value')
634
+
635
+ input.attr('value', ids)
636
+
637
+ if ( parent.children('.ot-gallery-list').length <= 0 )
638
+ input.after('<ul class="ot-gallery-list" />')
639
+
640
+ $.ajax({
641
+ type: 'POST',
642
+ url: ajaxurl,
643
+ dataType: 'html',
644
+ data: {
645
+ action: 'gallery_update',
646
+ ids: ids
647
+ },
648
+ success: function(res) {
649
+ parent.children('.ot-gallery-list').html(res)
650
+ if ( $(elm).parent().children('.ot-gallery-delete').length <= 0 ) {
651
+ $(elm).parent().append('<a href="#" class="option-tree-ui-button red hug-left ot-gallery-delete">' + option_tree.delete + '</a>')
652
+ }
653
+ $(elm).text(option_tree.edit)
654
+ }
655
+ })
656
+ })
657
+
658
+ return this._frame
659
+
660
+ }
661
+
662
+ , select: function (elm) {
663
+ var ids = $(elm).parents('.format-setting-inner').children('.ot-gallery-value').attr('value')
664
+ , fakeShortcode = '[gallery ids="' + ids + '"]'
665
+ , shortcode = wp.shortcode.next('gallery', ( ids ? fakeShortcode : wp.media.view.settings.ot_gallery.shortcode ) )
666
+ , defaultPostId = wp.media.gallery.defaults.id
667
+ , attachments
668
+ , selection
669
+
670
+ // Bail if we didn't match the shortcode or all of the content.
671
+ if ( ! shortcode )
672
+ return
673
+
674
+ // Ignore the rest of the match object.
675
+ shortcode = shortcode.shortcode
676
+
677
+ if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) )
678
+ shortcode.set( 'id', defaultPostId )
679
+
680
+ attachments = wp.media.gallery.attachments( shortcode )
681
+
682
+ selection = new wp.media.model.Selection( attachments.models, {
683
+ props: attachments.props.toJSON()
684
+ , multiple: true
685
+ })
686
+
687
+ selection.gallery = attachments.gallery
688
+
689
+ // Fetch the query's attachments, and then break ties from the query to allow for sorting.
690
+ selection.more().done( function () {
691
+ selection.props.set({ query: false })
692
+ selection.unmirror()
693
+ selection.props.unset('orderby')
694
+ })
695
+
696
+ return selection
697
+
698
+ }
699
+
700
+ , open: function (elm) {
701
+
702
+ ot_gallery.frame(elm).open()
703
+
704
+ }
705
+
706
+ , remove: function (elm) {
707
+
708
+ if ( confirm( option_tree.confirm ) ) {
709
+
710
+ $(elm).parents('.format-setting-inner').children('.ot-gallery-value').attr('value', ' ')
711
+ $(elm).parents('.format-setting-inner').children('.ot-gallery-list').remove()
712
+ $(elm).next('.ot-gallery-edit').text( option_tree.create )
713
+ $(elm).remove()
714
+
715
+ }
716
+
717
+ }
718
+
719
+ }
720
+
721
+ // Gallery delete
722
+ $(document).on('click.ot_gallery.data-api', '.ot-gallery-delete', function (e) {
723
+ e.preventDefault()
724
+ ot_gallery.remove($(this))
725
+ })
726
+
727
+ // Gallery edit
728
+ $(document).on('click.ot_gallery.data-api', '.ot-gallery-edit', function (e) {
729
+ e.preventDefault()
730
+ ot_gallery.open($(this))
731
+ })
732
+
733
+ }(window.jQuery);
assets/js/ot-colorpicker.js DELETED
@@ -1,453 +0,0 @@
1
- /**
2
- * Color picker
3
- * Author: Stefan Petre www.eyecon.ro
4
- *
5
- * Dependencies: jQuery
6
- */
7
- (function ($) {
8
- var ColorPicker = function () {
9
- var
10
- ids = {},
11
- inAction,
12
- charMin = 65,
13
- visible,
14
- tpl = '<div class="ot_colorpicker colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
15
- defaults = {
16
- eventName: 'click',
17
- onShow: function () {},
18
- onBeforeShow: function(){},
19
- onHide: function () {},
20
- onChange: function () {},
21
- onSubmit: function () {},
22
- color: 'ff0000',
23
- livePreview: true,
24
- flat: false
25
- },
26
- fillRGBFields = function (hsb, cal) {
27
- var rgb = HSBToRGB(hsb);
28
- $(cal).data('colorpicker').fields
29
- .eq(1).val(rgb.r).end()
30
- .eq(2).val(rgb.g).end()
31
- .eq(3).val(rgb.b).end();
32
- },
33
- fillHSBFields = function (hsb, cal) {
34
- $(cal).data('colorpicker').fields
35
- .eq(4).val(hsb.h).end()
36
- .eq(5).val(hsb.s).end()
37
- .eq(6).val(hsb.b).end();
38
- },
39
- fillHexFields = function (hsb, cal) {
40
- $(cal).data('colorpicker').fields
41
- .eq(0).val(HSBToHex(hsb)).end();
42
- },
43
- setSelector = function (hsb, cal) {
44
- $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
45
- $(cal).data('colorpicker').selectorIndic.css({
46
- left: parseInt(150 * hsb.s/100, 10),
47
- top: parseInt(150 * (100-hsb.b)/100, 10)
48
- });
49
- },
50
- setHue = function (hsb, cal) {
51
- $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
52
- },
53
- setCurrentColor = function (hsb, cal) {
54
- $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
55
- },
56
- setNewColor = function (hsb, cal) {
57
- $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
58
- },
59
- keyDown = function (ev) {
60
- var pressedKey = ev.charCode || ev.keyCode || -1;
61
- if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
62
- return false;
63
- }
64
- var cal = $(this).parent().parent();
65
- if (cal.data('colorpicker').livePreview === true) {
66
- change.apply(this);
67
- }
68
- },
69
- change = function (ev) {
70
- var cal = $(this).parent().parent(), col;
71
- if (this.parentNode.className.indexOf('_hex') > 0) {
72
- cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
73
- } else if (this.parentNode.className.indexOf('_hsb') > 0) {
74
- cal.data('colorpicker').color = col = fixHSB({
75
- h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
76
- s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
77
- b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
78
- });
79
- } else {
80
- cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
81
- r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
82
- g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
83
- b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
84
- }));
85
- }
86
- if (ev) {
87
- fillRGBFields(col, cal.get(0));
88
- fillHexFields(col, cal.get(0));
89
- fillHSBFields(col, cal.get(0));
90
- }
91
- setSelector(col, cal.get(0));
92
- setHue(col, cal.get(0));
93
- setNewColor(col, cal.get(0));
94
- cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
95
- },
96
- blur = function (ev) {
97
- var cal = $(this).parent().parent();
98
- cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus')
99
- },
100
- focus = function () {
101
- charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
102
- $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
103
- $(this).parent().addClass('colorpicker_focus');
104
- },
105
- downIncrement = function (ev) {
106
- var field = $(this).parent().find('input').focus();
107
- var current = {
108
- el: $(this).parent().addClass('colorpicker_slider'),
109
- max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
110
- y: ev.pageY,
111
- field: field,
112
- val: parseInt(field.val(), 10),
113
- preview: $(this).parent().parent().data('colorpicker').livePreview
114
- };
115
- $(document).bind('mouseup', current, upIncrement);
116
- $(document).bind('mousemove', current, moveIncrement);
117
- },
118
- moveIncrement = function (ev) {
119
- ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
120
- if (ev.data.preview) {
121
- change.apply(ev.data.field.get(0), [true]);
122
- }
123
- return false;
124
- },
125
- upIncrement = function (ev) {
126
- change.apply(ev.data.field.get(0), [true]);
127
- ev.data.el.removeClass('colorpicker_slider').find('input').focus();
128
- $(document).unbind('mouseup', upIncrement);
129
- $(document).unbind('mousemove', moveIncrement);
130
- return false;
131
- },
132
- downHue = function (ev) {
133
- var current = {
134
- cal: $(this).parent(),
135
- y: $(this).offset().top
136
- };
137
- current.preview = current.cal.data('colorpicker').livePreview;
138
- $(document).bind('mouseup', current, upHue);
139
- $(document).bind('mousemove', current, moveHue);
140
- },
141
- moveHue = function (ev) {
142
- change.apply(
143
- ev.data.cal.data('colorpicker')
144
- .fields
145
- .eq(4)
146
- .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
147
- .get(0),
148
- [ev.data.preview]
149
- );
150
- return false;
151
- },
152
- upHue = function (ev) {
153
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
154
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
155
- $(document).unbind('mouseup', upHue);
156
- $(document).unbind('mousemove', moveHue);
157
- return false;
158
- },
159
- downSelector = function (ev) {
160
- var current = {
161
- cal: $(this).parent(),
162
- pos: $(this).offset()
163
- };
164
- current.preview = current.cal.data('colorpicker').livePreview;
165
- $(document).bind('mouseup', current, upSelector);
166
- $(document).bind('mousemove', current, moveSelector);
167
- },
168
- moveSelector = function (ev) {
169
- change.apply(
170
- ev.data.cal.data('colorpicker')
171
- .fields
172
- .eq(6)
173
- .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
174
- .end()
175
- .eq(5)
176
- .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
177
- .get(0),
178
- [ev.data.preview]
179
- );
180
- return false;
181
- },
182
- upSelector = function (ev) {
183
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
184
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
185
- $(document).unbind('mouseup', upSelector);
186
- $(document).unbind('mousemove', moveSelector);
187
- return false;
188
- },
189
- enterSubmit = function (ev) {
190
- $(this).addClass('colorpicker_focus');
191
- },
192
- leaveSubmit = function (ev) {
193
- $(this).removeClass('colorpicker_focus');
194
- },
195
- clickSubmit = function (ev) {
196
- var cal = $(this).parent();
197
- var col = cal.data('colorpicker').color;
198
- cal.data('colorpicker').origColor = col;
199
- setCurrentColor(col, cal.get(0));
200
- cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col));
201
- cal.hide();
202
- },
203
- show = function (ev) {
204
- var cal = $('#' + $(this).data('colorpickerId'));
205
- cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
206
- var pos = $(this).offset();
207
- var viewPort = getViewport();
208
- var top = pos.top + this.offsetHeight;
209
- var left = pos.left;
210
- if (top + 176 > viewPort.t + viewPort.h) {
211
- top -= this.offsetHeight + 176;
212
- } else {
213
- top += 5;
214
- }
215
- if (left + 356 > viewPort.l + viewPort.w) {
216
- left -= 356;
217
- }
218
- cal.css({left: left + 'px', top: top + 'px'});
219
- if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
220
- cal.show();
221
- }
222
- $(document).bind('mousedown', {cal: cal}, hide);
223
- return false;
224
- },
225
- hide = function (ev) {
226
- if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
227
- if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
228
- ev.data.cal.hide();
229
- }
230
- $(document).unbind('mousedown', hide);
231
- }
232
- },
233
- isChildOf = function(parentEl, el, container) {
234
- if (parentEl == el) {
235
- return true;
236
- }
237
- if (parentEl.contains) {
238
- return parentEl.contains(el);
239
- }
240
- if ( parentEl.compareDocumentPosition ) {
241
- return !!(parentEl.compareDocumentPosition(el) & 16);
242
- }
243
- var prEl = el.parentNode;
244
- while(prEl && prEl != container) {
245
- if (prEl == parentEl)
246
- return true;
247
- prEl = prEl.parentNode;
248
- }
249
- return false;
250
- },
251
- getViewport = function () {
252
- var m = document.compatMode == 'CSS1Compat';
253
- return {
254
- l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
255
- t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
256
- w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
257
- h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
258
- };
259
- },
260
- fixHSB = function (hsb) {
261
- return {
262
- h: Math.min(360, Math.max(0, hsb.h)),
263
- s: Math.min(100, Math.max(0, hsb.s)),
264
- b: Math.min(100, Math.max(0, hsb.b))
265
- };
266
- },
267
- fixRGB = function (rgb) {
268
- return {
269
- r: Math.min(255, Math.max(0, rgb.r)),
270
- g: Math.min(255, Math.max(0, rgb.g)),
271
- b: Math.min(255, Math.max(0, rgb.b))
272
- };
273
- },
274
- fixHex = function (hex) {
275
- var len = 6 - hex.length;
276
- if (len > 0) {
277
- var o = [];
278
- for (var i=0; i<len; i++) {
279
- o.push('0');
280
- }
281
- o.push(hex);
282
- hex = o.join('');
283
- }
284
- return hex;
285
- },
286
- HexToRGB = function (hex) {
287
- var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
288
- return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
289
- },
290
- HexToHSB = function (hex) {
291
- return RGBToHSB(HexToRGB(hex));
292
- },
293
- RGBToHSB = function (rgb) {
294
- var hsb = {};
295
- hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b);
296
- hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b);
297
- hsb.b = Math.round((hsb.b /255)*100);
298
- if((rgb.r==rgb.g) && (rgb.g==rgb.b)) hsb.h = 0;
299
- else if(rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b);
300
- else if(rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b);
301
- else if(rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r);
302
- else if(rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r);
303
- else if(rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g);
304
- else if(rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g);
305
- else hsb.h = 0;
306
- hsb.h = Math.round(hsb.h);
307
- return hsb;
308
- },
309
- HSBToRGB = function (hsb) {
310
- var rgb = {};
311
- var h = Math.round(hsb.h);
312
- var s = Math.round(hsb.s*255/100);
313
- var v = Math.round(hsb.b*255/100);
314
- if(s == 0) {
315
- rgb.r = rgb.g = rgb.b = v;
316
- } else {
317
- var t1 = v;
318
- var t2 = (255-s)*v/255;
319
- var t3 = (t1-t2)*(h%60)/60;
320
- if(h==360) h = 0;
321
- if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
322
- else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
323
- else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
324
- else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
325
- else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
326
- else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
327
- else {rgb.r=0; rgb.g=0; rgb.b=0}
328
- }
329
- return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
330
- },
331
- RGBToHex = function (rgb) {
332
- var hex = [
333
- rgb.r.toString(16),
334
- rgb.g.toString(16),
335
- rgb.b.toString(16)
336
- ];
337
- $.each(hex, function (nr, val) {
338
- if (val.length == 1) {
339
- hex[nr] = '0' + val;
340
- }
341
- });
342
- return hex.join('');
343
- },
344
- HSBToHex = function (hsb) {
345
- return RGBToHex(HSBToRGB(hsb));
346
- };
347
- return {
348
- init: function (options) {
349
- options = $.extend({}, defaults, options||{});
350
- if (typeof options.color == 'string') {
351
- options.color = HexToHSB(options.color);
352
- } else if (options.color.r != undefined && options.color.g != undefined && options.color.b != undefined) {
353
- options.color = RGBToHSB(options.color);
354
- } else if (options.color.h != undefined && options.color.s != undefined && options.color.b != undefined) {
355
- options.color = fixHSB(options.color);
356
- } else {
357
- return this;
358
- }
359
- options.origColor = options.color;
360
- return this.each(function () {
361
- if (!$(this).data('colorpickerId')) {
362
- var id = 'collorpicker_' + parseInt(Math.random() * 1000);
363
- $(this).data('colorpickerId', id);
364
- var cal = $(tpl).attr('id', id);
365
- if (options.flat) {
366
- cal.appendTo(this).show();
367
- } else {
368
- cal.appendTo(document.body);
369
- }
370
- options.fields = cal
371
- .find('input')
372
- .bind('keydown', keyDown)
373
- .bind('change', change)
374
- .bind('blur', blur)
375
- .bind('focus', focus);
376
- cal.find('span').bind('mousedown', downIncrement);
377
- options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
378
- options.selectorIndic = options.selector.find('div div');
379
- options.hue = cal.find('div.colorpicker_hue div');
380
- cal.find('div.colorpicker_hue').bind('mousedown', downHue);
381
- options.newColor = cal.find('div.colorpicker_new_color');
382
- options.currentColor = cal.find('div.colorpicker_current_color');
383
- cal.data('colorpicker', options);
384
- cal.find('div.colorpicker_submit')
385
- .bind('mouseenter', enterSubmit)
386
- .bind('mouseleave', leaveSubmit)
387
- .bind('click', clickSubmit);
388
- fillRGBFields(options.color, cal.get(0));
389
- fillHSBFields(options.color, cal.get(0));
390
- fillHexFields(options.color, cal.get(0));
391
- setHue(options.color, cal.get(0));
392
- setSelector(options.color, cal.get(0));
393
- setCurrentColor(options.color, cal.get(0));
394
- setNewColor(options.color, cal.get(0));
395
- if (options.flat) {
396
- cal.css({
397
- position: 'relative',
398
- display: 'block'
399
- });
400
- } else {
401
- $(this).bind(options.eventName, show);
402
- }
403
- }
404
- });
405
- },
406
- showPicker: function() {
407
- return this.each( function () {
408
- if ($(this).data('colorpickerId')) {
409
- show.apply(this);
410
- }
411
- });
412
- },
413
- hidePicker: function() {
414
- return this.each( function () {
415
- if ($(this).data('colorpickerId')) {
416
- $('#' + $(this).data('colorpickerId')).hide();
417
- }
418
- });
419
- },
420
- setColor: function(col) {
421
- if (typeof col == 'string') {
422
- col = HexToHSB(col);
423
- } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
424
- col = RGBToHSB(col);
425
- } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
426
- col = fixHSB(col);
427
- } else {
428
- return this;
429
- }
430
- return this.each(function(){
431
- if ($(this).data('colorpickerId')) {
432
- var cal = $('#' + $(this).data('colorpickerId'));
433
- cal.data('colorpicker').color = col;
434
- cal.data('colorpicker').origColor = col;
435
- fillRGBFields(col, cal.get(0));
436
- fillHSBFields(col, cal.get(0));
437
- fillHexFields(col, cal.get(0));
438
- setHue(col, cal.get(0));
439
- setSelector(col, cal.get(0));
440
- setCurrentColor(col, cal.get(0));
441
- setNewColor(col, cal.get(0));
442
- }
443
- });
444
- }
445
- };
446
- }();
447
- $.fn.extend({
448
- ColorPicker: ColorPicker.init,
449
- ColorPickerHide: ColorPicker.hide,
450
- ColorPickerShow: ColorPicker.show,
451
- ColorPickerSetColor: ColorPicker.setColor
452
- });
453
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ot-functions-admin.php CHANGED
@@ -57,9 +57,9 @@ if ( ! function_exists( 'ot_register_theme_options_page' ) ) {
57
  'reset_message' => apply_filters( 'ot_theme_options_reset_message', __( 'Theme Options reset.', 'option-tree' ) ),
58
  'button_text' => apply_filters( 'ot_theme_options_button_text', __( 'Save Changes', 'option-tree' ) ),
59
  'screen_icon' => 'themes',
60
- 'contextual_help' => $contextual_help,
61
- 'sections' => $sections,
62
- 'settings' => $settings
63
  )
64
  )
65
  )
@@ -97,7 +97,7 @@ if ( ! function_exists( 'ot_register_settings_page' ) ) {
97
  'menu_title' => __( 'OptionTree', 'option-tree' ),
98
  'capability' => 'edit_theme_options',
99
  'menu_slug' => 'ot-settings',
100
- 'icon_url' => OT_URL . '/assets/images/ot-logo-mini.png',
101
  'position' => 61,
102
  'hidden_page' => true
103
  ),
@@ -521,6 +521,9 @@ if ( ! function_exists( 'ot_admin_styles' ) ) {
521
 
522
  wp_enqueue_style( 'ot-admin-css', OT_URL . 'assets/css/ot-admin.css', false, OT_VERSION );
523
 
 
 
 
524
  }
525
 
526
  }
@@ -549,14 +552,14 @@ if ( ! function_exists( 'ot_admin_scripts' ) ) {
549
  add_thickbox();
550
  }
551
 
552
- /* load the colorpicker */
553
- wp_enqueue_script( 'ot-colorpicker-js', OT_URL . 'assets/js/ot-colorpicker.js', array( 'jquery' ), OT_VERSION );
554
-
555
  /* load jQuery-ui slider */
556
  wp_enqueue_script( 'jquery-ui-slider' );
557
 
 
 
 
558
  /* load all the required scripts */
559
- wp_enqueue_script( 'ot-admin-js', OT_URL . 'assets/js/ot-admin.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-sortable', 'media-upload', 'thickbox' ), OT_VERSION );
560
 
561
  /* create localized JS array */
562
  $localized_array = array(
@@ -567,7 +570,11 @@ if ( ! function_exists( 'ot_admin_scripts' ) ) {
567
  'remove_no' => __( 'You can\'t remove this! But you can edit the values.', 'option-tree' ),
568
  'remove_agree' => __( 'Are you sure you want to remove this?', 'option-tree' ),
569
  'activate_layout_agree' => __( 'Are you sure you want to activate this layout?', 'option-tree' ),
570
- 'setting_limit' => __( 'Sorry, you can\'t have settings three levels deep.', 'option-tree' )
 
 
 
 
571
  );
572
 
573
  /* localized script attached to 'option_tree' */
@@ -1336,6 +1343,8 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1336
  $_taxonomy = isset( $value['taxonomy'] ) ? $value['taxonomy'] : '';
1337
  $_min_max_step = isset( $value['min_max_step'] ) ? $value['min_max_step'] : '';
1338
  $_class = isset( $value['class'] ) ? $value['class'] : '';
 
 
1339
 
1340
  $choices = '';
1341
  if ( isset( $value['choices'] ) && ! empty( $value['choices'] ) ) {
@@ -1353,7 +1362,7 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1353
  $choices = substr_replace( $choices, '' , -1 );
1354
  $choices = ",
1355
  'choices' => array( $choices
1356
- ),";
1357
  }
1358
 
1359
  $std = "'$_std'";
@@ -1380,6 +1389,8 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1380
  $_setting_taxonomy = isset( $setting['taxonomy'] ) ? $setting['taxonomy'] : '';
1381
  $_setting_min_max_step = isset( $setting['min_max_step'] ) ? $setting['min_max_step'] : '';
1382
  $_setting_class = isset( $setting['class'] ) ? $setting['class'] : '';
 
 
1383
 
1384
  $setting_choices = '';
1385
  if ( isset( $setting['choices'] ) && ! empty( $setting['choices'] ) ) {
@@ -1397,7 +1408,7 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1397
  $setting_choices = substr_replace( $setting_choices, '' , -1 );
1398
  $setting_choices = ",
1399
  'choices' => array( $setting_choices
1400
- ),";
1401
  }
1402
 
1403
  $setting_std = "'$_setting_std'";
@@ -1422,7 +1433,9 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1422
  'post_type' => '$_setting_post_type',
1423
  'taxonomy' => '$_setting_taxonomy',
1424
  'min_max_step'=> '$_setting_min_max_step',
1425
- 'class' => '$_setting_class'$setting_choices
 
 
1426
  ),";
1427
  }
1428
  $setting_settings = substr_replace( $setting_settings, '' , -1 );
@@ -1443,7 +1456,9 @@ if ( ! function_exists( 'ot_export_php_settings_array' ) ) {
1443
  'post_type' => '$_post_type',
1444
  'taxonomy' => '$_taxonomy',
1445
  'min_max_step'=> '$_min_max_step',
1446
- 'class' => '$_class'$choices$setting_settings
 
 
1447
  ),";
1448
  }
1449
  $settings = substr_replace( $settings, '' , -1 );
@@ -2058,13 +2073,15 @@ if ( ! function_exists( 'ot_option_types_array' ) ) {
2058
  'category-checkbox' => 'Category Checkbox',
2059
  'category-select' => 'Category Select',
2060
  'checkbox' => 'Checkbox',
2061
- 'colorpicker' => 'Colorpicker',
2062
  'css' => 'CSS',
2063
  'custom-post-type-checkbox' => 'Custom Post Type Checkbox',
2064
  'custom-post-type-select' => 'Custom Post Type Select',
 
2065
  'list-item' => 'List Item',
2066
  'measurement' => 'Measurement',
2067
  'numeric-slider' => 'Numeric Slider',
 
2068
  'page-checkbox' => 'Page Checkbox',
2069
  'page-select' => 'Page Select',
2070
  'post-checkbox' => 'Post Checkbox',
@@ -2874,7 +2891,7 @@ if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
2874
  $value = ! empty( $font ) ? implode( "\n", $font ) : '';
2875
 
2876
  /* background */
2877
- } else if ( ot_array_keys_exists( $value, array( 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position' ) ) ) {
2878
  $bg = array();
2879
 
2880
  if ( ! empty( $value['background-color'] ) )
@@ -2892,8 +2909,19 @@ if ( ! function_exists( 'ot_insert_css_with_markers' ) ) {
2892
  if ( ! empty( $value['background-position'] ) )
2893
  $bg[] = $value['background-position'];
2894
 
 
 
 
2895
  /* set $value with background properties or empty string */
2896
  $value = ! empty( $bg ) ? 'background: ' . implode( " ", $bg ) . ';' : '';
 
 
 
 
 
 
 
 
2897
  }
2898
 
2899
  } else {
@@ -3229,6 +3257,7 @@ if ( ! function_exists( 'ot_settings_view' ) ) {
3229
  $child = ( strpos( $name, '][settings]') !== false ) ? true : false;
3230
  $type = isset( $setting['type'] ) ? $setting['type'] : '';
3231
  $std = isset( $setting['std'] ) ? $setting['std'] : '';
 
3232
 
3233
  // Serialize the standard value just incase
3234
  if ( is_array( $std ) ) {
@@ -3358,6 +3387,25 @@ if ( ! function_exists( 'ot_settings_view' ) ) {
3358
  </div>
3359
  </div>
3360
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3361
  </div>
3362
  </div>
3363
  ' . ( ! $child ? '<input type="hidden" class="hidden-section" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][section]" value="' . ( isset( $setting['section'] ) ? esc_attr( $setting['section'] ) : '' ) . '" />' : '' );
@@ -3618,14 +3666,36 @@ if ( ! function_exists( 'ot_list_item_view' ) ) {
3618
  'field_taxonomy' => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
3619
  'field_min_max_step'=> isset( $field['min_max_step'] ) && ! empty( $field['min_max_step'] ) ? $field['min_max_step'] : '0,100,1',
3620
  'field_class' => isset( $field['class'] ) ? $field['class'] : '',
 
 
3621
  'field_choices' => isset( $field['choices'] ) && ! empty( $field['choices'] ) ? $field['choices'] : array(),
3622
  'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
3623
  'post_id' => $post_id,
3624
  'get_option' => $get_option
3625
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3626
 
3627
  /* option label */
3628
- echo '<div class="format-settings">';
3629
 
3630
  /* don't show title with textblocks */
3631
  if ( $_args['type'] != 'textblock' && ! empty( $field['label'] ) ) {
@@ -4137,4 +4207,4 @@ function ot_wpml_unregister_string( $id ) {
4137
  }
4138
 
4139
  /* End of file ot-functions-admin.php */
4140
- /* Location: ./includes/ot-functions-admin.php */
57
  'reset_message' => apply_filters( 'ot_theme_options_reset_message', __( 'Theme Options reset.', 'option-tree' ) ),
58
  'button_text' => apply_filters( 'ot_theme_options_button_text', __( 'Save Changes', 'option-tree' ) ),
59
  'screen_icon' => 'themes',
60
+ 'contextual_help' => apply_filters( 'ot_theme_options_contextual_help', $contextual_help ),
61
+ 'sections' => apply_filters( 'ot_theme_options_sections', $sections ),
62
+ 'settings' => apply_filters( 'ot_theme_options_settings', $settings )
63
  )
64
  )
65
  )
97
  'menu_title' => __( 'OptionTree', 'option-tree' ),
98
  'capability' => 'edit_theme_options',
99
  'menu_slug' => 'ot-settings',
100
+ 'icon_url' => null,
101
  'position' => 61,
102
  'hidden_page' => true
103
  ),
521
 
522
  wp_enqueue_style( 'ot-admin-css', OT_URL . 'assets/css/ot-admin.css', false, OT_VERSION );
523
 
524
+ /* load WP colorpicker */
525
+ wp_enqueue_style( 'wp-color-picker' );
526
+
527
  }
528
 
529
  }
552
  add_thickbox();
553
  }
554
 
 
 
 
555
  /* load jQuery-ui slider */
556
  wp_enqueue_script( 'jquery-ui-slider' );
557
 
558
+ /* load WP colorpicker */
559
+ wp_enqueue_script( 'wp-color-picker' );
560
+
561
  /* load all the required scripts */
562
+ wp_enqueue_script( 'ot-admin-js', OT_URL . 'assets/js/ot-admin.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-sortable', 'jquery-ui-slider', 'wp-color-picker' ), OT_VERSION );
563
 
564
  /* create localized JS array */
565
  $localized_array = array(
570
  'remove_no' => __( 'You can\'t remove this! But you can edit the values.', 'option-tree' ),
571
  'remove_agree' => __( 'Are you sure you want to remove this?', 'option-tree' ),
572
  'activate_layout_agree' => __( 'Are you sure you want to activate this layout?', 'option-tree' ),
573
+ 'setting_limit' => __( 'Sorry, you can\'t have settings three levels deep.', 'option-tree' ),
574
+ 'delete' => __( 'Delete Gallery', 'option-tree' ),
575
+ 'edit' => __( 'Edit Gallery', 'option-tree' ),
576
+ 'create' => __( 'Create Gallery', 'option-tree' ),
577
+ 'confirm' => __( 'Are you sure you want to delete this Gallery?', 'option-tree' )
578
  );
579
 
580
  /* localized script attached to 'option_tree' */
1343
  $_taxonomy = isset( $value['taxonomy'] ) ? $value['taxonomy'] : '';
1344
  $_min_max_step = isset( $value['min_max_step'] ) ? $value['min_max_step'] : '';
1345
  $_class = isset( $value['class'] ) ? $value['class'] : '';
1346
+ $_condition = isset( $value['condition'] ) ? $value['condition'] : '';
1347
+ $_operator = isset( $value['operator'] ) ? $value['operator'] : '';
1348
 
1349
  $choices = '';
1350
  if ( isset( $value['choices'] ) && ! empty( $value['choices'] ) ) {
1362
  $choices = substr_replace( $choices, '' , -1 );
1363
  $choices = ",
1364
  'choices' => array( $choices
1365
+ )";
1366
  }
1367
 
1368
  $std = "'$_std'";
1389
  $_setting_taxonomy = isset( $setting['taxonomy'] ) ? $setting['taxonomy'] : '';
1390
  $_setting_min_max_step = isset( $setting['min_max_step'] ) ? $setting['min_max_step'] : '';
1391
  $_setting_class = isset( $setting['class'] ) ? $setting['class'] : '';
1392
+ $_setting_condition = isset( $setting['condition'] ) ? $setting['condition'] : '';
1393
+ $_setting_operator = isset( $setting['operator'] ) ? $setting['operator'] : '';
1394
 
1395
  $setting_choices = '';
1396
  if ( isset( $setting['choices'] ) && ! empty( $setting['choices'] ) ) {
1408
  $setting_choices = substr_replace( $setting_choices, '' , -1 );
1409
  $setting_choices = ",
1410
  'choices' => array( $setting_choices
1411
+ )";
1412
  }
1413
 
1414
  $setting_std = "'$_setting_std'";
1433
  'post_type' => '$_setting_post_type',
1434
  'taxonomy' => '$_setting_taxonomy',
1435
  'min_max_step'=> '$_setting_min_max_step',
1436
+ 'class' => '$_setting_class',
1437
+ 'condition' => '$_setting_condition',
1438
+ 'operator' => '$_setting_operator'$setting_choices
1439
  ),";
1440
  }
1441
  $setting_settings = substr_replace( $setting_settings, '' , -1 );
1456
  'post_type' => '$_post_type',
1457
  'taxonomy' => '$_taxonomy',
1458
  'min_max_step'=> '$_min_max_step',
1459
+ 'class' => '$_class',
1460
+ 'condition' => '$_condition',
1461
+ 'operator' => '$_operator'$choices$setting_settings
1462
  ),";
1463
  }
1464
  $settings = substr_replace( $settings, '' , -1 );
2073
  'category-checkbox' => 'Category Checkbox',
2074
  'category-select' => 'Category Select',
2075
  'checkbox' => 'Checkbox',
2076
+ 'colorpicker' => 'Color Picker',
2077
  'css' => 'CSS',
2078
  'custom-post-type-checkbox' => 'Custom Post Type Checkbox',
2079
  'custom-post-type-select' => 'Custom Post Type Select',
2080
+ 'gallery' => 'Gallery',
2081
  'list-item' => 'List Item',
2082
  'measurement' => 'Measurement',
2083
  'numeric-slider' => 'Numeric Slider',
2084
+ 'on-off' => 'On/Off',
2085
  'page-checkbox' => 'Page Checkbox',
2086
  'page-select' => 'Page Select',
2087
  'post-checkbox' => 'Post Checkbox',
2891
  $value = ! empty( $font ) ? implode( "\n", $font ) : '';
2892
 
2893
  /* background */
2894
+ } else if ( ot_array_keys_exists( $value, array( 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position', 'background-size' ) ) ) {
2895
  $bg = array();
2896
 
2897
  if ( ! empty( $value['background-color'] ) )
2909
  if ( ! empty( $value['background-position'] ) )
2910
  $bg[] = $value['background-position'];
2911
 
2912
+ if ( ! empty( $value['background-size'] ) )
2913
+ $size = $value['background-size'];
2914
+
2915
  /* set $value with background properties or empty string */
2916
  $value = ! empty( $bg ) ? 'background: ' . implode( " ", $bg ) . ';' : '';
2917
+
2918
+ if ( isset( $size ) ) {
2919
+ if ( ! empty( $bg ) ) {
2920
+ $value.= apply_filters( 'ot_insert_css_with_markers_bg_size_white_space', "\n\x20\x20", $option_id );
2921
+ }
2922
+ $value.= "background-size: $size;";
2923
+ }
2924
+
2925
  }
2926
 
2927
  } else {
3257
  $child = ( strpos( $name, '][settings]') !== false ) ? true : false;
3258
  $type = isset( $setting['type'] ) ? $setting['type'] : '';
3259
  $std = isset( $setting['std'] ) ? $setting['std'] : '';
3260
+ $operator = isset( $setting['operator'] ) ? esc_attr( $setting['operator'] ) : 'and';
3261
 
3262
  // Serialize the standard value just incase
3263
  if ( is_array( $std ) ) {
3387
  </div>
3388
  </div>
3389
  </div>
3390
+ <div class="format-settings">
3391
+ <div class="format-setting type-text wide-desc">
3392
+ <div class="description">' . __( '<strong>Condition</strong>: Add a comma separated list of conditions where this field will be visible, leave empty to always show the field. Conditions can be in the form of <code>field_name:is(value)</code>, <code>field_name:not(value)</code>, <code>field_name:contains(value)</code>, <code>field_name:less_than(value)</code>, <code>field_name:less_than_or_equal_to(value)</code>, <code>field_name:greater_than(value)</code>, or <code>field_name:greater_than_or_equal_to(value)</code>.', 'option-tree' ) . '</div>
3393
+ <div class="format-setting-inner">
3394
+ <input type="text" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][condition]" value="' . ( isset( $setting['condition'] ) ? esc_attr( $setting['condition'] ) : '' ) . '" class="widefat option-tree-ui-input" autocomplete="off" />
3395
+ </div>
3396
+ </div>
3397
+ </div>
3398
+ <div class="format-settings">
3399
+ <div class="format-setting type-select wide-desc">
3400
+ <div class="description">' . __( '<strong>Condition Operator</strong>: Choose the logical operator to compute the result of the conditions.', 'option-tree' ) . '</div>
3401
+ <div class="format-setting-inner">
3402
+ <select name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][operator]" value="' . $operator . '" class="option-tree-ui-select">
3403
+ <option value="and" ' . selected( $operator, 'and', false ) . '>' . __( 'and', 'option-tree' ) . '</option>
3404
+ <option value="or" ' . selected( $operator, 'or', false ) . '>' . __( 'or', 'option-tree' ) . '</option>
3405
+ </select>
3406
+ </div>
3407
+ </div>
3408
+ </div>
3409
  </div>
3410
  </div>
3411
  ' . ( ! $child ? '<input type="hidden" class="hidden-section" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . '][section]" value="' . ( isset( $setting['section'] ) ? esc_attr( $setting['section'] ) : '' ) . '" />' : '' );
3666
  'field_taxonomy' => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
3667
  'field_min_max_step'=> isset( $field['min_max_step'] ) && ! empty( $field['min_max_step'] ) ? $field['min_max_step'] : '0,100,1',
3668
  'field_class' => isset( $field['class'] ) ? $field['class'] : '',
3669
+ 'field_condition' => isset( $field['condition'] ) ? $field['condition'] : '',
3670
+ 'field_operator' => isset( $field['operator'] ) ? $field['operator'] : 'and',
3671
  'field_choices' => isset( $field['choices'] ) && ! empty( $field['choices'] ) ? $field['choices'] : array(),
3672
  'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
3673
  'post_id' => $post_id,
3674
  'get_option' => $get_option
3675
  );
3676
+
3677
+ $conditions = '';
3678
+
3679
+ /* setup the conditions */
3680
+ if ( isset( $field['condition'] ) && ! empty( $field['condition'] ) ) {
3681
+
3682
+ /* doing magic on the conditions so they work in a list item */
3683
+ $conditionals = explode( ',', $field['condition'] );
3684
+ foreach( $conditionals as $conditions ) {
3685
+ $parts = explode( ':', $conditions );
3686
+ if ( isset( $parts[0] ) ) {
3687
+ $field['condition'] = str_replace( $parts[0], $name . '_' . $parts[0] . '_' . $key, $field['condition'] );
3688
+ }
3689
+ }
3690
+
3691
+ $conditions = ' data-condition="' . $field['condition'] . '"';
3692
+ $conditions.= isset( $field['operator'] ) && in_array( $field['operator'], array( 'and', 'or' ) ) ? ' data-operator="' . $field['operator'] . '"' : '';
3693
+
3694
+
3695
+ }
3696
 
3697
  /* option label */
3698
+ echo '<div id="setting_' . $_args['field_id'] . '" class="format-settings"' . $conditions . '>';
3699
 
3700
  /* don't show title with textblocks */
3701
  if ( $_args['type'] != 'textblock' && ! empty( $field['label'] ) ) {
4207
  }
4208
 
4209
  /* End of file ot-functions-admin.php */
4210
+ /* Location: ./includes/ot-functions-admin.php */
includes/ot-functions-docs-page.php CHANGED
@@ -141,6 +141,9 @@ body {
141
  echo '<h4>'. __( 'Custom Post Type Checkbox', 'option-tree' ) . ':</h4>';
142
  echo '<p>' . __( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It allows the user to check multiple post IDs for use in a custom function or loop. Requires at least one valid <code>post_type</code> when created in the settings. For some reason <code>any</code> does not work correctly and will looked into in future version.', 'option-tree' ) . '</p>';
143
 
 
 
 
144
  echo '<h4>'. __( 'List Item', 'option-tree' ) . ':</h4>';
145
  echo '<p>' . __( 'The list Item replaced the old Slider option type. It allows for a great deal of customization. You can add settings to the List Item and those settings will be displayed to the user when they add a new List Item. Typical use is for creating sliding content or blocks of code for custom layouts.', 'option-tree' ) . '</p>';
146
 
@@ -178,6 +181,9 @@ add_filter( \'ot_measurement_unit_types\', \'filter_measurement_unit_types\', 10
178
  echo '<h4>'. __( 'Numeric Slider', 'option-tree' ) . ':</h4>';
179
  echo '<p>' . __( 'The Numeric Slider option type displays a jQuery UI slider. It will return a single numerical value for use in a custom function or loop.', 'option-tree' ) . '</p>';
180
 
 
 
 
181
  echo '<h4>'. __( 'Page Select', 'option-tree' ) . ':</h4>';
182
  echo '<p>' . __( 'The Page Select option type displays a list of page IDs. It will return a single page ID for use in a custom function or loop.', 'option-tree' ) . '</p>';
183
 
@@ -261,7 +267,7 @@ add_filter( \'ot_radio_images\', \'filter_radio_images\', 10, 2 );</code></pre>'
261
  return $content;
262
 
263
  }
264
- add_filter( \'ot_wpautop\', \'filter_textarea_wpautop\', 10, 1 );</code></pre>';
265
 
266
  echo '<p>' . __( 'This example keeps WordPress from executing the <code>media_buttons</code> filter on the textarea WYSIWYG. The default is <code>true</code> which means show the buttons.', 'option-tree' ) . '</p>';
267
  echo '<pre><code>function filter_textarea_media_buttons( $content, $field_id ) {
141
  echo '<h4>'. __( 'Custom Post Type Checkbox', 'option-tree' ) . ':</h4>';
142
  echo '<p>' . __( 'The Custom Post Type Select option type displays a list of IDs from any available WordPress post type or custom post type. It allows the user to check multiple post IDs for use in a custom function or loop. Requires at least one valid <code>post_type</code> when created in the settings. For some reason <code>any</code> does not work correctly and will looked into in future version.', 'option-tree' ) . '</p>';
143
 
144
+ echo '<h4>'. __( 'Gallery', 'option-tree' ) . ':</h4>';
145
+ echo '<p>' . __( 'The Gallery option type saves a comma separated list of image attachment IDs. You will need to create a front-end function to display the images in your theme.', 'option-tree' ) . '</p>';
146
+
147
  echo '<h4>'. __( 'List Item', 'option-tree' ) . ':</h4>';
148
  echo '<p>' . __( 'The list Item replaced the old Slider option type. It allows for a great deal of customization. You can add settings to the List Item and those settings will be displayed to the user when they add a new List Item. Typical use is for creating sliding content or blocks of code for custom layouts.', 'option-tree' ) . '</p>';
149
 
181
  echo '<h4>'. __( 'Numeric Slider', 'option-tree' ) . ':</h4>';
182
  echo '<p>' . __( 'The Numeric Slider option type displays a jQuery UI slider. It will return a single numerical value for use in a custom function or loop.', 'option-tree' ) . '</p>';
183
 
184
+ echo '<h4>'. __( 'On/Off', 'option-tree' ) . ':</h4>';
185
+ echo '<p>' . __( 'The On/Off option type displays a simple switch that can be used to turn things on or off. The saved return value is either on or off.', 'option-tree' ) . '</p>';
186
+
187
  echo '<h4>'. __( 'Page Select', 'option-tree' ) . ':</h4>';
188
  echo '<p>' . __( 'The Page Select option type displays a list of page IDs. It will return a single page ID for use in a custom function or loop.', 'option-tree' ) . '</p>';
189
 
267
  return $content;
268
 
269
  }
270
+ add_filter( \'ot_wpautop\', \'filter_textarea_wpautop\', 10, 2 );</code></pre>';
271
 
272
  echo '<p>' . __( 'This example keeps WordPress from executing the <code>media_buttons</code> filter on the textarea WYSIWYG. The default is <code>true</code> which means show the buttons.', 'option-tree' ) . '</p>';
273
  echo '<pre><code>function filter_textarea_media_buttons( $content, $field_id ) {
includes/ot-functions-option-types.php CHANGED
@@ -80,81 +80,170 @@ if ( ! function_exists( 'ot_type_background' ) ) {
80
  /* format setting inner wrapper */
81
  echo '<div class="format-setting-inner">';
82
 
83
- /* build background colorpicker */
84
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
- /* colorpicker JS */
87
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
 
 
 
 
 
 
 
 
 
 
88
 
89
- /* set background color */
90
- $background_color = isset( $field_value['background-color'] ) ? esc_attr( $field_value['background-color'] ) : '';
 
 
91
 
92
- /* set border color */
93
- $border_color = in_array( $background_color, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : $background_color;
 
 
 
 
 
 
 
 
 
 
94
 
95
- /* input */
96
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-color]" id="' . $field_id . '-picker" value="' . $background_color . '" class="widefat option-tree-ui-input cp_input ' . esc_attr( $field_class ) . '" autocomplete="off" />';
97
-
98
- echo '<div id="cp_' . esc_attr( $field_id ) . '-picker" class="cp_box"' . ( $background_color ? " style='background-color:$background_color; border-color:$border_color;'" : '' ) . '></div>';
99
-
100
- echo '</div>';
101
-
102
- echo '<div class="select-group">';
103
-
104
- /* build background repeat */
105
- $background_repeat = isset( $field_value['background-repeat'] ) ? esc_attr( $field_value['background-repeat'] ) : '';
106
- echo '<select name="' . esc_attr( $field_name ) . '[background-repeat]" id="' . esc_attr( $field_id ) . '-repeat" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
107
- echo '<option value="">' . __( 'background-repeat', 'option-tree' ) . '</option>';
108
- foreach ( ot_recognized_background_repeat( $field_id ) as $key => $value ) {
109
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_repeat, $key, false ) . '>' . esc_attr( $value ) . '</option>';
110
- }
111
- echo '</select>';
112
 
113
  /* build background attachment */
114
- $background_attachment = isset( $field_value['background-attachment'] ) ? esc_attr( $field_value['background-attachment'] ) : '';
115
- echo '<select name="' . esc_attr( $field_name ) . '[background-attachment]" id="' . esc_attr( $field_id ) . '-attachment" class="option-tree-ui-select ' . $field_class . '">';
116
- echo '<option value="">' . __( 'background-attachment', 'option-tree' ) . '</option>';
117
- foreach ( ot_recognized_background_attachment( $field_id ) as $key => $value ) {
118
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_attachment, $key, false ) . '>' . esc_attr( $value ) . '</option>';
119
- }
120
- echo '</select>';
 
 
 
 
 
 
 
 
 
 
121
 
122
  /* build background position */
123
- $background_position = isset( $field_value['background-position'] ) ? esc_attr( $field_value['background-position'] ) : '';
124
- echo '<select name="' . esc_attr( $field_name ) . '[background-position]" id="' . esc_attr( $field_id ) . '-position" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
125
- echo '<option value="">' . __( 'background-position', 'option-tree' ) . '</option>';
126
- foreach ( ot_recognized_background_position( $field_id ) as $key => $value ) {
127
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_position, $key, false ) . '>' . esc_attr( $value ) . '</option>';
128
- }
129
- echo '</select>';
130
-
131
- echo '</div>';
132
-
133
- /* build background image */
134
- echo '<div class="option-tree-ui-upload-parent">';
135
 
136
- /* input */
137
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-image]" id="' . esc_attr( $field_id ) . '" value="' . ( isset( $field_value['background-image'] ) ? esc_attr( $field_value['background-image'] ) : '' ) . '" class="widefat option-tree-ui-upload-input ' . esc_attr( $field_class ) . '" />';
 
 
 
 
 
 
 
 
 
 
 
138
 
139
- /* add media button */
140
- echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button blue light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon upload">' . __( 'Add Media', 'option-tree' ) . '</span></a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
- echo '</div>';
 
 
 
 
 
 
 
 
143
 
144
- /* media */
145
- if ( isset( $field_value['background-image'] ) && $field_value['background-image'] !== '' ) {
 
 
146
 
147
- echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
148
-
149
- if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value['background-image'] ) )
150
- echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value['background-image'] ) . '" alt="" /></div>';
151
 
152
- echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button red light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon trash-can">' . __( 'Remove Media', 'option-tree' ) . '</span></a>';
 
153
 
 
 
 
154
  echo '</div>';
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
-
158
  echo '</div>';
159
 
160
  echo '</div>';
@@ -192,9 +281,9 @@ if ( ! function_exists( 'ot_type_category_checkbox' ) ) {
192
 
193
  /* format setting inner wrapper */
194
  echo '<div class="format-setting-inner">';
195
-
196
  /* get category array */
197
- $categories = get_categories( array( 'hide_empty' => false ) );
198
 
199
  /* build categories */
200
  if ( ! empty( $categories ) ) {
@@ -250,7 +339,7 @@ if ( ! function_exists( 'ot_type_category_select' ) ) {
250
  echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
251
 
252
  /* get category array */
253
- $categories = get_categories( array( 'hide_empty' => false ) );
254
 
255
  /* has cats */
256
  if ( ! empty( $categories ) ) {
@@ -330,6 +419,7 @@ if ( ! function_exists( 'ot_type_checkbox' ) ) {
330
  *
331
  * @access public
332
  * @since 2.0
 
333
  */
334
  if ( ! function_exists( 'ot_type_colorpicker' ) ) {
335
 
@@ -355,14 +445,12 @@ if ( ! function_exists( 'ot_type_colorpicker' ) ) {
355
 
356
  /* colorpicker JS */
357
  echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '"); });</script>';
358
-
359
- /* input */
360
- echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="widefat option-tree-ui-input cp_input ' . esc_attr( $field_class ) . '" autocomplete="off" />';
361
-
362
- /* set border color */
363
- $border_color = in_array( $field_value, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : esc_attr( $field_value );
364
 
365
- echo '<div id="cp_' . esc_attr( $field_id ) . '" class="cp_box"' . ( $field_value ? " style='background-color:" . esc_attr( $field_value ) . "; border-color:$border_color;'" : '' ) . '></div>';
 
 
 
 
366
 
367
  echo '</div>';
368
 
@@ -453,10 +541,11 @@ if ( ! function_exists( 'ot_type_custom_post_type_checkbox' ) ) {
453
 
454
  /* has posts */
455
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
456
- foreach( $my_posts as $my_post ){
 
457
  echo '<p>';
458
  echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
459
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $my_post->post_title . '</label>';
460
  echo '</p>';
461
  }
462
  } else {
@@ -513,8 +602,9 @@ if ( ! function_exists( 'ot_type_custom_post_type_select' ) ) {
513
  /* has posts */
514
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
515
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
516
- foreach( $my_posts as $my_post ){
517
- echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . esc_attr( $my_post->post_title ) . '</option>';
 
518
  }
519
  } else {
520
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
@@ -530,6 +620,88 @@ if ( ! function_exists( 'ot_type_custom_post_type_select' ) ) {
530
 
531
  }
532
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  /**
534
  * List Item option type.
535
  *
@@ -696,7 +868,7 @@ if( ! function_exists( 'ot_type_numeric_slider' ) ) {
696
 
697
  echo '<input type="hidden" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="ot-numeric-slider-hidden-input" value="' . esc_attr( $field_value ) . '" data-min="' . esc_attr( $min ) . '" data-max="' . esc_attr( $max ) . '" data-step="' . esc_attr( $step ) . '">';
698
 
699
- echo '<input type="text" class="ot-numeric-slider-helper-input widefat option-tree-ui-input" value="' . esc_attr( $field_value ) . '" readonly>';
700
 
701
  echo '<div id="ot_numeric_slider_' . esc_attr( $field_id ) . '" class="ot-numeric-slider"></div>';
702
 
@@ -709,6 +881,69 @@ if( ! function_exists( 'ot_type_numeric_slider' ) ) {
709
 
710
  }
711
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
712
  /**
713
  * Page Checkbox option type.
714
  *
@@ -744,10 +979,11 @@ if ( ! function_exists( 'ot_type_page_checkbox' ) ) {
744
 
745
  /* has pages */
746
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
747
- foreach( $my_posts as $my_post ){
 
748
  echo '<p>';
749
  echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
750
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $my_post->post_title . '</label>';
751
  echo '</p>';
752
  }
753
  } else {
@@ -802,7 +1038,8 @@ if ( ! function_exists( 'ot_type_page_select' ) ) {
802
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
803
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
804
  foreach( $my_posts as $my_post ) {
805
- echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . esc_attr( $my_post->post_title ) . '</option>';
 
806
  }
807
  } else {
808
  echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
@@ -925,10 +1162,11 @@ if ( ! function_exists( 'ot_type_post_checkbox' ) ) {
925
 
926
  /* has posts */
927
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
928
- foreach( $my_posts as $my_post ){
 
929
  echo '<p>';
930
  echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
931
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . esc_attr( $my_post->post_title ) . '</label>';
932
  echo '</p>';
933
  }
934
  } else {
@@ -982,8 +1220,9 @@ if ( ! function_exists( 'ot_type_post_select' ) ) {
982
  /* has posts */
983
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
984
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
985
- foreach( $my_posts as $my_post ){
986
- echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . esc_attr( $my_post->post_title ) . '</option>';
 
987
  }
988
  } else {
989
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
@@ -1363,7 +1602,7 @@ if ( ! function_exists( 'ot_type_taxonomy_checkbox' ) ) {
1363
  $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
1364
 
1365
  /* get taxonomies */
1366
- $taxonomies = get_categories( array( 'hide_empty' => false, 'taxonomy' => $taxonomy ) );
1367
 
1368
  /* has tags */
1369
  if ( $taxonomies ) {
@@ -1422,7 +1661,7 @@ if ( ! function_exists( 'ot_type_taxonomy_select' ) ) {
1422
  $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
1423
 
1424
  /* get taxonomies */
1425
- $taxonomies = get_categories( array( 'hide_empty' => false, 'taxonomy' => $taxonomy ) );
1426
 
1427
  /* has tags */
1428
  if ( $taxonomies ) {
@@ -1690,9 +1929,10 @@ if ( ! function_exists( 'ot_type_typography' ) ) {
1690
  'text-transform'
1691
  ), $field_id );
1692
 
1693
- /* build background colorpicker */
1694
  if ( in_array( 'font-color', $ot_recognized_typography_fields ) ) {
1695
-
 
1696
  echo '<div class="option-tree-ui-colorpicker-input-wrap">';
1697
 
1698
  /* colorpicker JS */
@@ -1701,13 +1941,8 @@ if ( ! function_exists( 'ot_type_typography' ) ) {
1701
  /* set background color */
1702
  $background_color = isset( $field_value['font-color'] ) ? esc_attr( $field_value['font-color'] ) : '';
1703
 
1704
- /* set border color */
1705
- $border_color = in_array( $background_color, array( '#FFFFFF', '#FFF', '#ffffff', '#fff' ) ) ? '#ccc' : $background_color;
1706
-
1707
  /* input */
1708
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[font-color]" id="' . esc_attr( $field_id ) . '-picker" value="' . esc_attr( $background_color ) . '" class="widefat option-tree-ui-input cp_input ' . esc_attr( $field_class ) . '" autocomplete="off" placeholder="font-color" />';
1709
-
1710
- echo '<div id="cp_' . esc_attr( $field_id ) . '-picker" class="cp_box"' . ( $background_color ? " style='background-color:$background_color; border-color:$border_color;'" : '' ) . '></div>';
1711
 
1712
  echo '</div>';
1713
 
80
  /* format setting inner wrapper */
81
  echo '<div class="format-setting-inner">';
82
 
83
+ /* allow fields to be filtered */
84
+ $ot_recognized_background_fields = apply_filters( 'ot_recognized_background_fields', array(
85
+ 'background-color',
86
+ 'background-repeat',
87
+ 'background-attachment',
88
+ 'background-position',
89
+ 'background-size',
90
+ 'background-image'
91
+ ), $field_id );
92
+
93
+ echo '<div class="ot-background-group">';
94
+
95
+ /* build background color */
96
+ if ( in_array( 'background-color', $ot_recognized_background_fields ) ) {
97
 
98
+ echo '<div class="option-tree-ui-colorpicker-input-wrap">';
99
+
100
+ /* colorpicker JS */
101
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
102
+
103
+ /* set background color */
104
+ $background_color = isset( $field_value['background-color'] ) ? esc_attr( $field_value['background-color'] ) : '';
105
+
106
+ /* input */
107
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-color]" id="' . $field_id . '-picker" value="' . $background_color . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" />';
108
+
109
+ echo '</div>';
110
 
111
+ }
112
+
113
+ /* build background repeat */
114
+ if ( in_array( 'background-repeat', $ot_recognized_background_fields ) ) {
115
 
116
+ $background_repeat = isset( $field_value['background-repeat'] ) ? esc_attr( $field_value['background-repeat'] ) : '';
117
+
118
+ echo '<select name="' . esc_attr( $field_name ) . '[background-repeat]" id="' . esc_attr( $field_id ) . '-repeat" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
119
+
120
+ echo '<option value="">' . __( 'background-repeat', 'option-tree' ) . '</option>';
121
+ foreach ( ot_recognized_background_repeat( $field_id ) as $key => $value ) {
122
+
123
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_repeat, $key, false ) . '>' . esc_attr( $value ) . '</option>';
124
+
125
+ }
126
+
127
+ echo '</select>';
128
 
129
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  /* build background attachment */
132
+ if ( in_array( 'background-attachment', $ot_recognized_background_fields ) ) {
133
+
134
+ $background_attachment = isset( $field_value['background-attachment'] ) ? esc_attr( $field_value['background-attachment'] ) : '';
135
+
136
+ echo '<select name="' . esc_attr( $field_name ) . '[background-attachment]" id="' . esc_attr( $field_id ) . '-attachment" class="option-tree-ui-select ' . $field_class . '">';
137
+
138
+ echo '<option value="">' . __( 'background-attachment', 'option-tree' ) . '</option>';
139
+
140
+ foreach ( ot_recognized_background_attachment( $field_id ) as $key => $value ) {
141
+
142
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_attachment, $key, false ) . '>' . esc_attr( $value ) . '</option>';
143
+
144
+ }
145
+
146
+ echo '</select>';
147
+
148
+ }
149
 
150
  /* build background position */
151
+ if ( in_array( 'background-position', $ot_recognized_background_fields ) ) {
 
 
 
 
 
 
 
 
 
 
 
152
 
153
+ $background_position = isset( $field_value['background-position'] ) ? esc_attr( $field_value['background-position'] ) : '';
154
+
155
+ echo '<select name="' . esc_attr( $field_name ) . '[background-position]" id="' . esc_attr( $field_id ) . '-position" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
156
+
157
+ echo '<option value="">' . __( 'background-position', 'option-tree' ) . '</option>';
158
+
159
+ foreach ( ot_recognized_background_position( $field_id ) as $key => $value ) {
160
+
161
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_position, $key, false ) . '>' . esc_attr( $value ) . '</option>';
162
+
163
+ }
164
+
165
+ echo '</select>';
166
 
167
+ }
168
+
169
+ /* Build background size */
170
+ if ( in_array( 'background-size', $ot_recognized_background_fields ) ) {
171
+
172
+ /**
173
+ * Use this filter to create a select instead of an text input.
174
+ * Be sure to return the array in the correct format. Add an empty
175
+ * value to the first choice so the user can leave it blank.
176
+ *
177
+ array(
178
+ array(
179
+ 'label' => 'background-size',
180
+ 'value' => ''
181
+ ),
182
+ array(
183
+ 'label' => 'cover',
184
+ 'value' => 'cover'
185
+ ),
186
+ array(
187
+ 'label' => 'contain',
188
+ 'value' => 'contain'
189
+ )
190
+ )
191
+ *
192
+ */
193
+ $choices = apply_filters( 'ot_type_background_size_choices', '', $field_id );
194
+
195
+ if ( is_array( $choices ) && ! empty( $choices ) ) {
196
+
197
+ /* build select */
198
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
199
+
200
+ foreach ( (array) $choices as $choice ) {
201
+ if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
202
+ echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( $field_value, $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
203
+ }
204
+ }
205
 
206
+ echo '</select>';
207
+
208
+ } else {
209
+
210
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-size]" id="' . esc_attr( $field_id ) . '-size" value="' . ( isset( $field_value['background-size'] ) ? esc_attr( $field_value['background-size'] ) : '' ) . '" class="widefat ot-background-size-input option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'background-size', 'option-tree' ) . '" />';
211
+
212
+ }
213
+
214
+ }
215
 
216
+ echo '</div>';
217
+
218
+ /* build background image */
219
+ if ( in_array( 'background-image', $ot_recognized_background_fields ) ) {
220
 
221
+ echo '<div class="option-tree-ui-upload-parent">';
 
 
 
222
 
223
+ /* input */
224
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[background-image]" id="' . esc_attr( $field_id ) . '" value="' . ( isset( $field_value['background-image'] ) ? esc_attr( $field_value['background-image'] ) : '' ) . '" class="widefat option-tree-ui-upload-input ' . esc_attr( $field_class ) . '" />';
225
 
226
+ /* add media button */
227
+ echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button blue light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon upload">' . __( 'Add Media', 'option-tree' ) . '</span></a>';
228
+
229
  echo '</div>';
230
 
231
+ /* media */
232
+ if ( isset( $field_value['background-image'] ) && $field_value['background-image'] !== '' ) {
233
+
234
+ echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
235
+
236
+ if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value['background-image'] ) )
237
+ echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value['background-image'] ) . '" alt="" /></div>';
238
+
239
+ echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button red light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon trash-can">' . __( 'Remove Media', 'option-tree' ) . '</span></a>';
240
+
241
+ echo '</div>';
242
+
243
+ }
244
+
245
  }
246
+
247
  echo '</div>';
248
 
249
  echo '</div>';
281
 
282
  /* format setting inner wrapper */
283
  echo '<div class="format-setting-inner">';
284
+
285
  /* get category array */
286
+ $categories = get_categories( apply_filters( 'ot_type_category_checkbox_query', array( 'hide_empty' => false ), $field_id ) );
287
 
288
  /* build categories */
289
  if ( ! empty( $categories ) ) {
339
  echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
340
 
341
  /* get category array */
342
+ $categories = get_categories( apply_filters( 'ot_type_category_select_query', array( 'hide_empty' => false ), $field_id ) );
343
 
344
  /* has cats */
345
  if ( ! empty( $categories ) ) {
419
  *
420
  * @access public
421
  * @since 2.0
422
+ * @updated 2.2.0
423
  */
424
  if ( ! function_exists( 'ot_type_colorpicker' ) ) {
425
 
445
 
446
  /* colorpicker JS */
447
  echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '"); });</script>';
 
 
 
 
 
 
448
 
449
+ /* set the default color */
450
+ $std = $field_std ? 'data-default-color="' . $field_std . '"' : '';
451
+
452
+ /* input */
453
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" ' . $std . ' />';
454
 
455
  echo '</div>';
456
 
541
 
542
  /* has posts */
543
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
544
+ foreach( $my_posts as $my_post ) {
545
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
546
  echo '<p>';
547
  echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
548
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
549
  echo '</p>';
550
  }
551
  } else {
602
  /* has posts */
603
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
604
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
605
+ foreach( $my_posts as $my_post ) {
606
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
607
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
608
  }
609
  } else {
610
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
620
 
621
  }
622
 
623
+ /**
624
+ * Gallery option type.
625
+ *
626
+ * See @ot_display_by_type to see the full list of available arguments.
627
+ *
628
+ * @param array The options arguments
629
+ * @return string The gallery metabox markup.
630
+ *
631
+ * @access public
632
+ * @since 2.2.0
633
+ */
634
+ if ( ! function_exists( 'ot_type_gallery' ) ) {
635
+
636
+ function ot_type_gallery( $args = array() ) {
637
+
638
+ // Turns arguments array into variables
639
+ extract( $args );
640
+
641
+ // Verify a description
642
+ $has_desc = $field_desc ? true : false;
643
+
644
+ // Format setting outer wrapper
645
+ echo '<div class="format-setting type-gallery ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
646
+
647
+ // Description
648
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
649
+
650
+ // Format setting inner wrapper
651
+ echo '<div class="format-setting-inner">';
652
+
653
+ // Setup the post type
654
+ $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
655
+
656
+ $field_value = trim( $field_value );
657
+
658
+ // Saved values
659
+ echo '<input type="hidden" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="ot-gallery-value ' . esc_attr( $field_class ) . '" />';
660
+
661
+ // Turn the field value into an array of IDs
662
+ $ids = ! empty( $field_value ) && $field_value != '' ? explode( ',', $field_value ) : array();
663
+
664
+ // Has attachment IDs
665
+ if ( ! empty( $ids ) ) {
666
+
667
+ echo '<ul class="ot-gallery-list">';
668
+
669
+ foreach( $ids as $id ) {
670
+
671
+ if ( $id == '' )
672
+ continue;
673
+
674
+ $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
675
+
676
+ echo '<li><img src="' . $thumbnail[0] . '" width="75" height="75" /></li>';
677
+
678
+ }
679
+
680
+ echo '</ul>';
681
+
682
+ echo '
683
+ <div class="ot-gallery-buttons">
684
+ <a href="#" class="option-tree-ui-button red hug-left ot-gallery-delete">' . __( 'Delete Gallery', 'option-tree' ) . '</a>
685
+ <a href="#" class="option-tree-ui-button blue right hug-right ot-gallery-edit">' . __( 'Edit Gallery', 'option-tree' ) . '</a>
686
+ </div>';
687
+
688
+ } else {
689
+
690
+ echo '
691
+ <div class="ot-gallery-buttons">
692
+ <a href="#" class="option-tree-ui-button blue right hug-right ot-gallery-edit">' . __( 'Create Gallery', 'option-tree' ) . '</a>
693
+ </div>';
694
+
695
+ }
696
+
697
+ echo '</div>';
698
+
699
+ echo '</div>';
700
+
701
+ }
702
+
703
+ }
704
+
705
  /**
706
  * List Item option type.
707
  *
868
 
869
  echo '<input type="hidden" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="ot-numeric-slider-hidden-input" value="' . esc_attr( $field_value ) . '" data-min="' . esc_attr( $min ) . '" data-max="' . esc_attr( $max ) . '" data-step="' . esc_attr( $step ) . '">';
870
 
871
+ echo '<input type="text" class="ot-numeric-slider-helper-input widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" value="' . esc_attr( $field_value ) . '" readonly>';
872
 
873
  echo '<div id="ot_numeric_slider_' . esc_attr( $field_id ) . '" class="ot-numeric-slider"></div>';
874
 
881
 
882
  }
883
 
884
+ /**
885
+ * On/Off option type
886
+ *
887
+ * See @ot_display_by_type to see the full list of available arguments.
888
+ *
889
+ * @param array The options arguments
890
+ * @return string The gallery metabox markup.
891
+ *
892
+ * @access public
893
+ * @since 2.2.0
894
+ */
895
+ if ( ! function_exists( 'ot_type_on_off' ) ) {
896
+
897
+ function ot_type_on_off( $args = array() ) {
898
+
899
+ /* turns arguments array into variables */
900
+ extract( $args );
901
+
902
+ /* verify a description */
903
+ $has_desc = $field_desc ? true : false;
904
+
905
+ /* format setting outer wrapper */
906
+ echo '<div class="format-setting type-radio ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
907
+
908
+ /* description */
909
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
910
+
911
+ /* format setting inner wrapper */
912
+ echo '<div class="format-setting-inner">';
913
+
914
+ // Force choices
915
+ $field_choices = array(
916
+ array(
917
+ 'value' => 'on',
918
+ 'label' => __( 'On', 'option-tree' ),
919
+ ),
920
+ array(
921
+ 'value' => 'off',
922
+ 'label' => __( 'Off', 'option-tree' ),
923
+ )
924
+ );
925
+
926
+ echo '<div class="on-off-switch">';
927
+
928
+ /* build radio */
929
+ foreach ( (array) $field_choices as $key => $choice ) {
930
+ echo '
931
+ <input type="radio" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" value="' . esc_attr( $choice['value'] ) . '"' . checked( $field_value, $choice['value'], false ) . ' class="radio option-tree-ui-radio ' . esc_attr( $field_class ) . '" />
932
+ <label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label>';
933
+ }
934
+
935
+ echo '<span class="slide-button"></span>';
936
+
937
+ echo '</div>';
938
+
939
+ echo '</div>';
940
+
941
+ echo '</div>';
942
+
943
+ }
944
+
945
+ }
946
+
947
  /**
948
  * Page Checkbox option type.
949
  *
979
 
980
  /* has pages */
981
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
982
+ foreach( $my_posts as $my_post ) {
983
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
984
  echo '<p>';
985
  echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
986
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
987
  echo '</p>';
988
  }
989
  } else {
1038
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1039
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1040
  foreach( $my_posts as $my_post ) {
1041
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1042
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
1043
  }
1044
  } else {
1045
  echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
1162
 
1163
  /* has posts */
1164
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1165
+ foreach( $my_posts as $my_post ) {
1166
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1167
  echo '<p>';
1168
  echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $my_post->ID ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '" value="' . esc_attr( $my_post->ID ) . '" ' . ( isset( $field_value[$my_post->ID] ) ? checked( $field_value[$my_post->ID], $my_post->ID, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
1169
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
1170
  echo '</p>';
1171
  }
1172
  } else {
1220
  /* has posts */
1221
  if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1222
  echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1223
+ foreach( $my_posts as $my_post ) {
1224
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1225
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
1226
  }
1227
  } else {
1228
  echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
1602
  $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
1603
 
1604
  /* get taxonomies */
1605
+ $taxonomies = get_categories( apply_filters( 'ot_type_taxonomy_checkbox_query', array( 'hide_empty' => false, 'taxonomy' => $taxonomy ), $field_id ) );
1606
 
1607
  /* has tags */
1608
  if ( $taxonomies ) {
1661
  $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
1662
 
1663
  /* get taxonomies */
1664
+ $taxonomies = get_categories( apply_filters( 'ot_type_taxonomy_select_query', array( 'hide_empty' => false, 'taxonomy' => $taxonomy ), $field_id ) );
1665
 
1666
  /* has tags */
1667
  if ( $taxonomies ) {
1929
  'text-transform'
1930
  ), $field_id );
1931
 
1932
+ /* build font color */
1933
  if ( in_array( 'font-color', $ot_recognized_typography_fields ) ) {
1934
+
1935
+ /* build colorpicker */
1936
  echo '<div class="option-tree-ui-colorpicker-input-wrap">';
1937
 
1938
  /* colorpicker JS */
1941
  /* set background color */
1942
  $background_color = isset( $field_value['font-color'] ) ? esc_attr( $field_value['font-color'] ) : '';
1943
 
 
 
 
1944
  /* input */
1945
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[font-color]" id="' . esc_attr( $field_id ) . '-picker" value="' . esc_attr( $background_color ) . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" />';
 
 
1946
 
1947
  echo '</div>';
1948
 
includes/ot-functions.php CHANGED
@@ -41,6 +41,29 @@ if ( ! function_exists( 'ot_get_option' ) ) {
41
 
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  /**
45
  * Filter the return values through WPML
46
  *
@@ -141,7 +164,7 @@ if ( ! function_exists( 'ot_load_dynamic_css' ) ) {
141
 
142
  if ( isset( $parts[1] ) ) {
143
 
144
- $css = home_url( '/wp-content' . $parts[1] );
145
 
146
  if ( $last_css !== $css ) {
147
 
41
 
42
  }
43
 
44
+ /**
45
+ * Echo Option. (via Github @joshlevinson)
46
+ *
47
+ * Helper function to echo the option value.
48
+ * If no value has been saved, it echos $default.
49
+ *
50
+ * @param string The option ID.
51
+ * @param string The default option value.
52
+ * @return mixed
53
+ *
54
+ * @access public
55
+ * @since 2.2.0
56
+ */
57
+ if ( ! function_exists( 'ot_echo_option' ) ) {
58
+
59
+ function ot_echo_option( $option_id, $default = '' ) {
60
+
61
+ echo ot_get_option( $option_id, $default );
62
+
63
+ }
64
+
65
+ }
66
+
67
  /**
68
  * Filter the return values through WPML
69
  *
164
 
165
  if ( isset( $parts[1] ) ) {
166
 
167
+ $css = set_url_scheme( WP_CONTENT_URL ) . $parts[1];
168
 
169
  if ( $last_css !== $css ) {
170
 
includes/ot-meta-box-api.php CHANGED
@@ -97,28 +97,44 @@ if ( ! class_exists( 'OT_Meta_Box' ) ) {
97
  'field_taxonomy' => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
98
  'field_min_max_step'=> isset( $field['min_max_step'] ) && ! empty( $field['min_max_step'] ) ? $field['min_max_step'] : '0,100,1',
99
  'field_class' => isset( $field['class'] ) ? $field['class'] : '',
 
 
100
  'field_choices' => isset( $field['choices'] ) ? $field['choices'] : array(),
101
  'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
102
  'post_id' => $post->ID,
103
  'meta' => true
104
  );
105
 
 
 
 
 
 
 
 
 
 
 
106
  /* only allow simple textarea due to DOM issues with wp_editor() */
107
  if ( $_args['type'] == 'textarea' )
108
  $_args['type'] = 'textarea-simple';
109
 
110
  /* option label */
111
- echo '<div class="format-settings">';
112
 
113
- /* don't show title with textblocks */
114
- if ( $_args['type'] != 'textblock' && ! empty( $field['label'] ) ) {
115
- echo '<div class="format-setting-label">';
116
- echo '<label for="' . $_args['field_id'] . '" class="label">' . $field['label'] . '</label>';
117
- echo '</div>';
118
- }
 
 
119
 
120
- /* get the option HTML */
121
- echo ot_display_by_type( $_args );
 
 
122
 
123
  echo '</div>';
124
 
@@ -251,7 +267,7 @@ if ( ! class_exists( 'OT_Meta_Box' ) ) {
251
 
252
  }
253
 
254
- if ( $new && $new !== $old ) {
255
  update_post_meta( $post_id, $field['id'], $new );
256
  } else if ( '' == $new && $old ) {
257
  delete_post_meta( $post_id, $field['id'], $old );
97
  'field_taxonomy' => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
98
  'field_min_max_step'=> isset( $field['min_max_step'] ) && ! empty( $field['min_max_step'] ) ? $field['min_max_step'] : '0,100,1',
99
  'field_class' => isset( $field['class'] ) ? $field['class'] : '',
100
+ 'field_condition' => isset( $field['condition'] ) ? $field['condition'] : '',
101
+ 'field_operator' => isset( $field['operator'] ) ? $field['operator'] : 'and',
102
  'field_choices' => isset( $field['choices'] ) ? $field['choices'] : array(),
103
  'field_settings' => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
104
  'post_id' => $post->ID,
105
  'meta' => true
106
  );
107
 
108
+ $conditions = '';
109
+
110
+ /* setup the conditions */
111
+ if ( isset( $field['condition'] ) && ! empty( $field['condition'] ) ) {
112
+
113
+ $conditions = ' data-condition="' . $field['condition'] . '"';
114
+ $conditions.= isset( $field['operator'] ) && in_array( $field['operator'], array( 'and', 'or' ) ) ? ' data-operator="' . $field['operator'] . '"' : '';
115
+
116
+ }
117
+
118
  /* only allow simple textarea due to DOM issues with wp_editor() */
119
  if ( $_args['type'] == 'textarea' )
120
  $_args['type'] = 'textarea-simple';
121
 
122
  /* option label */
123
+ echo '<div id="setting_' . $field['id'] . '" class="format-settings"' . $conditions . '>';
124
 
125
+ echo '<div class="format-setting-wrap">';
126
+
127
+ /* don't show title with textblocks */
128
+ if ( $_args['type'] != 'textblock' && ! empty( $field['label'] ) ) {
129
+ echo '<div class="format-setting-label">';
130
+ echo '<label for="' . $field['id'] . '" class="label">' . $field['label'] . '</label>';
131
+ echo '</div>';
132
+ }
133
 
134
+ /* get the option HTML */
135
+ echo ot_display_by_type( $_args );
136
+
137
+ echo '</div>';
138
 
139
  echo '</div>';
140
 
267
 
268
  }
269
 
270
+ if ( isset( $new ) && $new !== $old ) {
271
  update_post_meta( $post_id, $field['id'], $new );
272
  } else if ( '' == $new && $old ) {
273
  delete_post_meta( $post_id, $field['id'], $old );
includes/ot-settings-api.php CHANGED
@@ -484,6 +484,9 @@ if ( ! class_exists( 'OT_Settings' ) ) {
484
  if ( isset( $std ) ) {
485
  $field_value = ot_filter_std_value( $field_value, $std );
486
  }
 
 
 
487
 
488
  /* build the arguments array */
489
  $_args = array(
@@ -491,12 +494,14 @@ if ( ! class_exists( 'OT_Settings' ) ) {
491
  'field_id' => $id,
492
  'field_name' => $get_option . '[' . $id . ']',
493
  'field_value' => $field_value,
494
- 'field_desc' => isset( $desc ) ? $desc : '',
495
  'field_std' => isset( $std ) ? $std : '',
496
  'field_rows' => isset( $rows ) && ! empty( $rows ) ? $rows : 15,
497
  'field_post_type' => isset( $post_type ) && ! empty( $post_type ) ? $post_type : 'post',
498
  'field_taxonomy' => isset( $taxonomy ) && ! empty( $taxonomy ) ? $taxonomy : 'category',
499
  'field_min_max_step'=> isset( $min_max_step ) && ! empty( $min_max_step ) ? $min_max_step : '0,100,1',
 
 
500
  'field_class' => isset( $class ) ? $class : '',
501
  'field_choices' => isset( $choices ) && ! empty( $choices ) ? $choices : array(),
502
  'field_settings' => isset( $settings ) && ! empty( $settings ) ? $settings : array(),
@@ -820,8 +825,17 @@ if ( ! class_exists( 'OT_Settings' ) ) {
820
  return;
821
 
822
  foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
 
 
 
 
 
 
 
 
 
823
 
824
- echo '<div id="setting_' . $field['id'] . '" class="format-settings">';
825
 
826
  echo '<div class="format-setting-wrap">';
827
 
484
  if ( isset( $std ) ) {
485
  $field_value = ot_filter_std_value( $field_value, $std );
486
  }
487
+
488
+ // Allow the descriptions to be filtered before being displayed
489
+ $desc = apply_filters( 'ot_filter_description', ( isset( $desc ) ? $desc : '' ), $id );
490
 
491
  /* build the arguments array */
492
  $_args = array(
494
  'field_id' => $id,
495
  'field_name' => $get_option . '[' . $id . ']',
496
  'field_value' => $field_value,
497
+ 'field_desc' => $desc,
498
  'field_std' => isset( $std ) ? $std : '',
499
  'field_rows' => isset( $rows ) && ! empty( $rows ) ? $rows : 15,
500
  'field_post_type' => isset( $post_type ) && ! empty( $post_type ) ? $post_type : 'post',
501
  'field_taxonomy' => isset( $taxonomy ) && ! empty( $taxonomy ) ? $taxonomy : 'category',
502
  'field_min_max_step'=> isset( $min_max_step ) && ! empty( $min_max_step ) ? $min_max_step : '0,100,1',
503
+ 'field_condition' => isset( $condition ) && ! empty( $condition ) ? $condition : '',
504
+ 'field_operator' => isset( $operator ) && ! empty( $operator ) ? $operator : 'and',
505
  'field_class' => isset( $class ) ? $class : '',
506
  'field_choices' => isset( $choices ) && ! empty( $choices ) ? $choices : array(),
507
  'field_settings' => isset( $settings ) && ! empty( $settings ) ? $settings : array(),
825
  return;
826
 
827
  foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
828
+
829
+ $conditions = '';
830
+
831
+ if ( isset( $field['args']['condition'] ) && ! empty( $field['args']['condition'] ) ) {
832
+
833
+ $conditions = ' data-condition="' . $field['args']['condition'] . '"';
834
+ $conditions.= isset( $field['args']['operator'] ) && in_array( $field['args']['operator'], array( 'and', 'or' ) ) ? ' data-operator="' . $field['args']['operator'] . '"' : '';
835
+
836
+ }
837
 
838
+ echo '<div id="setting_' . $field['id'] . '" class="format-settings"' . $conditions . '>';
839
 
840
  echo '<div class="format-setting-wrap">';
841
 
languages/option-tree.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2013
2
  # This file is distributed under the same license as the package.
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/option-tree\n"
7
- "POT-Creation-Date: 2013-09-09 11:09:05+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
1
+ # Copyright (C) 2014
2
  # This file is distributed under the same license as the package.
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/option-tree\n"
7
+ "POT-Creation-Date: 2014-01-13 06:39:33+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
ot-loader.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
- * Version: 2.1.4
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv3
@@ -55,7 +55,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
55
  *
56
  * @since 2.1.3
57
  */
58
- define( 'OT_PLUGIN_MODE', strpos( dirname( __FILE__ ), 'plugins/' . basename( dirname( __FILE__ ) ) ) !== false ? true : false );
59
 
60
  /**
61
  * Path to the languages directory.
@@ -64,7 +64,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
64
  *
65
  * @since 2.0.10
66
  */
67
- define( 'OT_LANG_DIR', dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
68
 
69
  /* load the text domain */
70
  if ( OT_PLUGIN_MODE ) {
@@ -95,7 +95,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
95
 
96
  } else {
97
 
98
- load_theme_textdomain( 'option-tree', OT_LANG_DIR . 'theme-mode' );
99
 
100
  }
101
 
@@ -142,7 +142,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
142
  /**
143
  * Current Version number.
144
  */
145
- define( 'OT_VERSION', '2.1.4' );
146
 
147
  /**
148
  * For developers: Allow Unfiltered HTML in all the textareas.
@@ -273,11 +273,13 @@ if ( ! class_exists( 'OT_Loader' ) ) {
273
  define( 'OT_URL', plugin_dir_url( __FILE__ ) );
274
  } else {
275
  if ( true == OT_CHILD_THEME_MODE ) {
276
- define( 'OT_DIR', trailingslashit( get_stylesheet_directory() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
277
- define( 'OT_URL', trailingslashit( get_stylesheet_directory_uri() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
 
278
  } else {
279
- define( 'OT_DIR', trailingslashit( get_template_directory() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
280
- define( 'OT_URL', trailingslashit( get_template_directory_uri() ) . trailingslashit( basename( dirname( __FILE__ ) ) ) );
 
281
  }
282
  }
283
 
@@ -331,7 +333,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
331
 
332
  /* require the files */
333
  foreach ( $files as $file ) {
334
- $this->load_file( OT_DIR . "includes/{$file}.php" );
335
  }
336
 
337
  /* Registers the Theme Option page */
@@ -364,7 +366,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
364
 
365
  /* require the files */
366
  foreach ( $files as $file ) {
367
- $this->load_file( OT_DIR . "includes/{$file}.php" );
368
  }
369
 
370
  }
@@ -449,6 +451,12 @@ if ( ! class_exists( 'OT_Loader' ) ) {
449
  /* AJAX call to create a new list item */
450
  add_action( 'wp_ajax_add_list_item', array( $this, 'add_list_item' ) );
451
 
 
 
 
 
 
 
452
  /* Modify the media uploader button */
453
  add_filter( 'gettext', array( $this, 'change_image_button' ), 10, 3 );
454
 
@@ -472,9 +480,57 @@ if ( ! class_exists( 'OT_Loader' ) ) {
472
  * Adds the global CSS to fix the menu icon.
473
  */
474
  public function global_admin_css() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  echo '
476
  <style>
477
- #adminmenu #toplevel_page_ot-settings .wp-menu-image img { padding: 5px 0px 1px 6px !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  </style>
479
  ';
480
  }
@@ -535,6 +591,67 @@ if ( ! class_exists( 'OT_Loader' ) ) {
535
  die();
536
  }
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  /**
539
  * Filters the media uploader button.
540
  *
@@ -558,6 +675,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
558
 
559
  }
560
 
 
561
  }
562
 
563
  /**
3
  * Plugin Name: OptionTree
4
  * Plugin URI: http://wp.envato.com
5
  * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
6
+ * Version: 2.2.0
7
  * Author: Derek Herman
8
  * Author URI: http://valendesigns.com
9
  * License: GPLv3
55
  *
56
  * @since 2.1.3
57
  */
58
+ define( 'OT_PLUGIN_MODE', strpos( dirname( __FILE__ ), 'plugins' . DIRECTORY_SEPARATOR . basename( dirname( __FILE__ ) ) ) !== false ? true : false );
59
 
60
  /**
61
  * Path to the languages directory.
64
  *
65
  * @since 2.0.10
66
  */
67
+ define( 'OT_LANG_DIR', dirname( plugin_basename( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
68
 
69
  /* load the text domain */
70
  if ( OT_PLUGIN_MODE ) {
95
 
96
  } else {
97
 
98
+ load_theme_textdomain( 'option-tree', DIRECTORY_SEPARATOR . OT_LANG_DIR . 'theme-mode' );
99
 
100
  }
101
 
142
  /**
143
  * Current Version number.
144
  */
145
+ define( 'OT_VERSION', '2.2.0' );
146
 
147
  /**
148
  * For developers: Allow Unfiltered HTML in all the textareas.
273
  define( 'OT_URL', plugin_dir_url( __FILE__ ) );
274
  } else {
275
  if ( true == OT_CHILD_THEME_MODE ) {
276
+ $path = ltrim( end( @explode( end( @explode( '/', get_stylesheet_directory() ) ), dirname( __FILE__ ) ) ), '/' );
277
+ define( 'OT_DIR', trailingslashit( trailingslashit( get_stylesheet_directory() ) . $path ) );
278
+ define( 'OT_URL', trailingslashit( trailingslashit( get_stylesheet_directory_uri() ) . $path ) );
279
  } else {
280
+ $path = ltrim( end( @explode( end( @explode( '/', get_template_directory() ) ), dirname( __FILE__ ) ) ), '/' );
281
+ define( 'OT_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) );
282
+ define( 'OT_URL', trailingslashit( trailingslashit( get_template_directory_uri() ) . $path ) );
283
  }
284
  }
285
 
333
 
334
  /* require the files */
335
  foreach ( $files as $file ) {
336
+ $this->load_file( OT_DIR . "includes" . DIRECTORY_SEPARATOR . "{$file}.php" );
337
  }
338
 
339
  /* Registers the Theme Option page */
366
 
367
  /* require the files */
368
  foreach ( $files as $file ) {
369
+ $this->load_file( OT_DIR . "includes" . DIRECTORY_SEPARATOR . "{$file}.php" );
370
  }
371
 
372
  }
451
  /* AJAX call to create a new list item */
452
  add_action( 'wp_ajax_add_list_item', array( $this, 'add_list_item' ) );
453
 
454
+ // Adds the temporary hacktastic shortcode
455
+ add_filter( 'media_view_settings', array( $this, 'shortcode' ), 10, 2 );
456
+
457
+ // AJAX update
458
+ add_action( 'wp_ajax_gallery_update', array( $this, 'ajax_gallery_update' ) );
459
+
460
  /* Modify the media uploader button */
461
  add_filter( 'gettext', array( $this, 'change_image_button' ), 10, 3 );
462
 
480
  * Adds the global CSS to fix the menu icon.
481
  */
482
  public function global_admin_css() {
483
+ global $wp_version;
484
+
485
+ $wp_38plus = version_compare( $wp_version, '3.8', '>=' ) ? true : false;
486
+ $fontsize = $wp_38plus ? '20px' : '16px';
487
+ $wp_38minus = '';
488
+
489
+ if ( ! $wp_38plus ) {
490
+ $wp_38minus = '
491
+ #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image {
492
+ background: none;
493
+ }
494
+ #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image:before {
495
+ padding-left: 6px;
496
+ }';
497
+ }
498
+
499
  echo '
500
  <style>
501
+ @font-face {
502
+ font-family: "option-tree-font";
503
+ src:url("' . OT_URL . 'assets/fonts/option-tree-font.eot");
504
+ src:url("' . OT_URL . 'assets/fonts/option-tree-font.eot?#iefix") format("embedded-opentype"),
505
+ url("' . OT_URL . 'assets/fonts/option-tree-font.woff") format("woff"),
506
+ url("' . OT_URL . 'assets/fonts/option-tree-font.ttf") format("truetype"),
507
+ url("' . OT_URL . 'assets/fonts/option-tree-font.svg#option-tree-font") format("svg");
508
+ font-weight: normal;
509
+ font-style: normal;
510
+ }
511
+ #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image:before,
512
+ #option-tree-header #option-tree-logo a:before {
513
+ font: normal ' . $fontsize . '/1 "option-tree-font" !important;
514
+ speak: none;
515
+ padding: 6px 0;
516
+ height: 34px;
517
+ width: 20px;
518
+ display: inline-block;
519
+ -webkit-font-smoothing: antialiased;
520
+ -moz-osx-font-smoothing: grayscale;
521
+ -webkit-transition: all .1s ease-in-out;
522
+ -moz-transition: all .1s ease-in-out;
523
+ transition: all .1s ease-in-out;
524
+ }
525
+ #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image:before,
526
+ #option-tree-header #option-tree-logo a:before {
527
+ content: "\e785";
528
+ }
529
+ #option-tree-header #option-tree-logo a:before {
530
+ font-size: 20px !important;
531
+ height: 24px;
532
+ padding: 2px 0;
533
+ }' . $wp_38minus . '
534
  </style>
535
  ';
536
  }
591
  die();
592
  }
593
 
594
+ /**
595
+ * Fake the gallery shortcode
596
+ *
597
+ * The JS takes over and creates the actual shortcode with
598
+ * the real attachment IDs on the fly. Here we just need to
599
+ * pass in the post ID to get the ball rolling.
600
+ *
601
+ * @param array The current settings
602
+ * @param object The post object
603
+ * @return array
604
+ *
605
+ * @access public
606
+ * @since 2.2.0
607
+ */
608
+ public function shortcode( $settings, $post ) {
609
+
610
+ // Set the OptionTree post ID
611
+ if ( ! is_object( $post ) )
612
+ $settings['post']['id'] = ot_get_media_post_ID();
613
+
614
+ // No ID return settings
615
+ if ( $settings['post']['id'] == 0 )
616
+ return $settings;
617
+
618
+ // Set the fake shortcode
619
+ $settings['ot_gallery'] = array( 'shortcode' => "[gallery id='{$settings['post']['id']}']" );
620
+
621
+ // Return settings
622
+ return $settings;
623
+
624
+ }
625
+
626
+ /**
627
+ * Returns the AJAX images
628
+ *
629
+ * @return string
630
+ *
631
+ * @access public
632
+ * @since 2.2.0
633
+ */
634
+ public function ajax_gallery_update() {
635
+
636
+ if ( ! empty( $_POST['ids'] ) ) {
637
+
638
+ $return = '';
639
+
640
+ foreach( $_POST['ids'] as $id ) {
641
+
642
+ $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
643
+
644
+ $return .= '<li><img src="' . $thumbnail[0] . '" width="75" height="75" /></li>';
645
+
646
+ }
647
+
648
+ echo $return;
649
+ exit();
650
+
651
+ }
652
+
653
+ }
654
+
655
  /**
656
  * Filters the media uploader button.
657
  *
675
 
676
  }
677
 
678
+
679
  }
680
 
681
  /**
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: valendesigns
3
  Donate link: http://bit.ly/NuXI3T
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.5
6
- Tested up to: 3.6
7
- Stable tag: 2.1.4
8
  License: GPLv3
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
@@ -41,6 +41,31 @@ Yes. OptionTree & WordPress both require PHP5.
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  = 2.1.4 =
45
  * Hotfix - Fixed the Numeric Slider not work inside of a newly added List item.
46
  * Hotfix - Fixed the numeric slider fallback value being set to 0, it now becomes the minimum value if no standard is set.
3
  Donate link: http://bit.ly/NuXI3T
4
  Tags: admin, theme options, meta boxes, options, admin interface, ajax
5
  Requires at least: 3.5
6
+ Tested up to: 3.8
7
+ Stable tag: 2.2.0
8
  License: GPLv3
9
 
10
  Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.
41
 
42
  == Changelog ==
43
 
44
+ = 2.2.0 =
45
+ * Added the Gallery option type.
46
+ * Added the On/Off option type.
47
+ * Replaced the old Color Picker with the default WP Color Picker.
48
+ * Added UI support for WordPress 3.8. Contributors via github @AlxMedia, and @valendesigns.
49
+ * Added support for conditional toggling of settings fields. Contributors via github @maimairel, @valendesigns, @doitmax, and @imangm.
50
+ * Replaced the OptionTree image icon with a font version.
51
+ * Added 'background-size' to the Background option type.
52
+ * Added fallback text when displaying posts without titles in various option types.
53
+ * Added filter 'ot_recognized_background_fields' to show/hide fields for background option types.
54
+ * Added filter 'ot_filter_description' that allows the theme option descriptions to be filtered before being displayed.
55
+ * Added subfolder compatibility in theme mode. Contributors via github @doitmax, and @valendesigns.
56
+ * Fixed a bug caused by using 'home_url' when loading dynamic CSS files.
57
+ * Fixed an issue where you could not save metabox text field values as "0". Contributors via github @sparkdevelopment, and @valendesigns.
58
+ * Fixed the broken localization directory path in theme mode. Contributors via github @youri--, and @valendesigns.
59
+ * Fixed missing custom class for the Numeric Slider. Contributors via github @doitmax.
60
+ * Added filter 'ot_type_category_checkbox_query' which allows you to filter the get_categories() args for Category Checkbox.
61
+ * Added filter 'ot_type_category_select_query' which allows you to filter the get_categories() args for Category Select.
62
+ * Added filter 'ot_type_taxonomy_checkbox_query' which allows you to filter the get_categories() args for Taxonomy Checkbox.
63
+ * Added filter 'ot_type_taxonomy_select_query' which allows you to filter the get_categories() args for Taxonomy Select.
64
+ * Added the 'ot_echo_option' function. Contributors via github @joshlevinson.
65
+ * Added filter 'ot_theme_options_contextual_help' which allows you to filter the Contextual Help on the Theme Options page.
66
+ * Added filter 'ot_theme_options_sections' which allows you to filter the Sections on the Theme Options page. Contributors via github @joshlevinson.
67
+ * Added filter 'ot_theme_options_settings' which allows you to filter the Settings on the Theme Options page. Contributors via github @joshlevinson.
68
+
69
  = 2.1.4 =
70
  * Hotfix - Fixed the Numeric Slider not work inside of a newly added List item.
71
  * Hotfix - Fixed the numeric slider fallback value being set to 0, it now becomes the minimum value if no standard is set.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file