Coming Soon, Under Construction & Maintenance Page - Version 1.2

Version Description

  • 2018/03/06
  • 9k installs & 34.5k downloads
  • a lot of minor fixes
  • started advertising PRO themes
  • fixed countdown clock
  • fixed subscribe form
  • unused social icons can now be hidden
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Coming Soon, Under Construction & Maintenance Page
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.2 to 1.2

Files changed (53) hide show
  1. admin/assets/css/ot-admin.css +253 -179
  2. admin/assets/images/themes/pro/aeroplane-company.jpg +0 -0
  3. admin/assets/images/themes/pro/animated-clock.jpg +0 -0
  4. admin/assets/images/themes/pro/bicycle-race.jpg +0 -0
  5. admin/assets/images/themes/pro/bitcoin-miners.jpg +0 -0
  6. admin/assets/images/themes/pro/blogging.jpg +0 -0
  7. admin/assets/images/themes/pro/book-lovers.jpg +0 -0
  8. admin/assets/images/themes/pro/business-company.jpg +0 -0
  9. admin/assets/images/themes/pro/coffee-shop.jpg +0 -0
  10. admin/assets/images/themes/pro/default.jpg +0 -0
  11. admin/assets/images/themes/pro/dental-clinic.jpg +0 -0
  12. admin/assets/images/themes/pro/dog-training-and-behavior-consulting.jpg +0 -0
  13. admin/assets/images/themes/pro/flower-shop.jpg +0 -0
  14. admin/assets/images/themes/pro/homemade-chocolate-gifts.jpg +0 -0
  15. admin/assets/images/themes/pro/interior-design.jpg +0 -0
  16. admin/assets/images/themes/pro/lego-bricks.jpg +0 -0
  17. admin/assets/images/themes/pro/lonely-road.jpg +0 -0
  18. admin/assets/images/themes/pro/luxury-car.jpg +0 -0
  19. admin/assets/images/themes/pro/maintenance-mode.jpg +0 -0
  20. admin/assets/images/themes/pro/makeup-artist-training.jpg +0 -0
  21. admin/assets/images/themes/pro/mobile-designer.jpg +0 -0
  22. admin/assets/images/themes/pro/modern-blog.jpg +0 -0
  23. admin/assets/images/themes/pro/modern-office.jpg +0 -0
  24. admin/assets/images/themes/pro/mountain-slide.jpg +0 -0
  25. admin/assets/images/themes/pro/mountain.jpg +0 -0
  26. admin/assets/images/themes/pro/nature.jpg +0 -0
  27. admin/assets/images/themes/pro/office-theme.jpg +0 -0
  28. admin/assets/images/themes/pro/online-learning.jpg +0 -0
  29. admin/assets/images/themes/pro/pancake-house.jpg +0 -0
  30. admin/assets/images/themes/pro/parenting.jpg +0 -0
  31. admin/assets/images/themes/pro/running-blog.jpg +0 -0
  32. admin/assets/images/themes/pro/shoes-store.jpg +0 -0
  33. admin/assets/images/themes/pro/simple-beige-design.jpg +0 -0
  34. admin/assets/images/themes/pro/snowboarding-blog.jpg +0 -0
  35. admin/assets/images/themes/pro/the-big-city-newsletter.jpg +0 -0
  36. admin/assets/images/themes/pro/travel-agency.jpg +0 -0
  37. admin/assets/images/themes/pro/travel-blog.jpg +0 -0
  38. admin/assets/images/themes/pro/video-production.jpg +0 -0
  39. admin/assets/images/themes/pro/webinar.jpg +0 -0
  40. admin/assets/images/themes/pro/wedding-blog.jpg +0 -0
  41. admin/assets/images/themes/pro/workplace.jpg +0 -0
  42. admin/assets/js/ot-admin.js +1292 -1292
  43. admin/includes/ot-functions-admin.php +1 -1
  44. admin/includes/ot-functions-option-types.php +3233 -3233
  45. admin/includes/ot-settings-api.php +301 -301
  46. admin/main-options.php +597 -84
  47. admin/ot-loader.php +156 -156
  48. index.php +1 -0
  49. license.txt +674 -0
  50. nifty-coming-soon.php +63 -76
  51. readme.txt +32 -21
  52. template/assets/js/scripts.js +7 -7
  53. template/index.php +101 -122
admin/assets/css/ot-admin.css CHANGED
@@ -1,4 +1,78 @@
1
- /* --------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  :: OptionTree Font
3
  ---------------------------------------------------*/
4
  @font-face {
@@ -11,8 +85,8 @@
11
  font-weight: normal;
12
  font-style: normal;
13
  }
14
-
15
- [class^="ot-icon-"],
16
  [class*=" ot-icon-"] {
17
  font-family: "option-tree-font";
18
  speak: none;
@@ -25,7 +99,7 @@
25
  -moz-osx-font-smoothing: grayscale;
26
  }
27
 
28
- .ui-tabs li > a [class^="ot-icon-"],
29
  .ui-tabs li > a [class*=" ot-icon-"] {
30
  padding-right: 5px;
31
  line-height: 18px;
@@ -1139,8 +1213,8 @@
1139
  .ot-icon-plus-square-o:before {
1140
  content: "\f196";
1141
  }
1142
-
1143
- /* --------------------------------------------------
1144
  :: Screen Meta & Menu Icon
1145
  ---------------------------------------------------*/
1146
  .appearance_page_ot-theme-options #screen-meta {
@@ -1149,15 +1223,15 @@
1149
  min-width: 533px;
1150
  }
1151
 
1152
- /* --------------------------------------------------
1153
  :: Messages
1154
  ---------------------------------------------------*/
1155
  .wrap.settings-wrap div.error,
1156
  .wrap.settings-wrap div.updated {
1157
  margin: 9px 5px 0px 2px !important;
1158
  }
1159
-
1160
- /* --------------------------------------------------
1161
  :: OptionTree Wrappers
1162
  ---------------------------------------------------*/
1163
  #option-tree-settings-api .metabox-holder {
@@ -1188,7 +1262,7 @@
1188
  border-radius: 0 0 2px 2px;
1189
  }
1190
 
1191
- /* --------------------------------------------------
1192
  :: Header
1193
  ---------------------------------------------------*/
1194
  #option-tree-header-wrap {
@@ -1448,76 +1522,76 @@
1448
  border-left-color: #e75546;
1449
  }
1450
 
1451
- /* --------------------------------------------------
1452
  :: Sub Header
1453
  ---------------------------------------------------*/
1454
- #option-tree-sub-header {
1455
- background: #fafafa;
1456
- border: 1px solid #ccc;
1457
- border-top: none;
1458
- display: block;
1459
- margin: 0 5px 0 2px;
1460
- min-width: 523px;
1461
- overflow: hidden;
1462
- padding: 5px;
1463
- position: relative;
1464
  -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0,0,0,0.05);
1465
  -moz-box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0,0,0,0.05);
1466
  box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0,0,0,0.05);
1467
  }
1468
 
1469
- /* --------------------------------------------------
1470
  :: Tabs
1471
  ---------------------------------------------------*/
1472
- .wrap.settings-wrap .ui-tabs-nav {
1473
- float: left;
1474
- list-style: none;
1475
- margin: 0 0 0 -4px;
1476
- padding: 1em 0;
1477
- width: 151px;
1478
- }
1479
- .wrap.settings-wrap .ui-tabs-nav li {
1480
- border: 1px solid transparent;
1481
- border-right-width: 0px;
1482
- display: block; margin: 0;
1483
  -webkit-border-radius: 2px 0 0 2px;
1484
  -moz-border-radius: 2px 0 0 2px;
1485
- border-radius: 2px 0 0 2px;
1486
  }
1487
- .wrap.settings-wrap .ui-tabs-nav li.ui-state-active {
1488
- background: #fff;
1489
- border-color: #ccc;
1490
- color: #000;
1491
  }
1492
- .wrap.settings-wrap .ui-tabs-nav li a {
1493
- color: #21759b;
1494
- display: block;
1495
- line-height: 18px;
1496
- padding: 5px 5px 5px 12px;
1497
- text-decoration: none;
1498
  }
1499
  .wrap.settings-wrap .ui-tabs-nav li a:hover,
1500
- .wrap.settings-wrap .ui-tabs-nav li.ui-state-active a {
1501
- color: #000;
1502
- outline: none;
1503
  }
1504
- .wrap.settings-wrap .ui-tabs-panel {
1505
- clear: both;
1506
  }
1507
  .wrap.settings-wrap .ui-tabs-nav li a:focus { -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; }
1508
- /* --------------------------------------------------
1509
  :: Format Settings
1510
  ---------------------------------------------------*/
1511
  .format-settings {
1512
- position: relative;
1513
- width: 100%;
1514
  }
1515
  .format-setting-wrap,
1516
  .option-tree-sortable .format-settings {
1517
- padding: 10px 0 20px 0;
1518
  }
1519
 
1520
- /* --------------------------------------------------
1521
  :: Format Setting Label
1522
  ---------------------------------------------------*/
1523
  .format-setting-label {
@@ -1542,8 +1616,8 @@
1542
  -webkit-user-select: text;
1543
  text-shadow: none;
1544
  }
1545
-
1546
- /* --------------------------------------------------
1547
  :: Format Setting
1548
  ---------------------------------------------------*/
1549
  .format-setting {
@@ -1650,7 +1724,7 @@
1650
  top: 10px;
1651
  }
1652
  @media only screen and (max-width: 1020px) {
1653
- .format-setting .description,
1654
  .format-setting .format-setting-inner {
1655
  width: 100%;
1656
  }
@@ -1671,7 +1745,7 @@
1671
  text-indent: -9999px;
1672
  }
1673
 
1674
- /* --------------------------------------------------
1675
  :: Code formatting
1676
  ---------------------------------------------------*/
1677
  #option-tree-settings-api code,
@@ -1701,7 +1775,7 @@
1701
  background: url(../images/ot-pre-bg.gif) repeat left top;
1702
  }
1703
 
1704
- /* --------------------------------------------------
1705
  :: Input & Upload
1706
  ---------------------------------------------------*/
1707
  input.option-tree-ui-upload-input,
@@ -1740,7 +1814,7 @@ input:focus.option-tree-ui-input {
1740
  }
1741
  }
1742
 
1743
- /* --------------------------------------------------
1744
  :: Upload
1745
  ---------------------------------------------------*/
1746
  div.option-tree-ui-media-wrap {
@@ -1783,7 +1857,7 @@ div.option-tree-ui-media-wrap {
1783
  top: 1px;
1784
  }
1785
 
1786
- /* --------------------------------------------------
1787
  :: Textarea
1788
  ---------------------------------------------------*/
1789
  .fill-area .description,
@@ -1827,22 +1901,22 @@ div.option-tree-ui-media-wrap {
1827
  }
1828
  }
1829
 
1830
- /* --------------------------------------------------
1831
  :: Setting Item with Drag & Drop
1832
  ---------------------------------------------------*/
1833
- .option-tree-setting-wrap {
1834
- margin-top: 0px;
1835
  }
1836
- .option-tree-setting-wrap li {
1837
- margin: 5px 0px;
1838
  }
1839
- .option-tree-setting {
1840
- border: 1px solid #ccc;
1841
- overflow: hidden;
1842
- position: relative;
1843
  -webkit-border-radius: 2px;
1844
  -moz-border-radius: 2px;
1845
- border-radius: 2px;
1846
  }
1847
  .option-tree-setting:hover {
1848
  border-color: #999;
@@ -1850,8 +1924,8 @@ div.option-tree-ui-media-wrap {
1850
  -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
1851
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
1852
  }
1853
- .option-tree-setting a {
1854
- text-decoration: none;
1855
  }
1856
  .option-tree-setting .open {
1857
  background: #fafafa;
@@ -1894,8 +1968,8 @@ div.option-tree-ui-media-wrap {
1894
  right: 0px;
1895
  top: 1px;
1896
  }
1897
- .option-tree-setting.is-section {
1898
- border: 1px solid #000;
1899
  }
1900
  .option-tree-setting.is-section .option-tree-setting-body,
1901
  .option-tree-setting.is-section .option-tree-ui-button {
@@ -1915,8 +1989,8 @@ div.option-tree-ui-media-wrap {
1915
  /* light */
1916
  .admin-color-light .option-tree-setting.is-section,
1917
  .admin-color-light .option-tree-setting.is-section .option-tree-setting-body,
1918
- .admin-color-light .option-tree-setting.is-section .option-tree-ui-button {
1919
- border-color: #3c3c3c !important;
1920
  }
1921
  .admin-color-light .option-tree-setting.is-section .open:hover:before {
1922
  color: #3c3c3c;
@@ -1932,8 +2006,8 @@ div.option-tree-ui-media-wrap {
1932
  /* blue */
1933
  .admin-color-blue .option-tree-setting.is-section,
1934
  .admin-color-blue .option-tree-setting.is-section .option-tree-setting-body,
1935
- .admin-color-blue .option-tree-setting.is-section .option-tree-ui-button {
1936
- border-color: #002b39 !important;
1937
  }
1938
  .admin-color-blue .option-tree-setting.is-section .open:hover:before {
1939
  color: #002b39;
@@ -1949,8 +2023,8 @@ div.option-tree-ui-media-wrap {
1949
  /* coffee */
1950
  .admin-color-coffee .option-tree-setting.is-section,
1951
  .admin-color-coffee .option-tree-setting.is-section .option-tree-setting-body,
1952
- .admin-color-coffee .option-tree-setting.is-section .option-tree-ui-button {
1953
- border-color: #0f0e0d !important;
1954
  }
1955
  .admin-color-coffee .option-tree-setting.is-section .open:hover:before {
1956
  color: #0f0e0d;
@@ -1966,8 +2040,8 @@ div.option-tree-ui-media-wrap {
1966
  /* ectoplasm */
1967
  .admin-color-ectoplasm .option-tree-setting.is-section,
1968
  .admin-color-ectoplasm .option-tree-setting.is-section .option-tree-setting-body,
1969
- .admin-color-ectoplasm .option-tree-setting.is-section .option-tree-ui-button {
1970
- border-color: #181220 !important;
1971
  }
1972
  .admin-color-ectoplasm .option-tree-setting.is-section .open:hover:before {
1973
  color: #181220;
@@ -1983,8 +2057,8 @@ div.option-tree-ui-media-wrap {
1983
  /* midnight */
1984
  .admin-color-midnight .option-tree-setting.is-section,
1985
  .admin-color-midnight .option-tree-setting.is-section .option-tree-setting-body,
1986
- .admin-color-midnight .option-tree-setting.is-section .option-tree-ui-button {
1987
- border-color: #090a0b !important;
1988
  }
1989
  .admin-color-midnight .option-tree-setting.is-section .open:hover:before {
1990
  color: #090a0b;
@@ -2000,8 +2074,8 @@ div.option-tree-ui-media-wrap {
2000
  /* ocean */
2001
  .admin-color-ocean .option-tree-setting.is-section,
2002
  .admin-color-ocean .option-tree-setting.is-section .option-tree-setting-body,
2003
- .admin-color-ocean .option-tree-setting.is-section .option-tree-ui-button {
2004
- border-color: #39464a !important;
2005
  }
2006
  .admin-color-ocean .option-tree-setting.is-section .open:hover:before {
2007
  color: #39464a;
@@ -2017,8 +2091,8 @@ div.option-tree-ui-media-wrap {
2017
  /* sunrise */
2018
  .admin-color-sunrise .option-tree-setting.is-section,
2019
  .admin-color-sunrise .option-tree-setting.is-section .option-tree-setting-body,
2020
- .admin-color-sunrise .option-tree-setting.is-section .option-tree-ui-button {
2021
- border-color: #8a322a !important;
2022
  }
2023
  .admin-color-sunrise .option-tree-setting.is-section .open:hover:before {
2024
  color: #8a322a;
@@ -2059,7 +2133,7 @@ li ul .format-setting-label {
2059
  margin: 0px;
2060
  }
2061
 
2062
- /* --------------------------------------------------
2063
  :: Layouts
2064
  ---------------------------------------------------*/
2065
  #option_tree_layouts {
@@ -2106,7 +2180,7 @@ li ul .format-setting-label {
2106
  padding-left: 1px;
2107
  }
2108
 
2109
- /* --------------------------------------------------
2110
  :: Option Group
2111
  ---------------------------------------------------*/
2112
  .ot-option-group {
@@ -2214,7 +2288,7 @@ li ul .format-setting-label {
2214
  width: 100%;
2215
  }
2216
 
2217
- /* --------------------------------------------------
2218
  :: Select
2219
  ---------------------------------------------------*/
2220
  .select-wrapper {
@@ -2292,14 +2366,14 @@ select.option-tree-ui-select option {
2292
  }
2293
  }
2294
 
2295
- /* --------------------------------------------------
2296
  :: Measurement
2297
  ---------------------------------------------------*/
2298
- .option-tree-ui-measurement-input-wrap {
2299
- margin-right: 80px;
2300
  }
2301
 
2302
- /* --------------------------------------------------
2303
  :: Checkbox & Radio
2304
  ---------------------------------------------------*/
2305
  .format-setting.type-checkbox input,
@@ -2325,8 +2399,8 @@ select.option-tree-ui-select option {
2325
  padding-top: 0.3em;
2326
  }
2327
  }
2328
-
2329
- /* --------------------------------------------------
2330
  :: Radio Images
2331
  ---------------------------------------------------*/
2332
  .type-radio-image .option-tree-ui-radio-images {
@@ -2352,14 +2426,14 @@ select.option-tree-ui-select option {
2352
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
2353
  }
2354
 
2355
- /* --------------------------------------------------
2356
  :: Social Links
2357
  ---------------------------------------------------*/
2358
  .type-social-links input.option-tree-ui-input {
2359
  margin-top: 5px;
2360
  }
2361
 
2362
- /* --------------------------------------------------
2363
  :: Numeric Slider
2364
  ---------------------------------------------------*/
2365
  .type-numeric-slider .format-setting-inner {
@@ -2377,26 +2451,26 @@ select.option-tree-ui-select option {
2377
  .ot-numeric-slider-wrap {
2378
  margin: 0 96px 0 0;
2379
  }
2380
- .ot-numeric-slider-wrap .ot-numeric-slider-helper-input {
2381
- position: absolute;
2382
  right: 5px;
2383
  text-align: center;
2384
  top: 5px;
2385
  width: 90px !important;
2386
  }
2387
- .ot-numeric-slider.ui-slider {
2388
  background: #fff;
2389
  border: 1px solid #ccc;
2390
- margin: 8px 8px 0 8px;
2391
- position: relative;
2392
  -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
2393
- -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
2394
- box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
2395
  -webkit-border-radius: 2px;
2396
  -moz-border-radius: 2px;
2397
  border-radius: 2px;
2398
  }
2399
- .ot-numeric-slider.ui-slider-horizontal {
2400
  height: 11px;
2401
  }
2402
  .ot-numeric-slider.ui-slider .ui-slider-handle {
@@ -2404,10 +2478,10 @@ select.option-tree-ui-select option {
2404
  color: #555;
2405
  cursor: pointer;
2406
  display: block;
2407
- height: 27px;
2408
  margin: -9px -8px;
2409
  outline: 0;
2410
- position: absolute;
2411
  width: 16px;
2412
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
2413
  -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
@@ -2497,14 +2571,14 @@ select.option-tree-ui-select option {
2497
  border-color: #e75546;
2498
  }
2499
 
2500
- /* --------------------------------------------------
2501
  :: Colorpicker
2502
  ---------------------------------------------------*/
2503
  .option-tree-ui-colorpicker-input-wrap {
2504
  float: left;
2505
  }
2506
  .hide-color-picker {
2507
-
2508
  }
2509
  .option-tree-ui-colorpicker-input-wrap .option-tree-ui-colorpicker-label {
2510
  height: 30px;
@@ -2563,7 +2637,7 @@ select.option-tree-ui-select option {
2563
  }
2564
  }
2565
 
2566
- /* --------------------------------------------------
2567
  :: Colorpicker Opacity (Derivative work of the Codestar WP Color Picker.)
2568
  ---------------------------------------------------*/
2569
  .option-tree-opacity-wrap {
@@ -2628,7 +2702,7 @@ select.option-tree-ui-select option {
2628
  text-align: center;
2629
  }
2630
 
2631
- /* --------------------------------------------------
2632
  :: Google Font
2633
  ---------------------------------------------------*/
2634
  .type-google-font {
@@ -2647,8 +2721,8 @@ select.option-tree-ui-select option {
2647
  margin-top: 0;
2648
  }
2649
 
2650
- /* --------------------------------------------------
2651
- :: OptionTree UI Buttons
2652
  ---------------------------------------------------*/
2653
  .option-tree-ui-button.button {
2654
  float: left;
@@ -2761,7 +2835,7 @@ select.option-tree-ui-select option {
2761
  background: #f5f5f5;
2762
  border-color: #dfdfdf;
2763
  }
2764
- .option-tree-ui-buttons:before,
2765
  .option-tree-ui-buttons:after {
2766
  content: "\0020";
2767
  display: block;
@@ -2780,8 +2854,8 @@ button.reset-settings {
2780
  left: 8px;
2781
  }
2782
 
2783
- /* --------------------------------------------------
2784
- :: OptionTree UI Button Icons
2785
  ---------------------------------------------------*/
2786
  .option-tree-ui-button .icon {
2787
  color: #3a3a3a;
@@ -2831,31 +2905,31 @@ button.option-tree-ui-button .icon {
2831
  background-position: -54px -0px;
2832
  }
2833
 
2834
- /* --------------------------------------------------
2835
  :: WP 3.8 Fixes (via Github @AlxMedia)
2836
  ---------------------------------------------------*/
2837
  #option-tree-settings-api #poststuff,
2838
- #option-tree-settings-api #post-body-content {
2839
  min-width: 0;
2840
  }
2841
- #option-tree-settings-api #poststuff h3 {
2842
  font-family: inherit !important;
2843
  }
2844
- #option-tree-settings-api .postbox {
2845
  -webkit-box-shadow: none;
2846
  -moz-box-shadow: none;
2847
  box-shadow: none;
2848
  }
2849
- #option-tree-settings-api p input[type="checkbox"],
2850
- #option-tree-settings-api p input[type="radio"] {
2851
  margin-top: 2px;
2852
  }
2853
- #option-tree-settings-api .format-setting.type-checkbox p,
2854
- #option-tree-settings-api .format-setting.type-radio p {
2855
  margin: 0.3em 0 !important;
2856
  }
2857
- input.option-tree-ui-upload-input,
2858
- input.option-tree-ui-input {
2859
  padding-top: 5px;
2860
  padding-bottom: 5px;
2861
  }
@@ -2866,7 +2940,7 @@ input.option-tree-ui-input {
2866
  }
2867
  }
2868
 
2869
- /* --------------------------------------------------
2870
  :: Gallery
2871
  ---------------------------------------------------*/
2872
  ul.ot-gallery-list {
@@ -2898,7 +2972,7 @@ ul.ot-gallery-list li img {
2898
  margin-bottom: 0px;
2899
  }
2900
 
2901
- /* --------------------------------------------------
2902
  :: Google Fonts
2903
  ---------------------------------------------------*/
2904
  .option-tree-google-font-family,
@@ -2930,7 +3004,7 @@ ul.ot-gallery-list li img {
2930
  }
2931
  }
2932
 
2933
- /* --------------------------------------------------
2934
  :: On/Off Switch
2935
  ---------------------------------------------------*/
2936
  .on-off-switch .slide-button {
@@ -2961,7 +3035,7 @@ ul.ot-gallery-list li img {
2961
  .on-off-switch * {
2962
  -webkit-box-sizing: border-box;
2963
  -moz-box-sizing: border-box;
2964
- box-sizing: border-box;
2965
  }
2966
  .on-off-switch input {
2967
  position: absolute;
@@ -3011,7 +3085,7 @@ ul.ot-gallery-list li img {
3011
  box-shadow: inset 0 1px 0 #c8eb8e, 0 1px 0 rgba(0,0,0,.08);
3012
  -webkit-transition: all 0.2s ease-out;
3013
  -moz-transition: all 0.2s ease-out;
3014
- transition: all 0.2s ease-out;
3015
  }
3016
  .on-off-switch input:last-of-type:checked ~ .slide-button {
3017
  background: #b73b27;
@@ -3025,19 +3099,19 @@ ul.ot-gallery-list li img {
3025
  }
3026
  @media only screen and (-webkit-max-device-pixel-ratio: 2) and (max-device-width: 1280px) {
3027
  .on-off-switch {
3028
- -webkit-animation: webkitSiblingBugfix infinite 1s;
3029
- }
3030
  }
3031
  @-webkit-keyframes webkitSiblingBugfix {
3032
  from {
3033
- -webkit-transform: translate3d(0, 0, 0);
3034
  }
3035
  to {
3036
- -webkit-transform: translate3d(0, 0, 0);
3037
- }
3038
  }
3039
 
3040
- /* --------------------------------------------------
3041
  :: Simple Input Append & Prepend
3042
  ---------------------------------------------------*/
3043
  .ot-input-append,
@@ -3118,7 +3192,7 @@ ul.ot-gallery-list li img {
3118
  border-radius: 0 2px 2px 0;
3119
  }
3120
 
3121
- /* --------------------------------------------------
3122
  :: CSS Editor
3123
  ---------------------------------------------------*/
3124
  #option-tree-settings-api pre.ot-css-editor,
@@ -3156,9 +3230,9 @@ ul.ot-gallery-list li img {
3156
  -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
3157
  -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
3158
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
3159
- }
3160
 
3161
- /* --------------------------------------------------
3162
  :: Date Picker
3163
  ---------------------------------------------------*/
3164
  .ui-datepicker {
@@ -3193,7 +3267,7 @@ ul.ot-gallery-list li img {
3193
  .ui-datepicker .ui-datepicker-title {
3194
  text-align: center;
3195
  }
3196
- .ui-datepicker-prev,
3197
  .ui-datepicker-next {
3198
  color: #ccc;
3199
  display: inline-block;
@@ -3212,11 +3286,11 @@ ul.ot-gallery-list li img {
3212
  -moz-border-radius: 0 2px 0 0;
3213
  border-radius: 0 2px 0 0;
3214
  }
3215
- .ui-datepicker-prev span,
3216
  .ui-datepicker-next span {
3217
  display: none;
3218
  }
3219
- .ui-datepicker-prev:hover,
3220
  .ui-datepicker-next:hover {
3221
  color: #fff;
3222
  }
@@ -3245,7 +3319,7 @@ ul.ot-gallery-list li img {
3245
  float: right;
3246
  width: 31px;
3247
  }
3248
- a.ui-datepicker-prev,
3249
  a.ui-datepicker-next {
3250
  outline: 0;
3251
  }
@@ -3273,7 +3347,7 @@ a.ui-datepicker-next {
3273
  .ui-datepicker tbody tr:last-child {
3274
  border-bottom: 0px;
3275
  }
3276
- .ui-datepicker td span,
3277
  .ui-datepicker td a {
3278
  display: inline-block;
3279
  font-size: 11px;
@@ -3413,7 +3487,7 @@ a.ui-datepicker-next {
3413
  .ui-datepicker-prev:before {
3414
  border-color: #444;
3415
  }
3416
- .ui-datepicker-prev:hover,
3417
  .ui-datepicker-next:hover {
3418
  background: #222;
3419
  color: #0074a2 !important;
@@ -3434,7 +3508,7 @@ a.ui-datepicker-next {
3434
  .admin-color-light .ui-datepicker-prev:before {
3435
  border-color: #999;
3436
  }
3437
- .admin-color-light .ui-datepicker-prev:hover,
3438
  .admin-color-light .ui-datepicker-next:hover {
3439
  background: #777;
3440
  color: #eee !important;
@@ -3455,7 +3529,7 @@ a.ui-datepicker-next {
3455
  .admin-color-blue .ui-datepicker-prev:before {
3456
  border-color: #5dc2e6;
3457
  }
3458
- .admin-color-blue .ui-datepicker-prev:hover,
3459
  .admin-color-blue .ui-datepicker-next:hover {
3460
  background: #006484;
3461
  color: #fff !important;
@@ -3476,7 +3550,7 @@ a.ui-datepicker-next {
3476
  .admin-color-coffee .ui-datepicker-prev:before {
3477
  border-color: #675f58;
3478
  }
3479
- .admin-color-coffee .ui-datepicker-prev:hover,
3480
  .admin-color-coffee .ui-datepicker-next:hover {
3481
  background: #cca588;
3482
  color: #fff !important;
@@ -3497,7 +3571,7 @@ a.ui-datepicker-next {
3497
  .admin-color-ectoplasm .ui-datepicker-prev:before {
3498
  border-color: #644d85;
3499
  }
3500
- .admin-color-ectoplasm .ui-datepicker-prev:hover,
3501
  .admin-color-ectoplasm .ui-datepicker-next:hover {
3502
  background: #a3b542;
3503
  color: #fff !important;
@@ -3518,7 +3592,7 @@ a.ui-datepicker-next {
3518
  .admin-color-midnight .ui-datepicker-prev:before {
3519
  border-color: #4c5359;
3520
  }
3521
- .admin-color-midnight .ui-datepicker-prev:hover,
3522
  .admin-color-midnight .ui-datepicker-next:hover {
3523
  background: #ed543f;
3524
  color: #fff !important;
@@ -3539,7 +3613,7 @@ a.ui-datepicker-next {
3539
  .admin-color-ocean .ui-datepicker-prev:before {
3540
  border-color: #87a6af;
3541
  }
3542
- .admin-color-ocean .ui-datepicker-prev:hover,
3543
  .admin-color-ocean .ui-datepicker-next:hover {
3544
  background: #9ab8a0;
3545
  color: #fff !important;
@@ -3560,20 +3634,20 @@ a.ui-datepicker-next {
3560
  .admin-color-sunrise .ui-datepicker-prev:before {
3561
  border-color: #e75546;
3562
  }
3563
- .admin-color-sunrise .ui-datepicker-prev:hover,
3564
  .admin-color-sunrise .ui-datepicker-next:hover {
3565
  background: #e88436;
3566
  color: #fff !important;
3567
  }
3568
 
3569
- /* --------------------------------------------------
3570
  :: Time Picker
3571
  ---------------------------------------------------*/
3572
  .ui-timepicker-div {
3573
  border-top: 1px solid #ccc;
3574
  padding: 0 .4em;
3575
  }
3576
- .ui-timepicker-div .ui-widget-content {
3577
  border: 1px solid #aaa;
3578
  background: #fff;
3579
  font-weight: normal;
@@ -3597,12 +3671,12 @@ a.ui-datepicker-next {
3597
  color: #555;
3598
  cursor: pointer;
3599
  display: block;
3600
- height: 1.3em;
3601
  margin-left: -.5em;
3602
  outline: 0;
3603
  position: absolute;
3604
  top: -.325em;
3605
- width: .8em;
3606
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
3607
  -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
3608
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
@@ -3629,31 +3703,31 @@ a.ui-datepicker-next {
3629
  .ui-datepicker-prev:before {
3630
  border-color: #444;
3631
  }
3632
- .ui-datepicker-prev:hover,
3633
  .ui-datepicker-next:hover {
3634
  background: #222;
3635
  color: #0074a2 !important;
3636
  }
3637
 
3638
- .ui-timepicker-div dl {
3639
- text-align: left;
3640
  }
3641
- .ui-timepicker-div dl dt {
3642
- float: left;
3643
- clear: left;
3644
- padding: 0 0 0 5px;
3645
  }
3646
- .ui-timepicker-div dl dd {
3647
- margin: 0 10px 10px 45%;
3648
  }
3649
- .ui-timepicker-div td {
3650
- font-size: 90%;
3651
  }
3652
- .ui-tpicker-grid-label {
3653
- background: none;
3654
- border: none;
3655
- margin: 0;
3656
- padding: 0;
3657
  }
3658
  /* default */
3659
  .ui-timepicker-div .ui-slider-horizontal .ui-slider-handle {
@@ -3736,7 +3810,7 @@ a.ui-datepicker-next {
3736
  border-color: #e75546;
3737
  }
3738
 
3739
- /* --------------------------------------------------
3740
  :: Meta Box Tabs
3741
  ---------------------------------------------------*/
3742
  .ot-metabox-tabs.ui-tabs {
@@ -3803,7 +3877,7 @@ a.ui-datepicker-next {
3803
  clear: both;
3804
  }
3805
 
3806
- /* --------------------------------------------------
3807
  :: Theme Option & Side Metabox Tabs
3808
  ---------------------------------------------------*/
3809
  .ot-theme-option-tabs.ui-tabs
@@ -3896,7 +3970,7 @@ a.ui-datepicker-next {
3896
  width: 100%;
3897
  }
3898
 
3899
- /* --------------------------------------------------
3900
  :: Metabox Tabs for Small Screens & Mobile Devices
3901
  ---------------------------------------------------*/
3902
  @media screen and ( max-width: 1020px ) {
1
+ .theme-thumb {
2
+ min-width: 150px;
3
+ display: inline-block;
4
+ margin: 15px;
5
+ width: calc(33% - 25px);
6
+ box-sizing: border-box;
7
+ background-color: #f1f1f1;
8
+ padding-bottom: 5px;
9
+ border: thin solid transparent;
10
+ position: relative;
11
+ }
12
+ .format-setting-wrap .theme-thumb:nth-child(3n + 1) {
13
+ margin-left: 0;
14
+ }
15
+ .theme-thumb:hover {
16
+ border: thin solid #00000099;
17
+ }
18
+ .theme-thumb span {
19
+ display: block;
20
+ padding: 5px 10px;
21
+ }
22
+ .theme-thumb img {
23
+ max-width: 100%;
24
+ border-bottom: 2px solid #fe2929;
25
+ }
26
+ .theme-thumb span.name {
27
+ font-weight: 600;
28
+ font-size: 15px;
29
+ }
30
+ .theme-thumb .ribbon {
31
+ width: 100px;
32
+ height: 100px;
33
+ overflow: hidden;
34
+ position: absolute;
35
+ top: 0;
36
+ right: 0;
37
+ }
38
+ .theme-thumb .ribbon::before,
39
+ .theme-thumb .ribbon::after {
40
+ position: absolute;
41
+ z-index: -1;
42
+ content: '';
43
+ display: block;
44
+ }
45
+ .theme-thumb .ribbon i {
46
+ position: absolute;
47
+ display: inline-block;
48
+ width: 106px;
49
+ padding: 22px 0px 6px 10px;
50
+ background-color: #fe2929e6;
51
+ box-shadow: 0 5px 10px rgba(0,0,0,.1);
52
+ color: #fff;
53
+ font: 700 18px/1 'Lato', sans-serif;
54
+ text-shadow: 0 1px 1px rgba(0,0,0,.2);
55
+ text-transform: uppercase;
56
+ text-align: center;
57
+ left: 25px;
58
+ top: -11px;
59
+ transform: rotate(45deg);
60
+ }
61
+ .theme-thumb .ribbon::before,
62
+ .theme-thumb .ribbon::after {
63
+ border-top-color: transparent;
64
+ border-right-color: transparent;
65
+ }
66
+ .theme-thumb .ribbon::before {
67
+ top: 0;
68
+ left: 0;
69
+ }
70
+ .theme-thumb .ribbon::after {
71
+ bottom: 0;
72
+ right: 0;
73
+ }
74
+
75
+ /* --------------------------------------------------
76
  :: OptionTree Font
77
  ---------------------------------------------------*/
78
  @font-face {
85
  font-weight: normal;
86
  font-style: normal;
87
  }
88
+
89
+ [class^="ot-icon-"],
90
  [class*=" ot-icon-"] {
91
  font-family: "option-tree-font";
92
  speak: none;
99
  -moz-osx-font-smoothing: grayscale;
100
  }
101
 
102
+ .ui-tabs li > a [class^="ot-icon-"],
103
  .ui-tabs li > a [class*=" ot-icon-"] {
104
  padding-right: 5px;
105
  line-height: 18px;
1213
  .ot-icon-plus-square-o:before {
1214
  content: "\f196";
1215
  }
1216
+
1217
+ /* --------------------------------------------------
1218
  :: Screen Meta & Menu Icon
1219
  ---------------------------------------------------*/
1220
  .appearance_page_ot-theme-options #screen-meta {
1223
  min-width: 533px;
1224
  }
1225
 
1226
+ /* --------------------------------------------------
1227
  :: Messages
1228
  ---------------------------------------------------*/
1229
  .wrap.settings-wrap div.error,
1230
  .wrap.settings-wrap div.updated {
1231
  margin: 9px 5px 0px 2px !important;
1232
  }
1233
+
1234
+ /* --------------------------------------------------
1235
  :: OptionTree Wrappers
1236
  ---------------------------------------------------*/
1237
  #option-tree-settings-api .metabox-holder {
1262
  border-radius: 0 0 2px 2px;
1263
  }
1264
 
1265
+ /* --------------------------------------------------
1266
  :: Header
1267
  ---------------------------------------------------*/
1268
  #option-tree-header-wrap {
1522
  border-left-color: #e75546;
1523
  }
1524
 
1525
+ /* --------------------------------------------------
1526
  :: Sub Header
1527
  ---------------------------------------------------*/
1528
+ #option-tree-sub-header {
1529
+ background: #fafafa;
1530
+ border: 1px solid #ccc;
1531
+ border-top: none;
1532
+ display: block;
1533
+ margin: 0 5px 0 2px;
1534
+ min-width: 523px;
1535
+ overflow: hidden;
1536
+ padding: 5px;
1537
+ position: relative;
1538
  -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0,0,0,0.05);
1539
  -moz-box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0,0,0,0.05);
1540
  box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0,0,0,0.05);
1541
  }
1542
 
1543
+ /* --------------------------------------------------
1544
  :: Tabs
1545
  ---------------------------------------------------*/
1546
+ .wrap.settings-wrap .ui-tabs-nav {
1547
+ float: left;
1548
+ list-style: none;
1549
+ margin: 0 0 0 -4px;
1550
+ padding: 1em 0;
1551
+ width: 151px;
1552
+ }
1553
+ .wrap.settings-wrap .ui-tabs-nav li {
1554
+ border: 1px solid transparent;
1555
+ border-right-width: 0px;
1556
+ display: block; margin: 0;
1557
  -webkit-border-radius: 2px 0 0 2px;
1558
  -moz-border-radius: 2px 0 0 2px;
1559
+ border-radius: 2px 0 0 2px;
1560
  }
1561
+ .wrap.settings-wrap .ui-tabs-nav li.ui-state-active {
1562
+ background: #fff;
1563
+ border-color: #ccc;
1564
+ color: #000;
1565
  }
1566
+ .wrap.settings-wrap .ui-tabs-nav li a {
1567
+ color: #21759b;
1568
+ display: block;
1569
+ line-height: 18px;
1570
+ padding: 5px 5px 5px 12px;
1571
+ text-decoration: none;
1572
  }
1573
  .wrap.settings-wrap .ui-tabs-nav li a:hover,
1574
+ .wrap.settings-wrap .ui-tabs-nav li.ui-state-active a {
1575
+ color: #000;
1576
+ outline: none;
1577
  }
1578
+ .wrap.settings-wrap .ui-tabs-panel {
1579
+ clear: both;
1580
  }
1581
  .wrap.settings-wrap .ui-tabs-nav li a:focus { -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; }
1582
+ /* --------------------------------------------------
1583
  :: Format Settings
1584
  ---------------------------------------------------*/
1585
  .format-settings {
1586
+ position: relative;
1587
+ width: 100%;
1588
  }
1589
  .format-setting-wrap,
1590
  .option-tree-sortable .format-settings {
1591
+ padding: 10px 0 20px 0;
1592
  }
1593
 
1594
+ /* --------------------------------------------------
1595
  :: Format Setting Label
1596
  ---------------------------------------------------*/
1597
  .format-setting-label {
1616
  -webkit-user-select: text;
1617
  text-shadow: none;
1618
  }
1619
+
1620
+ /* --------------------------------------------------
1621
  :: Format Setting
1622
  ---------------------------------------------------*/
1623
  .format-setting {
1724
  top: 10px;
1725
  }
1726
  @media only screen and (max-width: 1020px) {
1727
+ .format-setting .description,
1728
  .format-setting .format-setting-inner {
1729
  width: 100%;
1730
  }
1745
  text-indent: -9999px;
1746
  }
1747
 
1748
+ /* --------------------------------------------------
1749
  :: Code formatting
1750
  ---------------------------------------------------*/
1751
  #option-tree-settings-api code,
1775
  background: url(../images/ot-pre-bg.gif) repeat left top;
1776
  }
1777
 
1778
+ /* --------------------------------------------------
1779
  :: Input & Upload
1780
  ---------------------------------------------------*/
1781
  input.option-tree-ui-upload-input,
1814
  }
1815
  }
1816
 
1817
+ /* --------------------------------------------------
1818
  :: Upload
1819
  ---------------------------------------------------*/
1820
  div.option-tree-ui-media-wrap {
1857
  top: 1px;
1858
  }
1859
 
1860
+ /* --------------------------------------------------
1861
  :: Textarea
1862
  ---------------------------------------------------*/
1863
  .fill-area .description,
1901
  }
1902
  }
1903
 
1904
+ /* --------------------------------------------------
1905
  :: Setting Item with Drag & Drop
1906
  ---------------------------------------------------*/
1907
+ .option-tree-setting-wrap {
1908
+ margin-top: 0px;
1909
  }
1910
+ .option-tree-setting-wrap li {
1911
+ margin: 5px 0px;
1912
  }
1913
+ .option-tree-setting {
1914
+ border: 1px solid #ccc;
1915
+ overflow: hidden;
1916
+ position: relative;
1917
  -webkit-border-radius: 2px;
1918
  -moz-border-radius: 2px;
1919
+ border-radius: 2px;
1920
  }
1921
  .option-tree-setting:hover {
1922
  border-color: #999;
1924
  -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
1925
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
1926
  }
1927
+ .option-tree-setting a {
1928
+ text-decoration: none;
1929
  }
1930
  .option-tree-setting .open {
1931
  background: #fafafa;
1968
  right: 0px;
1969
  top: 1px;
1970
  }
1971
+ .option-tree-setting.is-section {
1972
+ border: 1px solid #000;
1973
  }
1974
  .option-tree-setting.is-section .option-tree-setting-body,
1975
  .option-tree-setting.is-section .option-tree-ui-button {
1989
  /* light */
1990
  .admin-color-light .option-tree-setting.is-section,
1991
  .admin-color-light .option-tree-setting.is-section .option-tree-setting-body,
1992
+ .admin-color-light .option-tree-setting.is-section .option-tree-ui-button {
1993
+ border-color: #3c3c3c !important;
1994
  }
1995
  .admin-color-light .option-tree-setting.is-section .open:hover:before {
1996
  color: #3c3c3c;
2006
  /* blue */
2007
  .admin-color-blue .option-tree-setting.is-section,
2008
  .admin-color-blue .option-tree-setting.is-section .option-tree-setting-body,
2009
+ .admin-color-blue .option-tree-setting.is-section .option-tree-ui-button {
2010
+ border-color: #002b39 !important;
2011
  }
2012
  .admin-color-blue .option-tree-setting.is-section .open:hover:before {
2013
  color: #002b39;
2023
  /* coffee */
2024
  .admin-color-coffee .option-tree-setting.is-section,
2025
  .admin-color-coffee .option-tree-setting.is-section .option-tree-setting-body,
2026
+ .admin-color-coffee .option-tree-setting.is-section .option-tree-ui-button {
2027
+ border-color: #0f0e0d !important;
2028
  }
2029
  .admin-color-coffee .option-tree-setting.is-section .open:hover:before {
2030
  color: #0f0e0d;
2040
  /* ectoplasm */
2041
  .admin-color-ectoplasm .option-tree-setting.is-section,
2042
  .admin-color-ectoplasm .option-tree-setting.is-section .option-tree-setting-body,
2043
+ .admin-color-ectoplasm .option-tree-setting.is-section .option-tree-ui-button {
2044
+ border-color: #181220 !important;
2045
  }
2046
  .admin-color-ectoplasm .option-tree-setting.is-section .open:hover:before {
2047
  color: #181220;
2057
  /* midnight */
2058
  .admin-color-midnight .option-tree-setting.is-section,
2059
  .admin-color-midnight .option-tree-setting.is-section .option-tree-setting-body,
2060
+ .admin-color-midnight .option-tree-setting.is-section .option-tree-ui-button {
2061
+ border-color: #090a0b !important;
2062
  }
2063
  .admin-color-midnight .option-tree-setting.is-section .open:hover:before {
2064
  color: #090a0b;
2074
  /* ocean */
2075
  .admin-color-ocean .option-tree-setting.is-section,
2076
  .admin-color-ocean .option-tree-setting.is-section .option-tree-setting-body,
2077
+ .admin-color-ocean .option-tree-setting.is-section .option-tree-ui-button {
2078
+ border-color: #39464a !important;
2079
  }
2080
  .admin-color-ocean .option-tree-setting.is-section .open:hover:before {
2081
  color: #39464a;
2091
  /* sunrise */
2092
  .admin-color-sunrise .option-tree-setting.is-section,
2093
  .admin-color-sunrise .option-tree-setting.is-section .option-tree-setting-body,
2094
+ .admin-color-sunrise .option-tree-setting.is-section .option-tree-ui-button {
2095
+ border-color: #8a322a !important;
2096
  }
2097
  .admin-color-sunrise .option-tree-setting.is-section .open:hover:before {
2098
  color: #8a322a;
2133
  margin: 0px;
2134
  }
2135
 
2136
+ /* --------------------------------------------------
2137
  :: Layouts
2138
  ---------------------------------------------------*/
2139
  #option_tree_layouts {
2180
  padding-left: 1px;
2181
  }
2182
 
2183
+ /* --------------------------------------------------
2184
  :: Option Group
2185
  ---------------------------------------------------*/
2186
  .ot-option-group {
2288
  width: 100%;
2289
  }
2290
 
2291
+ /* --------------------------------------------------
2292
  :: Select
2293
  ---------------------------------------------------*/
2294
  .select-wrapper {
2366
  }
2367
  }
2368
 
2369
+ /* --------------------------------------------------
2370
  :: Measurement
2371
  ---------------------------------------------------*/
2372
+ .option-tree-ui-measurement-input-wrap {
2373
+ margin-right: 80px;
2374
  }
2375
 
2376
+ /* --------------------------------------------------
2377
  :: Checkbox & Radio
2378
  ---------------------------------------------------*/
2379
  .format-setting.type-checkbox input,
2399
  padding-top: 0.3em;
2400
  }
2401
  }
2402
+
2403
+ /* --------------------------------------------------
2404
  :: Radio Images
2405
  ---------------------------------------------------*/
2406
  .type-radio-image .option-tree-ui-radio-images {
2426
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
2427
  }
2428
 
2429
+ /* --------------------------------------------------
2430
  :: Social Links
2431
  ---------------------------------------------------*/
2432
  .type-social-links input.option-tree-ui-input {
2433
  margin-top: 5px;
2434
  }
2435
 
2436
+ /* --------------------------------------------------
2437
  :: Numeric Slider
2438
  ---------------------------------------------------*/
2439
  .type-numeric-slider .format-setting-inner {
2451
  .ot-numeric-slider-wrap {
2452
  margin: 0 96px 0 0;
2453
  }
2454
+ .ot-numeric-slider-wrap .ot-numeric-slider-helper-input {
2455
+ position: absolute;
2456
  right: 5px;
2457
  text-align: center;
2458
  top: 5px;
2459
  width: 90px !important;
2460
  }
2461
+ .ot-numeric-slider.ui-slider {
2462
  background: #fff;
2463
  border: 1px solid #ccc;
2464
+ margin: 8px 8px 0 8px;
2465
+ position: relative;
2466
  -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
2467
+ -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
2468
+ box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.05);
2469
  -webkit-border-radius: 2px;
2470
  -moz-border-radius: 2px;
2471
  border-radius: 2px;
2472
  }
2473
+ .ot-numeric-slider.ui-slider-horizontal {
2474
  height: 11px;
2475
  }
2476
  .ot-numeric-slider.ui-slider .ui-slider-handle {
2478
  color: #555;
2479
  cursor: pointer;
2480
  display: block;
2481
+ height: 27px;
2482
  margin: -9px -8px;
2483
  outline: 0;
2484
+ position: absolute;
2485
  width: 16px;
2486
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
2487
  -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
2571
  border-color: #e75546;
2572
  }
2573
 
2574
+ /* --------------------------------------------------
2575
  :: Colorpicker
2576
  ---------------------------------------------------*/
2577
  .option-tree-ui-colorpicker-input-wrap {
2578
  float: left;
2579
  }
2580
  .hide-color-picker {
2581
+
2582
  }
2583
  .option-tree-ui-colorpicker-input-wrap .option-tree-ui-colorpicker-label {
2584
  height: 30px;
2637
  }
2638
  }
2639
 
2640
+ /* --------------------------------------------------
2641
  :: Colorpicker Opacity (Derivative work of the Codestar WP Color Picker.)
2642
  ---------------------------------------------------*/
2643
  .option-tree-opacity-wrap {
2702
  text-align: center;
2703
  }
2704
 
2705
+ /* --------------------------------------------------
2706
  :: Google Font
2707
  ---------------------------------------------------*/
2708
  .type-google-font {
2721
  margin-top: 0;
2722
  }
2723
 
2724
+ /* --------------------------------------------------
2725
+ :: OptionTree UI Buttons
2726
  ---------------------------------------------------*/
2727
  .option-tree-ui-button.button {
2728
  float: left;
2835
  background: #f5f5f5;
2836
  border-color: #dfdfdf;
2837
  }
2838
+ .option-tree-ui-buttons:before,
2839
  .option-tree-ui-buttons:after {
2840
  content: "\0020";
2841
  display: block;
2854
  left: 8px;
2855
  }
2856
 
2857
+ /* --------------------------------------------------
2858
+ :: OptionTree UI Button Icons
2859
  ---------------------------------------------------*/
2860
  .option-tree-ui-button .icon {
2861
  color: #3a3a3a;
2905
  background-position: -54px -0px;
2906
  }
2907
 
2908
+ /* --------------------------------------------------
2909
  :: WP 3.8 Fixes (via Github @AlxMedia)
2910
  ---------------------------------------------------*/
2911
  #option-tree-settings-api #poststuff,
2912
+ #option-tree-settings-api #post-body-content {
2913
  min-width: 0;
2914
  }
2915
+ #option-tree-settings-api #poststuff h3 {
2916
  font-family: inherit !important;
2917
  }
2918
+ #option-tree-settings-api .postbox {
2919
  -webkit-box-shadow: none;
2920
  -moz-box-shadow: none;
2921
  box-shadow: none;
2922
  }
2923
+ #option-tree-settings-api p input[type="checkbox"],
2924
+ #option-tree-settings-api p input[type="radio"] {
2925
  margin-top: 2px;
2926
  }
2927
+ #option-tree-settings-api .format-setting.type-checkbox p,
2928
+ #option-tree-settings-api .format-setting.type-radio p {
2929
  margin: 0.3em 0 !important;
2930
  }
2931
+ input.option-tree-ui-upload-input,
2932
+ input.option-tree-ui-input {
2933
  padding-top: 5px;
2934
  padding-bottom: 5px;
2935
  }
2940
  }
2941
  }
2942
 
2943
+ /* --------------------------------------------------
2944
  :: Gallery
2945
  ---------------------------------------------------*/
2946
  ul.ot-gallery-list {
2972
  margin-bottom: 0px;
2973
  }
2974
 
2975
+ /* --------------------------------------------------
2976
  :: Google Fonts
2977
  ---------------------------------------------------*/
2978
  .option-tree-google-font-family,
3004
  }
3005
  }
3006
 
3007
+ /* --------------------------------------------------
3008
  :: On/Off Switch
3009
  ---------------------------------------------------*/
3010
  .on-off-switch .slide-button {
3035
  .on-off-switch * {
3036
  -webkit-box-sizing: border-box;
3037
  -moz-box-sizing: border-box;
3038
+ box-sizing: border-box;
3039
  }
3040
  .on-off-switch input {
3041
  position: absolute;
3085
  box-shadow: inset 0 1px 0 #c8eb8e, 0 1px 0 rgba(0,0,0,.08);
3086
  -webkit-transition: all 0.2s ease-out;
3087
  -moz-transition: all 0.2s ease-out;
3088
+ transition: all 0.2s ease-out;
3089
  }
3090
  .on-off-switch input:last-of-type:checked ~ .slide-button {
3091
  background: #b73b27;
3099
  }
3100
  @media only screen and (-webkit-max-device-pixel-ratio: 2) and (max-device-width: 1280px) {
3101
  .on-off-switch {
3102
+ -webkit-animation: webkitSiblingBugfix infinite 1s;
3103
+ }
3104
  }
3105
  @-webkit-keyframes webkitSiblingBugfix {
3106
  from {
3107
+ -webkit-transform: translate3d(0, 0, 0);
3108
  }
3109
  to {
3110
+ -webkit-transform: translate3d(0, 0, 0);
3111
+ }
3112
  }
3113
 
3114
+ /* --------------------------------------------------
3115
  :: Simple Input Append & Prepend
3116
  ---------------------------------------------------*/
3117
  .ot-input-append,
3192
  border-radius: 0 2px 2px 0;
3193
  }
3194
 
3195
+ /* --------------------------------------------------
3196
  :: CSS Editor
3197
  ---------------------------------------------------*/
3198
  #option-tree-settings-api pre.ot-css-editor,
3230
  -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
3231
  -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
3232
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.0980392);
3233
+ }
3234
 
3235
+ /* --------------------------------------------------
3236
  :: Date Picker
3237
  ---------------------------------------------------*/
3238
  .ui-datepicker {
3267
  .ui-datepicker .ui-datepicker-title {
3268
  text-align: center;
3269
  }
3270
+ .ui-datepicker-prev,
3271
  .ui-datepicker-next {
3272
  color: #ccc;
3273
  display: inline-block;
3286
  -moz-border-radius: 0 2px 0 0;
3287
  border-radius: 0 2px 0 0;
3288
  }
3289
+ .ui-datepicker-prev span,
3290
  .ui-datepicker-next span {
3291
  display: none;
3292
  }
3293
+ .ui-datepicker-prev:hover,
3294
  .ui-datepicker-next:hover {
3295
  color: #fff;
3296
  }
3319
  float: right;
3320
  width: 31px;
3321
  }
3322
+ a.ui-datepicker-prev,
3323
  a.ui-datepicker-next {
3324
  outline: 0;
3325
  }
3347
  .ui-datepicker tbody tr:last-child {
3348
  border-bottom: 0px;
3349
  }
3350
+ .ui-datepicker td span,
3351
  .ui-datepicker td a {
3352
  display: inline-block;
3353
  font-size: 11px;
3487
  .ui-datepicker-prev:before {
3488
  border-color: #444;
3489
  }
3490
+ .ui-datepicker-prev:hover,
3491
  .ui-datepicker-next:hover {
3492
  background: #222;
3493
  color: #0074a2 !important;
3508
  .admin-color-light .ui-datepicker-prev:before {
3509
  border-color: #999;
3510
  }
3511
+ .admin-color-light .ui-datepicker-prev:hover,
3512
  .admin-color-light .ui-datepicker-next:hover {
3513
  background: #777;
3514
  color: #eee !important;
3529
  .admin-color-blue .ui-datepicker-prev:before {
3530
  border-color: #5dc2e6;
3531
  }
3532
+ .admin-color-blue .ui-datepicker-prev:hover,
3533
  .admin-color-blue .ui-datepicker-next:hover {
3534
  background: #006484;
3535
  color: #fff !important;
3550
  .admin-color-coffee .ui-datepicker-prev:before {
3551
  border-color: #675f58;
3552
  }
3553
+ .admin-color-coffee .ui-datepicker-prev:hover,
3554
  .admin-color-coffee .ui-datepicker-next:hover {
3555
  background: #cca588;
3556
  color: #fff !important;
3571
  .admin-color-ectoplasm .ui-datepicker-prev:before {
3572
  border-color: #644d85;
3573
  }
3574
+ .admin-color-ectoplasm .ui-datepicker-prev:hover,
3575
  .admin-color-ectoplasm .ui-datepicker-next:hover {
3576
  background: #a3b542;
3577
  color: #fff !important;
3592
  .admin-color-midnight .ui-datepicker-prev:before {
3593
  border-color: #4c5359;
3594
  }
3595
+ .admin-color-midnight .ui-datepicker-prev:hover,
3596
  .admin-color-midnight .ui-datepicker-next:hover {
3597
  background: #ed543f;
3598
  color: #fff !important;
3613
  .admin-color-ocean .ui-datepicker-prev:before {
3614
  border-color: #87a6af;
3615
  }
3616
+ .admin-color-ocean .ui-datepicker-prev:hover,
3617
  .admin-color-ocean .ui-datepicker-next:hover {
3618
  background: #9ab8a0;
3619
  color: #fff !important;
3634
  .admin-color-sunrise .ui-datepicker-prev:before {
3635
  border-color: #e75546;
3636
  }
3637
+ .admin-color-sunrise .ui-datepicker-prev:hover,
3638
  .admin-color-sunrise .ui-datepicker-next:hover {
3639
  background: #e88436;
3640
  color: #fff !important;
3641
  }
3642
 
3643
+ /* --------------------------------------------------
3644
  :: Time Picker
3645
  ---------------------------------------------------*/
3646
  .ui-timepicker-div {
3647
  border-top: 1px solid #ccc;
3648
  padding: 0 .4em;
3649
  }
3650
+ .ui-timepicker-div .ui-widget-content {
3651
  border: 1px solid #aaa;
3652
  background: #fff;
3653
  font-weight: normal;
3671
  color: #555;
3672
  cursor: pointer;
3673
  display: block;
3674
+ height: 1.3em;
3675
  margin-left: -.5em;
3676
  outline: 0;
3677
  position: absolute;
3678
  top: -.325em;
3679
+ width: .8em;
3680
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
3681
  -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
3682
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(0,0,0,.08);
3703
  .ui-datepicker-prev:before {
3704
  border-color: #444;
3705
  }
3706
+ .ui-datepicker-prev:hover,
3707
  .ui-datepicker-next:hover {
3708
  background: #222;
3709
  color: #0074a2 !important;
3710
  }
3711
 
3712
+ .ui-timepicker-div dl {
3713
+ text-align: left;
3714
  }
3715
+ .ui-timepicker-div dl dt {
3716
+ float: left;
3717
+ clear: left;
3718
+ padding: 0 0 0 5px;
3719
  }
3720
+ .ui-timepicker-div dl dd {
3721
+ margin: 0 10px 10px 45%;
3722
  }
3723
+ .ui-timepicker-div td {
3724
+ font-size: 90%;
3725
  }
3726
+ .ui-tpicker-grid-label {
3727
+ background: none;
3728
+ border: none;
3729
+ margin: 0;
3730
+ padding: 0;
3731
  }
3732
  /* default */
3733
  .ui-timepicker-div .ui-slider-horizontal .ui-slider-handle {
3810
  border-color: #e75546;
3811
  }
3812
 
3813
+ /* --------------------------------------------------
3814
  :: Meta Box Tabs
3815
  ---------------------------------------------------*/
3816
  .ot-metabox-tabs.ui-tabs {
3877
  clear: both;
3878
  }
3879
 
3880
+ /* --------------------------------------------------
3881
  :: Theme Option & Side Metabox Tabs
3882
  ---------------------------------------------------*/
3883
  .ot-theme-option-tabs.ui-tabs
3970
  width: 100%;
3971
  }
3972
 
3973
+ /* --------------------------------------------------
3974
  :: Metabox Tabs for Small Screens & Mobile Devices
3975
  ---------------------------------------------------*/
3976
  @media screen and ( max-width: 1020px ) {
admin/assets/images/themes/pro/aeroplane-company.jpg ADDED
Binary file
admin/assets/images/themes/pro/animated-clock.jpg ADDED
Binary file
admin/assets/images/themes/pro/bicycle-race.jpg ADDED
Binary file
admin/assets/images/themes/pro/bitcoin-miners.jpg ADDED
Binary file
admin/assets/images/themes/pro/blogging.jpg ADDED
Binary file
admin/assets/images/themes/pro/book-lovers.jpg ADDED
Binary file
admin/assets/images/themes/pro/business-company.jpg ADDED
Binary file
admin/assets/images/themes/pro/coffee-shop.jpg ADDED
Binary file
admin/assets/images/themes/pro/default.jpg ADDED
Binary file
admin/assets/images/themes/pro/dental-clinic.jpg ADDED
Binary file
admin/assets/images/themes/pro/dog-training-and-behavior-consulting.jpg ADDED
Binary file
admin/assets/images/themes/pro/flower-shop.jpg ADDED
Binary file
admin/assets/images/themes/pro/homemade-chocolate-gifts.jpg ADDED
Binary file
admin/assets/images/themes/pro/interior-design.jpg ADDED
Binary file
admin/assets/images/themes/pro/lego-bricks.jpg ADDED
Binary file
admin/assets/images/themes/pro/lonely-road.jpg ADDED
Binary file
admin/assets/images/themes/pro/luxury-car.jpg ADDED
Binary file
admin/assets/images/themes/pro/maintenance-mode.jpg ADDED
Binary file
admin/assets/images/themes/pro/makeup-artist-training.jpg ADDED
Binary file
admin/assets/images/themes/pro/mobile-designer.jpg ADDED
Binary file
admin/assets/images/themes/pro/modern-blog.jpg ADDED
Binary file
admin/assets/images/themes/pro/modern-office.jpg ADDED
Binary file
admin/assets/images/themes/pro/mountain-slide.jpg ADDED
Binary file
admin/assets/images/themes/pro/mountain.jpg ADDED
Binary file
admin/assets/images/themes/pro/nature.jpg ADDED
Binary file
admin/assets/images/themes/pro/office-theme.jpg ADDED
Binary file
admin/assets/images/themes/pro/online-learning.jpg ADDED
Binary file
admin/assets/images/themes/pro/pancake-house.jpg ADDED
Binary file
admin/assets/images/themes/pro/parenting.jpg ADDED
Binary file
admin/assets/images/themes/pro/running-blog.jpg ADDED
Binary file
admin/assets/images/themes/pro/shoes-store.jpg ADDED
Binary file
admin/assets/images/themes/pro/simple-beige-design.jpg ADDED
Binary file
admin/assets/images/themes/pro/snowboarding-blog.jpg ADDED
Binary file
admin/assets/images/themes/pro/the-big-city-newsletter.jpg ADDED
Binary file
admin/assets/images/themes/pro/travel-agency.jpg ADDED
Binary file
admin/assets/images/themes/pro/travel-blog.jpg ADDED
Binary file
admin/assets/images/themes/pro/video-production.jpg ADDED
Binary file
admin/assets/images/themes/pro/webinar.jpg ADDED
Binary file
admin/assets/images/themes/pro/wedding-blog.jpg ADDED
Binary file
admin/assets/images/themes/pro/workplace.jpg ADDED
Binary file
admin/assets/js/ot-admin.js CHANGED
@@ -1,1293 +1,1293 @@
1
- /**
2
- * Option Tree UI
3
- *
4
- * Dependencies: jQuery, jQuery UI, ColorPicker
5
- *
6
- * @author Derek Herman (derek@valendesigns.com)
7
- */
8
- ;(function($) {
9
- OT_UI = {
10
- processing: false,
11
- init: function() {
12
- this.init_hide_body();
13
- this.init_sortable();
14
- this.init_add();
15
- this.init_edit();
16
- this.init_remove();
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();
24
- this.init_tabs();
25
- this.init_radio_image_select();
26
- this.init_select_wrapper();
27
- this.bind_select_wrapper();
28
- this.init_google_fonts();
29
- this.fix_upload_parent();
30
- this.fix_textarea();
31
- this.replicate_ajax();
32
- this.reset_settings();
33
- this.css_editor_mode();
34
- this.javascript_editor_mode();
35
- },
36
- init_hide_body: function(elm,type) {
37
- var css = '.option-tree-setting-body';
38
- if ( type == 'parent' ) {
39
- $(css).not( elm.parent().parent().children(css) ).hide();
40
- } else if ( type == 'child' ) {
41
- elm.closest('ul').find(css).not( elm.parent().parent().children(css) ).hide();
42
- } else if ( type == 'child-add' ) {
43
- elm.children().find(css).hide();
44
- } else if ( type == 'toggle' ) {
45
- elm.parent().parent().children(css).toggle();
46
- } else {
47
- $(css).hide();
48
- }
49
- },
50
- init_remove_active: function(elm,type) {
51
- var css = '.option-tree-setting-edit';
52
- if ( type == 'parent' ) {
53
- $(css).not(elm).removeClass('active');
54
- } else if ( type == 'child' ) {
55
- elm.closest('ul').find(css).not(elm).removeClass('active');
56
- } else if ( type == 'child-add' ) {
57
- elm.children().find(css).removeClass('active');
58
- } else {
59
- $(css).removeClass('active');
60
- }
61
- },
62
- init_sortable: function(scope) {
63
- scope = scope || document;
64
- $('.option-tree-sortable', scope).each( function() {
65
- if ( $(this).children('li').length ) {
66
- var elm = $(this);
67
- elm.show();
68
- elm.sortable({
69
- items: 'li:not(.ui-state-disabled)',
70
- handle: 'div.open',
71
- placeholder: 'ui-state-highlight',
72
- start: function (event, ui) {
73
- ui.placeholder.height(ui.item.height()-2);
74
- },
75
- stop: function(evt, ui) {
76
- setTimeout(
77
- function(){
78
- OT_UI.update_ids(elm);
79
- },
80
- 200
81
- )
82
- }
83
- });
84
- }
85
- });
86
- },
87
- init_add: function() {
88
- $(document).on('click', '.option-tree-section-add', function(e) {
89
- e.preventDefault();
90
- OT_UI.add(this,'section');
91
- });
92
- $(document).on('click', '.option-tree-setting-add', function(e) {
93
- e.preventDefault();
94
- OT_UI.add(this,'setting');
95
- });
96
- $(document).on('click', '.option-tree-help-add', function(e) {
97
- e.preventDefault();
98
- OT_UI.add(this,'the_contextual_help');
99
- });
100
- $(document).on('click', '.option-tree-choice-add', function(e) {
101
- e.preventDefault();
102
- OT_UI.add(this,'choice');
103
- });
104
- $(document).on('click', '.option-tree-list-item-add', function(e) {
105
- e.preventDefault();
106
- OT_UI.add(this,'list_item');
107
- });
108
- $(document).on('click', '.option-tree-social-links-add', function(e) {
109
- e.preventDefault();
110
- OT_UI.add(this,'social_links');
111
- });
112
- $(document).on('click', '.option-tree-list-item-setting-add', function(e) {
113
- e.preventDefault();
114
- if ( $(this).parents('ul').parents('ul').hasClass('ui-sortable') ) {
115
- alert(option_tree.setting_limit);
116
- return false;
117
- }
118
- OT_UI.add(this,'list_item_setting');
119
- });
120
- },
121
- init_edit: function() {
122
- $(document).on('click', '.option-tree-setting-edit', function(e) {
123
- e.preventDefault();
124
- if ( $(this).parents().hasClass('option-tree-setting-body') ) {
125
- OT_UI.init_remove_active($(this),'child');
126
- OT_UI.init_hide_body($(this),'child');
127
- } else {
128
- OT_UI.init_remove_active($(this),'parent');
129
- OT_UI.init_hide_body($(this), 'parent');
130
- }
131
- $(this).toggleClass('active');
132
- OT_UI.init_hide_body($(this), 'toggle');
133
- });
134
- },
135
- init_remove: function() {
136
- $(document).on('click', '.option-tree-setting-remove', function(event) {
137
- event.preventDefault();
138
- if ( $(this).parents('li').hasClass('ui-state-disabled') ) {
139
- alert(option_tree.remove_no);
140
- return false;
141
- }
142
- var agree = confirm(option_tree.remove_agree);
143
- if (agree) {
144
- var list = $(this).parents('ul');
145
- OT_UI.remove(this);
146
- setTimeout( function() {
147
- OT_UI.update_ids(list);
148
- }, 200 );
149
- }
150
- return false;
151
- });
152
- },
153
- init_edit_title: function() {
154
- $(document).on('keyup', '.option-tree-setting-title', function() {
155
- OT_UI.edit_title(this);
156
- });
157
- // Automatically fill option IDs with clean versions of their respective option labels
158
- $(document).on('blur', '.option-tree-setting-title', function() {
159
- var optionId = $(this).parents('.option-tree-setting-body').find('[type="text"][name$="id]"]')
160
- if ( optionId.val() === '' ) {
161
- optionId.val($(this).val().replace(/[^a-z0-9]/gi,'_').toLowerCase());
162
- }
163
- });
164
- },
165
- init_edit_id: function() {
166
- $(document).on('keyup', '.section-id', function(){
167
- OT_UI.update_id(this);
168
- });
169
- },
170
- init_activate_layout: function() {
171
- $(document).on('click', '.option-tree-layout-activate', function() {
172
- var active = $(this).parents('.option-tree-setting').find('.open').text();
173
- $('.option-tree-layout-activate').removeClass('active');
174
- $(this).toggleClass('active');
175
- $('.active-layout-input').attr({'value':active});
176
- });
177
- $(document).on('change', '#option-tree-options-layouts-form select', function() {
178
- var agree = confirm(option_tree.activate_layout_agree);
179
- if (agree) {
180
- $('#option-tree-options-layouts-form').submit();
181
- } else {
182
- var active = $('#the_current_layout').attr('value');
183
- $('#option-tree-options-layouts-form select option[value="' + active + '"]').attr({'selected':'selected'});
184
- $('#option-tree-options-layouts-form select').prev('span').replaceWith('<span>' + active + '</span>');
185
- }
186
- });
187
- },
188
- add: function(elm,type) {
189
- var self = this,
190
- list = '',
191
- list_class = '',
192
- name = '',
193
- post_id = 0,
194
- get_option = '',
195
- settings = '';
196
- if ( type == 'the_contextual_help' ) {
197
- list = $(elm).parent().find('ul:last');
198
- list_class = 'list-contextual-help';
199
- } else if ( type == 'choice' ) {
200
- list = $(elm).parent().children('ul');
201
- list_class = 'list-choice';
202
- } else if ( type == 'list_item' ) {
203
- list = $(elm).parent().children('ul');
204
- list_class = 'list-sub-setting';
205
- } else if ( type == 'list_item_setting' ) {
206
- list = $(elm).parent().children('ul');
207
- list_class = 'list-sub-setting';
208
- } else if ( type == 'social_links' ) {
209
- list = $(elm).parent().children('ul');
210
- list_class = 'list-sub-setting';
211
- } else {
212
- list = $(elm).parent().find('ul:first');
213
- list_class = ( type == 'section' ) ? 'list-section' : 'list-setting';
214
- }
215
- name = list.data('name');
216
- post_id = list.data('id');
217
- get_option = list.data('getOption');
218
- settings = $('#'+name+'_settings_array').val();
219
- if ( this.processing === false ) {
220
- this.processing = true;
221
- var count = parseInt(list.children('li').length);
222
- if ( type == 'list_item' || type == 'social_links' ) {
223
- list.find('li input.option-tree-setting-title', self).each(function(){
224
- var setting = $(this).attr('name'),
225
- regex = /\[([0-9]+)\]/,
226
- matches = setting.match(regex),
227
- id = null != matches ? parseInt(matches[1]) : 0;
228
- id++;
229
- if ( id > count) {
230
- count = id;
231
- }
232
- });
233
- }
234
- $.ajax({
235
- url: option_tree.ajax,
236
- type: 'post',
237
- data: {
238
- action: 'add_' + type,
239
- count: count,
240
- name: name,
241
- post_id: post_id,
242
- get_option: get_option,
243
- settings: settings,
244
- type: type,
245
- nonce: option_tree.nonce
246
- },
247
- complete: function( data ) {
248
- if ( type == 'choice' || type == 'list_item_setting' ) {
249
- OT_UI.init_remove_active(list,'child-add');
250
- OT_UI.init_hide_body(list,'child-add');
251
- } else {
252
- OT_UI.init_remove_active();
253
- OT_UI.init_hide_body();
254
- }
255
- var listItem = $('<li class="ui-state-default ' + list_class + '">' + data.responseText + '</li>');
256
- list.append(listItem);
257
- list.children().last().find('.option-tree-setting-edit').toggleClass('active');
258
- list.children().last().find('.option-tree-setting-body').toggle();
259
- list.children().last().find('.option-tree-setting-title').focus();
260
- if ( type != 'the_contextual_help' ) {
261
- OT_UI.update_ids(list);
262
- }
263
- OT_UI.init_sortable(listItem);
264
- OT_UI.init_select_wrapper(listItem);
265
- OT_UI.init_numeric_slider(listItem);
266
- OT_UI.parse_condition();
267
- self.processing = false;
268
- }
269
- });
270
- }
271
- },
272
- remove: function(e) {
273
- $(e).parent().parent().parent('li').remove();
274
- },
275
- edit_title: function(e) {
276
- if ( this.timer ) {
277
- clearTimeout(e.timer);
278
- }
279
- this.timer = setTimeout( function() {
280
- $(e).parent().parent().parent().parent().parent().children('.open').text(e.value);
281
- }, 100);
282
- return true;
283
- },
284
- update_id: function(e) {
285
- if ( this.timer ) {
286
- clearTimeout(e.timer);
287
- }
288
- this.timer = setTimeout( function() {
289
- OT_UI.update_ids($(e).parents('ul'));
290
- }, 100);
291
- return true;
292
- },
293
- update_ids: function(list) {
294
- var last_section, section, list_items = list.children('li');
295
- list_items.each(function(index) {
296
- if ( $(this).hasClass('list-section') ) {
297
- section = $(this).find('.section-id').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
298
- if (!section) {
299
- section = $(this).find('.section-title').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
300
- }
301
- if (!section) {
302
- section = last_section;
303
- }
304
- }
305
- if ($(this).hasClass('list-setting') ) {
306
- $(this).find('.hidden-section').attr({'value':section});
307
- }
308
- last_section = section;
309
- });
310
- },
311
- condition_objects: function() {
312
- return 'select, input[type="radio"]:checked, input[type="text"], input[type="hidden"], input.ot-numeric-slider-hidden-input';
313
- },
314
- match_conditions: function(condition) {
315
- var match;
316
- var regex = /(.+?):(is|not|contains|less_than|less_than_or_equal_to|greater_than|greater_than_or_equal_to)\((.*?)\),?/g;
317
- var conditions = [];
318
-
319
- while( match = regex.exec( condition ) ) {
320
- conditions.push({
321
- 'check': match[1],
322
- 'rule': match[2],
323
- 'value': match[3] || ''
324
- });
325
- }
326
-
327
- return conditions;
328
- },
329
- parse_condition: function() {
330
- $( '.format-settings[id^="setting_"][data-condition]' ).each(function() {
331
-
332
- var passed;
333
- var conditions = OT_UI.match_conditions( $( this ).data( 'condition' ) );
334
- var operator = ( $( this ).data( 'operator' ) || 'and' ).toLowerCase();
335
-
336
- $.each( conditions, function( index, condition ) {
337
-
338
- var target = $( '#setting_' + condition.check );
339
- var targetEl = !! target.length && target.find( OT_UI.condition_objects() ).first();
340
-
341
- if ( ! target.length || ( ! targetEl.length && condition.value.toString() != '' ) ) {
342
- return;
343
- }
344
-
345
- var v1 = targetEl.length ? targetEl.val().toString() : '';
346
- var v2 = condition.value.toString();
347
- var result;
348
-
349
- switch ( condition.rule ) {
350
- case 'less_than':
351
- result = ( parseInt( v1 ) < parseInt( v2 ) );
352
- break;
353
- case 'less_than_or_equal_to':
354
- result = ( parseInt( v1 ) <= parseInt( v2 ) );
355
- break;
356
- case 'greater_than':
357
- result = ( parseInt( v1 ) > parseInt( v2 ) );
358
- break;
359
- case 'greater_than_or_equal_to':
360
- result = ( parseInt( v1 ) >= parseInt( v2 ) );
361
- break;
362
- case 'contains':
363
- result = ( v1.indexOf(v2) !== -1 ? true : false );
364
- break;
365
- case 'is':
366
- result = ( v1 == v2 );
367
- break;
368
- case 'not':
369
- result = ( v1 != v2 );
370
- break;
371
- }
372
-
373
- if ( 'undefined' == typeof passed ) {
374
- passed = result;
375
- }
376
-
377
- switch ( operator ) {
378
- case 'or':
379
- passed = ( passed || result );
380
- break;
381
- case 'and':
382
- default:
383
- passed = ( passed && result );
384
- break;
385
- }
386
-
387
- });
388
-
389
- if ( passed ) {
390
- $(this).animate({opacity: 'show' , height: 'show'}, 200);
391
- } else {
392
- $(this).animate({opacity: 'hide' , height: 'hide'}, 200);
393
- }
394
-
395
- delete passed;
396
-
397
- });
398
- },
399
- init_conditions: function() {
400
- var delay = (function() {
401
- var timer = 0;
402
- return function(callback, ms) {
403
- clearTimeout(timer);
404
- timer = setTimeout(callback, ms);
405
- };
406
- })();
407
-
408
- $('.format-settings[id^="setting_"]').on( 'change.conditionals, keyup.conditionals', OT_UI.condition_objects(), function(e) {
409
- if (e.type === 'keyup') {
410
- // handle keyup event only once every 500ms
411
- delay(function() {
412
- OT_UI.parse_condition();
413
- }, 500);
414
- } else {
415
- OT_UI.parse_condition();
416
- }
417
- OT_UI.load_editors();
418
- });
419
- OT_UI.parse_condition();
420
- },
421
- init_upload: function() {
422
- $(document).on('click', '.ot_upload_media', function() {
423
- var field_id = $(this).parent('.option-tree-ui-upload-parent').find('input').attr('id'),
424
- post_id = $(this).attr('rel'),
425
- save_attachment_id = $('#'+field_id).hasClass('ot-upload-attachment-id'),
426
- btnContent = '';
427
- if ( window.wp && wp.media ) {
428
- window.ot_media_frame = window.ot_media_frame || new wp.media.view.MediaFrame.Select({
429
- title: $(this).attr('title'),
430
- button: {
431
- text: option_tree.upload_text
432
- },
433
- multiple: false
434
- });
435
- window.ot_media_frame.on('select', function() {
436
- var attachment = window.ot_media_frame.state().get('selection').first(),
437
- href = attachment.attributes.url,
438
- attachment_id = attachment.attributes.id,
439
- mime = attachment.attributes.mime,
440
- regex = /^image\/(?:jpe?g|png|gif|x-icon)$/i;
441
- if ( mime.match(regex) ) {
442
- btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
443
- }
444
- btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="'+option_tree.remove_media_text+'"><span class="icon ot-icon-minus-circle"></span>'+option_tree.remove_media_text+'</a>';
445
- $('#'+field_id).val( ( save_attachment_id ? attachment_id : href ) );
446
- $('#'+field_id+'_media').remove();
447
- $('#'+field_id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+field_id+'_media" />');
448
- $('#'+field_id+'_media').append(btnContent).slideDown();
449
- window.ot_media_frame.off('select');
450
- }).open();
451
- } else {
452
- var backup = window.send_to_editor,
453
- intval = window.setInterval(
454
- function() {
455
- if ( $('#TB_iframeContent').length > 0 && $('#TB_iframeContent').attr('src').indexOf( "&field_id=" ) !== -1 ) {
456
- $('#TB_iframeContent').contents().find('#tab-type_url').hide();
457
- }
458
- $('#TB_iframeContent').contents().find('.savesend .button').val(option_tree.upload_text);
459
- }, 50);
460
- tb_show('', 'media-upload.php?post_id='+post_id+'&field_id='+field_id+'&type=image&TB_iframe=1');
461
- window.send_to_editor = function(html) {
462
- var href = $(html).find('img').attr('src');
463
- if ( typeof href == 'undefined') {
464
- href = $(html).attr('src');
465
- }
466
- if ( typeof href == 'undefined') {
467
- href = $(html).attr('href');
468
- }
469
- var image = /\.(?:jpe?g|png|gif|ico)$/i;
470
- if (href.match(image) && OT_UI.url_exists(href)) {
471
- btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
472
- }
473
- btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="'+option_tree.remove_media_text+'"><span class="icon ot-icon-minus-circle"></span>'+option_tree.remove_media_text+'</a>';
474
- $('#'+field_id).val(href);
475
- $('#'+field_id+'_media').remove();
476
- $('#'+field_id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+field_id+'_media" />');
477
- $('#'+field_id+'_media').append(btnContent).slideDown();
478
- OT_UI.fix_upload_parent();
479
- tb_remove();
480
- window.clearInterval(intval);
481
- window.send_to_editor = backup;
482
- };
483
- }
484
- return false;
485
- });
486
- },
487
- init_upload_remove: function() {
488
- $(document).on('click', '.option-tree-ui-remove-media', function(event) {
489
- event.preventDefault();
490
- var agree = confirm(option_tree.remove_agree);
491
- if (agree) {
492
- OT_UI.remove_image(this);
493
- return false;
494
- }
495
- return false;
496
- });
497
- },
498
- init_upload_fix: function(elm) {
499
- var id = $(elm).attr('id'),
500
- val = $(elm).val(),
501
- img = $(elm).parent().next('.option-tree-ui-media-wrap').find('img'),
502
- src = img.attr('src'),
503
- btnContent = '';
504
- if ( val == src ) {
505
- return;
506
- }
507
- if ( val != src ) {
508
- img.attr('src', val);
509
- }
510
- if ( val !== '' && ( typeof src == 'undefined' || src == false ) && OT_UI.url_exists(val) ) {
511
- var image = /\.(?:jpe?g|png|gif|ico)$/i;
512
- if (val.match(image)) {
513
- btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+val+'" alt="" /></div>';
514
- }
515
- btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="'+option_tree.remove_media_text+'"><span class="icon ot-icon-minus-circle">'+option_tree.remove_media_text+'</span></a>';
516
- $('#'+id).val(val);
517
- $('#'+id+'_media').remove();
518
- $('#'+id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+id+'_media" />');
519
- $('#'+id+'_media').append(btnContent).slideDown();
520
- } else if ( val == '' || ! OT_UI.url_exists(val) ) {
521
- $(elm).parent().next('.option-tree-ui-media-wrap').remove();
522
- }
523
- },
524
- init_numeric_slider: function(scope) {
525
- scope = scope || document;
526
- $(".ot-numeric-slider-wrap", scope).each(function() {
527
- var hidden = $(".ot-numeric-slider-hidden-input", this),
528
- value = hidden.val(),
529
- helper = $(".ot-numeric-slider-helper-input", this);
530
- if ( ! value ) {
531
- value = hidden.data("min");
532
- helper.val(value)
533
- }
534
- $(".ot-numeric-slider", this).slider({
535
- min: hidden.data("min"),
536
- max: hidden.data("max"),
537
- step: hidden.data("step"),
538
- value: value,
539
- slide: function(event, ui) {
540
- hidden.add(helper).val(ui.value).trigger('change');
541
- },
542
- create: function() {
543
- hidden.val($(this).slider('value'));
544
- },
545
- change: function() {
546
- OT_UI.parse_condition();
547
- }
548
- });
549
- });
550
- },
551
- init_tabs: function() {
552
- $(".wrap.settings-wrap .ui-tabs").tabs({
553
- fx: {
554
- opacity: "toggle",
555
- duration: "fast"
556
- }
557
- });
558
- $(".wrap.settings-wrap .ui-tabs a.ui-tabs-anchor").on("click", function(event, ui) {
559
- var obj = "input[name='_wp_http_referer']";
560
- if ( $(obj).length > 0 ) {
561
- var url = $(obj).val(),
562
- hash = $(this).attr('href');
563
- if ( url.indexOf("#") != -1 ) {
564
- var o = url.split("#")[1],
565
- n = hash.split("#")[1];
566
- url = url.replace(o, n);
567
- } else {
568
- url = url + hash;
569
- }
570
- $(obj).val(url);
571
- }
572
- });
573
- },
574
- init_radio_image_select: function() {
575
- $(document).on('click', '.option-tree-ui-radio-image', function() {
576
- $(this).closest('.type-radio-image').find('.option-tree-ui-radio-image').removeClass('option-tree-ui-radio-image-selected');
577
- $(this).toggleClass('option-tree-ui-radio-image-selected');
578
- $(this).parent().find('.option-tree-ui-radio').prop('checked', true).trigger('change');
579
- });
580
- },
581
- init_select_wrapper: function(scope) {
582
- scope = scope || document;
583
- $('.option-tree-ui-select', scope).each(function () {
584
- if ( ! $(this).parent().hasClass('select-wrapper') ) {
585
- $(this).wrap('<div class="select-wrapper" />');
586
- $(this).parent('.select-wrapper').prepend('<span>' + $(this).find('option:selected').text() + '</span>');
587
- }
588
- });
589
- },
590
- bind_select_wrapper: function() {
591
- $(document).on('change', '.option-tree-ui-select', function () {
592
- $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
593
- });
594
- },
595
- init_google_fonts: function() {
596
- var update_items = function(input, items, element) {
597
- var itemsUI = input.closest('.type-google-font-group').find(element);
598
- if ( itemsUI.length ) {
599
- itemsUI.empty();
600
- itemsUI.append($.map(items, function(item) {
601
- var input = document.createElement('input'),
602
- label = document.createElement('label');
603
- input.type = 'checkbox';
604
- input.id = ( itemsUI.data('field-id-prefix') || '' ) + item;
605
- input.name = ( itemsUI.data('field-name') || '' ) + '[]';
606
- input.value = item;
607
- label.innerHTML = item;
608
- $( label ).attr( 'for', input.id );
609
- return $( document.createElement('p') ).addClass('checkbox-wrap').append([input, label]);
610
- }));
611
- }
612
- };
613
- $(document).on('change', '.option-tree-google-font-family select', function() {
614
- var input = $(this);
615
- $.ajax({
616
- url: option_tree.ajax,
617
- type: 'POST',
618
- dataType: 'json',
619
- data: {
620
- action: 'ot_google_font',
621
- family: input.val(),
622
- field_id: input.attr('id')
623
- }
624
- }).done(function(response) {
625
- if ( response.hasOwnProperty('variants') ) {
626
- update_items( input, response.variants, '.option-tree-google-font-variants' );
627
- }
628
- if ( response.hasOwnProperty('subsets') ) {
629
- update_items( input, response.subsets, '.option-tree-google-font-subsets' );
630
- }
631
- });
632
- });
633
- $('.js-add-google-font').on('click', function (event) {
634
- var $group = $(this).parent('.format-setting-inner').find('.type-google-font-group'),
635
- $el_clone = $(this).prev('.type-google-font-group-clone'),
636
- $clone = $el_clone.clone(true),
637
- $count = $group.length ? $group.length : 0;
638
- $clone.attr('class', 'type-google-font-group');
639
- var replacer = function(index, elm) {
640
- return elm.replace('%key%', $count);
641
- }
642
- $('select', $clone).each( function() {
643
- $(this).attr('id', replacer ).attr('name', replacer );
644
- });
645
- $('.option-tree-google-font-variants', $clone).each( function() {
646
- $(this).attr('data-field-id-prefix', replacer ).attr('data-field-name', replacer );
647
- });
648
- $('.option-tree-google-font-subsets', $clone).each( function() {
649
- $(this).attr('data-field-id-prefix', replacer ).attr('data-field-name', replacer );
650
- });
651
- $el_clone.before($clone)
652
- event.preventDefault()
653
- });
654
- $('.js-remove-google-font').on('click', function (event) {
655
- $(this).parents('.type-google-font-group').remove();
656
- event.preventDefault();
657
- });
658
- },
659
- bind_colorpicker: function(field_id) {
660
- $('#'+field_id).wpColorPicker({
661
- change: function() {
662
- OT_UI.parse_condition();
663
- },
664
- clear: function() {
665
- OT_UI.parse_condition();
666
- }
667
- });
668
- },
669
- bind_date_picker: function(field_id, date_format) {
670
- $('#'+field_id).datepicker({
671
- showOtherMonths: true,
672
- showButtonPanel: true,
673
- currentText: option_tree.date_current,
674
- closeText: option_tree.date_close,
675
- dateFormat: date_format
676
- });
677
- },
678
- bind_date_time_picker: function(field_id, date_format) {
679
- $('#'+field_id).datetimepicker({
680
- showOtherMonths: true,
681
- closeText: option_tree.date_close,
682
- dateFormat: date_format
683
- });
684
- },
685
- fix_upload_parent: function() {
686
- $('.option-tree-ui-upload-input').not('.ot-upload-attachment-id').on('focus blur', function(){
687
- $(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
688
- OT_UI.init_upload_fix(this);
689
- });
690
- },
691
- remove_image: function(e) {
692
- $(e).parent().parent().find('.option-tree-ui-upload-input').attr('value','');
693
- $(e).parent('.option-tree-ui-media-wrap').remove();
694
- },
695
- fix_textarea: function() {
696
- $('.wp-editor-area').focus( function(){
697
- $(this).parent('div').css({borderColor:'#bbb'});
698
- }).blur( function(){
699
- $(this).parent('div').css({borderColor:'#ccc'});
700
- });
701
- },
702
- replicate_ajax: function() {
703
- if (location.href.indexOf("#") != -1) {
704
- var url = $("input[name=\'_wp_http_referer\']").val(),
705
- hash = location.href.substr(location.href.indexOf("#"));
706
- $("input[name=\'_wp_http_referer\']").val( url + hash );
707
- this.scroll_to_top();
708
- }
709
- setTimeout( function() {
710
- $(".wrap.settings-wrap .fade").fadeOut("fast");
711
- }, 3000 );
712
- },
713
- reset_settings: function() {
714
- $(document).on("click", ".reset-settings", function(event){
715
- var agree = confirm(option_tree.reset_agree);
716
- if (agree) {
717
- return true;
718
- } else {
719
- return false;
720
- }
721
- event.preventDefault();
722
- });
723
- },
724
- css_editor_mode: function() {
725
- $('.ot-css-editor').each(function() {
726
- var editor = ace.edit($(this).attr('id'));
727
- var this_textarea = $('#textarea_' + $(this).attr('id'));
728
- editor.setTheme("ace/theme/chrome");
729
- editor.getSession().setMode("ace/mode/css");
730
- editor.setShowPrintMargin( false );
731
-
732
- editor.getSession().setValue(this_textarea.val());
733
- editor.getSession().on('change', function(){
734
- this_textarea.val(editor.getSession().getValue());
735
- });
736
- this_textarea.on('change', function(){
737
- editor.getSession().setValue(this_textarea.val());
738
- });
739
- });
740
- },
741
- javascript_editor_mode: function() {
742
- $('.ot-javascript-editor').each(function() {
743
- var editor = ace.edit($(this).attr('id'));
744
- var this_textarea = $('#textarea_' + $(this).attr('id'));
745
- editor.setTheme("ace/theme/chrome");
746
- editor.getSession().setMode("ace/mode/javascript");
747
- editor.setShowPrintMargin( false );
748
-
749
- editor.getSession().setValue(this_textarea.val());
750
- editor.getSession().on('change', function(){
751
- this_textarea.val(editor.getSession().getValue());
752
- });
753
- this_textarea.on('change', function(){
754
- editor.getSession().setValue(this_textarea.val());
755
- });
756
- });
757
- },
758
- load_editors: function() {
759
- OT_UI.css_editor_mode();
760
- OT_UI.javascript_editor_mode();
761
- },
762
- url_exists: function(url) {
763
- var link = document.createElement('a')
764
- link.href = url
765
- if ( link.hostname != window.location.hostname ) {
766
- return true; // Stop the code from checking across domains.
767
- }
768
- var http = new XMLHttpRequest();
769
- http.open('HEAD', url, false);
770
- http.send();
771
- return http.status!=404;
772
- },
773
- scroll_to_top: function() {
774
- setTimeout( function() {
775
- $(this).scrollTop(0);
776
- }, 50 );
777
- }
778
- };
779
- $(document).ready( function() {
780
- OT_UI.init();
781
- });
782
- })(jQuery);
783
-
784
- /* Gallery */
785
- !function ($) {
786
-
787
- ot_gallery = {
788
-
789
- frame: function (elm) {
790
-
791
- var selection = this.select(elm)
792
-
793
- this._frame = wp.media({
794
- id: 'ot-gallery-frame'
795
- , frame: 'post'
796
- , state: 'gallery-edit'
797
- , title: wp.media.view.l10n.editGalleryTitle
798
- , editing: true
799
- , multiple: true
800
- , selection: selection
801
- })
802
-
803
- this._frame.on('update', function () {
804
- var controller = ot_gallery._frame.states.get('gallery-edit')
805
- , library = controller.get('library')
806
- , ids = library.pluck('id')
807
- , parent = $(elm).parents('.format-setting-inner')
808
- , input = parent.children('.ot-gallery-value')
809
- , shortcode = wp.media.gallery.shortcode( selection ).string().replace(/\"/g,"'")
810
-
811
- input.attr('value', ids)
812
-
813
- if ( parent.children('.ot-gallery-list').length <= 0 )
814
- input.after('<ul class="ot-gallery-list" />')
815
-
816
- $.ajax({
817
- type: 'POST',
818
- url: ajaxurl,
819
- dataType: 'html',
820
- data: {
821
- action: 'gallery_update'
822
- , ids: ids
823
- },
824
- success: function(res) {
825
- parent.children('.ot-gallery-list').html(res);
826
- if ( input.hasClass('ot-gallery-shortcode') ) {
827
- input.val(shortcode);
828
- }
829
- if ( $(elm).parent().children('.ot-gallery-delete').length <= 0 ) {
830
- $(elm).parent().append('<a href="#" class="option-tree-ui-button button button-secondary hug-left ot-gallery-delete">' + option_tree.delete + '</a>');
831
- }
832
- $(elm).text(option_tree.edit);
833
- OT_UI.parse_condition();
834
- }
835
- })
836
- })
837
-
838
- return this._frame
839
-
840
- }
841
-
842
- , select: function (elm) {
843
- var input = $(elm).parents('.format-setting-inner').children('.ot-gallery-value')
844
- , ids = input.attr('value')
845
- , _shortcode = input.hasClass('ot-gallery-shortcode') ? ids : '[gallery ids=\'' + ids + '\]'
846
- , shortcode = wp.shortcode.next('gallery', ( ids ? _shortcode : wp.media.view.settings.ot_gallery.shortcode ) )
847
- , defaultPostId = wp.media.gallery.defaults.id
848
- , attachments
849
- , selection
850
-
851
- // Bail if we didn't match the shortcode or all of the content.
852
- if ( ! shortcode )
853
- return
854
-
855
- // Ignore the rest of the match object.
856
- shortcode = shortcode.shortcode
857
-
858
- if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) )
859
- shortcode.set( 'id', defaultPostId )
860
-
861
- if ( _.isUndefined( shortcode.get('ids') ) && ! input.hasClass('ot-gallery-shortcode') && ids )
862
- shortcode.set( 'ids', ids )
863
-
864
- if ( _.isUndefined( shortcode.get('ids') ) )
865
- shortcode.set( 'ids', '0' )
866
-
867
- attachments = wp.media.gallery.attachments( shortcode )
868
-
869
- selection = new wp.media.model.Selection( attachments.models, {
870
- props: attachments.props.toJSON()
871
- , multiple: true
872
- })
873
-
874
- selection.gallery = attachments.gallery
875
-
876
- // Fetch the query's attachments, and then break ties from the query to allow for sorting.
877
- selection.more().done( function () {
878
- selection.props.set({ query: false })
879
- selection.unmirror()
880
- selection.props.unset('orderby')
881
- })
882
-
883
- return selection
884
-
885
- }
886
-
887
- , open: function (elm) {
888
-
889
- ot_gallery.frame(elm).open()
890
-
891
- }
892
-
893
- , remove: function (elm) {
894
-
895
- if ( confirm( option_tree.confirm ) ) {
896
-
897
- $(elm).parents('.format-setting-inner').children('.ot-gallery-value').attr('value', '');
898
- $(elm).parents('.format-setting-inner').children('.ot-gallery-list').remove();
899
- $(elm).next('.ot-gallery-edit').text( option_tree.create );
900
- $(elm).remove();
901
- OT_UI.parse_condition();
902
-
903
- }
904
-
905
- }
906
-
907
- }
908
-
909
- // Gallery delete
910
- $(document).on('click.ot_gallery.data-api', '.ot-gallery-delete', function (e) {
911
- e.preventDefault()
912
- ot_gallery.remove($(this))
913
- })
914
-
915
- // Gallery edit
916
- $(document).on('click.ot_gallery.data-api', '.ot-gallery-edit', function (e) {
917
- e.preventDefault()
918
- ot_gallery.open($(this))
919
- })
920
-
921
- }(window.jQuery);
922
-
923
- /*!
924
- * Adds metabox tabs
925
- */
926
- !function ($) {
927
-
928
- $(document).on('ready', function () {
929
-
930
- // Loop over the metaboxes
931
- $('.ot-metabox-wrapper').each( function() {
932
-
933
- // Only if there is a tab option
934
- if ( $(this).find('.type-tab').length ) {
935
-
936
- // Add .ot-metabox-panels
937
- $(this).find('.type-tab').parents('.ot-metabox-wrapper').wrapInner('<div class="ot-metabox-panels" />')
938
-
939
- // Wrapp with .ot-metabox-tabs & add .ot-metabox-nav before .ot-metabox-panels
940
- $(this).find('.ot-metabox-panels').wrap('<div class="ot-metabox-tabs" />').before('<ul class="ot-metabox-nav" />')
941
-
942
- // Loop over settings and build the tabs nav
943
- $(this).find('.format-settings').each( function() {
944
-
945
- if ( $(this).find('.type-tab').length > 0 ) {
946
- var title = $(this).find('.type-tab').prev().find('label').text()
947
- , id = $(this).attr('id')
948
-
949
- // Add a class, hide & append nav item
950
- $(this).addClass('is-panel').hide()
951
- $(this).parents('.ot-metabox-panels').prev('.ot-metabox-nav').append('<li><a href="#' + id + '">' + title + '</a></li>')
952
-
953
- }
954
-
955
- })
956
-
957
- // Loop over the panels and wrap and ID them.
958
- $(this).find('.is-panel').each( function() {
959
- var id = $(this).attr('id')
960
-
961
- $(this).add( $(this).nextUntil('.is-panel') ).wrapAll('<div id="' + id + '" class="tab-content" />')
962
-
963
- })
964
-
965
- // Create the tabs
966
- $(this).find('.ot-metabox-tabs').tabs({
967
- activate: function( event, ui ) {
968
- var parent = $(this).outerHeight(),
969
- child = $(this).find('.ot-metabox-panels').outerHeight() + 8,
970
- minHeight = parent - 34
971
- if ( $(this).find('.ot-metabox-panels').css('padding') == '12px' && child < parent ) {
972
- $(this).find('.ot-metabox-panels').css({ minHeight: minHeight })
973
- }
974
- OT_UI.load_editors();
975
- }
976
- })
977
-
978
- // Move the orphaned settings to the top
979
- $(this).find('.ot-metabox-panels > .format-settings').prependTo($(this))
980
-
981
- // Remove a bunch of classes to stop style conflicts.
982
- $(this).find('.ot-metabox-tabs').removeClass('ui-widget ui-widget-content ui-corner-all')
983
- $(this).find('.ot-metabox-nav').removeClass('ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all')
984
- $(this).find('.ot-metabox-nav li').removeClass('ui-state-default ui-corner-top ui-tabs-active ui-tabs-active')
985
- $(this).find('.ot-metabox-nav li').on('mouseenter mouseleave', function() { $(this).removeClass('ui-state-hover') })
986
-
987
- }
988
-
989
- })
990
-
991
- })
992
-
993
- }(window.jQuery);
994
-
995
- /*!
996
- * Adds theme option tabs
997
- */
998
- !function ($) {
999
-
1000
- $(document).on('ready', function () {
1001
-
1002
- // Loop over the theme options
1003
- $('#option-tree-settings-api .inside').each( function() {
1004
-
1005
- // Only if there is a tab option
1006
- if ( $(this).find('.type-tab').length ) {
1007
-
1008
- // Add .ot-theme-option-panels
1009
- $(this).find('.type-tab').parents('.inside').wrapInner('<div class="ot-theme-option-panels" />')
1010
-
1011
- // Wrap with .ot-theme-option-tabs & add .ot-theme-option-nav before .ot-theme-option-panels
1012
- $(this).find('.ot-theme-option-panels').wrap('<div class="ot-theme-option-tabs" />').before('<ul class="ot-theme-option-nav" />')
1013
-
1014
- // Loop over settings and build the tabs nav
1015
- $(this).find('.format-settings').each( function() {
1016
-
1017
- if ( $(this).find('.type-tab').length > 0 ) {
1018
- var title = $(this).find('.type-tab').prev().find('.label').text()
1019
- , id = $(this).attr('id')
1020
-
1021
- // Add a class, hide & append nav item
1022
- $(this).addClass('is-panel').hide()
1023
- $(this).parents('.ot-theme-option-panels').prev('.ot-theme-option-nav').append('<li><a href="#' + id + '">' + title + '</a></li>')
1024
-
1025
- } else {
1026
-
1027
- }
1028
-
1029
- })
1030
-
1031
- // Loop over the panels and wrap and ID them.
1032
- $(this).find('.is-panel').each( function() {
1033
- var id = $(this).attr('id')
1034
-
1035
- $(this).add( $(this).nextUntil('.is-panel') ).wrapAll('<div id="' + id + '" class="tab-content" />')
1036
-
1037
- })
1038
-
1039
- // Create the tabs
1040
- $(this).find('.ot-theme-option-tabs').tabs({
1041
- activate: function( event, ui ) {
1042
- OT_UI.load_editors();
1043
- }
1044
- })
1045
-
1046
- // Move the orphaned settings to the top
1047
- $(this).find('.ot-theme-option-panels > .format-settings').prependTo($(this).find('.ot-theme-option-tabs'))
1048
-
1049
- }
1050
-
1051
- })
1052
-
1053
- })
1054
-
1055
- }(window.jQuery);
1056
-
1057
- /*!
1058
- * Fixes the state of metabox radio buttons after a Drag & Drop event.
1059
- */
1060
- !function ($) {
1061
-
1062
- $(document).on('ready', function () {
1063
-
1064
- // detect mousedown and store all checked radio buttons
1065
- $('.hndle').on('mousedown', function () {
1066
-
1067
- // get parent element of .hndle selected.
1068
- // We only need to monitor radios insde the object that is being moved.
1069
- var parent_id = $(this).closest('div').attr('id')
1070
-
1071
- // set live event listener for mouse up on the content .wrap
1072
- // then give the dragged div time to settle before firing the reclick function
1073
- $('.wrap').on('mouseup', function () {
1074
-
1075
- var ot_checked_radios = {}
1076
-
1077
- // loop over all checked radio buttons inside of parent element
1078
- $('#' + parent_id + ' input[type="radio"]').each( function () {
1079
-
1080
- // stores checked radio buttons
1081
- if ( $(this).is(':checked') ) {
1082
-
1083
- ot_checked_radios[$(this).attr('name')] = $(this).val()
1084
-
1085
- }
1086
-
1087
- // write to the object
1088
- $(document).data('ot_checked_radios', ot_checked_radios)
1089
-
1090
- })
1091
-
1092
- // restore all checked radio buttons
1093
- setTimeout( function () {
1094
-
1095
- // get object of checked radio button names and values
1096
- var checked = $(document).data('ot_checked_radios')
1097
-
1098
- // step thru each object element and trigger a click on it's corresponding radio button
1099
- for ( key in checked ) {
1100
-
1101
- $('input[name="' + key + '"]').filter('[value="' + checked[key] + '"]').trigger('click')
1102
-
1103
- }
1104
-
1105
- $('.wrap').unbind('mouseup')
1106
-
1107
- }, 50 )
1108
-
1109
- })
1110
-
1111
- })
1112
-
1113
- })
1114
-
1115
- }(window.jQuery);
1116
-
1117
- /*!
1118
- * Adds opacity to the default colorpicker
1119
- *
1120
- * Derivative work of the Codestar WP Color Picker.
1121
- */
1122
- ;(function ( $, window, document, undefined ) {
1123
- 'use strict';
1124
-
1125
- // adding alpha support for Automattic Color.js toString function.
1126
- if( typeof Color.fn.toString !== undefined ) {
1127
-
1128
- Color.fn.toString = function () {
1129
-
1130
- // check for alpha
1131
- if ( this._alpha < 1 ) {
1132
- return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
1133
- }
1134
-
1135
- var hex = parseInt( this._color, 10 ).toString( 16 );
1136
-
1137
- if ( this.error ) { return ''; }
1138
-
1139
- // maybe left pad it
1140
- if ( hex.length < 6 ) {
1141
- for (var i = 6 - hex.length - 1; i >= 0; i--) {
1142
- hex = '0' + hex;
1143
- }
1144
- }
1145
-
1146
- return '#' + hex;
1147
-
1148
- };
1149
-
1150
- }
1151
-
1152
- $.ot_ParseColorValue = function( val ) {
1153
-
1154
- var value = val.replace(/\s+/g, ''),
1155
- alpha = ( value.indexOf('rgba') !== -1 ) ? parseFloat( value.replace(/^.*,(.+)\)/, '$1') * 100 ) : 100,
1156
- rgba = ( alpha < 100 ) ? true : false;
1157
-
1158
- return { value: value, alpha: alpha, rgba: rgba };
1159
-
1160
- };
1161
-
1162
- $.fn.ot_wpColorPicker = function() {
1163
-
1164
- return this.each(function() {
1165
-
1166
- var $this = $(this);
1167
-
1168
- // check for rgba enabled/disable
1169
- if( $this.data('rgba') !== false ) {
1170
-
1171
- // parse value
1172
- var picker = $.ot_ParseColorValue( $this.val() );
1173
-
1174
- // wpColorPicker core
1175
- $this.wpColorPicker({
1176
-
1177
- // wpColorPicker: change
1178
- change: function( event, ui ) {
1179
-
1180
- // update checkerboard background color
1181
- $this.closest('.wp-picker-container').find('.option-tree-opacity-slider-offset').css('background-color', ui.color.toString());
1182
- $this.trigger('keyup');
1183
-
1184
- },
1185
-
1186
- // wpColorPicker: create
1187
- create: function( event, ui ) {
1188
-
1189
- // set variables for alpha slider
1190
- var a8cIris = $this.data('a8cIris'),
1191
- $container = $this.closest('.wp-picker-container'),
1192
-
1193
- // appending alpha wrapper
1194
- $alpha_wrap = $('<div class="option-tree-opacity-wrap">' +
1195
- '<div class="option-tree-opacity-slider"></div>' +
1196
- '<div class="option-tree-opacity-slider-offset"></div>' +
1197
- '<div class="option-tree-opacity-text"></div>' +
1198
- '</div>').appendTo( $container.find('.wp-picker-holder') ),
1199
-
1200
- $alpha_slider = $alpha_wrap.find('.option-tree-opacity-slider'),
1201
- $alpha_text = $alpha_wrap.find('.option-tree-opacity-text'),
1202
- $alpha_offset = $alpha_wrap.find('.option-tree-opacity-slider-offset');
1203
-
1204
- // alpha slider
1205
- $alpha_slider.slider({
1206
-
1207
- // slider: slide
1208
- slide: function( event, ui ) {
1209
-
1210
- var slide_value = parseFloat( ui.value / 100 );
1211
-
1212
- // update iris data alpha && wpColorPicker color option && alpha text
1213
- a8cIris._color._alpha = slide_value;
1214
- $this.wpColorPicker( 'color', a8cIris._color.toString() );
1215
- $alpha_text.text( ( slide_value < 1 ? slide_value : '' ) );
1216
-
1217
- },
1218
-
1219
- // slider: create
1220
- create: function() {
1221
-
1222
- var slide_value = parseFloat( picker.alpha / 100 ),
1223
- alpha_text_value = slide_value < 1 ? slide_value : '';
1224
-
1225
- // update alpha text && checkerboard background color
1226
- $alpha_text.text(alpha_text_value);
1227
- $alpha_offset.css('background-color', picker.value);
1228
-
1229
- // wpColorPicker clear button for update iris data alpha && alpha text && slider color option
1230
- $container.on('click', '.wp-picker-clear', function() {
1231
-
1232
- a8cIris._color._alpha = 1;
1233
- $alpha_text.text('');
1234
- $alpha_slider.slider('option', 'value', 100).trigger('slide');
1235
-
1236
- });
1237
-
1238
- // wpColorPicker default button for update iris data alpha && alpha text && slider color option
1239
- $container.on('click', '.wp-picker-default', function() {
1240
-
1241
- var default_picker = $.ot_ParseColorValue( $this.data('default-color') ),
1242
- default_value = parseFloat( default_picker.alpha / 100 ),
1243
- default_text = default_value < 1 ? default_value : '';
1244
-
1245
- a8cIris._color._alpha = default_value;
1246
- $alpha_text.text(default_text);
1247
- $alpha_slider.slider('option', 'value', default_picker.alpha).trigger('slide');
1248
-
1249
- });
1250
-
1251
- // show alpha wrapper on click color picker button
1252
- $container.on('click', '.wp-color-result', function() {
1253
- $alpha_wrap.toggle();
1254
- });
1255
-
1256
- // hide alpha wrapper on click body
1257
- $('body').on( 'click.wpcolorpicker', function() {
1258
- $alpha_wrap.hide();
1259
- });
1260
-
1261
- },
1262
-
1263
- // slider: options
1264
- value: picker.alpha,
1265
- step: 1,
1266
- min: 1,
1267
- max: 100
1268
-
1269
- });
1270
- }
1271
-
1272
- });
1273
-
1274
- } else {
1275
-
1276
- // wpColorPicker default picker
1277
- $this.wpColorPicker({
1278
- change: function() {
1279
- $this.trigger('keyup');
1280
- }
1281
- });
1282
-
1283
- }
1284
-
1285
- });
1286
-
1287
- };
1288
-
1289
- $(document).ready( function(){
1290
- $('.hide-color-picker.ot-colorpicker-opacity').ot_wpColorPicker();
1291
- });
1292
-
1293
  })( jQuery, window, document );
1
+ /**
2
+ * Option Tree UI
3
+ *
4
+ * Dependencies: jQuery, jQuery UI, ColorPicker
5
+ *
6
+ * @author Derek Herman (derek@valendesigns.com)
7
+ */
8
+ ;(function($) {
9
+ OT_UI = {
10
+ processing: false,
11
+ init: function() {
12
+ this.init_hide_body();
13
+ this.init_sortable();
14
+ this.init_add();
15
+ this.init_edit();
16
+ this.init_remove();
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();
24
+ this.init_tabs();
25
+ this.init_radio_image_select();
26
+ this.init_select_wrapper();
27
+ this.bind_select_wrapper();
28
+ this.init_google_fonts();
29
+ this.fix_upload_parent();
30
+ this.fix_textarea();
31
+ this.replicate_ajax();
32
+ this.reset_settings();
33
+ this.css_editor_mode();
34
+ this.javascript_editor_mode();
35
+ },
36
+ init_hide_body: function(elm,type) {
37
+ var css = '.option-tree-setting-body';
38
+ if ( type == 'parent' ) {
39
+ $(css).not( elm.parent().parent().children(css) ).hide();
40
+ } else if ( type == 'child' ) {
41
+ elm.closest('ul').find(css).not( elm.parent().parent().children(css) ).hide();
42
+ } else if ( type == 'child-add' ) {
43
+ elm.children().find(css).hide();
44
+ } else if ( type == 'toggle' ) {
45
+ elm.parent().parent().children(css).toggle();
46
+ } else {
47
+ $(css).hide();
48
+ }
49
+ },
50
+ init_remove_active: function(elm,type) {
51
+ var css = '.option-tree-setting-edit';
52
+ if ( type == 'parent' ) {
53
+ $(css).not(elm).removeClass('active');
54
+ } else if ( type == 'child' ) {
55
+ elm.closest('ul').find(css).not(elm).removeClass('active');
56
+ } else if ( type == 'child-add' ) {
57
+ elm.children().find(css).removeClass('active');
58
+ } else {
59
+ $(css).removeClass('active');
60
+ }
61
+ },
62
+ init_sortable: function(scope) {
63
+ scope = scope || document;
64
+ $('.option-tree-sortable', scope).each( function() {
65
+ if ( $(this).children('li').length ) {
66
+ var elm = $(this);
67
+ elm.show();
68
+ elm.sortable({
69
+ items: 'li:not(.ui-state-disabled)',
70
+ handle: 'div.open',
71
+ placeholder: 'ui-state-highlight',
72
+ start: function (event, ui) {
73
+ ui.placeholder.height(ui.item.height()-2);
74
+ },
75
+ stop: function(evt, ui) {
76
+ setTimeout(
77
+ function(){
78
+ OT_UI.update_ids(elm);
79
+ },
80
+ 200
81
+ )
82
+ }
83
+ });
84
+ }
85
+ });
86
+ },
87
+ init_add: function() {
88
+ $(document).on('click', '.option-tree-section-add', function(e) {
89
+ e.preventDefault();
90
+ OT_UI.add(this,'section');
91
+ });
92
+ $(document).on('click', '.option-tree-setting-add', function(e) {
93
+ e.preventDefault();
94
+ OT_UI.add(this,'setting');
95
+ });
96
+ $(document).on('click', '.option-tree-help-add', function(e) {
97
+ e.preventDefault();
98
+ OT_UI.add(this,'the_contextual_help');
99
+ });
100
+ $(document).on('click', '.option-tree-choice-add', function(e) {
101
+ e.preventDefault();
102
+ OT_UI.add(this,'choice');
103
+ });
104
+ $(document).on('click', '.option-tree-list-item-add', function(e) {
105
+ e.preventDefault();
106
+ OT_UI.add(this,'list_item');
107
+ });
108
+ $(document).on('click', '.option-tree-social-links-add', function(e) {
109
+ e.preventDefault();
110
+ OT_UI.add(this,'social_links');
111
+ });
112
+ $(document).on('click', '.option-tree-list-item-setting-add', function(e) {
113
+ e.preventDefault();
114
+ if ( $(this).parents('ul').parents('ul').hasClass('ui-sortable') ) {
115
+ alert(option_tree.setting_limit);
116
+ return false;
117
+ }
118
+ OT_UI.add(this,'list_item_setting');
119
+ });
120
+ },
121
+ init_edit: function() {
122
+ $(document).on('click', '.option-tree-setting-edit', function(e) {
123
+ e.preventDefault();
124
+ if ( $(this).parents().hasClass('option-tree-setting-body') ) {
125
+ OT_UI.init_remove_active($(this),'child');
126
+ OT_UI.init_hide_body($(this),'child');
127
+ } else {
128
+ OT_UI.init_remove_active($(this),'parent');
129
+ OT_UI.init_hide_body($(this), 'parent');
130
+ }
131
+ $(this).toggleClass('active');
132
+ OT_UI.init_hide_body($(this), 'toggle');
133
+ });
134
+ },
135
+ init_remove: function() {
136
+ $(document).on('click', '.option-tree-setting-remove', function(event) {
137
+ event.preventDefault();
138
+ if ( $(this).parents('li').hasClass('ui-state-disabled') ) {
139
+ alert(option_tree.remove_no);
140
+ return false;
141
+ }
142
+ var agree = confirm(option_tree.remove_agree);
143
+ if (agree) {
144
+ var list = $(this).parents('ul');
145
+ OT_UI.remove(this);
146
+ setTimeout( function() {
147
+ OT_UI.update_ids(list);
148
+ }, 200 );
149
+ }
150
+ return false;
151
+ });
152
+ },
153
+ init_edit_title: function() {
154
+ $(document).on('keyup', '.option-tree-setting-title', function() {
155
+ OT_UI.edit_title(this);
156
+ });
157
+ // Automatically fill option IDs with clean versions of their respective option labels
158
+ $(document).on('blur', '.option-tree-setting-title', function() {
159
+ var optionId = $(this).parents('.option-tree-setting-body').find('[type="text"][name$="id]"]')
160
+ if ( optionId.val() === '' ) {
161
+ optionId.val($(this).val().replace(/[^a-z0-9]/gi,'_').toLowerCase());
162
+ }
163
+ });
164
+ },
165
+ init_edit_id: function() {
166
+ $(document).on('keyup', '.section-id', function(){
167
+ OT_UI.update_id(this);
168
+ });
169
+ },
170
+ init_activate_layout: function() {
171
+ $(document).on('click', '.option-tree-layout-activate', function() {
172
+ var active = $(this).parents('.option-tree-setting').find('.open').text();
173
+ $('.option-tree-layout-activate').removeClass('active');
174
+ $(this).toggleClass('active');
175
+ $('.active-layout-input').attr({'value':active});
176
+ });
177
+ $(document).on('change', '#option-tree-options-layouts-form select', function() {
178
+ var agree = confirm(option_tree.activate_layout_agree);
179
+ if (agree) {
180
+ $('#option-tree-options-layouts-form').submit();
181
+ } else {
182
+ var active = $('#the_current_layout').attr('value');
183
+ $('#option-tree-options-layouts-form select option[value="' + active + '"]').attr({'selected':'selected'});
184
+ $('#option-tree-options-layouts-form select').prev('span').replaceWith('<span>' + active + '</span>');
185
+ }
186
+ });
187
+ },
188
+ add: function(elm,type) {
189
+ var self = this,
190
+ list = '',
191
+ list_class = '',
192
+ name = '',
193
+ post_id = 0,
194
+ get_option = '',
195
+ settings = '';
196
+ if ( type == 'the_contextual_help' ) {
197
+ list = $(elm).parent().find('ul:last');
198
+ list_class = 'list-contextual-help';
199
+ } else if ( type == 'choice' ) {
200
+ list = $(elm).parent().children('ul');
201
+ list_class = 'list-choice';
202
+ } else if ( type == 'list_item' ) {
203
+ list = $(elm).parent().children('ul');
204
+ list_class = 'list-sub-setting';
205
+ } else if ( type == 'list_item_setting' ) {
206
+ list = $(elm).parent().children('ul');
207
+ list_class = 'list-sub-setting';
208
+ } else if ( type == 'social_links' ) {
209
+ list = $(elm).parent().children('ul');
210
+ list_class = 'list-sub-setting';
211
+ } else {
212
+ list = $(elm).parent().find('ul:first');
213
+ list_class = ( type == 'section' ) ? 'list-section' : 'list-setting';
214
+ }
215
+ name = list.data('name');
216
+ post_id = list.data('id');
217
+ get_option = list.data('getOption');
218
+ settings = $('#'+name+'_settings_array').val();
219
+ if ( this.processing === false ) {
220
+ this.processing = true;
221
+ var count = parseInt(list.children('li').length);
222
+ if ( type == 'list_item' || type == 'social_links' ) {
223
+ list.find('li input.option-tree-setting-title', self).each(function(){
224
+ var setting = $(this).attr('name'),
225
+ regex = /\[([0-9]+)\]/,
226
+ matches = setting.match(regex),
227
+ id = null != matches ? parseInt(matches[1]) : 0;
228
+ id++;
229
+ if ( id > count) {
230
+ count = id;
231
+ }
232
+ });
233
+ }
234
+ $.ajax({
235
+ url: option_tree.ajax,
236
+ type: 'post',
237
+ data: {
238
+ action: 'add_' + type,
239
+ count: count,
240
+ name: name,
241
+ post_id: post_id,
242
+ get_option: get_option,
243
+ settings: settings,
244
+ type: type,
245
+ nonce: option_tree.nonce
246
+ },
247
+ complete: function( data ) {
248
+ if ( type == 'choice' || type == 'list_item_setting' ) {
249
+ OT_UI.init_remove_active(list,'child-add');
250
+ OT_UI.init_hide_body(list,'child-add');
251
+ } else {
252
+ OT_UI.init_remove_active();
253
+ OT_UI.init_hide_body();
254
+ }
255
+ var listItem = $('<li class="ui-state-default ' + list_class + '">' + data.responseText + '</li>');
256
+ list.append(listItem);
257
+ list.children().last().find('.option-tree-setting-edit').toggleClass('active');
258
+ list.children().last().find('.option-tree-setting-body').toggle();
259
+ list.children().last().find('.option-tree-setting-title').focus();
260
+ if ( type != 'the_contextual_help' ) {
261
+ OT_UI.update_ids(list);
262
+ }
263
+ OT_UI.init_sortable(listItem);
264
+ OT_UI.init_select_wrapper(listItem);
265
+ OT_UI.init_numeric_slider(listItem);
266
+ OT_UI.parse_condition();
267
+ self.processing = false;
268
+ }
269
+ });
270
+ }
271
+ },
272
+ remove: function(e) {
273
+ $(e).parent().parent().parent('li').remove();
274
+ },
275
+ edit_title: function(e) {
276
+ if ( this.timer ) {
277
+ clearTimeout(e.timer);
278
+ }
279
+ this.timer = setTimeout( function() {
280
+ $(e).parent().parent().parent().parent().parent().children('.open').text(e.value);
281
+ }, 100);
282
+ return true;
283
+ },
284
+ update_id: function(e) {
285
+ if ( this.timer ) {
286
+ clearTimeout(e.timer);
287
+ }
288
+ this.timer = setTimeout( function() {
289
+ OT_UI.update_ids($(e).parents('ul'));
290
+ }, 100);
291
+ return true;
292
+ },
293
+ update_ids: function(list) {
294
+ var last_section, section, list_items = list.children('li');
295
+ list_items.each(function(index) {
296
+ if ( $(this).hasClass('list-section') ) {
297
+ section = $(this).find('.section-id').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
298
+ if (!section) {
299
+ section = $(this).find('.section-title').val().trim().toLowerCase().replace(/[^a-z0-9]/gi,'_');
300
+ }
301
+ if (!section) {
302
+ section = last_section;
303
+ }
304
+ }
305
+ if ($(this).hasClass('list-setting') ) {
306
+ $(this).find('.hidden-section').attr({'value':section});
307
+ }
308
+ last_section = section;
309
+ });
310
+ },
311
+ condition_objects: function() {
312
+ return 'select, input[type="radio"]:checked, input[type="text"], input[type="hidden"], input.ot-numeric-slider-hidden-input';
313
+ },
314
+ match_conditions: function(condition) {
315
+ var match;
316
+ var regex = /(.+?):(is|not|contains|less_than|less_than_or_equal_to|greater_than|greater_than_or_equal_to)\((.*?)\),?/g;
317
+ var conditions = [];
318
+
319
+ while( match = regex.exec( condition ) ) {
320
+ conditions.push({
321
+ 'check': match[1],
322
+ 'rule': match[2],
323
+ 'value': match[3] || ''
324
+ });
325
+ }
326
+
327
+ return conditions;
328
+ },
329
+ parse_condition: function() {
330
+ $( '.format-settings[id^="setting_"][data-condition]' ).each(function() {
331
+
332
+ var passed;
333
+ var conditions = OT_UI.match_conditions( $( this ).data( 'condition' ) );
334
+ var operator = ( $( this ).data( 'operator' ) || 'and' ).toLowerCase();
335
+
336
+ $.each( conditions, function( index, condition ) {
337
+
338
+ var target = $( '#setting_' + condition.check );
339
+ var targetEl = !! target.length && target.find( OT_UI.condition_objects() ).first();
340
+
341
+ if ( ! target.length || ( ! targetEl.length && condition.value.toString() != '' ) ) {
342
+ return;
343
+ }
344
+
345
+ var v1 = targetEl.length ? targetEl.val().toString() : '';
346
+ var v2 = condition.value.toString();
347
+ var result;
348
+
349
+ switch ( condition.rule ) {
350
+ case 'less_than':
351
+ result = ( parseInt( v1 ) < parseInt( v2 ) );
352
+ break;
353
+ case 'less_than_or_equal_to':
354
+ result = ( parseInt( v1 ) <= parseInt( v2 ) );
355
+ break;
356
+ case 'greater_than':
357
+ result = ( parseInt( v1 ) > parseInt( v2 ) );
358
+ break;
359
+ case 'greater_than_or_equal_to':
360
+ result = ( parseInt( v1 ) >= parseInt( v2 ) );
361
+ break;
362
+ case 'contains':
363
+ result = ( v1.indexOf(v2) !== -1 ? true : false );
364
+ break;
365
+ case 'is':
366
+ result = ( v1 == v2 );
367
+ break;
368
+ case 'not':
369
+ result = ( v1 != v2 );
370
+ break;
371
+ }
372
+
373
+ if ( 'undefined' == typeof passed ) {
374
+ passed = result;
375
+ }
376
+
377
+ switch ( operator ) {
378
+ case 'or':
379
+ passed = ( passed || result );
380
+ break;
381
+ case 'and':
382
+ default:
383
+ passed = ( passed && result );
384
+ break;
385
+ }
386
+
387
+ });
388
+
389
+ if ( passed ) {
390
+ $(this).animate({opacity: 'show' , height: 'show'}, 200);
391
+ } else {
392
+ $(this).animate({opacity: 'hide' , height: 'hide'}, 200);
393
+ }
394
+
395
+ delete passed;
396
+
397
+ });
398
+ },
399
+ init_conditions: function() {
400
+ var delay = (function() {
401
+ var timer = 0;
402
+ return function(callback, ms) {
403
+ clearTimeout(timer);
404
+ timer = setTimeout(callback, ms);
405
+ };
406
+ })();
407
+
408
+ $('.format-settings[id^="setting_"]').on( 'change.conditionals, keyup.conditionals', OT_UI.condition_objects(), function(e) {
409
+ if (e.type === 'keyup') {
410
+ // handle keyup event only once every 500ms
411
+ delay(function() {
412
+ OT_UI.parse_condition();
413
+ }, 500);
414
+ } else {
415
+ OT_UI.parse_condition();
416
+ }
417
+ OT_UI.load_editors();
418
+ });
419
+ OT_UI.parse_condition();
420
+ },
421
+ init_upload: function() {
422
+ $(document).on('click', '.ot_upload_media', function() {
423
+ var field_id = $(this).parent('.option-tree-ui-upload-parent').find('input').attr('id'),
424
+ post_id = $(this).attr('rel'),
425
+ save_attachment_id = $('#'+field_id).hasClass('ot-upload-attachment-id'),
426
+ btnContent = '';
427
+ if ( window.wp && wp.media ) {
428
+ window.ot_media_frame = window.ot_media_frame || new wp.media.view.MediaFrame.Select({
429
+ title: $(this).attr('title'),
430
+ button: {
431
+ text: option_tree.upload_text
432
+ },
433
+ multiple: false
434
+ });
435
+ window.ot_media_frame.on('select', function() {
436
+ var attachment = window.ot_media_frame.state().get('selection').first(),
437
+ href = attachment.attributes.url,
438
+ attachment_id = attachment.attributes.id,
439
+ mime = attachment.attributes.mime,
440
+ regex = /^image\/(?:jpe?g|png|gif|x-icon)$/i;
441
+ if ( mime.match(regex) ) {
442
+ btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
443
+ }
444
+ btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="'+option_tree.remove_media_text+'"><span class="icon ot-icon-minus-circle"></span>'+option_tree.remove_media_text+'</a>';
445
+ $('#'+field_id).val( ( save_attachment_id ? attachment_id : href ) );
446
+ $('#'+field_id+'_media').remove();
447
+ $('#'+field_id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+field_id+'_media" />');
448
+ $('#'+field_id+'_media').append(btnContent).slideDown();
449
+ window.ot_media_frame.off('select');
450
+ }).open();
451
+ } else {
452
+ var backup = window.send_to_editor,
453
+ intval = window.setInterval(
454
+ function() {
455
+ if ( $('#TB_iframeContent').length > 0 && $('#TB_iframeContent').attr('src').indexOf( "&field_id=" ) !== -1 ) {
456
+ $('#TB_iframeContent').contents().find('#tab-type_url').hide();
457
+ }
458
+ $('#TB_iframeContent').contents().find('.savesend .button').val(option_tree.upload_text);
459
+ }, 50);
460
+ tb_show('', 'media-upload.php?post_id='+post_id+'&field_id='+field_id+'&type=image&TB_iframe=1');
461
+ window.send_to_editor = function(html) {
462
+ var href = $(html).find('img').attr('src');
463
+ if ( typeof href == 'undefined') {
464
+ href = $(html).attr('src');
465
+ }
466
+ if ( typeof href == 'undefined') {
467
+ href = $(html).attr('href');
468
+ }
469
+ var image = /\.(?:jpe?g|png|gif|ico)$/i;
470
+ if (href.match(image) && OT_UI.url_exists(href)) {
471
+ btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+href+'" alt="" /></div>';
472
+ }
473
+ btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="'+option_tree.remove_media_text+'"><span class="icon ot-icon-minus-circle"></span>'+option_tree.remove_media_text+'</a>';
474
+ $('#'+field_id).val(href);
475
+ $('#'+field_id+'_media').remove();
476
+ $('#'+field_id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+field_id+'_media" />');
477
+ $('#'+field_id+'_media').append(btnContent).slideDown();
478
+ OT_UI.fix_upload_parent();
479
+ tb_remove();
480
+ window.clearInterval(intval);
481
+ window.send_to_editor = backup;
482
+ };
483
+ }
484
+ return false;
485
+ });
486
+ },
487
+ init_upload_remove: function() {
488
+ $(document).on('click', '.option-tree-ui-remove-media', function(event) {
489
+ event.preventDefault();
490
+ var agree = confirm(option_tree.remove_agree);
491
+ if (agree) {
492
+ OT_UI.remove_image(this);
493
+ return false;
494
+ }
495
+ return false;
496
+ });
497
+ },
498
+ init_upload_fix: function(elm) {
499
+ var id = $(elm).attr('id'),
500
+ val = $(elm).val(),
501
+ img = $(elm).parent().next('.option-tree-ui-media-wrap').find('img'),
502
+ src = img.attr('src'),
503
+ btnContent = '';
504
+ if ( val == src ) {
505
+ return;
506
+ }
507
+ if ( val != src ) {
508
+ img.attr('src', val);
509
+ }
510
+ if ( val !== '' && ( typeof src == 'undefined' || src == false ) && OT_UI.url_exists(val) ) {
511
+ var image = /\.(?:jpe?g|png|gif|ico)$/i;
512
+ if (val.match(image)) {
513
+ btnContent += '<div class="option-tree-ui-image-wrap"><img src="'+val+'" alt="" /></div>';
514
+ }
515
+ btnContent += '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="'+option_tree.remove_media_text+'"><span class="icon ot-icon-minus-circle">'+option_tree.remove_media_text+'</span></a>';
516
+ $('#'+id).val(val);
517
+ $('#'+id+'_media').remove();
518
+ $('#'+id).parent().parent('div').append('<div class="option-tree-ui-media-wrap" id="'+id+'_media" />');
519
+ $('#'+id+'_media').append(btnContent).slideDown();
520
+ } else if ( val == '' || ! OT_UI.url_exists(val) ) {
521
+ $(elm).parent().next('.option-tree-ui-media-wrap').remove();
522
+ }
523
+ },
524
+ init_numeric_slider: function(scope) {
525
+ scope = scope || document;
526
+ $(".ot-numeric-slider-wrap", scope).each(function() {
527
+ var hidden = $(".ot-numeric-slider-hidden-input", this),
528
+ value = hidden.val(),
529
+ helper = $(".ot-numeric-slider-helper-input", this);
530
+ if ( ! value ) {
531
+ value = hidden.data("min");
532
+ helper.val(value)
533
+ }
534
+ $(".ot-numeric-slider", this).slider({
535
+ min: hidden.data("min"),
536
+ max: hidden.data("max"),
537
+ step: hidden.data("step"),
538
+ value: value,
539
+ slide: function(event, ui) {
540
+ hidden.add(helper).val(ui.value).trigger('change');
541
+ },
542
+ create: function() {
543
+ hidden.val($(this).slider('value'));
544
+ },
545
+ change: function() {
546
+ OT_UI.parse_condition();
547
+ }
548
+ });
549
+ });
550
+ },
551
+ init_tabs: function() {
552
+ $(".wrap.settings-wrap .ui-tabs").tabs({
553
+ fx: {
554
+ opacity: "toggle",
555
+ duration: "fast"
556
+ }
557
+ });
558
+ $(".wrap.settings-wrap .ui-tabs a.ui-tabs-anchor").on("click", function(event, ui) {
559
+ var obj = "input[name='_wp_http_referer']";
560
+ if ( $(obj).length > 0 ) {
561
+ var url = $(obj).val(),
562
+ hash = $(this).attr('href');
563
+ if ( url.indexOf("#") != -1 ) {
564
+ var o = url.split("#")[1],
565
+ n = hash.split("#")[1];
566
+ url = url.replace(o, n);
567
+ } else {
568
+ url = url + hash;
569
+ }
570
+ $(obj).val(url);
571
+ }
572
+ });
573
+ },
574
+ init_radio_image_select: function() {
575
+ $(document).on('click', '.option-tree-ui-radio-image', function() {
576
+ $(this).closest('.type-radio-image').find('.option-tree-ui-radio-image').removeClass('option-tree-ui-radio-image-selected');
577
+ $(this).toggleClass('option-tree-ui-radio-image-selected');
578
+ $(this).parent().find('.option-tree-ui-radio').prop('checked', true).trigger('change');
579
+ });
580
+ },
581
+ init_select_wrapper: function(scope) {
582
+ scope = scope || document;
583
+ $('.option-tree-ui-select', scope).each(function () {
584
+ if ( ! $(this).parent().hasClass('select-wrapper') ) {
585
+ $(this).wrap('<div class="select-wrapper" />');
586
+ $(this).parent('.select-wrapper').prepend('<span>' + $(this).find('option:selected').text() + '</span>');
587
+ }
588
+ });
589
+ },
590
+ bind_select_wrapper: function() {
591
+ $(document).on('change', '.option-tree-ui-select', function () {
592
+ $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
593
+ });
594
+ },
595
+ init_google_fonts: function() {
596
+ var update_items = function(input, items, element) {
597
+ var itemsUI = input.closest('.type-google-font-group').find(element);
598
+ if ( itemsUI.length ) {
599
+ itemsUI.empty();
600
+ itemsUI.append($.map(items, function(item) {
601
+ var input = document.createElement('input'),
602
+ label = document.createElement('label');
603
+ input.type = 'checkbox';
604
+ input.id = ( itemsUI.data('field-id-prefix') || '' ) + item;
605
+ input.name = ( itemsUI.data('field-name') || '' ) + '[]';
606
+ input.value = item;
607
+ label.innerHTML = item;
608
+ $( label ).attr( 'for', input.id );
609
+ return $( document.createElement('p') ).addClass('checkbox-wrap').append([input, label]);
610
+ }));
611
+ }
612
+ };
613
+ $(document).on('change', '.option-tree-google-font-family select', function() {
614
+ var input = $(this);
615
+ $.ajax({
616
+ url: option_tree.ajax,
617
+ type: 'POST',
618
+ dataType: 'json',
619
+ data: {
620
+ action: 'ot_google_font',
621
+ family: input.val(),
622
+ field_id: input.attr('id')
623
+ }
624
+ }).done(function(response) {
625
+ if ( response.hasOwnProperty('variants') ) {
626
+ update_items( input, response.variants, '.option-tree-google-font-variants' );
627
+ }
628
+ if ( response.hasOwnProperty('subsets') ) {
629
+ update_items( input, response.subsets, '.option-tree-google-font-subsets' );
630
+ }
631
+ });
632
+ });
633
+ $('.js-add-google-font').on('click', function (event) {
634
+ var $group = $(this).parent('.format-setting-inner').find('.type-google-font-group'),
635
+ $el_clone = $(this).prev('.type-google-font-group-clone'),
636
+ $clone = $el_clone.clone(true),
637
+ $count = $group.length ? $group.length : 0;
638
+ $clone.attr('class', 'type-google-font-group');
639
+ var replacer = function(index, elm) {
640
+ return elm.replace('%key%', $count);
641
+ }
642
+ $('select', $clone).each( function() {
643
+ $(this).attr('id', replacer ).attr('name', replacer );
644
+ });
645
+ $('.option-tree-google-font-variants', $clone).each( function() {
646
+ $(this).attr('data-field-id-prefix', replacer ).attr('data-field-name', replacer );
647
+ });
648
+ $('.option-tree-google-font-subsets', $clone).each( function() {
649
+ $(this).attr('data-field-id-prefix', replacer ).attr('data-field-name', replacer );
650
+ });
651
+ $el_clone.before($clone)
652
+ event.preventDefault()
653
+ });
654
+ $('.js-remove-google-font').on('click', function (event) {
655
+ $(this).parents('.type-google-font-group').remove();
656
+ event.preventDefault();
657
+ });
658
+ },
659
+ bind_colorpicker: function(field_id) {
660
+ $('#'+field_id).wpColorPicker({
661
+ change: function() {
662
+ OT_UI.parse_condition();
663
+ },
664
+ clear: function() {
665
+ OT_UI.parse_condition();
666
+ }
667
+ });
668
+ },
669
+ bind_date_picker: function(field_id, date_format) {
670
+ $('#'+field_id).datepicker({
671
+ showOtherMonths: true,
672
+ showButtonPanel: true,
673
+ currentText: option_tree.date_current,
674
+ closeText: option_tree.date_close,
675
+ dateFormat: date_format
676
+ });
677
+ },
678
+ bind_date_time_picker: function(field_id, date_format) {
679
+ $('#'+field_id).datetimepicker({
680
+ showOtherMonths: true,
681
+ closeText: option_tree.date_close,
682
+ dateFormat: date_format
683
+ });
684
+ },
685
+ fix_upload_parent: function() {
686
+ $('.option-tree-ui-upload-input').not('.ot-upload-attachment-id').on('focus blur', function(){
687
+ $(this).parent('.option-tree-ui-upload-parent').toggleClass('focus');
688
+ OT_UI.init_upload_fix(this);
689
+ });
690
+ },
691
+ remove_image: function(e) {
692
+ $(e).parent().parent().find('.option-tree-ui-upload-input').attr('value','');
693
+ $(e).parent('.option-tree-ui-media-wrap').remove();
694
+ },
695
+ fix_textarea: function() {
696
+ $('.wp-editor-area').focus( function(){
697
+ $(this).parent('div').css({borderColor:'#bbb'});
698
+ }).blur( function(){
699
+ $(this).parent('div').css({borderColor:'#ccc'});
700
+ });
701
+ },
702
+ replicate_ajax: function() {
703
+ if (location.href.indexOf("#") != -1) {
704
+ var url = $("input[name=\'_wp_http_referer\']").val(),
705
+ hash = location.href.substr(location.href.indexOf("#"));
706
+ $("input[name=\'_wp_http_referer\']").val( url + hash );
707
+ this.scroll_to_top();
708
+ }
709
+ setTimeout( function() {
710
+ $(".wrap.settings-wrap .fade").fadeOut("fast");
711
+ }, 3000 );
712
+ },
713
+ reset_settings: function() {
714
+ $(document).on("click", ".reset-settings", function(event){
715
+ var agree = confirm(option_tree.reset_agree);
716
+ if (agree) {
717
+ return true;
718
+ } else {
719
+ return false;
720
+ }
721
+ event.preventDefault();
722
+ });
723
+ },
724
+ css_editor_mode: function() {
725
+ $('.ot-css-editor').each(function() {
726
+ var editor = ace.edit($(this).attr('id'));
727
+ var this_textarea = $('#textarea_' + $(this).attr('id'));
728
+ editor.setTheme("ace/theme/chrome");
729
+ editor.getSession().setMode("ace/mode/css");
730
+ editor.setShowPrintMargin( false );
731
+
732
+ editor.getSession().setValue(this_textarea.val());
733
+ editor.getSession().on('change', function(){
734
+ this_textarea.val(editor.getSession().getValue());
735
+ });
736
+ this_textarea.on('change', function(){
737
+ editor.getSession().setValue(this_textarea.val());
738
+ });
739
+ });
740
+ },
741
+ javascript_editor_mode: function() {
742
+ $('.ot-javascript-editor').each(function() {
743
+ var editor = ace.edit($(this).attr('id'));
744
+ var this_textarea = $('#textarea_' + $(this).attr('id'));
745
+ editor.setTheme("ace/theme/chrome");
746
+ editor.getSession().setMode("ace/mode/javascript");
747
+ editor.setShowPrintMargin( false );
748
+
749
+ editor.getSession().setValue(this_textarea.val());
750
+ editor.getSession().on('change', function(){
751
+ this_textarea.val(editor.getSession().getValue());
752
+ });
753
+ this_textarea.on('change', function(){
754
+ editor.getSession().setValue(this_textarea.val());
755
+ });
756
+ });
757
+ },
758
+ load_editors: function() {
759
+ OT_UI.css_editor_mode();
760
+ OT_UI.javascript_editor_mode();
761
+ },
762
+ url_exists: function(url) {
763
+ var link = document.createElement('a')
764
+ link.href = url
765
+ if ( link.hostname != window.location.hostname ) {
766
+ return true; // Stop the code from checking across domains.
767
+ }
768
+ var http = new XMLHttpRequest();
769
+ http.open('HEAD', url, false);
770
+ http.send();
771
+ return http.status!=404;
772
+ },
773
+ scroll_to_top: function() {
774
+ setTimeout( function() {
775
+ $(this).scrollTop(0);
776
+ }, 50 );
777
+ }
778
+ };
779
+ $(document).ready( function() {
780
+ OT_UI.init();
781
+ });
782
+ })(jQuery);
783
+
784
+ /* Gallery */
785
+ !function ($) {
786
+
787
+ ot_gallery = {
788
+
789
+ frame: function (elm) {
790
+
791
+ var selection = this.select(elm)
792
+
793
+ this._frame = wp.media({
794
+ id: 'ot-gallery-frame'
795
+ , frame: 'post'
796
+ , state: 'gallery-edit'
797
+ , title: wp.media.view.l10n.editGalleryTitle
798
+ , editing: true
799
+ , multiple: true
800
+ , selection: selection
801
+ })
802
+
803
+ this._frame.on('update', function () {
804
+ var controller = ot_gallery._frame.states.get('gallery-edit')
805
+ , library = controller.get('library')
806
+ , ids = library.pluck('id')
807
+ , parent = $(elm).parents('.format-setting-inner')
808
+ , input = parent.children('.ot-gallery-value')
809
+ , shortcode = wp.media.gallery.shortcode( selection ).string().replace(/\"/g,"'")
810
+
811
+ input.attr('value', ids)
812
+
813
+ if ( parent.children('.ot-gallery-list').length <= 0 )
814
+ input.after('<ul class="ot-gallery-list" />')
815
+
816
+ $.ajax({
817
+ type: 'POST',
818
+ url: ajaxurl,
819
+ dataType: 'html',
820
+ data: {
821
+ action: 'gallery_update'
822
+ , ids: ids
823
+ },
824
+ success: function(res) {
825
+ parent.children('.ot-gallery-list').html(res);
826
+ if ( input.hasClass('ot-gallery-shortcode') ) {
827
+ input.val(shortcode);
828
+ }
829
+ if ( $(elm).parent().children('.ot-gallery-delete').length <= 0 ) {
830
+ $(elm).parent().append('<a href="#" class="option-tree-ui-button button button-secondary hug-left ot-gallery-delete">' + option_tree.delete + '</a>');
831
+ }
832
+ $(elm).text(option_tree.edit);
833
+ OT_UI.parse_condition();
834
+ }
835
+ })
836
+ })
837
+
838
+ return this._frame
839
+
840
+ }
841
+
842
+ , select: function (elm) {
843
+ var input = $(elm).parents('.format-setting-inner').children('.ot-gallery-value')
844
+ , ids = input.attr('value')
845
+ , _shortcode = input.hasClass('ot-gallery-shortcode') ? ids : '[gallery ids=\'' + ids + '\]'
846
+ , shortcode = wp.shortcode.next('gallery', ( ids ? _shortcode : wp.media.view.settings.ot_gallery.shortcode ) )
847
+ , defaultPostId = wp.media.gallery.defaults.id
848
+ , attachments
849
+ , selection
850
+
851
+ // Bail if we didn't match the shortcode or all of the content.
852
+ if ( ! shortcode )
853
+ return
854
+
855
+ // Ignore the rest of the match object.
856
+ shortcode = shortcode.shortcode
857
+
858
+ if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) )
859
+ shortcode.set( 'id', defaultPostId )
860
+
861
+ if ( _.isUndefined( shortcode.get('ids') ) && ! input.hasClass('ot-gallery-shortcode') && ids )
862
+ shortcode.set( 'ids', ids )
863
+
864
+ if ( _.isUndefined( shortcode.get('ids') ) )
865
+ shortcode.set( 'ids', '0' )
866
+
867
+ attachments = wp.media.gallery.attachments( shortcode )
868
+
869
+ selection = new wp.media.model.Selection( attachments.models, {
870
+ props: attachments.props.toJSON()
871
+ , multiple: true
872
+ })
873
+
874
+ selection.gallery = attachments.gallery
875
+
876
+ // Fetch the query's attachments, and then break ties from the query to allow for sorting.
877
+ selection.more().done( function () {
878
+ selection.props.set({ query: false })
879
+ selection.unmirror()
880
+ selection.props.unset('orderby')
881
+ })
882
+
883
+ return selection
884
+
885
+ }
886
+
887
+ , open: function (elm) {
888
+
889
+ ot_gallery.frame(elm).open()
890
+
891
+ }
892
+
893
+ , remove: function (elm) {
894
+
895
+ if ( confirm( option_tree.confirm ) ) {
896
+
897
+ $(elm).parents('.format-setting-inner').children('.ot-gallery-value').attr('value', '');
898
+ $(elm).parents('.format-setting-inner').children('.ot-gallery-list').remove();
899
+ $(elm).next('.ot-gallery-edit').text( option_tree.create );
900
+ $(elm).remove();
901
+ OT_UI.parse_condition();
902
+
903
+ }
904
+
905
+ }
906
+
907
+ }
908
+
909
+ // Gallery delete
910
+ $(document).on('click.ot_gallery.data-api', '.ot-gallery-delete', function (e) {
911
+ e.preventDefault()
912
+ ot_gallery.remove($(this))
913
+ })
914
+
915
+ // Gallery edit
916
+ $(document).on('click.ot_gallery.data-api', '.ot-gallery-edit', function (e) {
917
+ e.preventDefault()
918
+ ot_gallery.open($(this))
919
+ })
920
+
921
+ }(window.jQuery);
922
+
923
+ /*!
924
+ * Adds metabox tabs
925
+ */
926
+ !function ($) {
927
+
928
+ $(document).on('ready', function () {
929
+
930
+ // Loop over the metaboxes
931
+ $('.ot-metabox-wrapper').each( function() {
932
+
933
+ // Only if there is a tab option
934
+ if ( $(this).find('.type-tab').length ) {
935
+
936
+ // Add .ot-metabox-panels
937
+ $(this).find('.type-tab').parents('.ot-metabox-wrapper').wrapInner('<div class="ot-metabox-panels" />')
938
+
939
+ // Wrapp with .ot-metabox-tabs & add .ot-metabox-nav before .ot-metabox-panels
940
+ $(this).find('.ot-metabox-panels').wrap('<div class="ot-metabox-tabs" />').before('<ul class="ot-metabox-nav" />')
941
+
942
+ // Loop over settings and build the tabs nav
943
+ $(this).find('.format-settings').each( function() {
944
+
945
+ if ( $(this).find('.type-tab').length > 0 ) {
946
+ var title = $(this).find('.type-tab').prev().find('label').text()
947
+ , id = $(this).attr('id')
948
+
949
+ // Add a class, hide & append nav item
950
+ $(this).addClass('is-panel').hide()
951
+ $(this).parents('.ot-metabox-panels').prev('.ot-metabox-nav').append('<li><a href="#' + id + '">' + title + '</a></li>')
952
+
953
+ }
954
+
955
+ })
956
+
957
+ // Loop over the panels and wrap and ID them.
958
+ $(this).find('.is-panel').each( function() {
959
+ var id = $(this).attr('id')
960
+
961
+ $(this).add( $(this).nextUntil('.is-panel') ).wrapAll('<div id="' + id + '" class="tab-content" />')
962
+
963
+ })
964
+
965
+ // Create the tabs
966
+ $(this).find('.ot-metabox-tabs').tabs({
967
+ activate: function( event, ui ) {
968
+ var parent = $(this).outerHeight(),
969
+ child = $(this).find('.ot-metabox-panels').outerHeight() + 8,
970
+ minHeight = parent - 34
971
+ if ( $(this).find('.ot-metabox-panels').css('padding') == '12px' && child < parent ) {
972
+ $(this).find('.ot-metabox-panels').css({ minHeight: minHeight })
973
+ }
974
+ OT_UI.load_editors();
975
+ }
976
+ })
977
+
978
+ // Move the orphaned settings to the top
979
+ $(this).find('.ot-metabox-panels > .format-settings').prependTo($(this))
980
+
981
+ // Remove a bunch of classes to stop style conflicts.
982
+ $(this).find('.ot-metabox-tabs').removeClass('ui-widget ui-widget-content ui-corner-all')
983
+ $(this).find('.ot-metabox-nav').removeClass('ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all')
984
+ $(this).find('.ot-metabox-nav li').removeClass('ui-state-default ui-corner-top ui-tabs-active ui-tabs-active')
985
+ $(this).find('.ot-metabox-nav li').on('mouseenter mouseleave', function() { $(this).removeClass('ui-state-hover') })
986
+
987
+ }
988
+
989
+ })
990
+
991
+ })
992
+
993
+ }(window.jQuery);
994
+
995
+ /*!
996
+ * Adds theme option tabs
997
+ */
998
+ !function ($) {
999
+
1000
+ $(document).on('ready', function () {
1001
+
1002
+ // Loop over the theme options
1003
+ $('#option-tree-settings-api .inside').each( function() {
1004
+
1005
+ // Only if there is a tab option
1006
+ if ( $(this).find('.type-tab').length ) {
1007
+
1008
+ // Add .ot-theme-option-panels
1009
+ $(this).find('.type-tab').parents('.inside').wrapInner('<div class="ot-theme-option-panels" />')
1010
+
1011
+ // Wrap with .ot-theme-option-tabs & add .ot-theme-option-nav before .ot-theme-option-panels
1012
+ $(this).find('.ot-theme-option-panels').wrap('<div class="ot-theme-option-tabs" />').before('<ul class="ot-theme-option-nav" />')
1013
+
1014
+ // Loop over settings and build the tabs nav
1015
+ $(this).find('.format-settings').each( function() {
1016
+
1017
+ if ( $(this).find('.type-tab').length > 0 ) {
1018
+ var title = $(this).find('.type-tab').prev().find('.label').text()
1019
+ , id = $(this).attr('id')
1020
+
1021
+ // Add a class, hide & append nav item
1022
+ $(this).addClass('is-panel').hide()
1023
+ $(this).parents('.ot-theme-option-panels').prev('.ot-theme-option-nav').append('<li><a href="#' + id + '">' + title + '</a></li>')
1024
+
1025
+ } else {
1026
+
1027
+ }
1028
+
1029
+ })
1030
+
1031
+ // Loop over the panels and wrap and ID them.
1032
+ $(this).find('.is-panel').each( function() {
1033
+ var id = $(this).attr('id')
1034
+
1035
+ $(this).add( $(this).nextUntil('.is-panel') ).wrapAll('<div id="' + id + '" class="tab-content" />')
1036
+
1037
+ })
1038
+
1039
+ // Create the tabs
1040
+ $(this).find('.ot-theme-option-tabs').tabs({
1041
+ activate: function( event, ui ) {
1042
+ OT_UI.load_editors();
1043
+ }
1044
+ })
1045
+
1046
+ // Move the orphaned settings to the top
1047
+ $(this).find('.ot-theme-option-panels > .format-settings').prependTo($(this).find('.ot-theme-option-tabs'))
1048
+
1049
+ }
1050
+
1051
+ })
1052
+
1053
+ })
1054
+
1055
+ }(window.jQuery);
1056
+
1057
+ /*!
1058
+ * Fixes the state of metabox radio buttons after a Drag & Drop event.
1059
+ */
1060
+ !function ($) {
1061
+
1062
+ $(document).on('ready', function () {
1063
+
1064
+ // detect mousedown and store all checked radio buttons
1065
+ $('.hndle').on('mousedown', function () {
1066
+
1067
+ // get parent element of .hndle selected.
1068
+ // We only need to monitor radios insde the object that is being moved.
1069
+ var parent_id = $(this).closest('div').attr('id')
1070
+
1071
+ // set live event listener for mouse up on the content .wrap
1072
+ // then give the dragged div time to settle before firing the reclick function
1073
+ $('.wrap').on('mouseup', function () {
1074
+
1075
+ var ot_checked_radios = {}
1076
+
1077
+ // loop over all checked radio buttons inside of parent element
1078
+ $('#' + parent_id + ' input[type="radio"]').each( function () {
1079
+
1080
+ // stores checked radio buttons
1081
+ if ( $(this).is(':checked') ) {
1082
+
1083
+ ot_checked_radios[$(this).attr('name')] = $(this).val()
1084
+
1085
+ }
1086
+
1087
+ // write to the object
1088
+ $(document).data('ot_checked_radios', ot_checked_radios)
1089
+
1090
+ })
1091
+
1092
+ // restore all checked radio buttons
1093
+ setTimeout( function () {
1094
+
1095
+ // get object of checked radio button names and values
1096
+ var checked = $(document).data('ot_checked_radios')
1097
+
1098
+ // step thru each object element and trigger a click on it's corresponding radio button
1099
+ for ( key in checked ) {
1100
+
1101
+ $('input[name="' + key + '"]').filter('[value="' + checked[key] + '"]').trigger('click')
1102
+
1103
+ }
1104
+
1105
+ $('.wrap').unbind('mouseup')
1106
+
1107
+ }, 50 )
1108
+
1109
+ })
1110
+
1111
+ })
1112
+
1113
+ })
1114
+
1115
+ }(window.jQuery);
1116
+
1117
+ /*!
1118
+ * Adds opacity to the default colorpicker
1119
+ *
1120
+ * Derivative work of the Codestar WP Color Picker.
1121
+ */
1122
+ ;(function ( $, window, document, undefined ) {
1123
+ 'use strict';
1124
+
1125
+ // adding alpha support for Automattic Color.js toString function.
1126
+ if( typeof Color.fn.toString !== undefined ) {
1127
+
1128
+ Color.fn.toString = function () {
1129
+
1130
+ // check for alpha
1131
+ if ( this._alpha < 1 ) {
1132
+ return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
1133
+ }
1134
+
1135
+ var hex = parseInt( this._color, 10 ).toString( 16 );
1136
+
1137
+ if ( this.error ) { return ''; }
1138
+
1139
+ // maybe left pad it
1140
+ if ( hex.length < 6 ) {
1141
+ for (var i = 6 - hex.length - 1; i >= 0; i--) {
1142
+ hex = '0' + hex;
1143
+ }
1144
+ }
1145
+
1146
+ return '#' + hex;
1147
+
1148
+ };
1149
+
1150
+ }
1151
+
1152
+ $.ot_ParseColorValue = function( val ) {
1153
+
1154
+ var value = val.replace(/\s+/g, ''),
1155
+ alpha = ( value.indexOf('rgba') !== -1 ) ? parseFloat( value.replace(/^.*,(.+)\)/, '$1') * 100 ) : 100,
1156
+ rgba = ( alpha < 100 ) ? true : false;
1157
+
1158
+ return { value: value, alpha: alpha, rgba: rgba };
1159
+
1160
+ };
1161
+
1162
+ $.fn.ot_wpColorPicker = function() {
1163
+
1164
+ return this.each(function() {
1165
+
1166
+ var $this = $(this);
1167
+
1168
+ // check for rgba enabled/disable
1169
+ if( $this.data('rgba') !== false ) {
1170
+
1171
+ // parse value
1172
+ var picker = $.ot_ParseColorValue( $this.val() );
1173
+
1174
+ // wpColorPicker core
1175
+ $this.wpColorPicker({
1176
+
1177
+ // wpColorPicker: change
1178
+ change: function( event, ui ) {
1179
+
1180
+ // update checkerboard background color
1181
+ $this.closest('.wp-picker-container').find('.option-tree-opacity-slider-offset').css('background-color', ui.color.toString());
1182
+ $this.trigger('keyup');
1183
+
1184
+ },
1185
+
1186
+ // wpColorPicker: create
1187
+ create: function( event, ui ) {
1188
+
1189
+ // set variables for alpha slider
1190
+ var a8cIris = $this.data('a8cIris'),
1191
+ $container = $this.closest('.wp-picker-container'),
1192
+
1193
+ // appending alpha wrapper
1194
+ $alpha_wrap = $('<div class="option-tree-opacity-wrap">' +
1195
+ '<div class="option-tree-opacity-slider"></div>' +
1196
+ '<div class="option-tree-opacity-slider-offset"></div>' +
1197
+ '<div class="option-tree-opacity-text"></div>' +
1198
+ '</div>').appendTo( $container.find('.wp-picker-holder') ),
1199
+
1200
+ $alpha_slider = $alpha_wrap.find('.option-tree-opacity-slider'),
1201
+ $alpha_text = $alpha_wrap.find('.option-tree-opacity-text'),
1202
+ $alpha_offset = $alpha_wrap.find('.option-tree-opacity-slider-offset');
1203
+
1204
+ // alpha slider
1205
+ $alpha_slider.slider({
1206
+
1207
+ // slider: slide
1208
+ slide: function( event, ui ) {
1209
+
1210
+ var slide_value = parseFloat( ui.value / 100 );
1211
+
1212
+ // update iris data alpha && wpColorPicker color option && alpha text
1213
+ a8cIris._color._alpha = slide_value;
1214
+ $this.wpColorPicker( 'color', a8cIris._color.toString() );
1215
+ $alpha_text.text( ( slide_value < 1 ? slide_value : '' ) );
1216
+
1217
+ },
1218
+
1219
+ // slider: create
1220
+ create: function() {
1221
+
1222
+ var slide_value = parseFloat( picker.alpha / 100 ),
1223
+ alpha_text_value = slide_value < 1 ? slide_value : '';
1224
+
1225
+ // update alpha text && checkerboard background color
1226
+ $alpha_text.text(alpha_text_value);
1227
+ $alpha_offset.css('background-color', picker.value);
1228
+
1229
+ // wpColorPicker clear button for update iris data alpha && alpha text && slider color option
1230
+ $container.on('click', '.wp-picker-clear', function() {
1231
+
1232
+ a8cIris._color._alpha = 1;
1233
+ $alpha_text.text('');
1234
+ $alpha_slider.slider('option', 'value', 100).trigger('slide');
1235
+
1236
+ });
1237
+
1238
+ // wpColorPicker default button for update iris data alpha && alpha text && slider color option
1239
+ $container.on('click', '.wp-picker-default', function() {
1240
+
1241
+ var default_picker = $.ot_ParseColorValue( $this.data('default-color') ),
1242
+ default_value = parseFloat( default_picker.alpha / 100 ),
1243
+ default_text = default_value < 1 ? default_value : '';
1244
+
1245
+ a8cIris._color._alpha = default_value;
1246
+ $alpha_text.text(default_text);
1247
+ $alpha_slider.slider('option', 'value', default_picker.alpha).trigger('slide');
1248
+
1249
+ });
1250
+
1251
+ // show alpha wrapper on click color picker button
1252
+ $container.on('click', '.wp-color-result', function() {
1253
+ $alpha_wrap.toggle();
1254
+ });
1255
+
1256
+ // hide alpha wrapper on click body
1257
+ $('body').on( 'click.wpcolorpicker', function() {
1258
+ $alpha_wrap.hide();
1259
+ });
1260
+
1261
+ },
1262
+
1263
+ // slider: options
1264
+ value: picker.alpha,
1265
+ step: 1,
1266
+ min: 1,
1267
+ max: 100
1268
+
1269
+ });
1270
+ }
1271
+
1272
+ });
1273
+
1274
+ } else {
1275
+
1276
+ // wpColorPicker default picker
1277
+ $this.wpColorPicker({
1278
+ change: function() {
1279
+ $this.trigger('keyup');
1280
+ }
1281
+ });
1282
+
1283
+ }
1284
+
1285
+ });
1286
+
1287
+ };
1288
+
1289
+ $(document).ready( function(){
1290
+ $('.hide-color-picker.ot-colorpicker-opacity').ot_wpColorPicker();
1291
+ });
1292
+
1293
  })( jQuery, window, document );
admin/includes/ot-functions-admin.php CHANGED
@@ -47,7 +47,7 @@ if ( ! function_exists( 'ot_register_theme_options_page' ) ) {
47
  array(
48
  'id' => 'niftycs_options',
49
  'parent_slug' => apply_filters( 'niftycs_options_parent_slug', null ),
50
- 'page_title' => apply_filters( 'niftycs_options_page_title', __( 'Nifty Coming Soon, Maintenance and Under Construction Options', 'option-tree' ) ),
51
  'menu_title' => apply_filters( 'niftycs_options_menu_title', __( 'Nifty Options', 'option-tree' ) ),
52
  'capability' => $caps = apply_filters( 'niftycs_options_capability', 'edit_theme_options' ),
53
  'menu_slug' => apply_filters( 'niftycs_options_menu_slug', 'niftycs-options' ),
47
  array(
48
  'id' => 'niftycs_options',
49
  'parent_slug' => apply_filters( 'niftycs_options_parent_slug', null ),
50
+ 'page_title' => apply_filters( 'niftycs_options_page_title', __( 'Nifty Coming Soon, Maintenance &amp; Under Construction Options', 'option-tree' ) ),
51
  'menu_title' => apply_filters( 'niftycs_options_menu_title', __( 'Nifty Options', 'option-tree' ) ),
52
  'capability' => $caps = apply_filters( 'niftycs_options_capability', 'edit_theme_options' ),
53
  'menu_slug' => apply_filters( 'niftycs_options_menu_slug', 'niftycs-options' ),
admin/includes/ot-functions-option-types.php CHANGED
@@ -1,3233 +1,3233 @@
1
- <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
- /**
3
- * Functions used to build each option type.
4
- *
5
- * @package OptionTree
6
- * @author Derek Herman <derek@valendesigns.com>
7
- * @copyright Copyright (c) 2013, Derek Herman
8
- * @since 2.0
9
- */
10
-
11
- /**
12
- * Builds the HTML for each of the available option types by calling those
13
- * function with call_user_func and passing the arguments to the second param.
14
- *
15
- * All fields are required!
16
- *
17
- * @param array $args The array of arguments are as follows:
18
- * @param string $type Type of option.
19
- * @param string $field_id The field ID.
20
- * @param string $field_name The field Name.
21
- * @param mixed $field_value The field value is a string or an array of values.
22
- * @param string $field_desc The field description.
23
- * @param string $field_std The standard value.
24
- * @param string $field_class Extra CSS classes.
25
- * @param array $field_choices The array of option choices.
26
- * @param array $field_settings The array of settings for a list item.
27
- * @return string
28
- *
29
- * @access public
30
- * @since 2.0
31
- */
32
- if ( ! function_exists( 'ot_display_by_type' ) ) {
33
-
34
- function ot_display_by_type( $args = array() ) {
35
-
36
- /* allow filters to be executed on the array */
37
- $args = apply_filters( 'ot_display_by_type', $args );
38
-
39
- /* build the function name */
40
- $function_name_by_type = str_replace( '-', '_', 'ot_type_' . $args['type'] );
41
-
42
- /* call the function & pass in arguments array */
43
- if ( function_exists( $function_name_by_type ) ) {
44
- call_user_func( $function_name_by_type, $args );
45
- } else {
46
- echo '<p>' . __( 'Sorry, this function does not exist', 'option-tree' ) . '</p>';
47
- }
48
-
49
- }
50
-
51
- }
52
-
53
- /**
54
- * Background option type.
55
- *
56
- * See @ot_display_by_type to see the full list of available arguments.
57
- *
58
- * @param array An array of arguments.
59
- * @return string
60
- *
61
- * @access public
62
- * @since 2.0
63
- */
64
- if ( ! function_exists( 'ot_type_background' ) ) {
65
-
66
- function ot_type_background( $args = array() ) {
67
-
68
- /* turns arguments array into variables */
69
- extract( $args );
70
-
71
- /* verify a description */
72
- $has_desc = $field_desc ? true : false;
73
-
74
- /* If an attachment ID is stored here fetch its URL and replace the value */
75
- if ( isset( $field_value['background-image'] ) && wp_attachment_is_image( $field_value['background-image'] ) ) {
76
-
77
- $attachment_data = wp_get_attachment_image_src( $field_value['background-image'], 'original' );
78
-
79
- /* check for attachment data */
80
- if ( $attachment_data ) {
81
-
82
- $field_src = $attachment_data[0];
83
-
84
- }
85
-
86
- }
87
-
88
- /* format setting outer wrapper */
89
- echo '<div class="format-setting type-background ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
90
-
91
- /* description */
92
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
93
-
94
- /* format setting inner wrapper */
95
- echo '<div class="format-setting-inner">';
96
-
97
- /* allow fields to be filtered */
98
- $ot_recognized_background_fields = apply_filters( 'ot_recognized_background_fields', array(
99
- 'background-color',
100
- 'background-repeat',
101
- 'background-attachment',
102
- 'background-position',
103
- 'background-size',
104
- 'background-image'
105
- ), $field_id );
106
-
107
- echo '<div class="ot-background-group">';
108
-
109
- /* build background color */
110
- if ( in_array( 'background-color', $ot_recognized_background_fields ) ) {
111
-
112
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
113
-
114
- /* colorpicker JS */
115
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
116
-
117
- /* set background color */
118
- $background_color = isset( $field_value['background-color'] ) ? esc_attr( $field_value['background-color'] ) : '';
119
-
120
- /* input */
121
- 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 ) . '" />';
122
-
123
- echo '</div>';
124
-
125
- }
126
-
127
- /* build background repeat */
128
- if ( in_array( 'background-repeat', $ot_recognized_background_fields ) ) {
129
-
130
- $background_repeat = isset( $field_value['background-repeat'] ) ? esc_attr( $field_value['background-repeat'] ) : '';
131
-
132
- echo '<select name="' . esc_attr( $field_name ) . '[background-repeat]" id="' . esc_attr( $field_id ) . '-repeat" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
133
-
134
- echo '<option value="">' . __( 'background-repeat', 'option-tree' ) . '</option>';
135
- foreach ( ot_recognized_background_repeat( $field_id ) as $key => $value ) {
136
-
137
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_repeat, $key, false ) . '>' . esc_attr( $value ) . '</option>';
138
-
139
- }
140
-
141
- echo '</select>';
142
-
143
- }
144
-
145
- /* build background attachment */
146
- if ( in_array( 'background-attachment', $ot_recognized_background_fields ) ) {
147
-
148
- $background_attachment = isset( $field_value['background-attachment'] ) ? esc_attr( $field_value['background-attachment'] ) : '';
149
-
150
- echo '<select name="' . esc_attr( $field_name ) . '[background-attachment]" id="' . esc_attr( $field_id ) . '-attachment" class="option-tree-ui-select ' . $field_class . '">';
151
-
152
- echo '<option value="">' . __( 'background-attachment', 'option-tree' ) . '</option>';
153
-
154
- foreach ( ot_recognized_background_attachment( $field_id ) as $key => $value ) {
155
-
156
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_attachment, $key, false ) . '>' . esc_attr( $value ) . '</option>';
157
-
158
- }
159
-
160
- echo '</select>';
161
-
162
- }
163
-
164
- /* build background position */
165
- if ( in_array( 'background-position', $ot_recognized_background_fields ) ) {
166
-
167
- $background_position = isset( $field_value['background-position'] ) ? esc_attr( $field_value['background-position'] ) : '';
168
-
169
- echo '<select name="' . esc_attr( $field_name ) . '[background-position]" id="' . esc_attr( $field_id ) . '-position" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
170
-
171
- echo '<option value="">' . __( 'background-position', 'option-tree' ) . '</option>';
172
-
173
- foreach ( ot_recognized_background_position( $field_id ) as $key => $value ) {
174
-
175
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_position, $key, false ) . '>' . esc_attr( $value ) . '</option>';
176
-
177
- }
178
-
179
- echo '</select>';
180
-
181
- }
182
-
183
- /* Build background size */
184
- if ( in_array( 'background-size', $ot_recognized_background_fields ) ) {
185
-
186
- /**
187
- * Use this filter to create a select instead of an text input.
188
- * Be sure to return the array in the correct format. Add an empty
189
- * value to the first choice so the user can leave it blank.
190
- *
191
- array(
192
- array(
193
- 'label' => 'background-size',
194
- 'value' => ''
195
- ),
196
- array(
197
- 'label' => 'cover',
198
- 'value' => 'cover'
199
- ),
200
- array(
201
- 'label' => 'contain',
202
- 'value' => 'contain'
203
- )
204
- )
205
- *
206
- */
207
- $choices = apply_filters( 'ot_type_background_size_choices', '', $field_id );
208
-
209
- if ( is_array( $choices ) && ! empty( $choices ) ) {
210
-
211
- /* build select */
212
- echo '<select name="' . esc_attr( $field_name ) . '[background-size]" id="' . esc_attr( $field_id ) . '-size" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
213
-
214
- foreach ( (array) $choices as $choice ) {
215
- if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
216
- echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( ( isset( $field_value['background-size'] ) ? $field_value['background-size'] : '' ), $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
217
- }
218
- }
219
-
220
- echo '</select>';
221
-
222
- } else {
223
-
224
- 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' ) . '" />';
225
-
226
- }
227
-
228
- }
229
-
230
- echo '</div>';
231
-
232
- /* build background image */
233
- if ( in_array( 'background-image', $ot_recognized_background_fields ) ) {
234
-
235
- echo '<div class="option-tree-ui-upload-parent">';
236
-
237
- /* input */
238
- 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 ) . '" placeholder="' . __( 'background-image', 'option-tree' ) . '" />';
239
-
240
- /* add media button */
241
- echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button button button-primary light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon ot-icon-plus-circle"></span>' . __( 'Add Media', 'option-tree' ) . '</a>';
242
-
243
- echo '</div>';
244
-
245
- /* media */
246
- if ( isset( $field_value['background-image'] ) && $field_value['background-image'] !== '' ) {
247
-
248
- /* replace image src */
249
- if ( isset( $field_src ) )
250
- $field_value['background-image'] = $field_src;
251
-
252
- echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
253
-
254
- if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value['background-image'] ) )
255
- echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value['background-image'] ) . '" alt="" /></div>';
256
-
257
- echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"></span>' . __( 'Remove Media', 'option-tree' ) . '</a>';
258
-
259
- echo '</div>';
260
-
261
- }
262
-
263
- }
264
-
265
- echo '</div>';
266
-
267
- echo '</div>';
268
-
269
- }
270
-
271
- }
272
-
273
- /**
274
- * Border Option Type
275
- *
276
- * See @ot_display_by_type to see the full list of available arguments.
277
- *
278
- * @param array The options arguments
279
- * @return string The markup.
280
- *
281
- * @access public
282
- * @since 2.5.0
283
- */
284
- if ( ! function_exists( 'ot_type_border' ) ) {
285
-
286
- function ot_type_border( $args = array() ) {
287
-
288
- /* turns arguments array into variables */
289
- extract( $args );
290
-
291
- /* verify a description */
292
- $has_desc = $field_desc ? true : false;
293
-
294
- /* format setting outer wrapper */
295
- echo '<div class="format-setting type-border ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
296
-
297
- /* description */
298
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
299
-
300
- /* format setting inner wrapper */
301
- echo '<div class="format-setting-inner">';
302
-
303
- /* allow fields to be filtered */
304
- $ot_recognized_border_fields = apply_filters( 'ot_recognized_border_fields', array(
305
- 'width',
306
- 'unit',
307
- 'style',
308
- 'color'
309
- ), $field_id );
310
-
311
- /* build border width */
312
- if ( in_array( 'width', $ot_recognized_border_fields ) ) {
313
-
314
- $width = isset( $field_value['width'] ) ? esc_attr( $field_value['width'] ) : '';
315
-
316
- echo '<div class="ot-option-group ot-option-group--one-sixth"><input type="text" name="' . esc_attr( $field_name ) . '[width]" id="' . esc_attr( $field_id ) . '-width" value="' . esc_attr( $width ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'width', 'option-tree' ) . '" /></div>';
317
-
318
- }
319
-
320
- /* build unit dropdown */
321
- if ( in_array( 'unit', $ot_recognized_border_fields ) ) {
322
-
323
- echo '<div class="ot-option-group ot-option-group--one-fourth">';
324
-
325
- echo '<select name="' . esc_attr( $field_name ) . '[unit]" id="' . esc_attr( $field_id ) . '-unit" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
326
-
327
- echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
328
-
329
- foreach ( ot_recognized_border_unit_types( $field_id ) as $unit ) {
330
- echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value['unit'] ) ? selected( $field_value['unit'], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
331
- }
332
-
333
- echo '</select>';
334
-
335
- echo '</div>';
336
-
337
- }
338
-
339
- /* build style dropdown */
340
- if ( in_array( 'style', $ot_recognized_border_fields ) ) {
341
-
342
- echo '<div class="ot-option-group ot-option-group--one-fourth">';
343
-
344
- echo '<select name="' . esc_attr( $field_name ) . '[style]" id="' . esc_attr( $field_id ) . '-style" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
345
-
346
- echo '<option value="">' . __( 'style', 'option-tree' ) . '</option>';
347
-
348
- foreach ( ot_recognized_border_style_types( $field_id ) as $key => $style ) {
349
- echo '<option value="' . esc_attr( $key ) . '"' . ( isset( $field_value['style'] ) ? selected( $field_value['style'], $key, false ) : '' ) . '>' . esc_attr( $style ) . '</option>';
350
- }
351
-
352
- echo '</select>';
353
-
354
- echo '</div>';
355
-
356
- }
357
-
358
- /* build color */
359
- if ( in_array( 'color', $ot_recognized_border_fields ) ) {
360
-
361
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
362
-
363
- /* colorpicker JS */
364
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
365
-
366
- /* set color */
367
- $color = isset( $field_value['color'] ) ? esc_attr( $field_value['color'] ) : '';
368
-
369
- /* input */
370
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[color]" id="' . $field_id . '-picker" value="' . $color . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" />';
371
-
372
- echo '</div>';
373
-
374
- }
375
-
376
- echo '</div>';
377
-
378
- echo '</div>';
379
-
380
- }
381
-
382
- }
383
-
384
- /**
385
- * Box Shadow Option Type
386
- *
387
- * See @ot_display_by_type to see the full list of available arguments.
388
- *
389
- * @param array The options arguments
390
- * @return string The markup.
391
- *
392
- * @access public
393
- * @since 2.5.0
394
- */
395
- if ( ! function_exists( 'ot_type_box_shadow' ) ) {
396
-
397
- function ot_type_box_shadow( $args = array() ) {
398
-
399
- /* turns arguments array into variables */
400
- extract( $args );
401
-
402
- /* verify a description */
403
- $has_desc = $field_desc ? true : false;
404
-
405
- /* format setting outer wrapper */
406
- echo '<div class="format-setting type-box-shadow ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
407
-
408
- /* description */
409
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
410
-
411
- /* format setting inner wrapper */
412
- echo '<div class="format-setting-inner">';
413
-
414
- /* allow fields to be filtered */
415
- $ot_recognized_box_shadow_fields = apply_filters( 'ot_recognized_box_shadow_fields', array(
416
- 'inset',
417
- 'offset-x',
418
- 'offset-y',
419
- 'blur-radius',
420
- 'spread-radius',
421
- 'color'
422
- ), $field_id );
423
-
424
- /* build inset */
425
- if ( in_array( 'inset', $ot_recognized_box_shadow_fields ) ) {
426
-
427
- echo '<div class="ot-option-group ot-option-group--checkbox"><p>';
428
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[inset]" id="' . esc_attr( $field_id ) . '-inset" value="inset" ' . ( isset( $field_value['inset'] ) ? checked( $field_value['inset'], 'inset', false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
429
- echo '<label for="' . esc_attr( $field_id ) . '-inset">inset</label>';
430
- echo '</p></div>';
431
-
432
- }
433
-
434
- /* build horizontal offset */
435
- if ( in_array( 'offset-x', $ot_recognized_box_shadow_fields ) ) {
436
-
437
- $offset_x = isset( $field_value['offset-x'] ) ? esc_attr( $field_value['offset-x'] ) : '';
438
-
439
- echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-arrows-h ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[offset-x]" id="' . esc_attr( $field_id ) . '-offset-x" value="' . $offset_x . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'offset-x', 'option-tree' ) . '" /></div>';
440
-
441
- }
442
-
443
- /* build vertical offset */
444
- if ( in_array( 'offset-y', $ot_recognized_box_shadow_fields ) ) {
445
-
446
- $offset_y = isset( $field_value['offset-y'] ) ? esc_attr( $field_value['offset-y'] ) : '';
447
-
448
- echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-arrows-v ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[offset-y]" id="' . esc_attr( $field_id ) . '-offset-y" value="' . $offset_y . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'offset-y', 'option-tree' ) . '" /></div>';
449
-
450
- }
451
-
452
- /* build blur-radius radius */
453
- if ( in_array( 'blur-radius', $ot_recognized_box_shadow_fields ) ) {
454
-
455
- $blur_radius = isset( $field_value['blur-radius'] ) ? esc_attr( $field_value['blur-radius'] ) : '';
456
-
457
- echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-circle ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[blur-radius]" id="' . esc_attr( $field_id ) . '-blur-radius" value="' . $blur_radius . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'blur-radius', 'option-tree' ) . '" /></div>';
458
-
459
- }
460
-
461
- /* build spread-radius radius */
462
- if ( in_array( 'spread-radius', $ot_recognized_box_shadow_fields ) ) {
463
-
464
- $spread_radius = isset( $field_value['spread-radius'] ) ? esc_attr( $field_value['spread-radius'] ) : '';
465
-
466
- echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-arrows-alt ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[spread-radius]" id="' . esc_attr( $field_id ) . '-spread-radius" value="' . $spread_radius . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'spread-radius', 'option-tree' ) . '" /></div>';
467
-
468
- }
469
-
470
- /* build color */
471
- if ( in_array( 'color', $ot_recognized_box_shadow_fields ) ) {
472
-
473
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
474
-
475
- /* colorpicker JS */
476
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
477
-
478
- /* set color */
479
- $color = isset( $field_value['color'] ) ? esc_attr( $field_value['color'] ) : '';
480
-
481
- /* input */
482
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[color]" id="' . esc_attr( $field_id ) . '-picker" value="' . $color . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" />';
483
-
484
- echo '</div>';
485
-
486
- }
487
-
488
- echo '</div>';
489
-
490
- echo '</div>';
491
-
492
- }
493
-
494
- }
495
-
496
- /**
497
- * Category Checkbox option type.
498
- *
499
- * See @ot_display_by_type to see the full list of available arguments.
500
- *
501
- * @param array An array of arguments.
502
- * @return string
503
- *
504
- * @access public
505
- * @since 2.0
506
- */
507
- if ( ! function_exists( 'ot_type_category_checkbox' ) ) {
508
-
509
- function ot_type_category_checkbox( $args = array() ) {
510
-
511
- /* turns arguments array into variables */
512
- extract( $args );
513
-
514
- /* verify a description */
515
- $has_desc = $field_desc ? true : false;
516
-
517
- /* format setting outer wrapper */
518
- echo '<div class="format-setting type-category-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
519
-
520
- /* description */
521
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
522
-
523
- /* format setting inner wrapper */
524
- echo '<div class="format-setting-inner">';
525
-
526
- /* get category array */
527
- $categories = get_categories( apply_filters( 'ot_type_category_checkbox_query', array( 'hide_empty' => false ), $field_id ) );
528
-
529
- /* build categories */
530
- if ( ! empty( $categories ) ) {
531
- foreach ( $categories as $category ) {
532
- echo '<p>';
533
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $category->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $category->term_id ) . '" value="' . esc_attr( $category->term_id ) . '" ' . ( isset( $field_value[$category->term_id] ) ? checked( $field_value[$category->term_id], $category->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
534
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $category->term_id ) . '">' . esc_attr( $category->name ) . '</label>';
535
- echo '</p>';
536
- }
537
- } else {
538
- echo '<p>' . __( 'No Categories Found', 'option-tree' ) . '</p>';
539
- }
540
-
541
- echo '</div>';
542
-
543
- echo '</div>';
544
-
545
- }
546
-
547
- }
548
-
549
- /**
550
- * Category Select option type.
551
- *
552
- * See @ot_display_by_type to see the full list of available arguments.
553
- *
554
- * @param array An array of arguments.
555
- * @return string
556
- *
557
- * @access public
558
- * @since 2.0
559
- */
560
- if ( ! function_exists( 'ot_type_category_select' ) ) {
561
-
562
- function ot_type_category_select( $args = array() ) {
563
-
564
- /* turns arguments array into variables */
565
- extract( $args );
566
-
567
- /* verify a description */
568
- $has_desc = $field_desc ? true : false;
569
-
570
- /* format setting outer wrapper */
571
- echo '<div class="format-setting type-category-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
572
-
573
- /* description */
574
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
575
-
576
- /* format setting inner wrapper */
577
- echo '<div class="format-setting-inner">';
578
-
579
- /* build category */
580
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
581
-
582
- /* get category array */
583
- $categories = get_categories( apply_filters( 'ot_type_category_select_query', array( 'hide_empty' => false ), $field_id ) );
584
-
585
- /* has cats */
586
- if ( ! empty( $categories ) ) {
587
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
588
- foreach ( $categories as $category ) {
589
- echo '<option value="' . esc_attr( $category->term_id ) . '"' . selected( $field_value, $category->term_id, false ) . '>' . esc_attr( $category->name ) . '</option>';
590
- }
591
- } else {
592
- echo '<option value="">' . __( 'No Categories Found', 'option-tree' ) . '</option>';
593
- }
594
-
595
- echo '</select>';
596
-
597
- echo '</div>';
598
-
599
- echo '</div>';
600
-
601
- }
602
-
603
- }
604
-
605
- /**
606
- * Checkbox option type.
607
- *
608
- * See @ot_display_by_type to see the full list of available arguments.
609
- *
610
- * @param array An array of arguments.
611
- * @return string
612
- *
613
- * @access public
614
- * @since 2.0
615
- */
616
- if ( ! function_exists( 'ot_type_checkbox' ) ) {
617
-
618
- function ot_type_checkbox( $args = array() ) {
619
-
620
- /* turns arguments array into variables */
621
- extract( $args );
622
-
623
- /* verify a description */
624
- $has_desc = $field_desc ? true : false;
625
-
626
- /* format setting outer wrapper */
627
- echo '<div class="format-setting type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
628
-
629
- /* description */
630
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
631
-
632
- /* format setting inner wrapper */
633
- echo '<div class="format-setting-inner">';
634
-
635
- /* build checkbox */
636
- foreach ( (array) $field_choices as $key => $choice ) {
637
- if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
638
- echo '<p>';
639
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $key ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" value="' . esc_attr( $choice['value'] ) . '" ' . ( isset( $field_value[$key] ) ? checked( $field_value[$key], $choice['value'], false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
640
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label>';
641
- echo '</p>';
642
- }
643
- }
644
-
645
- echo '</div>';
646
-
647
- echo '</div>';
648
-
649
- }
650
-
651
- }
652
-
653
- /**
654
- * Colorpicker option type.
655
- *
656
- * See @ot_display_by_type to see the full list of available arguments.
657
- *
658
- * @param array An array of arguments.
659
- * @return string
660
- *
661
- * @access public
662
- * @since 2.0
663
- * @updated 2.2.0
664
- */
665
- if ( ! function_exists( 'ot_type_colorpicker' ) ) {
666
-
667
- function ot_type_colorpicker( $args = array() ) {
668
-
669
- /* turns arguments array into variables */
670
- extract( $args );
671
-
672
- /* verify a description */
673
- $has_desc = $field_desc ? true : false;
674
-
675
- /* format setting outer wrapper */
676
- echo '<div class="format-setting type-colorpicker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
677
-
678
- /* description */
679
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
680
-
681
- /* format setting inner wrapper */
682
- echo '<div class="format-setting-inner">';
683
-
684
- /* build colorpicker */
685
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
686
-
687
- /* colorpicker JS */
688
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '"); });</script>';
689
-
690
- /* set the default color */
691
- $std = $field_std ? 'data-default-color="' . $field_std . '"' : '';
692
-
693
- /* input */
694
- 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 . ' />';
695
-
696
- echo '</div>';
697
-
698
- echo '</div>';
699
-
700
- echo '</div>';
701
-
702
- }
703
-
704
- }
705
-
706
- /**
707
- * Colorpicker Opacity option type.
708
- *
709
- * See @ot_display_by_type to see the full list of available arguments.
710
- *
711
- * @param array An array of arguments.
712
- * @return string
713
- *
714
- * @access public
715
- * @since 2.5.0
716
- */
717
- if ( ! function_exists( 'ot_type_colorpicker_opacity' ) ) {
718
-
719
- function ot_type_colorpicker_opacity( $args = array() ) {
720
-
721
- $args['field_class'] = isset( $args['field_class'] ) ? $args['field_class'] . ' ot-colorpicker-opacity' : 'ot-colorpicker-opacity';
722
- ot_type_colorpicker( $args );
723
-
724
- }
725
-
726
- }
727
-
728
- /**
729
- * CSS option type.
730
- *
731
- * See @ot_display_by_type to see the full list of available arguments.
732
- *
733
- * @param array An array of arguments.
734
- * @return string
735
- *
736
- * @access public
737
- * @since 2.0
738
- */
739
- if ( ! function_exists( 'ot_type_css' ) ) {
740
-
741
- function ot_type_css( $args = array() ) {
742
-
743
- /* turns arguments array into variables */
744
- extract( $args );
745
-
746
- /* verify a description */
747
- $has_desc = $field_desc ? true : false;
748
-
749
- /* format setting outer wrapper */
750
- echo '<div class="format-setting type-css simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
751
-
752
- /* description */
753
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
754
-
755
- /* format setting inner wrapper */
756
- echo '<div class="format-setting-inner">';
757
-
758
- /* build textarea for CSS */
759
- echo '<textarea class="hidden" id="textarea_' . esc_attr( $field_id ) . '" name="' . esc_attr( $field_name ) .'">' . esc_attr( $field_value ) . '</textarea>';
760
-
761
- /* build pre to convert it into ace editor later */
762
- echo '<pre class="ot-css-editor ' . esc_attr( $field_class ) . '" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</pre>';
763
-
764
- echo '</div>';
765
-
766
- echo '</div>';
767
-
768
- }
769
-
770
- }
771
-
772
- /**
773
- * Custom Post Type Checkbox option type.
774
- *
775
- * See @ot_display_by_type to see the full list of available arguments.
776
- *
777
- * @param array An array of arguments.
778
- * @return string
779
- *
780
- * @access public
781
- * @since 2.0
782
- */
783
- if ( ! function_exists( 'ot_type_custom_post_type_checkbox' ) ) {
784
-
785
- function ot_type_custom_post_type_checkbox( $args = array() ) {
786
-
787
- /* turns arguments array into variables */
788
- extract( $args );
789
-
790
- /* verify a description */
791
- $has_desc = $field_desc ? true : false;
792
-
793
- /* format setting outer wrapper */
794
- echo '<div class="format-setting type-custom-post-type-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
795
-
796
- /* description */
797
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
798
-
799
- /* format setting inner wrapper */
800
- echo '<div class="format-setting-inner">';
801
-
802
- /* setup the post types */
803
- $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
804
-
805
- /* query posts array */
806
- $my_posts = get_posts( apply_filters( 'ot_type_custom_post_type_checkbox_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
807
-
808
- /* has posts */
809
- if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
810
- foreach( $my_posts as $my_post ) {
811
- $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
812
- echo '<p>';
813
- 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 ) . '" />';
814
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
815
- echo '</p>';
816
- }
817
- } else {
818
- echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
819
- }
820
-
821
- echo '</div>';
822
-
823
- echo '</div>';
824
-
825
- }
826
-
827
- }
828
-
829
- /**
830
- * Custom Post Type Select option type.
831
- *
832
- * See @ot_display_by_type to see the full list of available arguments.
833
- *
834
- * @param array An array of arguments.
835
- * @return string
836
- *
837
- * @access public
838
- * @since 2.0
839
- */
840
- if ( ! function_exists( 'ot_type_custom_post_type_select' ) ) {
841
-
842
- function ot_type_custom_post_type_select( $args = array() ) {
843
-
844
- /* turns arguments array into variables */
845
- extract( $args );
846
-
847
- /* verify a description */
848
- $has_desc = $field_desc ? true : false;
849
-
850
- /* format setting outer wrapper */
851
- echo '<div class="format-setting type-custom-post-type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
852
-
853
- /* description */
854
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
855
-
856
- /* format setting inner wrapper */
857
- echo '<div class="format-setting-inner">';
858
-
859
- /* build category */
860
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
861
-
862
- /* setup the post types */
863
- $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
864
-
865
- /* query posts array */
866
- $my_posts = get_posts( apply_filters( 'ot_type_custom_post_type_select_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
867
-
868
- /* has posts */
869
- if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
870
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
871
- foreach( $my_posts as $my_post ) {
872
- $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
873
- echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
874
- }
875
- } else {
876
- echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
877
- }
878
-
879
- echo '</select>';
880
-
881
- echo '</div>';
882
-
883
- echo '</div>';
884
-
885
- }
886
-
887
- }
888
-
889
- /**
890
- * Date Picker option type.
891
- *
892
- * See @ot_display_by_type to see the full list of available arguments.
893
- *
894
- * @param array An array of arguments.
895
- * @return string
896
- *
897
- * @access public
898
- * @since 2.3
899
- */
900
- if ( ! function_exists( 'ot_type_date_picker' ) ) {
901
-
902
- function ot_type_date_picker( $args = array() ) {
903
-
904
- /* turns arguments array into variables */
905
- extract( $args );
906
-
907
- /* verify a description */
908
- $has_desc = $field_desc ? true : false;
909
-
910
- /* filter date format */
911
- $date_format = apply_filters( 'ot_type_date_picker_date_format', 'yy-mm-dd', $field_id );
912
-
913
- /**
914
- * Filter the addition of the readonly attribute.
915
- *
916
- * @since 2.5.0
917
- *
918
- * @param bool $is_readonly Whether to add the 'readonly' attribute. Default 'false'.
919
- * @param string $field_id The field ID.
920
- */
921
- $is_readonly = apply_filters( 'ot_type_date_picker_readonly', false, $field_id );
922
-
923
- /* format setting outer wrapper */
924
- echo '<div class="format-setting type-date-picker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
925
-
926
- /* date picker JS */
927
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_date_picker("' . esc_attr( $field_id ) . '", "' . esc_attr( $date_format ) . '"); });</script>';
928
-
929
- /* description */
930
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
931
-
932
- /* format setting inner wrapper */
933
- echo '<div class="format-setting-inner">';
934
-
935
- /* build date picker */
936
- 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 ' . esc_attr( $field_class ) . '"' . ( $is_readonly == true ? ' readonly' : '' ) . ' />';
937
-
938
- echo '</div>';
939
-
940
- echo '</div>';
941
-
942
- }
943
-
944
- }
945
-
946
- /**
947
- * Date Time Picker option type.
948
- *
949
- * See @ot_display_by_type to see the full list of available arguments.
950
- *
951
- * @param array An array of arguments.
952
- * @return string
953
- *
954
- * @access public
955
- * @since 2.3
956
- */
957
- if ( ! function_exists( 'ot_type_date_time_picker' ) ) {
958
-
959
- function ot_type_date_time_picker( $args = array() ) {
960
-
961
- /* turns arguments array into variables */
962
- extract( $args );
963
-
964
- /* verify a description */
965
- $has_desc = $field_desc ? true : false;
966
-
967
- /* filter date format */
968
- $date_format = apply_filters( 'ot_type_date_time_picker_date_format', 'yy-mm-dd', $field_id );
969
-
970
- /**
971
- * Filter the addition of the readonly attribute.
972
- *
973
- * @since 2.5.0
974
- *
975
- * @param bool $is_readonly Whether to add the 'readonly' attribute. Default 'false'.
976
- * @param string $field_id The field ID.
977
- */
978
- $is_readonly = apply_filters( 'ot_type_date_time_picker_readonly', false, $field_id );
979
-
980
- /* format setting outer wrapper */
981
- echo '<div class="format-setting type-date-time-picker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
982
-
983
- /* date time picker JS */
984
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_date_time_picker("' . esc_attr( $field_id ) . '", "' . esc_attr( $date_format ) . '"); });</script>';
985
-
986
- /* description */
987
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
988
-
989
- /* format setting inner wrapper */
990
- echo '<div class="format-setting-inner">';
991
-
992
- /* build date time picker */
993
- 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 ' . esc_attr( $field_class ) . '"' . ( $is_readonly == true ? ' readonly' : '' ) . ' />';
994
-
995
- echo '</div>';
996
-
997
- echo '</div>';
998
-
999
- }
1000
-
1001
- }
1002
-
1003
- /**
1004
- * Dimension Option Type
1005
- *
1006
- * See @ot_display_by_type to see the full list of available arguments.
1007
- *
1008
- * @param array The options arguments
1009
- * @return string The markup.
1010
- *
1011
- * @access public
1012
- * @since 2.5.0
1013
- */
1014
- if ( ! function_exists( 'ot_type_dimension' ) ) {
1015
-
1016
- function ot_type_dimension( $args = array() ) {
1017
-
1018
- /* turns arguments array into variables */
1019
- extract( $args );
1020
-
1021
- /* verify a description */
1022
- $has_desc = $field_desc ? true : false;
1023
-
1024
- /* format setting outer wrapper */
1025
- echo '<div class="format-setting type-dimension ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1026
-
1027
- /* description */
1028
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1029
-
1030
- /* format setting inner wrapper */
1031
- echo '<div class="format-setting-inner">';
1032
-
1033
- /* allow fields to be filtered */
1034
- $ot_recognized_dimension_fields = apply_filters( 'ot_recognized_dimension_fields', array(
1035
- 'width',
1036
- 'height',
1037
- 'unit'
1038
- ), $field_id );
1039
-
1040
- /* build width dimension */
1041
- if ( in_array( 'width', $ot_recognized_dimension_fields ) ) {
1042
-
1043
- $width = isset( $field_value['width'] ) ? esc_attr( $field_value['width'] ) : '';
1044
-
1045
- echo '<div class="ot-option-group ot-option-group--one-third"><span class="ot-icon-arrows-h ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[width]" id="' . esc_attr( $field_id ) . '-width" value="' . esc_attr( $width ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'width', 'option-tree' ) . '" /></div>';
1046
-
1047
- }
1048
-
1049
- /* build height dimension */
1050
- if ( in_array( 'height', $ot_recognized_dimension_fields ) ) {
1051
-
1052
- $height = isset( $field_value['height'] ) ? esc_attr( $field_value['height'] ) : '';
1053
-
1054
- echo '<div class="ot-option-group ot-option-group--one-third"><span class="ot-icon-arrows-v ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[height]" id="' . esc_attr( $field_id ) . '-height" value="' . esc_attr( $height ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'height', 'option-tree' ) . '" /></div>';
1055
-
1056
- }
1057
-
1058
- /* build unit dropdown */
1059
- if ( in_array( 'unit', $ot_recognized_dimension_fields ) ) {
1060
-
1061
- echo '<div class="ot-option-group ot-option-group--one-third ot-option-group--is-last">';
1062
-
1063
- echo '<select name="' . esc_attr( $field_name ) . '[unit]" id="' . esc_attr( $field_id ) . '-unit" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1064
-
1065
- echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
1066
-
1067
- foreach ( ot_recognized_dimension_unit_types( $field_id ) as $unit ) {
1068
- echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value['unit'] ) ? selected( $field_value['unit'], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
1069
- }
1070
-
1071
- echo '</select>';
1072
-
1073
- echo '</div>';
1074
-
1075
- }
1076
-
1077
- echo '</div>';
1078
-
1079
- echo '</div>';
1080
-
1081
- }
1082
-
1083
- }
1084
-
1085
- /**
1086
- * Gallery option type.
1087
- *
1088
- * See @ot_display_by_type to see the full list of available arguments.
1089
- *
1090
- * @param array The options arguments
1091
- * @return string The gallery metabox markup.
1092
- *
1093
- * @access public
1094
- * @since 2.2.0
1095
- */
1096
- if ( ! function_exists( 'ot_type_gallery' ) ) {
1097
-
1098
- function ot_type_gallery( $args = array() ) {
1099
-
1100
- // Turns arguments array into variables
1101
- extract( $args );
1102
-
1103
- // Verify a description
1104
- $has_desc = $field_desc ? true : false;
1105
-
1106
- // Format setting outer wrapper
1107
- echo '<div class="format-setting type-gallery ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1108
-
1109
- // Description
1110
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1111
-
1112
- // Format setting inner wrapper
1113
- echo '<div class="format-setting-inner">';
1114
-
1115
- // Setup the post type
1116
- $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
1117
-
1118
- $field_value = trim( $field_value );
1119
-
1120
- // Saved values
1121
- 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 ) . '" />';
1122
-
1123
- // Search the string for the IDs
1124
- preg_match( '/ids=\'(.*?)\'/', $field_value, $matches );
1125
-
1126
- // Turn the field value into an array of IDs
1127
- if ( isset( $matches[1] ) ) {
1128
-
1129
- // Found the IDs in the shortcode
1130
- $ids = explode( ',', $matches[1] );
1131
-
1132
- } else {
1133
-
1134
- // The string is only IDs
1135
- $ids = ! empty( $field_value ) && $field_value != '' ? explode( ',', $field_value ) : array();
1136
-
1137
- }
1138
-
1139
- // Has attachment IDs
1140
- if ( ! empty( $ids ) ) {
1141
-
1142
- echo '<ul class="ot-gallery-list">';
1143
-
1144
- foreach( $ids as $id ) {
1145
-
1146
- if ( $id == '' )
1147
- continue;
1148
-
1149
- $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
1150
-
1151
- echo '<li><img src="' . $thumbnail[0] . '" width="75" height="75" /></li>';
1152
-
1153
- }
1154
-
1155
- echo '</ul>';
1156
-
1157
- echo '
1158
- <div class="ot-gallery-buttons">
1159
- <a href="#" class="option-tree-ui-button button button-secondary hug-left ot-gallery-delete">' . __( 'Delete Gallery', 'option-tree' ) . '</a>
1160
- <a href="#" class="option-tree-ui-button button button-primary right hug-right ot-gallery-edit">' . __( 'Edit Gallery', 'option-tree' ) . '</a>
1161
- </div>';
1162
-
1163
- } else {
1164
-
1165
- echo '
1166
- <div class="ot-gallery-buttons">
1167
- <a href="#" class="option-tree-ui-button button button-primary right hug-right ot-gallery-edit">' . __( 'Create Gallery', 'option-tree' ) . '</a>
1168
- </div>';
1169
-
1170
- }
1171
-
1172
- echo '</div>';
1173
-
1174
- echo '</div>';
1175
-
1176
- }
1177
-
1178
- }
1179
-
1180
- /**
1181
- * Google Fonts option type.
1182
- *
1183
- * See @ot_display_by_type to see the full list of available arguments.
1184
- *
1185
- * @param array An array of arguments.
1186
- * @return string
1187
- *
1188
- * @access public
1189
- * @since 2.5.0
1190
- */
1191
- if ( ! function_exists( 'ot_type_google_fonts' ) ) {
1192
-
1193
- function ot_type_google_fonts( $args = array() ) {
1194
-
1195
- /* turns arguments array into variables */
1196
- extract( $args );
1197
-
1198
- /* verify a description */
1199
- $has_desc = $field_desc ? true : false;
1200
-
1201
- /* format setting outer wrapper */
1202
- echo '<div class="format-setting type-google-font ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1203
-
1204
- /* description */
1205
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1206
-
1207
- /* format setting inner wrapper */
1208
- echo '<div class="format-setting-inner">';
1209
-
1210
- /* allow fields to be filtered */
1211
- $ot_recognized_google_fonts_fields = apply_filters( 'ot_recognized_google_font_fields', array(
1212
- 'variants',
1213
- 'subsets'
1214
- ), $field_id );
1215
-
1216
- // Set a default to show at least one item.
1217
- if ( ! is_array( $field_value ) || empty( $field_value ) ) {
1218
- $field_value = array( array(
1219
- 'family' => '',
1220
- 'variants' => array(),
1221
- 'subsets' => array()
1222
- ) );
1223
- }
1224
-
1225
- foreach( $field_value as $key => $value ) {
1226
-
1227
- echo '<div class="type-google-font-group">';
1228
-
1229
- /* build font family */
1230
- $family = isset( $value['family'] ) ? $value['family'] : '';
1231
- echo '<div class="option-tree-google-font-family">';
1232
- echo '<a href="javascript:void(0);" class="js-remove-google-font option-tree-ui-button button button-secondary light" title="' . __( 'Remove Google Font', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"/>' . __( 'Remove Google Font', 'option-tree' ) . '</a>';
1233
- echo '<select name="' . esc_attr( $field_name ) . '[' . $key . '][family]" id="' . esc_attr( $field_id ) . '-' . $key . '" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1234
- echo '<option value="">' . __( '-- Choose One --', 'option-tree' ) . '</option>';
1235
- foreach ( ot_recognized_google_font_families( $field_id ) as $family_key => $family_value ) {
1236
- echo '<option value="' . esc_attr( $family_key ) . '" ' . selected( $family, $family_key, false ) . '>' . esc_html( $family_value ) . '</option>';
1237
- }
1238
- echo '</select>';
1239
- echo '</div>';
1240
-
1241
- /* build font variants */
1242
- if ( in_array( 'variants', $ot_recognized_google_fonts_fields ) ) {
1243
- $variants = isset( $value['variants'] ) ? $value['variants'] : array();
1244
- echo '<div class="option-tree-google-font-variants" data-field-id-prefix="' . esc_attr( $field_id ) . '-' . $key . '-" data-field-name="' . esc_attr( $field_name ) . '[' . $key . '][variants]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1245
- foreach ( ot_recognized_google_font_variants( $field_id, $family ) as $variant_key => $variant ) {
1246
- echo '<p class="checkbox-wrap">';
1247
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . $key . '][variants][]" id="' . esc_attr( $field_id ) . '-' . $key . '-' . $variant . '" value="' . esc_attr( $variant ) . '" ' . checked( in_array( $variant, $variants ), true, false ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
1248
- echo '<label for="' . esc_attr( $field_id ) . '-' . $key . '-' . $variant . '">' . esc_html( $variant ) . '</label>';
1249
- echo '</p>';
1250
- }
1251
- echo '</div>';
1252
- }
1253
-
1254
- /* build font subsets */
1255
- if ( in_array( 'subsets', $ot_recognized_google_fonts_fields ) ) {
1256
- $subsets = isset( $value['subsets'] ) ? $value['subsets'] : array();
1257
- echo '<div class="option-tree-google-font-subsets" data-field-id-prefix="' . esc_attr( $field_id ) . '-' . $key . '-" data-field-name="' . esc_attr( $field_name ) . '[' . $key . '][subsets]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1258
- foreach ( ot_recognized_google_font_subsets( $field_id, $family ) as $subset_key => $subset ) {
1259
- echo '<p class="checkbox-wrap">';
1260
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . $key . '][subsets][]" id="' . esc_attr( $field_id ) . '-' . $key . '-' . $subset . '" value="' . esc_attr( $subset ) . '" ' . checked( in_array( $subset, $subsets ), true, false ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
1261
- echo '<label for="' . esc_attr( $field_id ) . '-' . $key . '-' . $subset . '">' . esc_html( $subset ) . '</label>';
1262
- echo '</p>';
1263
- }
1264
- echo '</div>';
1265
- }
1266
-
1267
- echo '</div>';
1268
-
1269
- }
1270
-
1271
- echo '<div class="type-google-font-group-clone">';
1272
-
1273
- /* build font family */
1274
- echo '<div class="option-tree-google-font-family">';
1275
- echo '<a href="javascript:void(0);" class="js-remove-google-font option-tree-ui-button button button-secondary light" title="' . __( 'Remove Google Font', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"/>' . __( 'Remove Google Font', 'option-tree' ) . '</a>';
1276
- echo '<select name="' . esc_attr( $field_name ) . '[%key%][family]" id="' . esc_attr( $field_id ) . '-%key%" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1277
- echo '<option value="">' . __( '-- Choose One --', 'option-tree' ) . '</option>';
1278
- foreach ( ot_recognized_google_font_families( $field_id ) as $family_key => $family_value ) {
1279
- echo '<option value="' . esc_attr( $family_key ) . '">' . esc_html( $family_value ) . '</option>';
1280
- }
1281
- echo '</select>';
1282
- echo '</div>';
1283
-
1284
- /* build font variants */
1285
- if ( in_array( 'variants', $ot_recognized_google_fonts_fields ) ) {
1286
- echo '<div class="option-tree-google-font-variants" data-field-id-prefix="' . esc_attr( $field_id ) . '-%key%-" data-field-name="' . esc_attr( $field_name ) . '[%key%][variants]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1287
- echo '</div>';
1288
- }
1289
-
1290
- /* build font subsets */
1291
- if ( in_array( 'subsets', $ot_recognized_google_fonts_fields ) ) {
1292
- echo '<div class="option-tree-google-font-subsets" data-field-id-prefix="' . esc_attr( $field_id ) . '-%key%-" data-field-name="' . esc_attr( $field_name ) . '[%key%][subsets]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1293
- echo '</div>';
1294
- }
1295
-
1296
- echo '</div>';
1297
-
1298
- echo '<a href="javascript:void(0);" class="js-add-google-font option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add Google Font', 'option-tree' ) . '">' . __( 'Add Google Font', 'option-tree' ) . '</a>';
1299
-
1300
- echo '</div>';
1301
-
1302
- echo '</div>';
1303
-
1304
- }
1305
-
1306
- }
1307
-
1308
- /**
1309
- * JavaScript option type.
1310
- *
1311
- * See @ot_display_by_type to see the full list of available arguments.
1312
- *
1313
- * @param array An array of arguments.
1314
- * @return string
1315
- *
1316
- * @access public
1317
- * @since 2.5.0
1318
- */
1319
- if ( ! function_exists( 'ot_type_javascript' ) ) {
1320
-
1321
- function ot_type_javascript( $args = array() ) {
1322
-
1323
- /* turns arguments array into variables */
1324
- extract( $args );
1325
-
1326
- /* verify a description */
1327
- $has_desc = $field_desc ? true : false;
1328
-
1329
- /* format setting outer wrapper */
1330
- echo '<div class="format-setting type-javascript simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1331
-
1332
- /* description */
1333
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1334
-
1335
- /* format setting inner wrapper */
1336
- echo '<div class="format-setting-inner">';
1337
-
1338
- /* build textarea for CSS */
1339
- echo '<textarea class="hidden" id="textarea_' . esc_attr( $field_id ) . '" name="' . esc_attr( $field_name ) .'">' . esc_attr( $field_value ) . '</textarea>';
1340
-
1341
- /* build pre to convert it into ace editor later */
1342
- echo '<pre class="ot-javascript-editor ' . esc_attr( $field_class ) . '" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</pre>';
1343
-
1344
- echo '</div>';
1345
-
1346
- echo '</div>';
1347
-
1348
- }
1349
-
1350
- }
1351
-
1352
- /**
1353
- * Link Color option type.
1354
- *
1355
- * See @ot_display_by_type to see the full list of available arguments.
1356
- *
1357
- * @param array The options arguments
1358
- * @return string The markup.
1359
- *
1360
- * @access public
1361
- * @since 2.5.0
1362
- */
1363
- if ( ! function_exists( 'ot_type_link_color' ) ) {
1364
-
1365
- function ot_type_link_color( $args = array() ) {
1366
-
1367
- /* turns arguments array into variables */
1368
- extract( $args );
1369
-
1370
- /* verify a description */
1371
- $has_desc = $field_desc ? true : false;
1372
-
1373
- /* format setting outer wrapper */
1374
- echo '<div class="format-setting type-link-color ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1375
-
1376
- /* description */
1377
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1378
-
1379
- /* format setting inner wrapper */
1380
- echo '<div class="format-setting-inner">';
1381
-
1382
- /* allow fields to be filtered */
1383
- $ot_recognized_link_color_fields = apply_filters( 'ot_recognized_link_color_fields', array(
1384
- 'link' => _x( 'Standard', 'color picker', 'option-tree' ),
1385
- 'hover' => _x( 'Hover', 'color picker', 'option-tree' ),
1386
- 'active' => _x( 'Active', 'color picker', 'option-tree' ),
1387
- 'visited' => _x( 'Visited', 'color picker', 'option-tree' ),
1388
- 'focus' => _x( 'Focus', 'color picker', 'option-tree' )
1389
- ), $field_id );
1390
-
1391
- /* build link color fields */
1392
- foreach( $ot_recognized_link_color_fields as $type => $label ) {
1393
-
1394
- if ( array_key_exists( $type, $ot_recognized_link_color_fields ) ) {
1395
-
1396
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
1397
-
1398
- echo '<label for="' . esc_attr( $field_id ) . '-picker-' . $type . '" class="option-tree-ui-colorpicker-label">' . esc_attr( $label ) . '</label>';
1399
-
1400
- /* colorpicker JS */
1401
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker-' . $type . '"); });</script>';
1402
-
1403
- /* set color */
1404
- $color = isset( $field_value[ $type ] ) ? esc_attr( $field_value[ $type ] ) : '';
1405
-
1406
- /* set default color */
1407
- $std = isset( $field_std[ $type ] ) ? 'data-default-color="' . $field_std[ $type ] . '"' : '';
1408
-
1409
- /* input */
1410
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[' . $type . ']" id="' . esc_attr( $field_id ) . '-picker-' . $type . '" value="' . $color . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" ' . $std . ' />';
1411
-
1412
- echo '</div>';
1413
-
1414
- }
1415
-
1416
- }
1417
-
1418
- echo '</div>';
1419
-
1420
- echo '</div>';
1421
-
1422
- }
1423
-
1424
- }
1425
-
1426
- /**
1427
- * List Item option type.
1428
- *
1429
- * See @ot_display_by_type to see the full list of available arguments.
1430
- *
1431
- * @param array An array of arguments.
1432
- * @return string
1433
- *
1434
- * @access public
1435
- * @since 2.0
1436
- */
1437
- if ( ! function_exists( 'ot_type_list_item' ) ) {
1438
-
1439
- function ot_type_list_item( $args = array() ) {
1440
-
1441
- /* turns arguments array into variables */
1442
- extract( $args );
1443
-
1444
- /* verify a description */
1445
- $has_desc = $field_desc ? true : false;
1446
-
1447
- // Default
1448
- $sortable = true;
1449
-
1450
- // Check if the list can be sorted
1451
- if ( ! empty( $field_class ) ) {
1452
- $classes = explode( ' ', $field_class );
1453
- if ( in_array( 'not-sortable', $classes ) ) {
1454
- $sortable = false;
1455
- str_replace( 'not-sortable', '', $field_class );
1456
- }
1457
- }
1458
-
1459
- /* format setting outer wrapper */
1460
- echo '<div class="format-setting type-list-item ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1461
-
1462
- /* description */
1463
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1464
-
1465
- /* format setting inner wrapper */
1466
- echo '<div class="format-setting-inner">';
1467
-
1468
- /* pass the settings array arround */
1469
- echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
1470
-
1471
- /**
1472
- * settings pages have array wrappers like 'option_tree'.
1473
- * So we need that value to create a proper array to save to.
1474
- * This is only for NON metabox settings.
1475
- */
1476
- if ( ! isset( $get_option ) )
1477
- $get_option = '';
1478
-
1479
- /* build list items */
1480
- echo '<ul class="option-tree-setting-wrap' . ( $sortable ? ' option-tree-sortable' : '' ) .'" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
1481
-
1482
- if ( is_array( $field_value ) && ! empty( $field_value ) ) {
1483
-
1484
- foreach( $field_value as $key => $list_item ) {
1485
-
1486
- echo '<li class="ui-state-default list-list-item">';
1487
- ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
1488
- echo '</li>';
1489
-
1490
- }
1491
-
1492
- }
1493
-
1494
- echo '</ul>';
1495
-
1496
- /* button */
1497
- echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
1498
-
1499
- /* description */
1500
- $list_desc = $sortable ? __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ) : '';
1501
- echo '<div class="list-item-description">' . apply_filters( 'ot_list_item_description', $list_desc, $field_id ) . '</div>';
1502
-
1503
- echo '</div>';
1504
-
1505
- echo '</div>';
1506
-
1507
- }
1508
-
1509
- }
1510
-
1511
- /**
1512
- * Measurement option type.
1513
- *
1514
- * See @ot_display_by_type to see the full list of available arguments.
1515
- *
1516
- * @param array An array of arguments.
1517
- * @return string
1518
- *
1519
- * @access public
1520
- * @since 2.0
1521
- */
1522
- if ( ! function_exists( 'ot_type_measurement' ) ) {
1523
-
1524
- function ot_type_measurement( $args = array() ) {
1525
-
1526
- /* turns arguments array into variables */
1527
- extract( $args );
1528
-
1529
- /* verify a description */
1530
- $has_desc = $field_desc ? true : false;
1531
-
1532
- /* format setting outer wrapper */
1533
- echo '<div class="format-setting type-measurement ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1534
-
1535
- /* description */
1536
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1537
-
1538
- /* format setting inner wrapper */
1539
- echo '<div class="format-setting-inner">';
1540
-
1541
- echo '<div class="option-tree-ui-measurement-input-wrap">';
1542
-
1543
- echo '<input type="text" name="' . esc_attr( $field_name ) . '[0]" id="' . esc_attr( $field_id ) . '-0" value="' . ( isset( $field_value[0] ) ? esc_attr( $field_value[0] ) : '' ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" />';
1544
-
1545
- echo '</div>';
1546
-
1547
- /* build measurement */
1548
- echo '<select name="' . esc_attr( $field_name ) . '[1]" id="' . esc_attr( $field_id ) . '-1" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1549
-
1550
- echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
1551
-
1552
- foreach ( ot_measurement_unit_types( $field_id ) as $unit ) {
1553
- echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value[1] ) ? selected( $field_value[1], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
1554
- }
1555
-
1556
- echo '</select>';
1557
-
1558
- echo '</div>';
1559
-
1560
- echo '</div>';
1561
-
1562
- }
1563
-
1564
- }
1565
-
1566
- /**
1567
- * Numeric Slider option type.
1568
- *
1569
- * See @ot_display_by_type to see the full list of available arguments.
1570
- *
1571
- * @param array An array of arguments.
1572
- * @return string
1573
- *
1574
- * @access public
1575
- * @since 2.1
1576
- */
1577
- if ( ! function_exists( 'ot_type_numeric_slider' ) ) {
1578
-
1579
- function ot_type_numeric_slider( $args = array() ) {
1580
-
1581
- /* turns arguments array into variables */
1582
- extract( $args );
1583
-
1584
- /* verify a description */
1585
- $has_desc = $field_desc ? true : false;
1586
-
1587
- $_options = explode( ',', $field_min_max_step );
1588
- $min = isset( $_options[0] ) ? $_options[0] : 0;
1589
- $max = isset( $_options[1] ) ? $_options[1] : 100;
1590
- $step = isset( $_options[2] ) ? $_options[2] : 1;
1591
-
1592
- /* format setting outer wrapper */
1593
- echo '<div class="format-setting type-numeric-slider ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1594
-
1595
- /* description */
1596
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1597
-
1598
- /* format setting inner wrapper */
1599
- echo '<div class="format-setting-inner">';
1600
-
1601
- echo '<div class="ot-numeric-slider-wrap">';
1602
-
1603
- 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 ) . '">';
1604
-
1605
- 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>';
1606
-
1607
- echo '<div id="ot_numeric_slider_' . esc_attr( $field_id ) . '" class="ot-numeric-slider"></div>';
1608
-
1609
- echo '</div>';
1610
-
1611
- echo '</div>';
1612
-
1613
- echo '</div>';
1614
- }
1615
-
1616
- }
1617
-
1618
- /**
1619
- * On/Off option type
1620
- *
1621
- * See @ot_display_by_type to see the full list of available arguments.
1622
- *
1623
- * @param array The options arguments
1624
- * @return string The gallery metabox markup.
1625
- *
1626
- * @access public
1627
- * @since 2.2.0
1628
- */
1629
- if ( ! function_exists( 'ot_type_on_off' ) ) {
1630
-
1631
- function ot_type_on_off( $args = array() ) {
1632
-
1633
- /* turns arguments array into variables */
1634
- extract( $args );
1635
-
1636
- /* verify a description */
1637
- $has_desc = $field_desc ? true : false;
1638
-
1639
- /* format setting outer wrapper */
1640
- echo '<div class="format-setting type-radio ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1641
-
1642
- /* description */
1643
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1644
-
1645
- /* format setting inner wrapper */
1646
- echo '<div class="format-setting-inner">';
1647
-
1648
- /* Force only two choices, and allowing filtering on the choices value & label */
1649
- $field_choices = array(
1650
- array(
1651
- /**
1652
- * Filter the value of the On button.
1653
- *
1654
- * @since 2.5.0
1655
- *
1656
- * @param string The On button value. Default 'on'.
1657
- * @param string $field_id The field ID.
1658
- * @param string $filter_id For filtering both on/off value with one function.
1659
- */
1660
- 'value' => apply_filters( 'ot_on_off_switch_on_value', 'on', $field_id, 'on' ),
1661
- /**
1662
- * Filter the label of the On button.
1663
- *
1664
- * @since 2.5.0
1665
- *
1666
- * @param string The On button label. Default 'On'.
1667
- * @param string $field_id The field ID.
1668
- * @param string $filter_id For filtering both on/off label with one function.
1669
- */
1670
- 'label' => apply_filters( 'ot_on_off_switch_on_label', __( 'On', 'option-tree' ), $field_id, 'on' )
1671
- ),
1672
- array(
1673
- /**
1674
- * Filter the value of the Off button.
1675
- *
1676
- * @since 2.5.0
1677
- *
1678
- * @param string The Off button value. Default 'off'.
1679
- * @param string $field_id The field ID.
1680
- * @param string $filter_id For filtering both on/off value with one function.
1681
- */
1682
- 'value' => apply_filters( 'ot_on_off_switch_off_value', 'off', $field_id, 'off' ),
1683
- /**
1684
- * Filter the label of the Off button.
1685
- *
1686
- * @since 2.5.0
1687
- *
1688
- * @param string The Off button label. Default 'Off'.
1689
- * @param string $field_id The field ID.
1690
- * @param string $filter_id For filtering both on/off label with one function.
1691
- */
1692
- 'label' => apply_filters( 'ot_on_off_switch_off_label', __( 'Off', 'option-tree' ), $field_id, 'off' )
1693
- )
1694
- );
1695
-
1696
- /**
1697
- * Filter the width of the On/Off switch.
1698
- *
1699
- * @since 2.5.0
1700
- *
1701
- * @param string The switch width. Default '100px'.
1702
- * @param string $field_id The field ID.
1703
- */
1704
- $switch_width = apply_filters( 'ot_on_off_switch_width', '100px', $field_id );
1705
-
1706
- echo '<div class="on-off-switch"' . ( $switch_width != '100px' ? sprintf( ' style="width:%s"', $switch_width ) : '' ) . '>';
1707
-
1708
- /* build radio */
1709
- foreach ( (array) $field_choices as $key => $choice ) {
1710
- echo '
1711
- <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 ) . '" />
1712
- <label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" onclick="">' . esc_attr( $choice['label'] ) . '</label>';
1713
- }
1714
-
1715
- echo '<span class="slide-button"></span>';
1716
-
1717
- echo '</div>';
1718
-
1719
- echo '</div>';
1720
-
1721
- echo '</div>';
1722
-
1723
- }
1724
-
1725
- }
1726
-
1727
- /**
1728
- * Page Checkbox option type.
1729
- *
1730
- * See @ot_display_by_type to see the full list of available arguments.
1731
- *
1732
- * @param array An array of arguments.
1733
- * @return string
1734
- *
1735
- * @access public
1736
- * @since 2.0
1737
- */
1738
- if ( ! function_exists( 'ot_type_page_checkbox' ) ) {
1739
-
1740
- function ot_type_page_checkbox( $args = array() ) {
1741
-
1742
- /* turns arguments array into variables */
1743
- extract( $args );
1744
-
1745
- /* verify a description */
1746
- $has_desc = $field_desc ? true : false;
1747
-
1748
- /* format setting outer wrapper */
1749
- echo '<div class="format-setting type-page-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1750
-
1751
- /* description */
1752
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1753
-
1754
- /* format setting inner wrapper */
1755
- echo '<div class="format-setting-inner">';
1756
-
1757
- /* query pages array */
1758
- $my_posts = get_posts( apply_filters( 'ot_type_page_checkbox_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1759
-
1760
- /* has pages */
1761
- if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1762
- foreach( $my_posts as $my_post ) {
1763
- $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1764
- echo '<p>';
1765
- 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 ) . '" />';
1766
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
1767
- echo '</p>';
1768
- }
1769
- } else {
1770
- echo '<p>' . __( 'No Pages Found', 'option-tree' ) . '</p>';
1771
- }
1772
-
1773
- echo '</div>';
1774
-
1775
- echo '</div>';
1776
-
1777
- }
1778
-
1779
- }
1780
-
1781
- /**
1782
- * Page Select option type.
1783
- *
1784
- * See @ot_display_by_type to see the full list of available arguments.
1785
- *
1786
- * @param array An array of arguments.
1787
- * @return string
1788
- *
1789
- * @access public
1790
- * @since 2.0
1791
- */
1792
- if ( ! function_exists( 'ot_type_page_select' ) ) {
1793
-
1794
- function ot_type_page_select( $args = array() ) {
1795
-
1796
- /* turns arguments array into variables */
1797
- extract( $args );
1798
-
1799
- /* verify a description */
1800
- $has_desc = $field_desc ? true : false;
1801
-
1802
- /* format setting outer wrapper */
1803
- echo '<div class="format-setting type-page-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1804
-
1805
- /* description */
1806
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1807
-
1808
- /* format setting inner wrapper */
1809
- echo '<div class="format-setting-inner">';
1810
-
1811
- /* build page select */
1812
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
1813
-
1814
- /* query pages array */
1815
- $my_posts = get_posts( apply_filters( 'ot_type_page_select_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1816
-
1817
- /* has pages */
1818
- if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1819
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1820
- foreach( $my_posts as $my_post ) {
1821
- $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1822
- echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
1823
- }
1824
- } else {
1825
- echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
1826
- }
1827
-
1828
- echo '</select>';
1829
-
1830
- echo '</div>';
1831
-
1832
- echo '</div>';
1833
-
1834
- }
1835
-
1836
- }
1837
-
1838
- /**
1839
- * Post Checkbox option type.
1840
- *
1841
- * See @ot_display_by_type to see the full list of available arguments.
1842
- *
1843
- * @param array An array of arguments.
1844
- * @return string
1845
- *
1846
- * @access public
1847
- * @since 2.0
1848
- */
1849
- if ( ! function_exists( 'ot_type_post_checkbox' ) ) {
1850
-
1851
- function ot_type_post_checkbox( $args = array() ) {
1852
-
1853
- /* turns arguments array into variables */
1854
- extract( $args );
1855
-
1856
- /* verify a description */
1857
- $has_desc = $field_desc ? true : false;
1858
-
1859
- /* format setting outer wrapper */
1860
- echo '<div class="format-setting type-post-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1861
-
1862
- /* description */
1863
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1864
-
1865
- /* format setting inner wrapper */
1866
- echo '<div class="format-setting-inner">';
1867
-
1868
- /* query posts array */
1869
- $my_posts = get_posts( apply_filters( 'ot_type_post_checkbox_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1870
-
1871
- /* has posts */
1872
- if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1873
- foreach( $my_posts as $my_post ) {
1874
- $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1875
- echo '<p>';
1876
- 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 ) . '" />';
1877
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
1878
- echo '</p>';
1879
- }
1880
- } else {
1881
- echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
1882
- }
1883
-
1884
- echo '</div>';
1885
-
1886
- echo '</div>';
1887
-
1888
- }
1889
-
1890
- }
1891
-
1892
- /**
1893
- * Post Select option type.
1894
- *
1895
- * See @ot_display_by_type to see the full list of available arguments.
1896
- *
1897
- * @param array An array of arguments.
1898
- * @return string
1899
- *
1900
- * @access public
1901
- * @since 2.0
1902
- */
1903
- if ( ! function_exists( 'ot_type_post_select' ) ) {
1904
-
1905
- function ot_type_post_select( $args = array() ) {
1906
-
1907
- /* turns arguments array into variables */
1908
- extract( $args );
1909
-
1910
- /* verify a description */
1911
- $has_desc = $field_desc ? true : false;
1912
-
1913
- /* format setting outer wrapper */
1914
- echo '<div class="format-setting type-post-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1915
-
1916
- /* description */
1917
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1918
-
1919
- /* format setting inner wrapper */
1920
- echo '<div class="format-setting-inner">';
1921
-
1922
- /* build page select */
1923
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
1924
-
1925
- /* query posts array */
1926
- $my_posts = get_posts( apply_filters( 'ot_type_post_select_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1927
-
1928
- /* has posts */
1929
- if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1930
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1931
- foreach( $my_posts as $my_post ) {
1932
- $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1933
- echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
1934
- }
1935
- } else {
1936
- echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
1937
- }
1938
-
1939
- echo '</select>';
1940
-
1941
- echo '</div>';
1942
-
1943
- echo '</div>';
1944
-
1945
- }
1946
-
1947
- }
1948
-
1949
- /**
1950
- * Radio option type.
1951
- *
1952
- * See @ot_display_by_type to see the full list of available arguments.
1953
- *
1954
- * @param array An array of arguments.
1955
- * @return string
1956
- *
1957
- * @access public
1958
- * @since 2.0
1959
- */
1960
- if ( ! function_exists( 'ot_type_radio' ) ) {
1961
-
1962
- function ot_type_radio( $args = array() ) {
1963
-
1964
- /* turns arguments array into variables */
1965
- extract( $args );
1966
-
1967
- /* verify a description */
1968
- $has_desc = $field_desc ? true : false;
1969
-
1970
- /* format setting outer wrapper */
1971
- echo '<div class="format-setting type-radio ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1972
-
1973
- /* description */
1974
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1975
-
1976
- /* format setting inner wrapper */
1977
- echo '<div class="format-setting-inner">';
1978
-
1979
- /* build radio */
1980
- foreach ( (array) $field_choices as $key => $choice ) {
1981
- echo '<p><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 ) . '" /><label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label></p>';
1982
- }
1983
-
1984
- echo '</div>';
1985
-
1986
- echo '</div>';
1987
-
1988
- }
1989
-
1990
- }
1991
-
1992
- /**
1993
- * Radio Images option type.
1994
- *
1995
- * See @ot_display_by_type to see the full list of available arguments.
1996
- *
1997
- * @param array An array of arguments.
1998
- * @return string
1999
- *
2000
- * @access public
2001
- * @since 2.0
2002
- */
2003
- if ( ! function_exists( 'ot_type_radio_image' ) ) {
2004
-
2005
- function ot_type_radio_image( $args = array() ) {
2006
-
2007
- /* turns arguments array into variables */
2008
- extract( $args );
2009
-
2010
- /* verify a description */
2011
- $has_desc = $field_desc ? true : false;
2012
-
2013
- /* format setting outer wrapper */
2014
- echo '<div class="format-setting type-radio-image ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2015
-
2016
- /* description */
2017
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2018
-
2019
- /* format setting inner wrapper */
2020
- echo '<div class="format-setting-inner">';
2021
-
2022
- /**
2023
- * load the default filterable images if nothing
2024
- * has been set in the choices array.
2025
- */
2026
- if ( empty( $field_choices ) )
2027
- $field_choices = ot_radio_images( $field_id );
2028
-
2029
- /* build radio image */
2030
- foreach ( (array) $field_choices as $key => $choice ) {
2031
-
2032
- $src = str_replace( 'OT_URL', OT_URL, $choice['src'] );
2033
- $src = str_replace( 'OT_THEME_URL', OT_THEME_URL, $src );
2034
-
2035
- /* make radio image source filterable */
2036
- $src = apply_filters( 'ot_type_radio_image_src', $src, $field_id );
2037
-
2038
- /**
2039
- * Filter the image attributes.
2040
- *
2041
- * @since 2.5.3
2042
- *
2043
- * @param string $attributes The image attributes.
2044
- * @param string $field_id The field ID.
2045
- * @param array $choice The choice.
2046
- */
2047
- $attributes = apply_filters( 'ot_type_radio_image_attributes', '', $field_id, $choice );
2048
-
2049
- echo '<div class="option-tree-ui-radio-images">';
2050
- echo '<p style="display:none"><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="option-tree-ui-radio option-tree-ui-images" /><label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label></p>';
2051
- echo '<img ' . $attributes . ' src="' . esc_url( $src ) . '" alt="' . esc_attr( $choice['label'] ) .'" title="' . esc_attr( $choice['label'] ) .'" class="option-tree-ui-radio-image ' . esc_attr( $field_class ) . ( $field_value == $choice['value'] ? ' option-tree-ui-radio-image-selected' : '' ) . '" />';
2052
- echo '</div>';
2053
- }
2054
-
2055
- echo '</div>';
2056
-
2057
- echo '</div>';
2058
-
2059
- }
2060
-
2061
- }
2062
-
2063
- /**
2064
- * Select option type.
2065
- *
2066
- * See @ot_display_by_type to see the full list of available arguments.
2067
- *
2068
- * @param array An array of arguments.
2069
- * @return string
2070
- *
2071
- * @access public
2072
- * @since 2.0
2073
- */
2074
- if ( ! function_exists( 'ot_type_select' ) ) {
2075
-
2076
- function ot_type_select( $args = array() ) {
2077
-
2078
- /* turns arguments array into variables */
2079
- extract( $args );
2080
-
2081
- /* verify a description */
2082
- $has_desc = $field_desc ? true : false;
2083
-
2084
- /* format setting outer wrapper */
2085
- echo '<div class="format-setting type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2086
-
2087
- /* description */
2088
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2089
-
2090
- /* filter choices array */
2091
- $field_choices = apply_filters( 'ot_type_select_choices', $field_choices, $field_id );
2092
-
2093
- /* format setting inner wrapper */
2094
- echo '<div class="format-setting-inner">';
2095
-
2096
- /* build select */
2097
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
2098
- foreach ( (array) $field_choices as $choice ) {
2099
- if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
2100
- echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( $field_value, $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
2101
- }
2102
- }
2103
-
2104
- echo '</select>';
2105
-
2106
- echo '</div>';
2107
-
2108
- echo '</div>';
2109
-
2110
- }
2111
-
2112
- }
2113
-
2114
- /**
2115
- * Sidebar Select option type.
2116
- *
2117
- * This option type makes it possible for users to select a WordPress registered sidebar
2118
- * to use on a specific area. By using the two provided filters, 'ot_recognized_sidebars',
2119
- * and 'ot_recognized_sidebars_{$field_id}' we can be selective about which sidebars are
2120
- * available on a specific content area.
2121
- *
2122
- * For example, if we create a WordPress theme that provides the ability to change the
2123
- * Blog Sidebar and we don't want to have the footer sidebars available on this area,
2124
- * we can unset those sidebars either manually or by using a regular expression if we
2125
- * have a common name like footer-sidebar-$i.
2126
- *
2127
- * @param array An array of arguments.
2128
- * @return string
2129
- *
2130
- * @access public
2131
- * @since 2.1
2132
- */
2133
- if ( ! function_exists( 'ot_type_sidebar_select' ) ) {
2134
-
2135
- function ot_type_sidebar_select( $args = array() ) {
2136
-
2137
- /* turns arguments array into variables */
2138
- extract( $args );
2139
-
2140
- /* verify a description */
2141
- $has_desc = $field_desc ? true : false;
2142
-
2143
- /* format setting outer wrapper */
2144
- echo '<div class="format-setting type-sidebar-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2145
-
2146
- /* description */
2147
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2148
-
2149
- /* format setting inner wrapper */
2150
- echo '<div class="format-setting-inner">';
2151
-
2152
- /* build page select */
2153
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
2154
-
2155
- /* get the registered sidebars */
2156
- global $wp_registered_sidebars;
2157
-
2158
- $sidebars = array();
2159
- foreach( $wp_registered_sidebars as $id=>$sidebar ) {
2160
- $sidebars[ $id ] = $sidebar[ 'name' ];
2161
- }
2162
-
2163
- /* filters to restrict which sidebars are allowed to be selected, for example we can restrict footer sidebars to be selectable on a blog page */
2164
- $sidebars = apply_filters( 'ot_recognized_sidebars', $sidebars );
2165
- $sidebars = apply_filters( 'ot_recognized_sidebars_' . $field_id, $sidebars );
2166
-
2167
- /* has sidebars */
2168
- if ( count( $sidebars ) ) {
2169
- echo '<option value="">-- ' . __( 'Choose Sidebar', 'option-tree' ) . ' --</option>';
2170
- foreach ( $sidebars as $id => $sidebar ) {
2171
- echo '<option value="' . esc_attr( $id ) . '"' . selected( $field_value, $id, false ) . '>' . esc_attr( $sidebar ) . '</option>';
2172
- }
2173
- } else {
2174
- echo '<option value="">' . __( 'No Sidebars', 'option-tree' ) . '</option>';
2175
- }
2176
-
2177
- echo '</select>';
2178
-
2179
- echo '</div>';
2180
-
2181
- echo '</div>';
2182
-
2183
- }
2184
-
2185
- }
2186
-
2187
- /**
2188
- * List Item option type.
2189
- *
2190
- * See @ot_display_by_type to see the full list of available arguments.
2191
- *
2192
- * @param array An array of arguments.
2193
- * @return string
2194
- *
2195
- * @access public
2196
- * @since 2.0
2197
- */
2198
- if ( ! function_exists( 'ot_type_slider' ) ) {
2199
-
2200
- function ot_type_slider( $args = array() ) {
2201
-
2202
- /* turns arguments array into variables */
2203
- extract( $args );
2204
-
2205
- /* verify a description */
2206
- $has_desc = $field_desc ? true : false;
2207
-
2208
- /* format setting outer wrapper */
2209
- echo '<div class="format-setting type-slider ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2210
-
2211
- /* description */
2212
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2213
-
2214
- /* format setting inner wrapper */
2215
- echo '<div class="format-setting-inner">';
2216
-
2217
- /* pass the settings array arround */
2218
- echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
2219
-
2220
- /**
2221
- * settings pages have array wrappers like 'option_tree'.
2222
- * So we need that value to create a proper array to save to.
2223
- * This is only for NON metabox settings.
2224
- */
2225
- if ( ! isset( $get_option ) )
2226
- $get_option = '';
2227
-
2228
- /* build list items */
2229
- echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
2230
-
2231
- if ( is_array( $field_value ) && ! empty( $field_value ) ) {
2232
-
2233
- foreach( $field_value as $key => $list_item ) {
2234
-
2235
- echo '<li class="ui-state-default list-list-item">';
2236
- ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
2237
- echo '</li>';
2238
-
2239
- }
2240
-
2241
- }
2242
-
2243
- echo '</ul>';
2244
-
2245
- /* button */
2246
- echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
2247
-
2248
- /* description */
2249
- echo '<div class="list-item-description">' . __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ) . '</div>';
2250
-
2251
- echo '</div>';
2252
-
2253
- echo '</div>';
2254
-
2255
- }
2256
-
2257
- }
2258
-
2259
- /**
2260
- * Social Links option type.
2261
- *
2262
- * See @ot_display_by_type to see the full list of available arguments.
2263
- *
2264
- * @param array An array of arguments.
2265
- * @return string
2266
- *
2267
- * @access public
2268
- * @since 2.4.0
2269
- */
2270
- if ( ! function_exists( 'ot_type_social_links' ) ) {
2271
-
2272
- function ot_type_social_links( $args = array() ) {
2273
-
2274
- /* turns arguments array into variables */
2275
- extract( $args );
2276
-
2277
- /* Load the default social links */
2278
- if ( empty( $field_value ) && apply_filters( 'ot_type_social_links_load_defaults', true, $field_id ) ) {
2279
-
2280
- $field_value = apply_filters( 'ot_type_social_links_defaults', array(
2281
- array(
2282
- 'name' => __( 'Facebook', 'option-tree' ),
2283
- 'title' => '',
2284
- 'href' => ''
2285
- ),
2286
- array(
2287
- 'name' => __( 'Twitter', 'option-tree' ),
2288
- 'title' => '',
2289
- 'href' => ''
2290
- ),
2291
- array(
2292
- 'name' => __( 'Google+', 'option-tree' ),
2293
- 'title' => '',
2294
- 'href' => ''
2295
- ),
2296
- array(
2297
- 'name' => __( 'LinkedIn', 'option-tree' ),
2298
- 'title' => '',
2299
- 'href' => ''
2300
- ),
2301
- array(
2302
- 'name' => __( 'Pinterest', 'option-tree' ),
2303
- 'title' => '',
2304
- 'href' => ''
2305
- ),
2306
- array(
2307
- 'name' => __( 'Youtube', 'option-tree' ),
2308
- 'title' => '',
2309
- 'href' => ''
2310
- ),
2311
- array(
2312
- 'name' => __( 'Dribbble', 'option-tree' ),
2313
- 'title' => '',
2314
- 'href' => ''
2315
- ),
2316
- array(
2317
- 'name' => __( 'Github', 'option-tree' ),
2318
- 'title' => '',
2319
- 'href' => ''
2320
- ),
2321
- array(
2322
- 'name' => __( 'Forrst', 'option-tree' ),
2323
- 'title' => '',
2324
- 'href' => ''
2325
- ),
2326
- array(
2327
- 'name' => __( 'Digg', 'option-tree' ),
2328
- 'title' => '',
2329
- 'href' => ''
2330
- ),
2331
- array(
2332
- 'name' => __( 'Delicious', 'option-tree' ),
2333
- 'title' => '',
2334
- 'href' => ''
2335
- ),
2336
- array(
2337
- 'name' => __( 'Tumblr', 'option-tree' ),
2338
- 'title' => '',
2339
- 'href' => ''
2340
- ),
2341
- array(
2342
- 'name' => __( 'Skype', 'option-tree' ),
2343
- 'title' => '',
2344
- 'href' => ''
2345
- ),
2346
- array(
2347
- 'name' => __( 'SoundCloud', 'option-tree' ),
2348
- 'title' => '',
2349
- 'href' => ''
2350
- ),
2351
- array(
2352
- 'name' => __( 'Vimeo', 'option-tree' ),
2353
- 'title' => '',
2354
- 'href' => ''
2355
- ),
2356
- array(
2357
- 'name' => __( 'Flickr', 'option-tree' ),
2358
- 'title' => '',
2359
- 'href' => ''
2360
- ),
2361
- array(
2362
- 'name' => __( 'VK.com', 'option-tree' ),
2363
- 'title' => '',
2364
- 'href' => ''
2365
- )
2366
- ), $field_id );
2367
-
2368
- }
2369
-
2370
- /* verify a description */
2371
- $has_desc = $field_desc ? true : false;
2372
-
2373
- /* format setting outer wrapper */
2374
- echo '<div class="format-setting type-social-list-item ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2375
-
2376
- /* description */
2377
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2378
-
2379
- /* format setting inner wrapper */
2380
- echo '<div class="format-setting-inner">';
2381
-
2382
- /* pass the settings array arround */
2383
- echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
2384
-
2385
- /**
2386
- * settings pages have array wrappers like 'option_tree'.
2387
- * So we need that value to create a proper array to save to.
2388
- * This is only for NON metabox settings.
2389
- */
2390
- if ( ! isset( $get_option ) )
2391
- $get_option = '';
2392
-
2393
- /* build list items */
2394
- echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
2395
-
2396
- if ( is_array( $field_value ) && ! empty( $field_value ) ) {
2397
-
2398
- foreach( $field_value as $key => $link ) {
2399
-
2400
- echo '<li class="ui-state-default list-list-item">';
2401
- ot_social_links_view( $field_id, $key, $link, $post_id, $get_option, $field_settings, $type );
2402
- echo '</li>';
2403
-
2404
- }
2405
-
2406
- }
2407
-
2408
- echo '</ul>';
2409
-
2410
- /* button */
2411
- echo '<a href="javascript:void(0);" class="option-tree-social-links-add option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
2412
-
2413
- /* description */
2414
- echo '<div class="list-item-description">' . apply_filters( 'ot_social_links_description', __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ), $field_id ) . '</div>';
2415
-
2416
- echo '</div>';
2417
-
2418
- echo '</div>';
2419
-
2420
- }
2421
-
2422
- }
2423
-
2424
- /**
2425
- * Spacing Option Type.
2426
- *
2427
- * See @ot_display_by_type to see the full list of available arguments.
2428
- *
2429
- * @param array An array of arguments.
2430
- * @return string
2431
- *
2432
- * @access public
2433
- * @since 2.5.0
2434
- */
2435
- if ( ! function_exists( 'ot_type_spacing' ) ) {
2436
-
2437
- function ot_type_spacing( $args = array() ) {
2438
-
2439
- /* turns arguments array into variables */
2440
- extract( $args );
2441
-
2442
- /* verify a description */
2443
- $has_desc = $field_desc ? true : false;
2444
-
2445
- /* format setting outer wrapper */
2446
- echo '<div class="format-setting type-spacing ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2447
-
2448
- /* description */
2449
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2450
-
2451
- /* format setting inner wrapper */
2452
- echo '<div class="format-setting-inner">';
2453
-
2454
- /* allow fields to be filtered */
2455
- $ot_recognized_spacing_fields = apply_filters( 'ot_recognized_spacing_fields', array(
2456
- 'top',
2457
- 'right',
2458
- 'bottom',
2459
- 'left',
2460
- 'unit'
2461
- ), $field_id );
2462
-
2463
- /* build top spacing */
2464
- if ( in_array( 'top', $ot_recognized_spacing_fields ) ) {
2465
-
2466
- $top = isset( $field_value['top'] ) ? esc_attr( $field_value['top'] ) : '';
2467
-
2468
- echo '<div class="ot-option-group"><span class="ot-icon-arrow-up ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[top]" id="' . esc_attr( $field_id ) . '-top" value="' . $top . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'top', 'option-tree' ) . '" /></div>';
2469
-
2470
- }
2471
-
2472
- /* build right spacing */
2473
- if ( in_array( 'right', $ot_recognized_spacing_fields ) ) {
2474
-
2475
- $right = isset( $field_value['right'] ) ? esc_attr( $field_value['right'] ) : '';
2476
-
2477
- echo '<div class="ot-option-group"><span class="ot-icon-arrow-right ot-option-group--icon"></span></span><input type="text" name="' . esc_attr( $field_name ) . '[right]" id="' . esc_attr( $field_id ) . '-right" value="' . $right . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'right', 'option-tree' ) . '" /></div>';
2478
-
2479
- }
2480
-
2481
- /* build bottom spacing */
2482
- if ( in_array( 'bottom', $ot_recognized_spacing_fields ) ) {
2483
-
2484
- $bottom = isset( $field_value['bottom'] ) ? esc_attr( $field_value['bottom'] ) : '';
2485
-
2486
- echo '<div class="ot-option-group"><span class="ot-icon-arrow-down ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[bottom]" id="' . esc_attr( $field_id ) . '-bottom" value="' . $bottom . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'bottom', 'option-tree' ) . '" /></div>';
2487
-
2488
- }
2489
-
2490
- /* build left spacing */
2491
- if ( in_array( 'left', $ot_recognized_spacing_fields ) ) {
2492
-
2493
- $left = isset( $field_value['left'] ) ? esc_attr( $field_value['left'] ) : '';
2494
-
2495
- echo '<div class="ot-option-group"><span class="ot-icon-arrow-left ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[left]" id="' . esc_attr( $field_id ) . '-left" value="' . $left . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'left', 'option-tree' ) . '" /></div>';
2496
-
2497
- }
2498
-
2499
- /* build unit dropdown */
2500
- if ( in_array( 'unit', $ot_recognized_spacing_fields ) ) {
2501
-
2502
- echo '<div class="ot-option-group ot-option-group--is-last">';
2503
-
2504
- echo '<select name="' . esc_attr( $field_name ) . '[unit]" id="' . esc_attr( $field_id ) . '-unit" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
2505
-
2506
- echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
2507
-
2508
- foreach ( ot_recognized_spacing_unit_types( $field_id ) as $unit ) {
2509
- echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value['unit'] ) ? selected( $field_value['unit'], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
2510
- }
2511
-
2512
- echo '</select>';
2513
-
2514
- echo '</div>';
2515
-
2516
- }
2517
-
2518
- echo '</div>';
2519
-
2520
- echo '</div>';
2521
-
2522
- }
2523
-
2524
- }
2525
-
2526
- /**
2527
- * Tab option type.
2528
- *
2529
- * See @ot_display_by_type to see the full list of available arguments.
2530
- *
2531
- * @param array An array of arguments.
2532
- * @return string
2533
- *
2534
- * @access public
2535
- * @since 2.3.0
2536
- */
2537
- if ( ! function_exists( 'ot_type_tab' ) ) {
2538
-
2539
- function ot_type_tab( $args = array() ) {
2540
-
2541
- /* turns arguments array into variables */
2542
- extract( $args );
2543
-
2544
- /* format setting outer wrapper */
2545
- echo '<div class="format-setting type-tab">';
2546
-
2547
- echo '<br />';
2548
-
2549
- echo '</div>';
2550
-
2551
- }
2552
-
2553
- }
2554
-
2555
- /**
2556
- * Tag Checkbox option type.
2557
- *
2558
- * See @ot_display_by_type to see the full list of available arguments.
2559
- *
2560
- * @param array An array of arguments.
2561
- * @return string
2562
- *
2563
- * @access public
2564
- * @since 2.0
2565
- */
2566
- if ( ! function_exists( 'ot_type_tag_checkbox' ) ) {
2567
-
2568
- function ot_type_tag_checkbox( $args = array() ) {
2569
-
2570
- /* turns arguments array into variables */
2571
- extract( $args );
2572
-
2573
- /* verify a description */
2574
- $has_desc = $field_desc ? true : false;
2575
-
2576
- /* format setting outer wrapper */
2577
- echo '<div class="format-setting type-tag-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2578
-
2579
- /* description */
2580
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2581
-
2582
- /* format setting inner wrapper */
2583
- echo '<div class="format-setting-inner">';
2584
-
2585
- /* get tags */
2586
- $tags = get_tags( array( 'hide_empty' => false ) );
2587
-
2588
- /* has tags */
2589
- if ( $tags ) {
2590
- foreach( $tags as $tag ) {
2591
- echo '<p>';
2592
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $tag->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $tag->term_id ) . '" value="' . esc_attr( $tag->term_id ) . '" ' . ( isset( $field_value[$tag->term_id] ) ? checked( $field_value[$tag->term_id], $tag->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
2593
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $tag->term_id ) . '">' . esc_attr( $tag->name ) . '</label>';
2594
- echo '</p>';
2595
- }
2596
- } else {
2597
- echo '<p>' . __( 'No Tags Found', 'option-tree' ) . '</p>';
2598
- }
2599
-
2600
- echo '</div>';
2601
-
2602
- echo '</div>';
2603
-
2604
- }
2605
-
2606
- }
2607
-
2608
- /**
2609
- * Tag Select option type.
2610
- *
2611
- * See @ot_display_by_type to see the full list of available arguments.
2612
- *
2613
- * @param array An array of arguments.
2614
- * @return string
2615
- *
2616
- * @access public
2617
- * @since 2.0
2618
- */
2619
- if ( ! function_exists( 'ot_type_tag_select' ) ) {
2620
-
2621
- function ot_type_tag_select( $args = array() ) {
2622
-
2623
- /* turns arguments array into variables */
2624
- extract( $args );
2625
-
2626
- /* verify a description */
2627
- $has_desc = $field_desc ? true : false;
2628
-
2629
- /* format setting outer wrapper */
2630
- echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2631
-
2632
- /* description */
2633
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2634
-
2635
- /* format setting inner wrapper */
2636
- echo '<div class="format-setting-inner">';
2637
-
2638
- /* build tag select */
2639
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
2640
-
2641
- /* get tags */
2642
- $tags = get_tags( array( 'hide_empty' => false ) );
2643
-
2644
- /* has tags */
2645
- if ( $tags ) {
2646
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
2647
- foreach( $tags as $tag ) {
2648
- echo '<option value="' . esc_attr( $tag->term_id ) . '"' . selected( $field_value, $tag->term_id, false ) . '>' . esc_attr( $tag->name ) . '</option>';
2649
- }
2650
- } else {
2651
- echo '<option value="">' . __( 'No Tags Found', 'option-tree' ) . '</option>';
2652
- }
2653
-
2654
- echo '</select>';
2655
-
2656
- echo '</div>';
2657
-
2658
- echo '</div>';
2659
-
2660
- }
2661
-
2662
- }
2663
-
2664
- /**
2665
- * Taxonomy Checkbox option type.
2666
- *
2667
- * See @ot_display_by_type to see the full list of available arguments.
2668
- *
2669
- * @param array An array of arguments.
2670
- * @return string
2671
- *
2672
- * @access public
2673
- * @since 2.0
2674
- */
2675
- if ( ! function_exists( 'ot_type_taxonomy_checkbox' ) ) {
2676
-
2677
- function ot_type_taxonomy_checkbox( $args = array() ) {
2678
-
2679
- /* turns arguments array into variables */
2680
- extract( $args );
2681
-
2682
- /* verify a description */
2683
- $has_desc = $field_desc ? true : false;
2684
-
2685
- /* format setting outer wrapper */
2686
- echo '<div class="format-setting type-taxonomy-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2687
-
2688
- /* description */
2689
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2690
-
2691
- /* format setting inner wrapper */
2692
- echo '<div class="format-setting-inner">';
2693
-
2694
- /* setup the taxonomy */
2695
- $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
2696
-
2697
- /* get taxonomies */
2698
- $taxonomies = get_categories( apply_filters( 'ot_type_taxonomy_checkbox_query', array( 'hide_empty' => false, 'taxonomy' => $taxonomy ), $field_id ) );
2699
-
2700
- /* has tags */
2701
- if ( $taxonomies ) {
2702
- foreach( $taxonomies as $taxonomy ) {
2703
- echo '<p>';
2704
- echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $taxonomy->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $taxonomy->term_id ) . '" value="' . esc_attr( $taxonomy->term_id ) . '" ' . ( isset( $field_value[$taxonomy->term_id] ) ? checked( $field_value[$taxonomy->term_id], $taxonomy->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
2705
- echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $taxonomy->term_id ) . '">' . esc_attr( $taxonomy->name ) . '</label>';
2706
- echo '</p>';
2707
- }
2708
- } else {
2709
- echo '<p>' . __( 'No Taxonomies Found', 'option-tree' ) . '</p>';
2710
- }
2711
-
2712
- echo '</div>';
2713
-
2714
- echo '</div>';
2715
-
2716
- }
2717
-
2718
- }
2719
-
2720
- /**
2721
- * Taxonomy Select option type.
2722
- *
2723
- * See @ot_display_by_type to see the full list of available arguments.
2724
- *
2725
- * @param array An array of arguments.
2726
- * @return string
2727
- *
2728
- * @access public
2729
- * @since 2.0
2730
- */
2731
- if ( ! function_exists( 'ot_type_taxonomy_select' ) ) {
2732
-
2733
- function ot_type_taxonomy_select( $args = array() ) {
2734
-
2735
- /* turns arguments array into variables */
2736
- extract( $args );
2737
-
2738
- /* verify a description */
2739
- $has_desc = $field_desc ? true : false;
2740
-
2741
- /* format setting outer wrapper */
2742
- echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2743
-
2744
- /* description */
2745
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2746
-
2747
- /* format setting inner wrapper */
2748
- echo '<div class="format-setting-inner">';
2749
-
2750
- /* build tag select */
2751
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
2752
-
2753
- /* setup the taxonomy */
2754
- $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
2755
-
2756
- /* get taxonomies */
2757
- $taxonomies = get_categories( apply_filters( 'ot_type_taxonomy_select_query', array( 'hide_empty' => false, 'taxonomy' => $taxonomy ), $field_id ) );
2758
-
2759
- /* has tags */
2760
- if ( $taxonomies ) {
2761
- echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
2762
- foreach( $taxonomies as $taxonomy ) {
2763
- echo '<option value="' . esc_attr( $taxonomy->term_id ) . '"' . selected( $field_value, $taxonomy->term_id, false ) . '>' . esc_attr( $taxonomy->name ) . '</option>';
2764
- }
2765
- } else {
2766
- echo '<option value="">' . __( 'No Taxonomies Found', 'option-tree' ) . '</option>';
2767
- }
2768
-
2769
- echo '</select>';
2770
-
2771
- echo '</div>';
2772
-
2773
- echo '</div>';
2774
-
2775
- }
2776
-
2777
- }
2778
-
2779
- /**
2780
- * Text option type.
2781
- *
2782
- * See @ot_display_by_type to see the full list of available arguments.
2783
- *
2784
- * @param array An array of arguments.
2785
- * @return string
2786
- *
2787
- * @access public
2788
- * @since 2.0
2789
- */
2790
- if ( ! function_exists( 'ot_type_text' ) ) {
2791
-
2792
- function ot_type_text( $args = array() ) {
2793
-
2794
- /* turns arguments array into variables */
2795
- extract( $args );
2796
-
2797
- /* verify a description */
2798
- $has_desc = $field_desc ? true : false;
2799
-
2800
- /* format setting outer wrapper */
2801
- echo '<div class="format-setting type-text ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2802
-
2803
- /* description */
2804
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2805
-
2806
- /* format setting inner wrapper */
2807
- echo '<div class="format-setting-inner">';
2808
-
2809
- /* build text input */
2810
- 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 ' . esc_attr( $field_class ) . '" />';
2811
-
2812
- echo '</div>';
2813
-
2814
- echo '</div>';
2815
-
2816
- }
2817
-
2818
- }
2819
-
2820
- /**
2821
- * Textarea option type.
2822
- *
2823
- * See @ot_display_by_type to see the full list of available arguments.
2824
- *
2825
- * @param array An array of arguments.
2826
- * @return string
2827
- *
2828
- * @access public
2829
- * @since 2.0
2830
- */
2831
- if ( ! function_exists( 'ot_type_textarea' ) ) {
2832
-
2833
- function ot_type_textarea( $args = array() ) {
2834
-
2835
- /* turns arguments array into variables */
2836
- extract( $args );
2837
-
2838
- /* verify a description */
2839
- $has_desc = $field_desc ? true : false;
2840
-
2841
- /* format setting outer wrapper */
2842
- echo '<div class="format-setting type-textarea ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . ' fill-area">';
2843
-
2844
- /* description */
2845
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2846
-
2847
- /* format setting inner wrapper */
2848
- echo '<div class="format-setting-inner">';
2849
-
2850
- /* build textarea */
2851
- wp_editor(
2852
- $field_value,
2853
- esc_attr( $field_id ),
2854
- array(
2855
- 'editor_class' => esc_attr( $field_class ),
2856
- 'wpautop' => apply_filters( 'ot_wpautop', false, $field_id ),
2857
- 'media_buttons' => apply_filters( 'ot_media_buttons', true, $field_id ),
2858
- 'textarea_name' => esc_attr( $field_name ),
2859
- 'textarea_rows' => esc_attr( $field_rows ),
2860
- 'tinymce' => apply_filters( 'ot_tinymce', true, $field_id ),
2861
- 'quicktags' => apply_filters( 'ot_quicktags', array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ), $field_id )
2862
- )
2863
- );
2864
-
2865
- echo '</div>';
2866
-
2867
- echo '</div>';
2868
-
2869
- }
2870
-
2871
- }
2872
-
2873
- /**
2874
- * Textarea Simple option type.
2875
- *
2876
- * See @ot_display_by_type to see the full list of available arguments.
2877
- *
2878
- * @param array An array of arguments.
2879
- * @return string
2880
- *
2881
- * @access public
2882
- * @since 2.0
2883
- */
2884
- if ( ! function_exists( 'ot_type_textarea_simple' ) ) {
2885
-
2886
- function ot_type_textarea_simple( $args = array() ) {
2887
-
2888
- /* turns arguments array into variables */
2889
- extract( $args );
2890
-
2891
- /* verify a description */
2892
- $has_desc = $field_desc ? true : false;
2893
-
2894
- /* format setting outer wrapper */
2895
- echo '<div class="format-setting type-textarea simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2896
-
2897
- /* description */
2898
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2899
-
2900
- /* format setting inner wrapper */
2901
- echo '<div class="format-setting-inner">';
2902
-
2903
- /* filter to allow wpautop */
2904
- $wpautop = apply_filters( 'ot_wpautop', false, $field_id );
2905
-
2906
- /* wpautop $field_value */
2907
- if ( $wpautop == true )
2908
- $field_value = wpautop( $field_value );
2909
-
2910
- /* build textarea simple */
2911
- echo '<textarea class="textarea ' . esc_attr( $field_class ) . '" rows="' . esc_attr( $field_rows ) . '" cols="40" name="' . esc_attr( $field_name ) .'" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</textarea>';
2912
-
2913
- echo '</div>';
2914
-
2915
- echo '</div>';
2916
-
2917
- }
2918
-
2919
- }
2920
-
2921
- /**
2922
- * Textblock option type.
2923
- *
2924
- * See @ot_display_by_type to see the full list of available arguments.
2925
- *
2926
- * @param array An array of arguments.
2927
- * @return string
2928
- *
2929
- * @access public
2930
- * @since 2.0
2931
- */
2932
- if ( ! function_exists( 'ot_type_textblock' ) ) {
2933
-
2934
- function ot_type_textblock( $args = array() ) {
2935
-
2936
- /* turns arguments array into variables */
2937
- extract( $args );
2938
-
2939
- /* format setting outer wrapper */
2940
- echo '<div class="format-setting type-textblock wide-desc">';
2941
-
2942
- /* description */
2943
- echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
2944
-
2945
- echo '</div>';
2946
-
2947
- }
2948
-
2949
- }
2950
-
2951
- /**
2952
- * Textblock Titled option type.
2953
- *
2954
- * See @ot_display_by_type to see the full list of available arguments.
2955
- *
2956
- * @param array An array of arguments.
2957
- * @return string
2958
- *
2959
- * @access public
2960
- * @since 2.0
2961
- */
2962
- if ( ! function_exists( 'ot_type_textblock_titled' ) ) {
2963
-
2964
- function ot_type_textblock_titled( $args = array() ) {
2965
-
2966
- /* turns arguments array into variables */
2967
- extract( $args );
2968
-
2969
- /* format setting outer wrapper */
2970
- echo '<div class="format-setting type-textblock titled wide-desc">';
2971
-
2972
- /* description */
2973
- echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
2974
-
2975
- echo '</div>';
2976
-
2977
- }
2978
-
2979
- }
2980
-
2981
- /**
2982
- * Typography option type.
2983
- *
2984
- * See @ot_display_by_type to see the full list of available arguments.
2985
- *
2986
- * @param array An array of arguments.
2987
- * @return string
2988
- *
2989
- * @access public
2990
- * @since 2.0
2991
- */
2992
- if ( ! function_exists( 'ot_type_typography' ) ) {
2993
-
2994
- function ot_type_typography( $args = array() ) {
2995
-
2996
- /* turns arguments array into variables */
2997
- extract( $args );
2998
-
2999
- /* verify a description */
3000
- $has_desc = $field_desc ? true : false;
3001
-
3002
- /* format setting outer wrapper */
3003
- echo '<div class="format-setting type-typography ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
3004
-
3005
- /* description */
3006
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
3007
-
3008
- /* format setting inner wrapper */
3009
- echo '<div class="format-setting-inner">';
3010
-
3011
- /* allow fields to be filtered */
3012
- $ot_recognized_typography_fields = apply_filters( 'ot_recognized_typography_fields', array(
3013
- 'font-color',
3014
- 'font-family',
3015
- 'font-size',
3016
- 'font-style',
3017
- 'font-variant',
3018
- 'font-weight',
3019
- 'letter-spacing',
3020
- 'line-height',
3021
- 'text-decoration',
3022
- 'text-transform'
3023
- ), $field_id );
3024
-
3025
- /* build font color */
3026
- if ( in_array( 'font-color', $ot_recognized_typography_fields ) ) {
3027
-
3028
- /* build colorpicker */
3029
- echo '<div class="option-tree-ui-colorpicker-input-wrap">';
3030
-
3031
- /* colorpicker JS */
3032
- echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
3033
-
3034
- /* set background color */
3035
- $background_color = isset( $field_value['font-color'] ) ? esc_attr( $field_value['font-color'] ) : '';
3036
-
3037
- /* input */
3038
- 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 ) . '" />';
3039
-
3040
- echo '</div>';
3041
-
3042
- }
3043
-
3044
- /* build font family */
3045
- if ( in_array( 'font-family', $ot_recognized_typography_fields ) ) {
3046
- $font_family = isset( $field_value['font-family'] ) ? $field_value['font-family'] : '';
3047
- echo '<select name="' . esc_attr( $field_name ) . '[font-family]" id="' . esc_attr( $field_id ) . '-font-family" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3048
- echo '<option value="">font-family</option>';
3049
- foreach ( ot_recognized_font_families( $field_id ) as $key => $value ) {
3050
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_family, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3051
- }
3052
- echo '</select>';
3053
- }
3054
-
3055
- /* build font size */
3056
- if ( in_array( 'font-size', $ot_recognized_typography_fields ) ) {
3057
- $font_size = isset( $field_value['font-size'] ) ? esc_attr( $field_value['font-size'] ) : '';
3058
- echo '<select name="' . esc_attr( $field_name ) . '[font-size]" id="' . esc_attr( $field_id ) . '-font-size" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3059
- echo '<option value="">font-size</option>';
3060
- foreach( ot_recognized_font_sizes( $field_id ) as $option ) {
3061
- echo '<option value="' . esc_attr( $option ) . '" ' . selected( $font_size, $option, false ) . '>' . esc_attr( $option ) . '</option>';
3062
- }
3063
- echo '</select>';
3064
- }
3065
-
3066
- /* build font style */
3067
- if ( in_array( 'font-style', $ot_recognized_typography_fields ) ) {
3068
- $font_style = isset( $field_value['font-style'] ) ? esc_attr( $field_value['font-style'] ) : '';
3069
- echo '<select name="' . esc_attr( $field_name ) . '[font-style]" id="' . esc_attr( $field_id ) . '-font-style" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3070
- echo '<option value="">font-style</option>';
3071
- foreach ( ot_recognized_font_styles( $field_id ) as $key => $value ) {
3072
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_style, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3073
- }
3074
- echo '</select>';
3075
- }
3076
-
3077
- /* build font variant */
3078
- if ( in_array( 'font-variant', $ot_recognized_typography_fields ) ) {
3079
- $font_variant = isset( $field_value['font-variant'] ) ? esc_attr( $field_value['font-variant'] ) : '';
3080
- echo '<select name="' . esc_attr( $field_name ) . '[font-variant]" id="' . esc_attr( $field_id ) . '-font-variant" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3081
- echo '<option value="">font-variant</option>';
3082
- foreach ( ot_recognized_font_variants( $field_id ) as $key => $value ) {
3083
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_variant, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3084
- }
3085
- echo '</select>';
3086
- }
3087
-
3088
- /* build font weight */
3089
- if ( in_array( 'font-weight', $ot_recognized_typography_fields ) ) {
3090
- $font_weight = isset( $field_value['font-weight'] ) ? esc_attr( $field_value['font-weight'] ) : '';
3091
- echo '<select name="' . esc_attr( $field_name ) . '[font-weight]" id="' . esc_attr( $field_id ) . '-font-weight" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3092
- echo '<option value="">font-weight</option>';
3093
- foreach ( ot_recognized_font_weights( $field_id ) as $key => $value ) {
3094
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_weight, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3095
- }
3096
- echo '</select>';
3097
- }
3098
-
3099
- /* build letter spacing */
3100
- if ( in_array( 'letter-spacing', $ot_recognized_typography_fields ) ) {
3101
- $letter_spacing = isset( $field_value['letter-spacing'] ) ? esc_attr( $field_value['letter-spacing'] ) : '';
3102
- echo '<select name="' . esc_attr( $field_name ) . '[letter-spacing]" id="' . esc_attr( $field_id ) . '-letter-spacing" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3103
- echo '<option value="">letter-spacing</option>';
3104
- foreach( ot_recognized_letter_spacing( $field_id ) as $option ) {
3105
- echo '<option value="' . esc_attr( $option ) . '" ' . selected( $letter_spacing, $option, false ) . '>' . esc_attr( $option ) . '</option>';
3106
- }
3107
- echo '</select>';
3108
- }
3109
-
3110
- /* build line height */
3111
- if ( in_array( 'line-height', $ot_recognized_typography_fields ) ) {
3112
- $line_height = isset( $field_value['line-height'] ) ? esc_attr( $field_value['line-height'] ) : '';
3113
- echo '<select name="' . esc_attr( $field_name ) . '[line-height]" id="' . esc_attr( $field_id ) . '-line-height" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3114
- echo '<option value="">line-height</option>';
3115
- foreach( ot_recognized_line_heights( $field_id ) as $option ) {
3116
- echo '<option value="' . esc_attr( $option ) . '" ' . selected( $line_height, $option, false ) . '>' . esc_attr( $option ) . '</option>';
3117
- }
3118
- echo '</select>';
3119
- }
3120
-
3121
- /* build text decoration */
3122
- if ( in_array( 'text-decoration', $ot_recognized_typography_fields ) ) {
3123
- $text_decoration = isset( $field_value['text-decoration'] ) ? esc_attr( $field_value['text-decoration'] ) : '';
3124
- echo '<select name="' . esc_attr( $field_name ) . '[text-decoration]" id="' . esc_attr( $field_id ) . '-text-decoration" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3125
- echo '<option value="">text-decoration</option>';
3126
- foreach ( ot_recognized_text_decorations( $field_id ) as $key => $value ) {
3127
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_decoration, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3128
- }
3129
- echo '</select>';
3130
- }
3131
-
3132
- /* build text transform */
3133
- if ( in_array( 'text-transform', $ot_recognized_typography_fields ) ) {
3134
- $text_transform = isset( $field_value['text-transform'] ) ? esc_attr( $field_value['text-transform'] ) : '';
3135
- echo '<select name="' . esc_attr( $field_name ) . '[text-transform]" id="' . esc_attr( $field_id ) . '-text-transform" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3136
- echo '<option value="">text-transform</option>';
3137
- foreach ( ot_recognized_text_transformations( $field_id ) as $key => $value ) {
3138
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_transform, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3139
- }
3140
- echo '</select>';
3141
- }
3142
-
3143
- echo '</div>';
3144
-
3145
- echo '</div>';
3146
-
3147
- }
3148
-
3149
- }
3150
-
3151
- /**
3152
- * Upload option type.
3153
- *
3154
- * See @ot_display_by_type to see the full list of available arguments.
3155
- *
3156
- * @param array An array of arguments.
3157
- * @return string
3158
- *
3159
- * @access public
3160
- * @since 2.0
3161
- */
3162
- if ( ! function_exists( 'ot_type_upload' ) ) {
3163
-
3164
- function ot_type_upload( $args = array() ) {
3165
-
3166
- /* turns arguments array into variables */
3167
- extract( $args );
3168
-
3169
- /* verify a description */
3170
- $has_desc = $field_desc ? true : false;
3171
-
3172
- /* If an attachment ID is stored here fetch its URL and replace the value */
3173
- if ( $field_value && wp_attachment_is_image( $field_value ) ) {
3174
-
3175
- $attachment_data = wp_get_attachment_image_src( $field_value, 'original' );
3176
-
3177
- /* check for attachment data */
3178
- if ( $attachment_data ) {
3179
-
3180
- $field_src = $attachment_data[0];
3181
-
3182
- }
3183
-
3184
- }
3185
-
3186
- /* format setting outer wrapper */
3187
- echo '<div class="format-setting type-upload ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
3188
-
3189
- /* description */
3190
- echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
3191
-
3192
- /* format setting inner wrapper */
3193
- echo '<div class="format-setting-inner">';
3194
-
3195
- /* build upload */
3196
- echo '<div class="option-tree-ui-upload-parent">';
3197
-
3198
- /* input */
3199
- echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="widefat option-tree-ui-upload-input ' . esc_attr( $field_class ) . '" />';
3200
-
3201
- /* add media button */
3202
- echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button button button-primary light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon ot-icon-plus-circle"></span>' . __( 'Add Media', 'option-tree' ) . '</a>';
3203
-
3204
- echo '</div>';
3205
-
3206
- /* media */
3207
- if ( $field_value ) {
3208
-
3209
- echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
3210
-
3211
- /* replace image src */
3212
- if ( isset( $field_src ) )
3213
- $field_value = $field_src;
3214
-
3215
- if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value ) )
3216
- echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value ) . '" alt="" /></div>';
3217
-
3218
- echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"></span>' . __( 'Remove Media', 'option-tree' ) . '</a>';
3219
-
3220
- echo '</div>';
3221
-
3222
- }
3223
-
3224
- echo '</div>';
3225
-
3226
- echo '</div>';
3227
-
3228
- }
3229
-
3230
- }
3231
-
3232
- /* End of file ot-functions-option-types.php */
3233
- /* Location: ./includes/ot-functions-option-types.php */
1
+ <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
2
+ /**
3
+ * Functions used to build each option type.
4
+ *
5
+ * @package OptionTree
6
+ * @author Derek Herman <derek@valendesigns.com>
7
+ * @copyright Copyright (c) 2013, Derek Herman
8
+ * @since 2.0
9
+ */
10
+
11
+ /**
12
+ * Builds the HTML for each of the available option types by calling those
13
+ * function with call_user_func and passing the arguments to the second param.
14
+ *
15
+ * All fields are required!
16
+ *
17
+ * @param array $args The array of arguments are as follows:
18
+ * @param string $type Type of option.
19
+ * @param string $field_id The field ID.
20
+ * @param string $field_name The field Name.
21
+ * @param mixed $field_value The field value is a string or an array of values.
22
+ * @param string $field_desc The field description.
23
+ * @param string $field_std The standard value.
24
+ * @param string $field_class Extra CSS classes.
25
+ * @param array $field_choices The array of option choices.
26
+ * @param array $field_settings The array of settings for a list item.
27
+ * @return string
28
+ *
29
+ * @access public
30
+ * @since 2.0
31
+ */
32
+ if ( ! function_exists( 'ot_display_by_type' ) ) {
33
+
34
+ function ot_display_by_type( $args = array() ) {
35
+
36
+ /* allow filters to be executed on the array */
37
+ $args = apply_filters( 'ot_display_by_type', $args );
38
+
39
+ /* build the function name */
40
+ $function_name_by_type = str_replace( '-', '_', 'ot_type_' . $args['type'] );
41
+ //var_dump($function_name_by_type );
42
+ /* call the function & pass in arguments array */
43
+ if ( function_exists( $function_name_by_type ) ) {
44
+ call_user_func( $function_name_by_type, $args );
45
+ } else {
46
+ echo '<p>' . __( 'Sorry, this function does not exist', 'option-tree' ) . '</p>';
47
+ }
48
+
49
+ }
50
+
51
+ }
52
+
53
+ /**
54
+ * Background option type.
55
+ *
56
+ * See @ot_display_by_type to see the full list of available arguments.
57
+ *
58
+ * @param array An array of arguments.
59
+ * @return string
60
+ *
61
+ * @access public
62
+ * @since 2.0
63
+ */
64
+ if ( ! function_exists( 'ot_type_background' ) ) {
65
+
66
+ function ot_type_background( $args = array() ) {
67
+
68
+ /* turns arguments array into variables */
69
+ extract( $args );
70
+
71
+ /* verify a description */
72
+ $has_desc = $field_desc ? true : false;
73
+
74
+ /* If an attachment ID is stored here fetch its URL and replace the value */
75
+ if ( isset( $field_value['background-image'] ) && wp_attachment_is_image( $field_value['background-image'] ) ) {
76
+
77
+ $attachment_data = wp_get_attachment_image_src( $field_value['background-image'], 'original' );
78
+
79
+ /* check for attachment data */
80
+ if ( $attachment_data ) {
81
+
82
+ $field_src = $attachment_data[0];
83
+
84
+ }
85
+
86
+ }
87
+
88
+ /* format setting outer wrapper */
89
+ echo '<div class="format-setting type-background ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
90
+
91
+ /* description */
92
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
93
+
94
+ /* format setting inner wrapper */
95
+ echo '<div class="format-setting-inner">';
96
+
97
+ /* allow fields to be filtered */
98
+ $ot_recognized_background_fields = apply_filters( 'ot_recognized_background_fields', array(
99
+ 'background-color',
100
+ 'background-repeat',
101
+ 'background-attachment',
102
+ 'background-position',
103
+ 'background-size',
104
+ 'background-image'
105
+ ), $field_id );
106
+
107
+ echo '<div class="ot-background-group">';
108
+
109
+ /* build background color */
110
+ if ( in_array( 'background-color', $ot_recognized_background_fields ) ) {
111
+
112
+ echo '<div class="option-tree-ui-colorpicker-input-wrap">';
113
+
114
+ /* colorpicker JS */
115
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
116
+
117
+ /* set background color */
118
+ $background_color = isset( $field_value['background-color'] ) ? esc_attr( $field_value['background-color'] ) : '';
119
+
120
+ /* input */
121
+ 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 ) . '" />';
122
+
123
+ echo '</div>';
124
+
125
+ }
126
+
127
+ /* build background repeat */
128
+ if ( in_array( 'background-repeat', $ot_recognized_background_fields ) ) {
129
+
130
+ $background_repeat = isset( $field_value['background-repeat'] ) ? esc_attr( $field_value['background-repeat'] ) : '';
131
+
132
+ echo '<select name="' . esc_attr( $field_name ) . '[background-repeat]" id="' . esc_attr( $field_id ) . '-repeat" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
133
+
134
+ echo '<option value="">' . __( 'background-repeat', 'option-tree' ) . '</option>';
135
+ foreach ( ot_recognized_background_repeat( $field_id ) as $key => $value ) {
136
+
137
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_repeat, $key, false ) . '>' . esc_attr( $value ) . '</option>';
138
+
139
+ }
140
+
141
+ echo '</select>';
142
+
143
+ }
144
+
145
+ /* build background attachment */
146
+ if ( in_array( 'background-attachment', $ot_recognized_background_fields ) ) {
147
+
148
+ $background_attachment = isset( $field_value['background-attachment'] ) ? esc_attr( $field_value['background-attachment'] ) : '';
149
+
150
+ echo '<select name="' . esc_attr( $field_name ) . '[background-attachment]" id="' . esc_attr( $field_id ) . '-attachment" class="option-tree-ui-select ' . $field_class . '">';
151
+
152
+ echo '<option value="">' . __( 'background-attachment', 'option-tree' ) . '</option>';
153
+
154
+ foreach ( ot_recognized_background_attachment( $field_id ) as $key => $value ) {
155
+
156
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_attachment, $key, false ) . '>' . esc_attr( $value ) . '</option>';
157
+
158
+ }
159
+
160
+ echo '</select>';
161
+
162
+ }
163
+
164
+ /* build background position */
165
+ if ( in_array( 'background-position', $ot_recognized_background_fields ) ) {
166
+
167
+ $background_position = isset( $field_value['background-position'] ) ? esc_attr( $field_value['background-position'] ) : '';
168
+
169
+ echo '<select name="' . esc_attr( $field_name ) . '[background-position]" id="' . esc_attr( $field_id ) . '-position" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
170
+
171
+ echo '<option value="">' . __( 'background-position', 'option-tree' ) . '</option>';
172
+
173
+ foreach ( ot_recognized_background_position( $field_id ) as $key => $value ) {
174
+
175
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $background_position, $key, false ) . '>' . esc_attr( $value ) . '</option>';
176
+
177
+ }
178
+
179
+ echo '</select>';
180
+
181
+ }
182
+
183
+ /* Build background size */
184
+ if ( in_array( 'background-size', $ot_recognized_background_fields ) ) {
185
+
186
+ /**
187
+ * Use this filter to create a select instead of an text input.
188
+ * Be sure to return the array in the correct format. Add an empty
189
+ * value to the first choice so the user can leave it blank.
190
+ *
191
+ array(
192
+ array(
193
+ 'label' => 'background-size',
194
+ 'value' => ''
195
+ ),
196
+ array(
197
+ 'label' => 'cover',
198
+ 'value' => 'cover'
199
+ ),
200
+ array(
201
+ 'label' => 'contain',
202
+ 'value' => 'contain'
203
+ )
204
+ )
205
+ *
206
+ */
207
+ $choices = apply_filters( 'ot_type_background_size_choices', '', $field_id );
208
+
209
+ if ( is_array( $choices ) && ! empty( $choices ) ) {
210
+
211
+ /* build select */
212
+ echo '<select name="' . esc_attr( $field_name ) . '[background-size]" id="' . esc_attr( $field_id ) . '-size" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
213
+
214
+ foreach ( (array) $choices as $choice ) {
215
+ if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
216
+ echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( ( isset( $field_value['background-size'] ) ? $field_value['background-size'] : '' ), $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
217
+ }
218
+ }
219
+
220
+ echo '</select>';
221
+
222
+ } else {
223
+
224
+ 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' ) . '" />';
225
+
226
+ }
227
+
228
+ }
229
+
230
+ echo '</div>';
231
+
232
+ /* build background image */
233
+ if ( in_array( 'background-image', $ot_recognized_background_fields ) ) {
234
+
235
+ echo '<div class="option-tree-ui-upload-parent">';
236
+
237
+ /* input */
238
+ 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 ) . '" placeholder="' . __( 'background-image', 'option-tree' ) . '" />';
239
+
240
+ /* add media button */
241
+ echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button button button-primary light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon ot-icon-plus-circle"></span>' . __( 'Add Media', 'option-tree' ) . '</a>';
242
+
243
+ echo '</div>';
244
+
245
+ /* media */
246
+ if ( isset( $field_value['background-image'] ) && $field_value['background-image'] !== '' ) {
247
+
248
+ /* replace image src */
249
+ if ( isset( $field_src ) )
250
+ $field_value['background-image'] = $field_src;
251
+
252
+ echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
253
+
254
+ if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value['background-image'] ) )
255
+ echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value['background-image'] ) . '" alt="" /></div>';
256
+
257
+ echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"></span>' . __( 'Remove Media', 'option-tree' ) . '</a>';
258
+
259
+ echo '</div>';
260
+
261
+ }
262
+
263
+ }
264
+
265
+ echo '</div>';
266
+
267
+ echo '</div>';
268
+
269
+ }
270
+
271
+ }
272
+
273
+ /**
274
+ * Border Option Type
275
+ *
276
+ * See @ot_display_by_type to see the full list of available arguments.
277
+ *
278
+ * @param array The options arguments
279
+ * @return string The markup.
280
+ *
281
+ * @access public
282
+ * @since 2.5.0
283
+ */
284
+ if ( ! function_exists( 'ot_type_border' ) ) {
285
+
286
+ function ot_type_border( $args = array() ) {
287
+
288
+ /* turns arguments array into variables */
289
+ extract( $args );
290
+
291
+ /* verify a description */
292
+ $has_desc = $field_desc ? true : false;
293
+
294
+ /* format setting outer wrapper */
295
+ echo '<div class="format-setting type-border ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
296
+
297
+ /* description */
298
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
299
+
300
+ /* format setting inner wrapper */
301
+ echo '<div class="format-setting-inner">';
302
+
303
+ /* allow fields to be filtered */
304
+ $ot_recognized_border_fields = apply_filters( 'ot_recognized_border_fields', array(
305
+ 'width',
306
+ 'unit',
307
+ 'style',
308
+ 'color'
309
+ ), $field_id );
310
+
311
+ /* build border width */
312
+ if ( in_array( 'width', $ot_recognized_border_fields ) ) {
313
+
314
+ $width = isset( $field_value['width'] ) ? esc_attr( $field_value['width'] ) : '';
315
+
316
+ echo '<div class="ot-option-group ot-option-group--one-sixth"><input type="text" name="' . esc_attr( $field_name ) . '[width]" id="' . esc_attr( $field_id ) . '-width" value="' . esc_attr( $width ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'width', 'option-tree' ) . '" /></div>';
317
+
318
+ }
319
+
320
+ /* build unit dropdown */
321
+ if ( in_array( 'unit', $ot_recognized_border_fields ) ) {
322
+
323
+ echo '<div class="ot-option-group ot-option-group--one-fourth">';
324
+
325
+ echo '<select name="' . esc_attr( $field_name ) . '[unit]" id="' . esc_attr( $field_id ) . '-unit" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
326
+
327
+ echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
328
+
329
+ foreach ( ot_recognized_border_unit_types( $field_id ) as $unit ) {
330
+ echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value['unit'] ) ? selected( $field_value['unit'], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
331
+ }
332
+
333
+ echo '</select>';
334
+
335
+ echo '</div>';
336
+
337
+ }
338
+
339
+ /* build style dropdown */
340
+ if ( in_array( 'style', $ot_recognized_border_fields ) ) {
341
+
342
+ echo '<div class="ot-option-group ot-option-group--one-fourth">';
343
+
344
+ echo '<select name="' . esc_attr( $field_name ) . '[style]" id="' . esc_attr( $field_id ) . '-style" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
345
+
346
+ echo '<option value="">' . __( 'style', 'option-tree' ) . '</option>';
347
+
348
+ foreach ( ot_recognized_border_style_types( $field_id ) as $key => $style ) {
349
+ echo '<option value="' . esc_attr( $key ) . '"' . ( isset( $field_value['style'] ) ? selected( $field_value['style'], $key, false ) : '' ) . '>' . esc_attr( $style ) . '</option>';
350
+ }
351
+
352
+ echo '</select>';
353
+
354
+ echo '</div>';
355
+
356
+ }
357
+
358
+ /* build color */
359
+ if ( in_array( 'color', $ot_recognized_border_fields ) ) {
360
+
361
+ echo '<div class="option-tree-ui-colorpicker-input-wrap">';
362
+
363
+ /* colorpicker JS */
364
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
365
+
366
+ /* set color */
367
+ $color = isset( $field_value['color'] ) ? esc_attr( $field_value['color'] ) : '';
368
+
369
+ /* input */
370
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[color]" id="' . $field_id . '-picker" value="' . $color . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" />';
371
+
372
+ echo '</div>';
373
+
374
+ }
375
+
376
+ echo '</div>';
377
+
378
+ echo '</div>';
379
+
380
+ }
381
+
382
+ }
383
+
384
+ /**
385
+ * Box Shadow Option Type
386
+ *
387
+ * See @ot_display_by_type to see the full list of available arguments.
388
+ *
389
+ * @param array The options arguments
390
+ * @return string The markup.
391
+ *
392
+ * @access public
393
+ * @since 2.5.0
394
+ */
395
+ if ( ! function_exists( 'ot_type_box_shadow' ) ) {
396
+
397
+ function ot_type_box_shadow( $args = array() ) {
398
+
399
+ /* turns arguments array into variables */
400
+ extract( $args );
401
+
402
+ /* verify a description */
403
+ $has_desc = $field_desc ? true : false;
404
+
405
+ /* format setting outer wrapper */
406
+ echo '<div class="format-setting type-box-shadow ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
407
+
408
+ /* description */
409
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
410
+
411
+ /* format setting inner wrapper */
412
+ echo '<div class="format-setting-inner">';
413
+
414
+ /* allow fields to be filtered */
415
+ $ot_recognized_box_shadow_fields = apply_filters( 'ot_recognized_box_shadow_fields', array(
416
+ 'inset',
417
+ 'offset-x',
418
+ 'offset-y',
419
+ 'blur-radius',
420
+ 'spread-radius',
421
+ 'color'
422
+ ), $field_id );
423
+
424
+ /* build inset */
425
+ if ( in_array( 'inset', $ot_recognized_box_shadow_fields ) ) {
426
+
427
+ echo '<div class="ot-option-group ot-option-group--checkbox"><p>';
428
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[inset]" id="' . esc_attr( $field_id ) . '-inset" value="inset" ' . ( isset( $field_value['inset'] ) ? checked( $field_value['inset'], 'inset', false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
429
+ echo '<label for="' . esc_attr( $field_id ) . '-inset">inset</label>';
430
+ echo '</p></div>';
431
+
432
+ }
433
+
434
+ /* build horizontal offset */
435
+ if ( in_array( 'offset-x', $ot_recognized_box_shadow_fields ) ) {
436
+
437
+ $offset_x = isset( $field_value['offset-x'] ) ? esc_attr( $field_value['offset-x'] ) : '';
438
+
439
+ echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-arrows-h ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[offset-x]" id="' . esc_attr( $field_id ) . '-offset-x" value="' . $offset_x . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'offset-x', 'option-tree' ) . '" /></div>';
440
+
441
+ }
442
+
443
+ /* build vertical offset */
444
+ if ( in_array( 'offset-y', $ot_recognized_box_shadow_fields ) ) {
445
+
446
+ $offset_y = isset( $field_value['offset-y'] ) ? esc_attr( $field_value['offset-y'] ) : '';
447
+
448
+ echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-arrows-v ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[offset-y]" id="' . esc_attr( $field_id ) . '-offset-y" value="' . $offset_y . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'offset-y', 'option-tree' ) . '" /></div>';
449
+
450
+ }
451
+
452
+ /* build blur-radius radius */
453
+ if ( in_array( 'blur-radius', $ot_recognized_box_shadow_fields ) ) {
454
+
455
+ $blur_radius = isset( $field_value['blur-radius'] ) ? esc_attr( $field_value['blur-radius'] ) : '';
456
+
457
+ echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-circle ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[blur-radius]" id="' . esc_attr( $field_id ) . '-blur-radius" value="' . $blur_radius . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'blur-radius', 'option-tree' ) . '" /></div>';
458
+
459
+ }
460
+
461
+ /* build spread-radius radius */
462
+ if ( in_array( 'spread-radius', $ot_recognized_box_shadow_fields ) ) {
463
+
464
+ $spread_radius = isset( $field_value['spread-radius'] ) ? esc_attr( $field_value['spread-radius'] ) : '';
465
+
466
+ echo '<div class="ot-option-group ot-option-group--one-fifth"><span class="ot-icon-arrows-alt ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[spread-radius]" id="' . esc_attr( $field_id ) . '-spread-radius" value="' . $spread_radius . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'spread-radius', 'option-tree' ) . '" /></div>';
467
+
468
+ }
469
+
470
+ /* build color */
471
+ if ( in_array( 'color', $ot_recognized_box_shadow_fields ) ) {
472
+
473
+ echo '<div class="option-tree-ui-colorpicker-input-wrap">';
474
+
475
+ /* colorpicker JS */
476
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
477
+
478
+ /* set color */
479
+ $color = isset( $field_value['color'] ) ? esc_attr( $field_value['color'] ) : '';
480
+
481
+ /* input */
482
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[color]" id="' . esc_attr( $field_id ) . '-picker" value="' . $color . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" />';
483
+
484
+ echo '</div>';
485
+
486
+ }
487
+
488
+ echo '</div>';
489
+
490
+ echo '</div>';
491
+
492
+ }
493
+
494
+ }
495
+
496
+ /**
497
+ * Category Checkbox option type.
498
+ *
499
+ * See @ot_display_by_type to see the full list of available arguments.
500
+ *
501
+ * @param array An array of arguments.
502
+ * @return string
503
+ *
504
+ * @access public
505
+ * @since 2.0
506
+ */
507
+ if ( ! function_exists( 'ot_type_category_checkbox' ) ) {
508
+
509
+ function ot_type_category_checkbox( $args = array() ) {
510
+
511
+ /* turns arguments array into variables */
512
+ extract( $args );
513
+
514
+ /* verify a description */
515
+ $has_desc = $field_desc ? true : false;
516
+
517
+ /* format setting outer wrapper */
518
+ echo '<div class="format-setting type-category-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
519
+
520
+ /* description */
521
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
522
+
523
+ /* format setting inner wrapper */
524
+ echo '<div class="format-setting-inner">';
525
+
526
+ /* get category array */
527
+ $categories = get_categories( apply_filters( 'ot_type_category_checkbox_query', array( 'hide_empty' => false ), $field_id ) );
528
+
529
+ /* build categories */
530
+ if ( ! empty( $categories ) ) {
531
+ foreach ( $categories as $category ) {
532
+ echo '<p>';
533
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $category->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $category->term_id ) . '" value="' . esc_attr( $category->term_id ) . '" ' . ( isset( $field_value[$category->term_id] ) ? checked( $field_value[$category->term_id], $category->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
534
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $category->term_id ) . '">' . esc_attr( $category->name ) . '</label>';
535
+ echo '</p>';
536
+ }
537
+ } else {
538
+ echo '<p>' . __( 'No Categories Found', 'option-tree' ) . '</p>';
539
+ }
540
+
541
+ echo '</div>';
542
+
543
+ echo '</div>';
544
+
545
+ }
546
+
547
+ }
548
+
549
+ /**
550
+ * Category Select option type.
551
+ *
552
+ * See @ot_display_by_type to see the full list of available arguments.
553
+ *
554
+ * @param array An array of arguments.
555
+ * @return string
556
+ *
557
+ * @access public
558
+ * @since 2.0
559
+ */
560
+ if ( ! function_exists( 'ot_type_category_select' ) ) {
561
+
562
+ function ot_type_category_select( $args = array() ) {
563
+
564
+ /* turns arguments array into variables */
565
+ extract( $args );
566
+
567
+ /* verify a description */
568
+ $has_desc = $field_desc ? true : false;
569
+
570
+ /* format setting outer wrapper */
571
+ echo '<div class="format-setting type-category-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
572
+
573
+ /* description */
574
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
575
+
576
+ /* format setting inner wrapper */
577
+ echo '<div class="format-setting-inner">';
578
+
579
+ /* build category */
580
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
581
+
582
+ /* get category array */
583
+ $categories = get_categories( apply_filters( 'ot_type_category_select_query', array( 'hide_empty' => false ), $field_id ) );
584
+
585
+ /* has cats */
586
+ if ( ! empty( $categories ) ) {
587
+ echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
588
+ foreach ( $categories as $category ) {
589
+ echo '<option value="' . esc_attr( $category->term_id ) . '"' . selected( $field_value, $category->term_id, false ) . '>' . esc_attr( $category->name ) . '</option>';
590
+ }
591
+ } else {
592
+ echo '<option value="">' . __( 'No Categories Found', 'option-tree' ) . '</option>';
593
+ }
594
+
595
+ echo '</select>';
596
+
597
+ echo '</div>';
598
+
599
+ echo '</div>';
600
+
601
+ }
602
+
603
+ }
604
+
605
+ /**
606
+ * Checkbox option type.
607
+ *
608
+ * See @ot_display_by_type to see the full list of available arguments.
609
+ *
610
+ * @param array An array of arguments.
611
+ * @return string
612
+ *
613
+ * @access public
614
+ * @since 2.0
615
+ */
616
+ if ( ! function_exists( 'ot_type_checkbox' ) ) {
617
+
618
+ function ot_type_checkbox( $args = array() ) {
619
+
620
+ /* turns arguments array into variables */
621
+ extract( $args );
622
+
623
+ /* verify a description */
624
+ $has_desc = $field_desc ? true : false;
625
+
626
+ /* format setting outer wrapper */
627
+ echo '<div class="format-setting type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
628
+
629
+ /* description */
630
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
631
+
632
+ /* format setting inner wrapper */
633
+ echo '<div class="format-setting-inner">';
634
+
635
+ /* build checkbox */
636
+ foreach ( (array) $field_choices as $key => $choice ) {
637
+ if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
638
+ echo '<p>';
639
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $key ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" value="' . esc_attr( $choice['value'] ) . '" ' . ( isset( $field_value[$key] ) ? checked( $field_value[$key], $choice['value'], false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
640
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label>';
641
+ echo '</p>';
642
+ }
643
+ }
644
+
645
+ echo '</div>';
646
+
647
+ echo '</div>';
648
+
649
+ }
650
+
651
+ }
652
+
653
+ /**
654
+ * Colorpicker option type.
655
+ *
656
+ * See @ot_display_by_type to see the full list of available arguments.
657
+ *
658
+ * @param array An array of arguments.
659
+ * @return string
660
+ *
661
+ * @access public
662
+ * @since 2.0
663
+ * @updated 2.2.0
664
+ */
665
+ if ( ! function_exists( 'ot_type_colorpicker' ) ) {
666
+
667
+ function ot_type_colorpicker( $args = array() ) {
668
+
669
+ /* turns arguments array into variables */
670
+ extract( $args );
671
+
672
+ /* verify a description */
673
+ $has_desc = $field_desc ? true : false;
674
+
675
+ /* format setting outer wrapper */
676
+ echo '<div class="format-setting type-colorpicker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
677
+
678
+ /* description */
679
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
680
+
681
+ /* format setting inner wrapper */
682
+ echo '<div class="format-setting-inner">';
683
+
684
+ /* build colorpicker */
685
+ echo '<div class="option-tree-ui-colorpicker-input-wrap">';
686
+
687
+ /* colorpicker JS */
688
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '"); });</script>';
689
+
690
+ /* set the default color */
691
+ $std = $field_std ? 'data-default-color="' . $field_std . '"' : '';
692
+
693
+ /* input */
694
+ 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 . ' />';
695
+
696
+ echo '</div>';
697
+
698
+ echo '</div>';
699
+
700
+ echo '</div>';
701
+
702
+ }
703
+
704
+ }
705
+
706
+ /**
707
+ * Colorpicker Opacity option type.
708
+ *
709
+ * See @ot_display_by_type to see the full list of available arguments.
710
+ *
711
+ * @param array An array of arguments.
712
+ * @return string
713
+ *
714
+ * @access public
715
+ * @since 2.5.0
716
+ */
717
+ if ( ! function_exists( 'ot_type_colorpicker_opacity' ) ) {
718
+
719
+ function ot_type_colorpicker_opacity( $args = array() ) {
720
+
721
+ $args['field_class'] = isset( $args['field_class'] ) ? $args['field_class'] . ' ot-colorpicker-opacity' : 'ot-colorpicker-opacity';
722
+ ot_type_colorpicker( $args );
723
+
724
+ }
725
+
726
+ }
727
+
728
+ /**
729
+ * CSS option type.
730
+ *
731
+ * See @ot_display_by_type to see the full list of available arguments.
732
+ *
733
+ * @param array An array of arguments.
734
+ * @return string
735
+ *
736
+ * @access public
737
+ * @since 2.0
738
+ */
739
+ if ( ! function_exists( 'ot_type_css' ) ) {
740
+
741
+ function ot_type_css( $args = array() ) {
742
+
743
+ /* turns arguments array into variables */
744
+ extract( $args );
745
+
746
+ /* verify a description */
747
+ $has_desc = $field_desc ? true : false;
748
+
749
+ /* format setting outer wrapper */
750
+ echo '<div class="format-setting type-css simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
751
+
752
+ /* description */
753
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
754
+
755
+ /* format setting inner wrapper */
756
+ echo '<div class="format-setting-inner">';
757
+
758
+ /* build textarea for CSS */
759
+ echo '<textarea class="hidden" id="textarea_' . esc_attr( $field_id ) . '" name="' . esc_attr( $field_name ) .'">' . esc_attr( $field_value ) . '</textarea>';
760
+
761
+ /* build pre to convert it into ace editor later */
762
+ echo '<pre class="ot-css-editor ' . esc_attr( $field_class ) . '" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</pre>';
763
+
764
+ echo '</div>';
765
+
766
+ echo '</div>';
767
+
768
+ }
769
+
770
+ }
771
+
772
+ /**
773
+ * Custom Post Type Checkbox option type.
774
+ *
775
+ * See @ot_display_by_type to see the full list of available arguments.
776
+ *
777
+ * @param array An array of arguments.
778
+ * @return string
779
+ *
780
+ * @access public
781
+ * @since 2.0
782
+ */
783
+ if ( ! function_exists( 'ot_type_custom_post_type_checkbox' ) ) {
784
+
785
+ function ot_type_custom_post_type_checkbox( $args = array() ) {
786
+
787
+ /* turns arguments array into variables */
788
+ extract( $args );
789
+
790
+ /* verify a description */
791
+ $has_desc = $field_desc ? true : false;
792
+
793
+ /* format setting outer wrapper */
794
+ echo '<div class="format-setting type-custom-post-type-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
795
+
796
+ /* description */
797
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
798
+
799
+ /* format setting inner wrapper */
800
+ echo '<div class="format-setting-inner">';
801
+
802
+ /* setup the post types */
803
+ $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
804
+
805
+ /* query posts array */
806
+ $my_posts = get_posts( apply_filters( 'ot_type_custom_post_type_checkbox_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
807
+
808
+ /* has posts */
809
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
810
+ foreach( $my_posts as $my_post ) {
811
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
812
+ echo '<p>';
813
+ 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 ) . '" />';
814
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
815
+ echo '</p>';
816
+ }
817
+ } else {
818
+ echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
819
+ }
820
+
821
+ echo '</div>';
822
+
823
+ echo '</div>';
824
+
825
+ }
826
+
827
+ }
828
+
829
+ /**
830
+ * Custom Post Type Select option type.
831
+ *
832
+ * See @ot_display_by_type to see the full list of available arguments.
833
+ *
834
+ * @param array An array of arguments.
835
+ * @return string
836
+ *
837
+ * @access public
838
+ * @since 2.0
839
+ */
840
+ if ( ! function_exists( 'ot_type_custom_post_type_select' ) ) {
841
+
842
+ function ot_type_custom_post_type_select( $args = array() ) {
843
+
844
+ /* turns arguments array into variables */
845
+ extract( $args );
846
+
847
+ /* verify a description */
848
+ $has_desc = $field_desc ? true : false;
849
+
850
+ /* format setting outer wrapper */
851
+ echo '<div class="format-setting type-custom-post-type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
852
+
853
+ /* description */
854
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
855
+
856
+ /* format setting inner wrapper */
857
+ echo '<div class="format-setting-inner">';
858
+
859
+ /* build category */
860
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
861
+
862
+ /* setup the post types */
863
+ $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
864
+
865
+ /* query posts array */
866
+ $my_posts = get_posts( apply_filters( 'ot_type_custom_post_type_select_query', array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
867
+
868
+ /* has posts */
869
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
870
+ echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
871
+ foreach( $my_posts as $my_post ) {
872
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
873
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
874
+ }
875
+ } else {
876
+ echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
877
+ }
878
+
879
+ echo '</select>';
880
+
881
+ echo '</div>';
882
+
883
+ echo '</div>';
884
+
885
+ }
886
+
887
+ }
888
+
889
+ /**
890
+ * Date Picker option type.
891
+ *
892
+ * See @ot_display_by_type to see the full list of available arguments.
893
+ *
894
+ * @param array An array of arguments.
895
+ * @return string
896
+ *
897
+ * @access public
898
+ * @since 2.3
899
+ */
900
+ if ( ! function_exists( 'ot_type_date_picker' ) ) {
901
+
902
+ function ot_type_date_picker( $args = array() ) {
903
+
904
+ /* turns arguments array into variables */
905
+ extract( $args );
906
+
907
+ /* verify a description */
908
+ $has_desc = $field_desc ? true : false;
909
+
910
+ /* filter date format */
911
+ $date_format = apply_filters( 'ot_type_date_picker_date_format', 'yy-mm-dd', $field_id );
912
+
913
+ /**
914
+ * Filter the addition of the readonly attribute.
915
+ *
916
+ * @since 2.5.0
917
+ *
918
+ * @param bool $is_readonly Whether to add the 'readonly' attribute. Default 'false'.
919
+ * @param string $field_id The field ID.
920
+ */
921
+ $is_readonly = apply_filters( 'ot_type_date_picker_readonly', false, $field_id );
922
+
923
+ /* format setting outer wrapper */
924
+ echo '<div class="format-setting type-date-picker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
925
+
926
+ /* date picker JS */
927
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_date_picker("' . esc_attr( $field_id ) . '", "' . esc_attr( $date_format ) . '"); });</script>';
928
+
929
+ /* description */
930
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
931
+
932
+ /* format setting inner wrapper */
933
+ echo '<div class="format-setting-inner">';
934
+
935
+ /* build date picker */
936
+ 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 ' . esc_attr( $field_class ) . '"' . ( $is_readonly == true ? ' readonly' : '' ) . ' />';
937
+
938
+ echo '</div>';
939
+
940
+ echo '</div>';
941
+
942
+ }
943
+
944
+ }
945
+
946
+ /**
947
+ * Date Time Picker option type.
948
+ *
949
+ * See @ot_display_by_type to see the full list of available arguments.
950
+ *
951
+ * @param array An array of arguments.
952
+ * @return string
953
+ *
954
+ * @access public
955
+ * @since 2.3
956
+ */
957
+ if ( ! function_exists( 'ot_type_date_time_picker' ) ) {
958
+
959
+ function ot_type_date_time_picker( $args = array() ) {
960
+
961
+ /* turns arguments array into variables */
962
+ extract( $args );
963
+
964
+ /* verify a description */
965
+ $has_desc = $field_desc ? true : false;
966
+
967
+ /* filter date format */
968
+ $date_format = apply_filters( 'ot_type_date_time_picker_date_format', 'yy-mm-dd', $field_id );
969
+
970
+ /**
971
+ * Filter the addition of the readonly attribute.
972
+ *
973
+ * @since 2.5.0
974
+ *
975
+ * @param bool $is_readonly Whether to add the 'readonly' attribute. Default 'false'.
976
+ * @param string $field_id The field ID.
977
+ */
978
+ $is_readonly = apply_filters( 'ot_type_date_time_picker_readonly', false, $field_id );
979
+
980
+ /* format setting outer wrapper */
981
+ echo '<div class="format-setting type-date-time-picker ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
982
+
983
+ /* date time picker JS */
984
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_date_time_picker("' . esc_attr( $field_id ) . '", "' . esc_attr( $date_format ) . '"); });</script>';
985
+
986
+ /* description */
987
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
988
+
989
+ /* format setting inner wrapper */
990
+ echo '<div class="format-setting-inner">';
991
+
992
+ /* build date time picker */
993
+ 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 ' . esc_attr( $field_class ) . '"' . ( $is_readonly == true ? ' readonly' : '' ) . ' />';
994
+
995
+ echo '</div>';
996
+
997
+ echo '</div>';
998
+
999
+ }
1000
+
1001
+ }
1002
+
1003
+ /**
1004
+ * Dimension Option Type
1005
+ *
1006
+ * See @ot_display_by_type to see the full list of available arguments.
1007
+ *
1008
+ * @param array The options arguments
1009
+ * @return string The markup.
1010
+ *
1011
+ * @access public
1012
+ * @since 2.5.0
1013
+ */
1014
+ if ( ! function_exists( 'ot_type_dimension' ) ) {
1015
+
1016
+ function ot_type_dimension( $args = array() ) {
1017
+
1018
+ /* turns arguments array into variables */
1019
+ extract( $args );
1020
+
1021
+ /* verify a description */
1022
+ $has_desc = $field_desc ? true : false;
1023
+
1024
+ /* format setting outer wrapper */
1025
+ echo '<div class="format-setting type-dimension ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1026
+
1027
+ /* description */
1028
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1029
+
1030
+ /* format setting inner wrapper */
1031
+ echo '<div class="format-setting-inner">';
1032
+
1033
+ /* allow fields to be filtered */
1034
+ $ot_recognized_dimension_fields = apply_filters( 'ot_recognized_dimension_fields', array(
1035
+ 'width',
1036
+ 'height',
1037
+ 'unit'
1038
+ ), $field_id );
1039
+
1040
+ /* build width dimension */
1041
+ if ( in_array( 'width', $ot_recognized_dimension_fields ) ) {
1042
+
1043
+ $width = isset( $field_value['width'] ) ? esc_attr( $field_value['width'] ) : '';
1044
+
1045
+ echo '<div class="ot-option-group ot-option-group--one-third"><span class="ot-icon-arrows-h ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[width]" id="' . esc_attr( $field_id ) . '-width" value="' . esc_attr( $width ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'width', 'option-tree' ) . '" /></div>';
1046
+
1047
+ }
1048
+
1049
+ /* build height dimension */
1050
+ if ( in_array( 'height', $ot_recognized_dimension_fields ) ) {
1051
+
1052
+ $height = isset( $field_value['height'] ) ? esc_attr( $field_value['height'] ) : '';
1053
+
1054
+ echo '<div class="ot-option-group ot-option-group--one-third"><span class="ot-icon-arrows-v ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[height]" id="' . esc_attr( $field_id ) . '-height" value="' . esc_attr( $height ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'height', 'option-tree' ) . '" /></div>';
1055
+
1056
+ }
1057
+
1058
+ /* build unit dropdown */
1059
+ if ( in_array( 'unit', $ot_recognized_dimension_fields ) ) {
1060
+
1061
+ echo '<div class="ot-option-group ot-option-group--one-third ot-option-group--is-last">';
1062
+
1063
+ echo '<select name="' . esc_attr( $field_name ) . '[unit]" id="' . esc_attr( $field_id ) . '-unit" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1064
+
1065
+ echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
1066
+
1067
+ foreach ( ot_recognized_dimension_unit_types( $field_id ) as $unit ) {
1068
+ echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value['unit'] ) ? selected( $field_value['unit'], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
1069
+ }
1070
+
1071
+ echo '</select>';
1072
+
1073
+ echo '</div>';
1074
+
1075
+ }
1076
+
1077
+ echo '</div>';
1078
+
1079
+ echo '</div>';
1080
+
1081
+ }
1082
+
1083
+ }
1084
+
1085
+ /**
1086
+ * Gallery option type.
1087
+ *
1088
+ * See @ot_display_by_type to see the full list of available arguments.
1089
+ *
1090
+ * @param array The options arguments
1091
+ * @return string The gallery metabox markup.
1092
+ *
1093
+ * @access public
1094
+ * @since 2.2.0
1095
+ */
1096
+ if ( ! function_exists( 'ot_type_gallery' ) ) {
1097
+
1098
+ function ot_type_gallery( $args = array() ) {
1099
+
1100
+ // Turns arguments array into variables
1101
+ extract( $args );
1102
+
1103
+ // Verify a description
1104
+ $has_desc = $field_desc ? true : false;
1105
+
1106
+ // Format setting outer wrapper
1107
+ echo '<div class="format-setting type-gallery ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1108
+
1109
+ // Description
1110
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1111
+
1112
+ // Format setting inner wrapper
1113
+ echo '<div class="format-setting-inner">';
1114
+
1115
+ // Setup the post type
1116
+ $post_type = isset( $field_post_type ) ? explode( ',', $field_post_type ) : array( 'post' );
1117
+
1118
+ $field_value = trim( $field_value );
1119
+
1120
+ // Saved values
1121
+ 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 ) . '" />';
1122
+
1123
+ // Search the string for the IDs
1124
+ preg_match( '/ids=\'(.*?)\'/', $field_value, $matches );
1125
+
1126
+ // Turn the field value into an array of IDs
1127
+ if ( isset( $matches[1] ) ) {
1128
+
1129
+ // Found the IDs in the shortcode
1130
+ $ids = explode( ',', $matches[1] );
1131
+
1132
+ } else {
1133
+
1134
+ // The string is only IDs
1135
+ $ids = ! empty( $field_value ) && $field_value != '' ? explode( ',', $field_value ) : array();
1136
+
1137
+ }
1138
+
1139
+ // Has attachment IDs
1140
+ if ( ! empty( $ids ) ) {
1141
+
1142
+ echo '<ul class="ot-gallery-list">';
1143
+
1144
+ foreach( $ids as $id ) {
1145
+
1146
+ if ( $id == '' )
1147
+ continue;
1148
+
1149
+ $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
1150
+
1151
+ echo '<li><img src="' . $thumbnail[0] . '" width="75" height="75" /></li>';
1152
+
1153
+ }
1154
+
1155
+ echo '</ul>';
1156
+
1157
+ echo '
1158
+ <div class="ot-gallery-buttons">
1159
+ <a href="#" class="option-tree-ui-button button button-secondary hug-left ot-gallery-delete">' . __( 'Delete Gallery', 'option-tree' ) . '</a>
1160
+ <a href="#" class="option-tree-ui-button button button-primary right hug-right ot-gallery-edit">' . __( 'Edit Gallery', 'option-tree' ) . '</a>
1161
+ </div>';
1162
+
1163
+ } else {
1164
+
1165
+ echo '
1166
+ <div class="ot-gallery-buttons">
1167
+ <a href="#" class="option-tree-ui-button button button-primary right hug-right ot-gallery-edit">' . __( 'Create Gallery', 'option-tree' ) . '</a>
1168
+ </div>';
1169
+
1170
+ }
1171
+
1172
+ echo '</div>';
1173
+
1174
+ echo '</div>';
1175
+
1176
+ }
1177
+
1178
+ }
1179
+
1180
+ /**
1181
+ * Google Fonts option type.
1182
+ *
1183
+ * See @ot_display_by_type to see the full list of available arguments.
1184
+ *
1185
+ * @param array An array of arguments.
1186
+ * @return string
1187
+ *
1188
+ * @access public
1189
+ * @since 2.5.0
1190
+ */
1191
+ if ( ! function_exists( 'ot_type_google_fonts' ) ) {
1192
+
1193
+ function ot_type_google_fonts( $args = array() ) {
1194
+
1195
+ /* turns arguments array into variables */
1196
+ extract( $args );
1197
+
1198
+ /* verify a description */
1199
+ $has_desc = $field_desc ? true : false;
1200
+
1201
+ /* format setting outer wrapper */
1202
+ echo '<div class="format-setting type-google-font ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1203
+
1204
+ /* description */
1205
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1206
+
1207
+ /* format setting inner wrapper */
1208
+ echo '<div class="format-setting-inner">';
1209
+
1210
+ /* allow fields to be filtered */
1211
+ $ot_recognized_google_fonts_fields = apply_filters( 'ot_recognized_google_font_fields', array(
1212
+ 'variants',
1213
+ 'subsets'
1214
+ ), $field_id );
1215
+
1216
+ // Set a default to show at least one item.
1217
+ if ( ! is_array( $field_value ) || empty( $field_value ) ) {
1218
+ $field_value = array( array(
1219
+ 'family' => '',
1220
+ 'variants' => array(),
1221
+ 'subsets' => array()
1222
+ ) );
1223
+ }
1224
+
1225
+ foreach( $field_value as $key => $value ) {
1226
+
1227
+ echo '<div class="type-google-font-group">';
1228
+
1229
+ /* build font family */
1230
+ $family = isset( $value['family'] ) ? $value['family'] : '';
1231
+ echo '<div class="option-tree-google-font-family">';
1232
+ echo '<a href="javascript:void(0);" class="js-remove-google-font option-tree-ui-button button button-secondary light" title="' . __( 'Remove Google Font', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"/>' . __( 'Remove Google Font', 'option-tree' ) . '</a>';
1233
+ echo '<select name="' . esc_attr( $field_name ) . '[' . $key . '][family]" id="' . esc_attr( $field_id ) . '-' . $key . '" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1234
+ echo '<option value="">' . __( '-- Choose One --', 'option-tree' ) . '</option>';
1235
+ foreach ( ot_recognized_google_font_families( $field_id ) as $family_key => $family_value ) {
1236
+ echo '<option value="' . esc_attr( $family_key ) . '" ' . selected( $family, $family_key, false ) . '>' . esc_html( $family_value ) . '</option>';
1237
+ }
1238
+ echo '</select>';
1239
+ echo '</div>';
1240
+
1241
+ /* build font variants */
1242
+ if ( in_array( 'variants', $ot_recognized_google_fonts_fields ) ) {
1243
+ $variants = isset( $value['variants'] ) ? $value['variants'] : array();
1244
+ echo '<div class="option-tree-google-font-variants" data-field-id-prefix="' . esc_attr( $field_id ) . '-' . $key . '-" data-field-name="' . esc_attr( $field_name ) . '[' . $key . '][variants]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1245
+ foreach ( ot_recognized_google_font_variants( $field_id, $family ) as $variant_key => $variant ) {
1246
+ echo '<p class="checkbox-wrap">';
1247
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . $key . '][variants][]" id="' . esc_attr( $field_id ) . '-' . $key . '-' . $variant . '" value="' . esc_attr( $variant ) . '" ' . checked( in_array( $variant, $variants ), true, false ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
1248
+ echo '<label for="' . esc_attr( $field_id ) . '-' . $key . '-' . $variant . '">' . esc_html( $variant ) . '</label>';
1249
+ echo '</p>';
1250
+ }
1251
+ echo '</div>';
1252
+ }
1253
+
1254
+ /* build font subsets */
1255
+ if ( in_array( 'subsets', $ot_recognized_google_fonts_fields ) ) {
1256
+ $subsets = isset( $value['subsets'] ) ? $value['subsets'] : array();
1257
+ echo '<div class="option-tree-google-font-subsets" data-field-id-prefix="' . esc_attr( $field_id ) . '-' . $key . '-" data-field-name="' . esc_attr( $field_name ) . '[' . $key . '][subsets]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1258
+ foreach ( ot_recognized_google_font_subsets( $field_id, $family ) as $subset_key => $subset ) {
1259
+ echo '<p class="checkbox-wrap">';
1260
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . $key . '][subsets][]" id="' . esc_attr( $field_id ) . '-' . $key . '-' . $subset . '" value="' . esc_attr( $subset ) . '" ' . checked( in_array( $subset, $subsets ), true, false ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
1261
+ echo '<label for="' . esc_attr( $field_id ) . '-' . $key . '-' . $subset . '">' . esc_html( $subset ) . '</label>';
1262
+ echo '</p>';
1263
+ }
1264
+ echo '</div>';
1265
+ }
1266
+
1267
+ echo '</div>';
1268
+
1269
+ }
1270
+
1271
+ echo '<div class="type-google-font-group-clone">';
1272
+
1273
+ /* build font family */
1274
+ echo '<div class="option-tree-google-font-family">';
1275
+ echo '<a href="javascript:void(0);" class="js-remove-google-font option-tree-ui-button button button-secondary light" title="' . __( 'Remove Google Font', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"/>' . __( 'Remove Google Font', 'option-tree' ) . '</a>';
1276
+ echo '<select name="' . esc_attr( $field_name ) . '[%key%][family]" id="' . esc_attr( $field_id ) . '-%key%" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1277
+ echo '<option value="">' . __( '-- Choose One --', 'option-tree' ) . '</option>';
1278
+ foreach ( ot_recognized_google_font_families( $field_id ) as $family_key => $family_value ) {
1279
+ echo '<option value="' . esc_attr( $family_key ) . '">' . esc_html( $family_value ) . '</option>';
1280
+ }
1281
+ echo '</select>';
1282
+ echo '</div>';
1283
+
1284
+ /* build font variants */
1285
+ if ( in_array( 'variants', $ot_recognized_google_fonts_fields ) ) {
1286
+ echo '<div class="option-tree-google-font-variants" data-field-id-prefix="' . esc_attr( $field_id ) . '-%key%-" data-field-name="' . esc_attr( $field_name ) . '[%key%][variants]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1287
+ echo '</div>';
1288
+ }
1289
+
1290
+ /* build font subsets */
1291
+ if ( in_array( 'subsets', $ot_recognized_google_fonts_fields ) ) {
1292
+ echo '<div class="option-tree-google-font-subsets" data-field-id-prefix="' . esc_attr( $field_id ) . '-%key%-" data-field-name="' . esc_attr( $field_name ) . '[%key%][subsets]" data-field-class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '">';
1293
+ echo '</div>';
1294
+ }
1295
+
1296
+ echo '</div>';
1297
+
1298
+ echo '<a href="javascript:void(0);" class="js-add-google-font option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add Google Font', 'option-tree' ) . '">' . __( 'Add Google Font', 'option-tree' ) . '</a>';
1299
+
1300
+ echo '</div>';
1301
+
1302
+ echo '</div>';
1303
+
1304
+ }
1305
+
1306
+ }
1307
+
1308
+ /**
1309
+ * JavaScript option type.
1310
+ *
1311
+ * See @ot_display_by_type to see the full list of available arguments.
1312
+ *
1313
+ * @param array An array of arguments.
1314
+ * @return string
1315
+ *
1316
+ * @access public
1317
+ * @since 2.5.0
1318
+ */
1319
+ if ( ! function_exists( 'ot_type_javascript' ) ) {
1320
+
1321
+ function ot_type_javascript( $args = array() ) {
1322
+
1323
+ /* turns arguments array into variables */
1324
+ extract( $args );
1325
+
1326
+ /* verify a description */
1327
+ $has_desc = $field_desc ? true : false;
1328
+
1329
+ /* format setting outer wrapper */
1330
+ echo '<div class="format-setting type-javascript simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1331
+
1332
+ /* description */
1333
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1334
+
1335
+ /* format setting inner wrapper */
1336
+ echo '<div class="format-setting-inner">';
1337
+
1338
+ /* build textarea for CSS */
1339
+ echo '<textarea class="hidden" id="textarea_' . esc_attr( $field_id ) . '" name="' . esc_attr( $field_name ) .'">' . esc_attr( $field_value ) . '</textarea>';
1340
+
1341
+ /* build pre to convert it into ace editor later */
1342
+ echo '<pre class="ot-javascript-editor ' . esc_attr( $field_class ) . '" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</pre>';
1343
+
1344
+ echo '</div>';
1345
+
1346
+ echo '</div>';
1347
+
1348
+ }
1349
+
1350
+ }
1351
+
1352
+ /**
1353
+ * Link Color option type.
1354
+ *
1355
+ * See @ot_display_by_type to see the full list of available arguments.
1356
+ *
1357
+ * @param array The options arguments
1358
+ * @return string The markup.
1359
+ *
1360
+ * @access public
1361
+ * @since 2.5.0
1362
+ */
1363
+ if ( ! function_exists( 'ot_type_link_color' ) ) {
1364
+
1365
+ function ot_type_link_color( $args = array() ) {
1366
+
1367
+ /* turns arguments array into variables */
1368
+ extract( $args );
1369
+
1370
+ /* verify a description */
1371
+ $has_desc = $field_desc ? true : false;
1372
+
1373
+ /* format setting outer wrapper */
1374
+ echo '<div class="format-setting type-link-color ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1375
+
1376
+ /* description */
1377
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1378
+
1379
+ /* format setting inner wrapper */
1380
+ echo '<div class="format-setting-inner">';
1381
+
1382
+ /* allow fields to be filtered */
1383
+ $ot_recognized_link_color_fields = apply_filters( 'ot_recognized_link_color_fields', array(
1384
+ 'link' => _x( 'Standard', 'color picker', 'option-tree' ),
1385
+ 'hover' => _x( 'Hover', 'color picker', 'option-tree' ),
1386
+ 'active' => _x( 'Active', 'color picker', 'option-tree' ),
1387
+ 'visited' => _x( 'Visited', 'color picker', 'option-tree' ),
1388
+ 'focus' => _x( 'Focus', 'color picker', 'option-tree' )
1389
+ ), $field_id );
1390
+
1391
+ /* build link color fields */
1392
+ foreach( $ot_recognized_link_color_fields as $type => $label ) {
1393
+
1394
+ if ( array_key_exists( $type, $ot_recognized_link_color_fields ) ) {
1395
+
1396
+ echo '<div class="option-tree-ui-colorpicker-input-wrap">';
1397
+
1398
+ echo '<label for="' . esc_attr( $field_id ) . '-picker-' . $type . '" class="option-tree-ui-colorpicker-label">' . esc_attr( $label ) . '</label>';
1399
+
1400
+ /* colorpicker JS */
1401
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker-' . $type . '"); });</script>';
1402
+
1403
+ /* set color */
1404
+ $color = isset( $field_value[ $type ] ) ? esc_attr( $field_value[ $type ] ) : '';
1405
+
1406
+ /* set default color */
1407
+ $std = isset( $field_std[ $type ] ) ? 'data-default-color="' . $field_std[ $type ] . '"' : '';
1408
+
1409
+ /* input */
1410
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[' . $type . ']" id="' . esc_attr( $field_id ) . '-picker-' . $type . '" value="' . $color . '" class="hide-color-picker ' . esc_attr( $field_class ) . '" ' . $std . ' />';
1411
+
1412
+ echo '</div>';
1413
+
1414
+ }
1415
+
1416
+ }
1417
+
1418
+ echo '</div>';
1419
+
1420
+ echo '</div>';
1421
+
1422
+ }
1423
+
1424
+ }
1425
+
1426
+ /**
1427
+ * List Item option type.
1428
+ *
1429
+ * See @ot_display_by_type to see the full list of available arguments.
1430
+ *
1431
+ * @param array An array of arguments.
1432
+ * @return string
1433
+ *
1434
+ * @access public
1435
+ * @since 2.0
1436
+ */
1437
+ if ( ! function_exists( 'ot_type_list_item' ) ) {
1438
+
1439
+ function ot_type_list_item( $args = array() ) {
1440
+
1441
+ /* turns arguments array into variables */
1442
+ extract( $args );
1443
+
1444
+ /* verify a description */
1445
+ $has_desc = $field_desc ? true : false;
1446
+
1447
+ // Default
1448
+ $sortable = true;
1449
+
1450
+ // Check if the list can be sorted
1451
+ if ( ! empty( $field_class ) ) {
1452
+ $classes = explode( ' ', $field_class );
1453
+ if ( in_array( 'not-sortable', $classes ) ) {
1454
+ $sortable = false;
1455
+ str_replace( 'not-sortable', '', $field_class );
1456
+ }
1457
+ }
1458
+
1459
+ /* format setting outer wrapper */
1460
+ echo '<div class="format-setting type-list-item ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1461
+
1462
+ /* description */
1463
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1464
+
1465
+ /* format setting inner wrapper */
1466
+ echo '<div class="format-setting-inner">';
1467
+
1468
+ /* pass the settings array arround */
1469
+ echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
1470
+
1471
+ /**
1472
+ * settings pages have array wrappers like 'option_tree'.
1473
+ * So we need that value to create a proper array to save to.
1474
+ * This is only for NON metabox settings.
1475
+ */
1476
+ if ( ! isset( $get_option ) )
1477
+ $get_option = '';
1478
+
1479
+ /* build list items */
1480
+ echo '<ul class="option-tree-setting-wrap' . ( $sortable ? ' option-tree-sortable' : '' ) .'" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
1481
+
1482
+ if ( is_array( $field_value ) && ! empty( $field_value ) ) {
1483
+
1484
+ foreach( $field_value as $key => $list_item ) {
1485
+
1486
+ echo '<li class="ui-state-default list-list-item">';
1487
+ ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
1488
+ echo '</li>';
1489
+
1490
+ }
1491
+
1492
+ }
1493
+
1494
+ echo '</ul>';
1495
+
1496
+ /* button */
1497
+ echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
1498
+
1499
+ /* description */
1500
+ $list_desc = $sortable ? __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ) : '';
1501
+ echo '<div class="list-item-description">' . apply_filters( 'ot_list_item_description', $list_desc, $field_id ) . '</div>';
1502
+
1503
+ echo '</div>';
1504
+
1505
+ echo '</div>';
1506
+
1507
+ }
1508
+
1509
+ }
1510
+
1511
+ /**
1512
+ * Measurement option type.
1513
+ *
1514
+ * See @ot_display_by_type to see the full list of available arguments.
1515
+ *
1516
+ * @param array An array of arguments.
1517
+ * @return string
1518
+ *
1519
+ * @access public
1520
+ * @since 2.0
1521
+ */
1522
+ if ( ! function_exists( 'ot_type_measurement' ) ) {
1523
+
1524
+ function ot_type_measurement( $args = array() ) {
1525
+
1526
+ /* turns arguments array into variables */
1527
+ extract( $args );
1528
+
1529
+ /* verify a description */
1530
+ $has_desc = $field_desc ? true : false;
1531
+
1532
+ /* format setting outer wrapper */
1533
+ echo '<div class="format-setting type-measurement ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1534
+
1535
+ /* description */
1536
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1537
+
1538
+ /* format setting inner wrapper */
1539
+ echo '<div class="format-setting-inner">';
1540
+
1541
+ echo '<div class="option-tree-ui-measurement-input-wrap">';
1542
+
1543
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '[0]" id="' . esc_attr( $field_id ) . '-0" value="' . ( isset( $field_value[0] ) ? esc_attr( $field_value[0] ) : '' ) . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" />';
1544
+
1545
+ echo '</div>';
1546
+
1547
+ /* build measurement */
1548
+ echo '<select name="' . esc_attr( $field_name ) . '[1]" id="' . esc_attr( $field_id ) . '-1" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
1549
+
1550
+ echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
1551
+
1552
+ foreach ( ot_measurement_unit_types( $field_id ) as $unit ) {
1553
+ echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value[1] ) ? selected( $field_value[1], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
1554
+ }
1555
+
1556
+ echo '</select>';
1557
+
1558
+ echo '</div>';
1559
+
1560
+ echo '</div>';
1561
+
1562
+ }
1563
+
1564
+ }
1565
+
1566
+ /**
1567
+ * Numeric Slider option type.
1568
+ *
1569
+ * See @ot_display_by_type to see the full list of available arguments.
1570
+ *
1571
+ * @param array An array of arguments.
1572
+ * @return string
1573
+ *
1574
+ * @access public
1575
+ * @since 2.1
1576
+ */
1577
+ if ( ! function_exists( 'ot_type_numeric_slider' ) ) {
1578
+
1579
+ function ot_type_numeric_slider( $args = array() ) {
1580
+
1581
+ /* turns arguments array into variables */
1582
+ extract( $args );
1583
+
1584
+ /* verify a description */
1585
+ $has_desc = $field_desc ? true : false;
1586
+
1587
+ $_options = explode( ',', $field_min_max_step );
1588
+ $min = isset( $_options[0] ) ? $_options[0] : 0;
1589
+ $max = isset( $_options[1] ) ? $_options[1] : 100;
1590
+ $step = isset( $_options[2] ) ? $_options[2] : 1;
1591
+
1592
+ /* format setting outer wrapper */
1593
+ echo '<div class="format-setting type-numeric-slider ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1594
+
1595
+ /* description */
1596
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1597
+
1598
+ /* format setting inner wrapper */
1599
+ echo '<div class="format-setting-inner">';
1600
+
1601
+ echo '<div class="ot-numeric-slider-wrap">';
1602
+
1603
+ 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 ) . '">';
1604
+
1605
+ 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>';
1606
+
1607
+ echo '<div id="ot_numeric_slider_' . esc_attr( $field_id ) . '" class="ot-numeric-slider"></div>';
1608
+
1609
+ echo '</div>';
1610
+
1611
+ echo '</div>';
1612
+
1613
+ echo '</div>';
1614
+ }
1615
+
1616
+ }
1617
+
1618
+ /**
1619
+ * On/Off option type
1620
+ *
1621
+ * See @ot_display_by_type to see the full list of available arguments.
1622
+ *
1623
+ * @param array The options arguments
1624
+ * @return string The gallery metabox markup.
1625
+ *
1626
+ * @access public
1627
+ * @since 2.2.0
1628
+ */
1629
+ if ( ! function_exists( 'ot_type_on_off' ) ) {
1630
+
1631
+ function ot_type_on_off( $args = array() ) {
1632
+
1633
+ /* turns arguments array into variables */
1634
+ extract( $args );
1635
+
1636
+ /* verify a description */
1637
+ $has_desc = $field_desc ? true : false;
1638
+
1639
+ /* format setting outer wrapper */
1640
+ echo '<div class="format-setting type-radio ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1641
+
1642
+ /* description */
1643
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1644
+
1645
+ /* format setting inner wrapper */
1646
+ echo '<div class="format-setting-inner">';
1647
+
1648
+ /* Force only two choices, and allowing filtering on the choices value & label */
1649
+ $field_choices = array(
1650
+ array(
1651
+ /**
1652
+ * Filter the value of the On button.
1653
+ *
1654
+ * @since 2.5.0
1655
+ *
1656
+ * @param string The On button value. Default 'on'.
1657
+ * @param string $field_id The field ID.
1658
+ * @param string $filter_id For filtering both on/off value with one function.
1659
+ */
1660
+ 'value' => apply_filters( 'ot_on_off_switch_on_value', 'on', $field_id, 'on' ),
1661
+ /**
1662
+ * Filter the label of the On button.
1663
+ *
1664
+ * @since 2.5.0
1665
+ *
1666
+ * @param string The On button label. Default 'On'.
1667
+ * @param string $field_id The field ID.
1668
+ * @param string $filter_id For filtering both on/off label with one function.
1669
+ */
1670
+ 'label' => apply_filters( 'ot_on_off_switch_on_label', __( 'On', 'option-tree' ), $field_id, 'on' )
1671
+ ),
1672
+ array(
1673
+ /**
1674
+ * Filter the value of the Off button.
1675
+ *
1676
+ * @since 2.5.0
1677
+ *
1678
+ * @param string The Off button value. Default 'off'.
1679
+ * @param string $field_id The field ID.
1680
+ * @param string $filter_id For filtering both on/off value with one function.
1681
+ */
1682
+ 'value' => apply_filters( 'ot_on_off_switch_off_value', 'off', $field_id, 'off' ),
1683
+ /**
1684
+ * Filter the label of the Off button.
1685
+ *
1686
+ * @since 2.5.0
1687
+ *
1688
+ * @param string The Off button label. Default 'Off'.
1689
+ * @param string $field_id The field ID.
1690
+ * @param string $filter_id For filtering both on/off label with one function.
1691
+ */
1692
+ 'label' => apply_filters( 'ot_on_off_switch_off_label', __( 'Off', 'option-tree' ), $field_id, 'off' )
1693
+ )
1694
+ );
1695
+
1696
+ /**
1697
+ * Filter the width of the On/Off switch.
1698
+ *
1699
+ * @since 2.5.0
1700
+ *
1701
+ * @param string The switch width. Default '100px'.
1702
+ * @param string $field_id The field ID.
1703
+ */
1704
+ $switch_width = apply_filters( 'ot_on_off_switch_width', '100px', $field_id );
1705
+
1706
+ echo '<div class="on-off-switch"' . ( $switch_width != '100px' ? sprintf( ' style="width:%s"', $switch_width ) : '' ) . '>';
1707
+
1708
+ /* build radio */
1709
+ foreach ( (array) $field_choices as $key => $choice ) {
1710
+ echo '
1711
+ <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 ) . '" />
1712
+ <label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '" onclick="">' . esc_attr( $choice['label'] ) . '</label>';
1713
+ }
1714
+
1715
+ echo '<span class="slide-button"></span>';
1716
+
1717
+ echo '</div>';
1718
+
1719
+ echo '</div>';
1720
+
1721
+ echo '</div>';
1722
+
1723
+ }
1724
+
1725
+ }
1726
+
1727
+ /**
1728
+ * Page Checkbox option type.
1729
+ *
1730
+ * See @ot_display_by_type to see the full list of available arguments.
1731
+ *
1732
+ * @param array An array of arguments.
1733
+ * @return string
1734
+ *
1735
+ * @access public
1736
+ * @since 2.0
1737
+ */
1738
+ if ( ! function_exists( 'ot_type_page_checkbox' ) ) {
1739
+
1740
+ function ot_type_page_checkbox( $args = array() ) {
1741
+
1742
+ /* turns arguments array into variables */
1743
+ extract( $args );
1744
+
1745
+ /* verify a description */
1746
+ $has_desc = $field_desc ? true : false;
1747
+
1748
+ /* format setting outer wrapper */
1749
+ echo '<div class="format-setting type-page-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1750
+
1751
+ /* description */
1752
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1753
+
1754
+ /* format setting inner wrapper */
1755
+ echo '<div class="format-setting-inner">';
1756
+
1757
+ /* query pages array */
1758
+ $my_posts = get_posts( apply_filters( 'ot_type_page_checkbox_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1759
+
1760
+ /* has pages */
1761
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1762
+ foreach( $my_posts as $my_post ) {
1763
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1764
+ echo '<p>';
1765
+ 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 ) . '" />';
1766
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
1767
+ echo '</p>';
1768
+ }
1769
+ } else {
1770
+ echo '<p>' . __( 'No Pages Found', 'option-tree' ) . '</p>';
1771
+ }
1772
+
1773
+ echo '</div>';
1774
+
1775
+ echo '</div>';
1776
+
1777
+ }
1778
+
1779
+ }
1780
+
1781
+ /**
1782
+ * Page Select option type.
1783
+ *
1784
+ * See @ot_display_by_type to see the full list of available arguments.
1785
+ *
1786
+ * @param array An array of arguments.
1787
+ * @return string
1788
+ *
1789
+ * @access public
1790
+ * @since 2.0
1791
+ */
1792
+ if ( ! function_exists( 'ot_type_page_select' ) ) {
1793
+
1794
+ function ot_type_page_select( $args = array() ) {
1795
+
1796
+ /* turns arguments array into variables */
1797
+ extract( $args );
1798
+
1799
+ /* verify a description */
1800
+ $has_desc = $field_desc ? true : false;
1801
+
1802
+ /* format setting outer wrapper */
1803
+ echo '<div class="format-setting type-page-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1804
+
1805
+ /* description */
1806
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1807
+
1808
+ /* format setting inner wrapper */
1809
+ echo '<div class="format-setting-inner">';
1810
+
1811
+ /* build page select */
1812
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
1813
+
1814
+ /* query pages array */
1815
+ $my_posts = get_posts( apply_filters( 'ot_type_page_select_query', array( 'post_type' => array( 'page' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1816
+
1817
+ /* has pages */
1818
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1819
+ echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1820
+ foreach( $my_posts as $my_post ) {
1821
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1822
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
1823
+ }
1824
+ } else {
1825
+ echo '<option value="">' . __( 'No Pages Found', 'option-tree' ) . '</option>';
1826
+ }
1827
+
1828
+ echo '</select>';
1829
+
1830
+ echo '</div>';
1831
+
1832
+ echo '</div>';
1833
+
1834
+ }
1835
+
1836
+ }
1837
+
1838
+ /**
1839
+ * Post Checkbox option type.
1840
+ *
1841
+ * See @ot_display_by_type to see the full list of available arguments.
1842
+ *
1843
+ * @param array An array of arguments.
1844
+ * @return string
1845
+ *
1846
+ * @access public
1847
+ * @since 2.0
1848
+ */
1849
+ if ( ! function_exists( 'ot_type_post_checkbox' ) ) {
1850
+
1851
+ function ot_type_post_checkbox( $args = array() ) {
1852
+
1853
+ /* turns arguments array into variables */
1854
+ extract( $args );
1855
+
1856
+ /* verify a description */
1857
+ $has_desc = $field_desc ? true : false;
1858
+
1859
+ /* format setting outer wrapper */
1860
+ echo '<div class="format-setting type-post-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1861
+
1862
+ /* description */
1863
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1864
+
1865
+ /* format setting inner wrapper */
1866
+ echo '<div class="format-setting-inner">';
1867
+
1868
+ /* query posts array */
1869
+ $my_posts = get_posts( apply_filters( 'ot_type_post_checkbox_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1870
+
1871
+ /* has posts */
1872
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1873
+ foreach( $my_posts as $my_post ) {
1874
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1875
+ echo '<p>';
1876
+ 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 ) . '" />';
1877
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $my_post->ID ) . '">' . $post_title . '</label>';
1878
+ echo '</p>';
1879
+ }
1880
+ } else {
1881
+ echo '<p>' . __( 'No Posts Found', 'option-tree' ) . '</p>';
1882
+ }
1883
+
1884
+ echo '</div>';
1885
+
1886
+ echo '</div>';
1887
+
1888
+ }
1889
+
1890
+ }
1891
+
1892
+ /**
1893
+ * Post Select option type.
1894
+ *
1895
+ * See @ot_display_by_type to see the full list of available arguments.
1896
+ *
1897
+ * @param array An array of arguments.
1898
+ * @return string
1899
+ *
1900
+ * @access public
1901
+ * @since 2.0
1902
+ */
1903
+ if ( ! function_exists( 'ot_type_post_select' ) ) {
1904
+
1905
+ function ot_type_post_select( $args = array() ) {
1906
+
1907
+ /* turns arguments array into variables */
1908
+ extract( $args );
1909
+
1910
+ /* verify a description */
1911
+ $has_desc = $field_desc ? true : false;
1912
+
1913
+ /* format setting outer wrapper */
1914
+ echo '<div class="format-setting type-post-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1915
+
1916
+ /* description */
1917
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1918
+
1919
+ /* format setting inner wrapper */
1920
+ echo '<div class="format-setting-inner">';
1921
+
1922
+ /* build page select */
1923
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
1924
+
1925
+ /* query posts array */
1926
+ $my_posts = get_posts( apply_filters( 'ot_type_post_select_query', array( 'post_type' => array( 'post' ), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'any' ), $field_id ) );
1927
+
1928
+ /* has posts */
1929
+ if ( is_array( $my_posts ) && ! empty( $my_posts ) ) {
1930
+ echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
1931
+ foreach( $my_posts as $my_post ) {
1932
+ $post_title = '' != $my_post->post_title ? $my_post->post_title : 'Untitled';
1933
+ echo '<option value="' . esc_attr( $my_post->ID ) . '"' . selected( $field_value, $my_post->ID, false ) . '>' . $post_title . '</option>';
1934
+ }
1935
+ } else {
1936
+ echo '<option value="">' . __( 'No Posts Found', 'option-tree' ) . '</option>';
1937
+ }
1938
+
1939
+ echo '</select>';
1940
+
1941
+ echo '</div>';
1942
+
1943
+ echo '</div>';
1944
+
1945
+ }
1946
+
1947
+ }
1948
+
1949
+ /**
1950
+ * Radio option type.
1951
+ *
1952
+ * See @ot_display_by_type to see the full list of available arguments.
1953
+ *
1954
+ * @param array An array of arguments.
1955
+ * @return string
1956
+ *
1957
+ * @access public
1958
+ * @since 2.0
1959
+ */
1960
+ if ( ! function_exists( 'ot_type_radio' ) ) {
1961
+
1962
+ function ot_type_radio( $args = array() ) {
1963
+
1964
+ /* turns arguments array into variables */
1965
+ extract( $args );
1966
+
1967
+ /* verify a description */
1968
+ $has_desc = $field_desc ? true : false;
1969
+
1970
+ /* format setting outer wrapper */
1971
+ echo '<div class="format-setting type-radio ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
1972
+
1973
+ /* description */
1974
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
1975
+
1976
+ /* format setting inner wrapper */
1977
+ echo '<div class="format-setting-inner">';
1978
+
1979
+ /* build radio */
1980
+ foreach ( (array) $field_choices as $key => $choice ) {
1981
+ echo '<p><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 ) . '" /><label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label></p>';
1982
+ }
1983
+
1984
+ echo '</div>';
1985
+
1986
+ echo '</div>';
1987
+
1988
+ }
1989
+
1990
+ }
1991
+
1992
+ /**
1993
+ * Radio Images option type.
1994
+ *
1995
+ * See @ot_display_by_type to see the full list of available arguments.
1996
+ *
1997
+ * @param array An array of arguments.
1998
+ * @return string
1999
+ *
2000
+ * @access public
2001
+ * @since 2.0
2002
+ */
2003
+ if ( ! function_exists( 'ot_type_radio_image' ) ) {
2004
+
2005
+ function ot_type_radio_image( $args = array() ) {
2006
+
2007
+ /* turns arguments array into variables */
2008
+ extract( $args );
2009
+
2010
+ /* verify a description */
2011
+ $has_desc = $field_desc ? true : false;
2012
+
2013
+ /* format setting outer wrapper */
2014
+ echo '<div class="format-setting type-radio-image ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2015
+
2016
+ /* description */
2017
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2018
+
2019
+ /* format setting inner wrapper */
2020
+ echo '<div class="format-setting-inner">';
2021
+
2022
+ /**
2023
+ * load the default filterable images if nothing
2024
+ * has been set in the choices array.
2025
+ */
2026
+ if ( empty( $field_choices ) )
2027
+ $field_choices = ot_radio_images( $field_id );
2028
+
2029
+ /* build radio image */
2030
+ foreach ( (array) $field_choices as $key => $choice ) {
2031
+
2032
+ $src = str_replace( 'OT_URL', OT_URL, $choice['src'] );
2033
+ $src = str_replace( 'OT_THEME_URL', OT_THEME_URL, $src );
2034
+
2035
+ /* make radio image source filterable */
2036
+ $src = apply_filters( 'ot_type_radio_image_src', $src, $field_id );
2037
+
2038
+ /**
2039
+ * Filter the image attributes.
2040
+ *
2041
+ * @since 2.5.3
2042
+ *
2043
+ * @param string $attributes The image attributes.
2044
+ * @param string $field_id The field ID.
2045
+ * @param array $choice The choice.
2046
+ */
2047
+ $attributes = apply_filters( 'ot_type_radio_image_attributes', '', $field_id, $choice );
2048
+
2049
+ echo '<div class="option-tree-ui-radio-images">';
2050
+ echo '<p style="display:none"><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="option-tree-ui-radio option-tree-ui-images" /><label for="' . esc_attr( $field_id ) . '-' . esc_attr( $key ) . '">' . esc_attr( $choice['label'] ) . '</label></p>';
2051
+ echo '<img ' . $attributes . ' src="' . esc_url( $src ) . '" alt="' . esc_attr( $choice['label'] ) .'" title="' . esc_attr( $choice['label'] ) .'" class="option-tree-ui-radio-image ' . esc_attr( $field_class ) . ( $field_value == $choice['value'] ? ' option-tree-ui-radio-image-selected' : '' ) . '" />';
2052
+ echo '</div>';
2053
+ }
2054
+
2055
+ echo '</div>';
2056
+
2057
+ echo '</div>';
2058
+
2059
+ }
2060
+
2061
+ }
2062
+
2063
+ /**
2064
+ * Select option type.
2065
+ *
2066
+ * See @ot_display_by_type to see the full list of available arguments.
2067
+ *
2068
+ * @param array An array of arguments.
2069
+ * @return string
2070
+ *
2071
+ * @access public
2072
+ * @since 2.0
2073
+ */
2074
+ if ( ! function_exists( 'ot_type_select' ) ) {
2075
+
2076
+ function ot_type_select( $args = array() ) {
2077
+
2078
+ /* turns arguments array into variables */
2079
+ extract( $args );
2080
+
2081
+ /* verify a description */
2082
+ $has_desc = $field_desc ? true : false;
2083
+
2084
+ /* format setting outer wrapper */
2085
+ echo '<div class="format-setting type-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2086
+
2087
+ /* description */
2088
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2089
+
2090
+ /* filter choices array */
2091
+ $field_choices = apply_filters( 'ot_type_select_choices', $field_choices, $field_id );
2092
+
2093
+ /* format setting inner wrapper */
2094
+ echo '<div class="format-setting-inner">';
2095
+
2096
+ /* build select */
2097
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
2098
+ foreach ( (array) $field_choices as $choice ) {
2099
+ if ( isset( $choice['value'] ) && isset( $choice['label'] ) ) {
2100
+ echo '<option value="' . esc_attr( $choice['value'] ) . '"' . selected( $field_value, $choice['value'], false ) . '>' . esc_attr( $choice['label'] ) . '</option>';
2101
+ }
2102
+ }
2103
+
2104
+ echo '</select>';
2105
+
2106
+ echo '</div>';
2107
+
2108
+ echo '</div>';
2109
+
2110
+ }
2111
+
2112
+ }
2113
+
2114
+ /**
2115
+ * Sidebar Select option type.
2116
+ *
2117
+ * This option type makes it possible for users to select a WordPress registered sidebar
2118
+ * to use on a specific area. By using the two provided filters, 'ot_recognized_sidebars',
2119
+ * and 'ot_recognized_sidebars_{$field_id}' we can be selective about which sidebars are
2120
+ * available on a specific content area.
2121
+ *
2122
+ * For example, if we create a WordPress theme that provides the ability to change the
2123
+ * Blog Sidebar and we don't want to have the footer sidebars available on this area,
2124
+ * we can unset those sidebars either manually or by using a regular expression if we
2125
+ * have a common name like footer-sidebar-$i.
2126
+ *
2127
+ * @param array An array of arguments.
2128
+ * @return string
2129
+ *
2130
+ * @access public
2131
+ * @since 2.1
2132
+ */
2133
+ if ( ! function_exists( 'ot_type_sidebar_select' ) ) {
2134
+
2135
+ function ot_type_sidebar_select( $args = array() ) {
2136
+
2137
+ /* turns arguments array into variables */
2138
+ extract( $args );
2139
+
2140
+ /* verify a description */
2141
+ $has_desc = $field_desc ? true : false;
2142
+
2143
+ /* format setting outer wrapper */
2144
+ echo '<div class="format-setting type-sidebar-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2145
+
2146
+ /* description */
2147
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2148
+
2149
+ /* format setting inner wrapper */
2150
+ echo '<div class="format-setting-inner">';
2151
+
2152
+ /* build page select */
2153
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
2154
+
2155
+ /* get the registered sidebars */
2156
+ global $wp_registered_sidebars;
2157
+
2158
+ $sidebars = array();
2159
+ foreach( $wp_registered_sidebars as $id=>$sidebar ) {
2160
+ $sidebars[ $id ] = $sidebar[ 'name' ];
2161
+ }
2162
+
2163
+ /* filters to restrict which sidebars are allowed to be selected, for example we can restrict footer sidebars to be selectable on a blog page */
2164
+ $sidebars = apply_filters( 'ot_recognized_sidebars', $sidebars );
2165
+ $sidebars = apply_filters( 'ot_recognized_sidebars_' . $field_id, $sidebars );
2166
+
2167
+ /* has sidebars */
2168
+ if ( count( $sidebars ) ) {
2169
+ echo '<option value="">-- ' . __( 'Choose Sidebar', 'option-tree' ) . ' --</option>';
2170
+ foreach ( $sidebars as $id => $sidebar ) {
2171
+ echo '<option value="' . esc_attr( $id ) . '"' . selected( $field_value, $id, false ) . '>' . esc_attr( $sidebar ) . '</option>';
2172
+ }
2173
+ } else {
2174
+ echo '<option value="">' . __( 'No Sidebars', 'option-tree' ) . '</option>';
2175
+ }
2176
+
2177
+ echo '</select>';
2178
+
2179
+ echo '</div>';
2180
+
2181
+ echo '</div>';
2182
+
2183
+ }
2184
+
2185
+ }
2186
+
2187
+ /**
2188
+ * List Item option type.
2189
+ *
2190
+ * See @ot_display_by_type to see the full list of available arguments.
2191
+ *
2192
+ * @param array An array of arguments.
2193
+ * @return string
2194
+ *
2195
+ * @access public
2196
+ * @since 2.0
2197
+ */
2198
+ if ( ! function_exists( 'ot_type_slider' ) ) {
2199
+
2200
+ function ot_type_slider( $args = array() ) {
2201
+
2202
+ /* turns arguments array into variables */
2203
+ extract( $args );
2204
+
2205
+ /* verify a description */
2206
+ $has_desc = $field_desc ? true : false;
2207
+
2208
+ /* format setting outer wrapper */
2209
+ echo '<div class="format-setting type-slider ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2210
+
2211
+ /* description */
2212
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2213
+
2214
+ /* format setting inner wrapper */
2215
+ echo '<div class="format-setting-inner">';
2216
+
2217
+ /* pass the settings array arround */
2218
+ echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
2219
+
2220
+ /**
2221
+ * settings pages have array wrappers like 'option_tree'.
2222
+ * So we need that value to create a proper array to save to.
2223
+ * This is only for NON metabox settings.
2224
+ */
2225
+ if ( ! isset( $get_option ) )
2226
+ $get_option = '';
2227
+
2228
+ /* build list items */
2229
+ echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
2230
+
2231
+ if ( is_array( $field_value ) && ! empty( $field_value ) ) {
2232
+
2233
+ foreach( $field_value as $key => $list_item ) {
2234
+
2235
+ echo '<li class="ui-state-default list-list-item">';
2236
+ ot_list_item_view( $field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type );
2237
+ echo '</li>';
2238
+
2239
+ }
2240
+
2241
+ }
2242
+
2243
+ echo '</ul>';
2244
+
2245
+ /* button */
2246
+ echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
2247
+
2248
+ /* description */
2249
+ echo '<div class="list-item-description">' . __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ) . '</div>';
2250
+
2251
+ echo '</div>';
2252
+
2253
+ echo '</div>';
2254
+
2255
+ }
2256
+
2257
+ }
2258
+
2259
+ /**
2260
+ * Social Links option type.
2261
+ *
2262
+ * See @ot_display_by_type to see the full list of available arguments.
2263
+ *
2264
+ * @param array An array of arguments.
2265
+ * @return string
2266
+ *
2267
+ * @access public
2268
+ * @since 2.4.0
2269
+ */
2270
+ if ( ! function_exists( 'ot_type_social_links' ) ) {
2271
+
2272
+ function ot_type_social_links( $args = array() ) {
2273
+
2274
+ /* turns arguments array into variables */
2275
+ extract( $args );
2276
+
2277
+ /* Load the default social links */
2278
+ if ( empty( $field_value ) && apply_filters( 'ot_type_social_links_load_defaults', true, $field_id ) ) {
2279
+
2280
+ $field_value = apply_filters( 'ot_type_social_links_defaults', array(
2281
+ array(
2282
+ 'name' => __( 'Facebook', 'option-tree' ),
2283
+ 'title' => '',
2284
+ 'href' => ''
2285
+ ),
2286
+ array(
2287
+ 'name' => __( 'Twitter', 'option-tree' ),
2288
+ 'title' => '',
2289
+ 'href' => ''
2290
+ ),
2291
+ array(
2292
+ 'name' => __( 'Google+', 'option-tree' ),
2293
+ 'title' => '',
2294
+ 'href' => ''
2295
+ ),
2296
+ array(
2297
+ 'name' => __( 'LinkedIn', 'option-tree' ),
2298
+ 'title' => '',
2299
+ 'href' => ''
2300
+ ),
2301
+ array(
2302
+ 'name' => __( 'Pinterest', 'option-tree' ),
2303
+ 'title' => '',
2304
+ 'href' => ''
2305
+ ),
2306
+ array(
2307
+ 'name' => __( 'Youtube', 'option-tree' ),
2308
+ 'title' => '',
2309
+ 'href' => ''
2310
+ ),
2311
+ array(
2312
+ 'name' => __( 'Dribbble', 'option-tree' ),
2313
+ 'title' => '',
2314
+ 'href' => ''
2315
+ ),
2316
+ array(
2317
+ 'name' => __( 'Github', 'option-tree' ),
2318
+ 'title' => '',
2319
+ 'href' => ''
2320
+ ),
2321
+ array(
2322
+ 'name' => __( 'Forrst', 'option-tree' ),
2323
+ 'title' => '',
2324
+ 'href' => ''
2325
+ ),
2326
+ array(
2327
+ 'name' => __( 'Digg', 'option-tree' ),
2328
+ 'title' => '',
2329
+ 'href' => ''
2330
+ ),
2331
+ array(
2332
+ 'name' => __( 'Delicious', 'option-tree' ),
2333
+ 'title' => '',
2334
+ 'href' => ''
2335
+ ),
2336
+ array(
2337
+ 'name' => __( 'Tumblr', 'option-tree' ),
2338
+ 'title' => '',
2339
+ 'href' => ''
2340
+ ),
2341
+ array(
2342
+ 'name' => __( 'Skype', 'option-tree' ),
2343
+ 'title' => '',
2344
+ 'href' => ''
2345
+ ),
2346
+ array(
2347
+ 'name' => __( 'SoundCloud', 'option-tree' ),
2348
+ 'title' => '',
2349
+ 'href' => ''
2350
+ ),
2351
+ array(
2352
+ 'name' => __( 'Vimeo', 'option-tree' ),
2353
+ 'title' => '',
2354
+ 'href' => ''
2355
+ ),
2356
+ array(
2357
+ 'name' => __( 'Flickr', 'option-tree' ),
2358
+ 'title' => '',
2359
+ 'href' => ''
2360
+ ),
2361
+ array(
2362
+ 'name' => __( 'VK.com', 'option-tree' ),
2363
+ 'title' => '',
2364
+ 'href' => ''
2365
+ )
2366
+ ), $field_id );
2367
+
2368
+ }
2369
+
2370
+ /* verify a description */
2371
+ $has_desc = $field_desc ? true : false;
2372
+
2373
+ /* format setting outer wrapper */
2374
+ echo '<div class="format-setting type-social-list-item ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2375
+
2376
+ /* description */
2377
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2378
+
2379
+ /* format setting inner wrapper */
2380
+ echo '<div class="format-setting-inner">';
2381
+
2382
+ /* pass the settings array arround */
2383
+ echo '<input type="hidden" name="' . esc_attr( $field_id ) . '_settings_array" id="' . esc_attr( $field_id ) . '_settings_array" value="' . ot_encode( serialize( $field_settings ) ) . '" />';
2384
+
2385
+ /**
2386
+ * settings pages have array wrappers like 'option_tree'.
2387
+ * So we need that value to create a proper array to save to.
2388
+ * This is only for NON metabox settings.
2389
+ */
2390
+ if ( ! isset( $get_option ) )
2391
+ $get_option = '';
2392
+
2393
+ /* build list items */
2394
+ echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr( $field_id ) . '" data-id="' . esc_attr( $post_id ) . '" data-get-option="' . esc_attr( $get_option ) . '" data-type="' . esc_attr( $type ) . '">';
2395
+
2396
+ if ( is_array( $field_value ) && ! empty( $field_value ) ) {
2397
+
2398
+ foreach( $field_value as $key => $link ) {
2399
+
2400
+ echo '<li class="ui-state-default list-list-item">';
2401
+ ot_social_links_view( $field_id, $key, $link, $post_id, $get_option, $field_settings, $type );
2402
+ echo '</li>';
2403
+
2404
+ }
2405
+
2406
+ }
2407
+
2408
+ echo '</ul>';
2409
+
2410
+ /* button */
2411
+ echo '<a href="javascript:void(0);" class="option-tree-social-links-add option-tree-ui-button button button-primary right hug-right" title="' . __( 'Add New', 'option-tree' ) . '">' . __( 'Add New', 'option-tree' ) . '</a>';
2412
+
2413
+ /* description */
2414
+ echo '<div class="list-item-description">' . apply_filters( 'ot_social_links_description', __( 'You can re-order with drag & drop, the order will update after saving.', 'option-tree' ), $field_id ) . '</div>';
2415
+
2416
+ echo '</div>';
2417
+
2418
+ echo '</div>';
2419
+
2420
+ }
2421
+
2422
+ }
2423
+
2424
+ /**
2425
+ * Spacing Option Type.
2426
+ *
2427
+ * See @ot_display_by_type to see the full list of available arguments.
2428
+ *
2429
+ * @param array An array of arguments.
2430
+ * @return string
2431
+ *
2432
+ * @access public
2433
+ * @since 2.5.0
2434
+ */
2435
+ if ( ! function_exists( 'ot_type_spacing' ) ) {
2436
+
2437
+ function ot_type_spacing( $args = array() ) {
2438
+
2439
+ /* turns arguments array into variables */
2440
+ extract( $args );
2441
+
2442
+ /* verify a description */
2443
+ $has_desc = $field_desc ? true : false;
2444
+
2445
+ /* format setting outer wrapper */
2446
+ echo '<div class="format-setting type-spacing ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2447
+
2448
+ /* description */
2449
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2450
+
2451
+ /* format setting inner wrapper */
2452
+ echo '<div class="format-setting-inner">';
2453
+
2454
+ /* allow fields to be filtered */
2455
+ $ot_recognized_spacing_fields = apply_filters( 'ot_recognized_spacing_fields', array(
2456
+ 'top',
2457
+ 'right',
2458
+ 'bottom',
2459
+ 'left',
2460
+ 'unit'
2461
+ ), $field_id );
2462
+
2463
+ /* build top spacing */
2464
+ if ( in_array( 'top', $ot_recognized_spacing_fields ) ) {
2465
+
2466
+ $top = isset( $field_value['top'] ) ? esc_attr( $field_value['top'] ) : '';
2467
+
2468
+ echo '<div class="ot-option-group"><span class="ot-icon-arrow-up ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[top]" id="' . esc_attr( $field_id ) . '-top" value="' . $top . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'top', 'option-tree' ) . '" /></div>';
2469
+
2470
+ }
2471
+
2472
+ /* build right spacing */
2473
+ if ( in_array( 'right', $ot_recognized_spacing_fields ) ) {
2474
+
2475
+ $right = isset( $field_value['right'] ) ? esc_attr( $field_value['right'] ) : '';
2476
+
2477
+ echo '<div class="ot-option-group"><span class="ot-icon-arrow-right ot-option-group--icon"></span></span><input type="text" name="' . esc_attr( $field_name ) . '[right]" id="' . esc_attr( $field_id ) . '-right" value="' . $right . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'right', 'option-tree' ) . '" /></div>';
2478
+
2479
+ }
2480
+
2481
+ /* build bottom spacing */
2482
+ if ( in_array( 'bottom', $ot_recognized_spacing_fields ) ) {
2483
+
2484
+ $bottom = isset( $field_value['bottom'] ) ? esc_attr( $field_value['bottom'] ) : '';
2485
+
2486
+ echo '<div class="ot-option-group"><span class="ot-icon-arrow-down ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[bottom]" id="' . esc_attr( $field_id ) . '-bottom" value="' . $bottom . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'bottom', 'option-tree' ) . '" /></div>';
2487
+
2488
+ }
2489
+
2490
+ /* build left spacing */
2491
+ if ( in_array( 'left', $ot_recognized_spacing_fields ) ) {
2492
+
2493
+ $left = isset( $field_value['left'] ) ? esc_attr( $field_value['left'] ) : '';
2494
+
2495
+ echo '<div class="ot-option-group"><span class="ot-icon-arrow-left ot-option-group--icon"></span><input type="text" name="' . esc_attr( $field_name ) . '[left]" id="' . esc_attr( $field_id ) . '-left" value="' . $left . '" class="widefat option-tree-ui-input ' . esc_attr( $field_class ) . '" placeholder="' . __( 'left', 'option-tree' ) . '" /></div>';
2496
+
2497
+ }
2498
+
2499
+ /* build unit dropdown */
2500
+ if ( in_array( 'unit', $ot_recognized_spacing_fields ) ) {
2501
+
2502
+ echo '<div class="ot-option-group ot-option-group--is-last">';
2503
+
2504
+ echo '<select name="' . esc_attr( $field_name ) . '[unit]" id="' . esc_attr( $field_id ) . '-unit" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
2505
+
2506
+ echo '<option value="">' . __( 'unit', 'option-tree' ) . '</option>';
2507
+
2508
+ foreach ( ot_recognized_spacing_unit_types( $field_id ) as $unit ) {
2509
+ echo '<option value="' . esc_attr( $unit ) . '"' . ( isset( $field_value['unit'] ) ? selected( $field_value['unit'], $unit, false ) : '' ) . '>' . esc_attr( $unit ) . '</option>';
2510
+ }
2511
+
2512
+ echo '</select>';
2513
+
2514
+ echo '</div>';
2515
+
2516
+ }
2517
+
2518
+ echo '</div>';
2519
+
2520
+ echo '</div>';
2521
+
2522
+ }
2523
+
2524
+ }
2525
+
2526
+ /**
2527
+ * Tab option type.
2528
+ *
2529
+ * See @ot_display_by_type to see the full list of available arguments.
2530
+ *
2531
+ * @param array An array of arguments.
2532
+ * @return string
2533
+ *
2534
+ * @access public
2535
+ * @since 2.3.0
2536
+ */
2537
+ if ( ! function_exists( 'ot_type_tab' ) ) {
2538
+
2539
+ function ot_type_tab( $args = array() ) {
2540
+
2541
+ /* turns arguments array into variables */
2542
+ extract( $args );
2543
+
2544
+ /* format setting outer wrapper */
2545
+ echo '<div class="format-setting type-tab">';
2546
+
2547
+ echo '<br />';
2548
+
2549
+ echo '</div>';
2550
+
2551
+ }
2552
+
2553
+ }
2554
+
2555
+ /**
2556
+ * Tag Checkbox option type.
2557
+ *
2558
+ * See @ot_display_by_type to see the full list of available arguments.
2559
+ *
2560
+ * @param array An array of arguments.
2561
+ * @return string
2562
+ *
2563
+ * @access public
2564
+ * @since 2.0
2565
+ */
2566
+ if ( ! function_exists( 'ot_type_tag_checkbox' ) ) {
2567
+
2568
+ function ot_type_tag_checkbox( $args = array() ) {
2569
+
2570
+ /* turns arguments array into variables */
2571
+ extract( $args );
2572
+
2573
+ /* verify a description */
2574
+ $has_desc = $field_desc ? true : false;
2575
+
2576
+ /* format setting outer wrapper */
2577
+ echo '<div class="format-setting type-tag-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2578
+
2579
+ /* description */
2580
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2581
+
2582
+ /* format setting inner wrapper */
2583
+ echo '<div class="format-setting-inner">';
2584
+
2585
+ /* get tags */
2586
+ $tags = get_tags( array( 'hide_empty' => false ) );
2587
+
2588
+ /* has tags */
2589
+ if ( $tags ) {
2590
+ foreach( $tags as $tag ) {
2591
+ echo '<p>';
2592
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $tag->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $tag->term_id ) . '" value="' . esc_attr( $tag->term_id ) . '" ' . ( isset( $field_value[$tag->term_id] ) ? checked( $field_value[$tag->term_id], $tag->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
2593
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $tag->term_id ) . '">' . esc_attr( $tag->name ) . '</label>';
2594
+ echo '</p>';
2595
+ }
2596
+ } else {
2597
+ echo '<p>' . __( 'No Tags Found', 'option-tree' ) . '</p>';
2598
+ }
2599
+
2600
+ echo '</div>';
2601
+
2602
+ echo '</div>';
2603
+
2604
+ }
2605
+
2606
+ }
2607
+
2608
+ /**
2609
+ * Tag Select option type.
2610
+ *
2611
+ * See @ot_display_by_type to see the full list of available arguments.
2612
+ *
2613
+ * @param array An array of arguments.
2614
+ * @return string
2615
+ *
2616
+ * @access public
2617
+ * @since 2.0
2618
+ */
2619
+ if ( ! function_exists( 'ot_type_tag_select' ) ) {
2620
+
2621
+ function ot_type_tag_select( $args = array() ) {
2622
+
2623
+ /* turns arguments array into variables */
2624
+ extract( $args );
2625
+
2626
+ /* verify a description */
2627
+ $has_desc = $field_desc ? true : false;
2628
+
2629
+ /* format setting outer wrapper */
2630
+ echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2631
+
2632
+ /* description */
2633
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2634
+
2635
+ /* format setting inner wrapper */
2636
+ echo '<div class="format-setting-inner">';
2637
+
2638
+ /* build tag select */
2639
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
2640
+
2641
+ /* get tags */
2642
+ $tags = get_tags( array( 'hide_empty' => false ) );
2643
+
2644
+ /* has tags */
2645
+ if ( $tags ) {
2646
+ echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
2647
+ foreach( $tags as $tag ) {
2648
+ echo '<option value="' . esc_attr( $tag->term_id ) . '"' . selected( $field_value, $tag->term_id, false ) . '>' . esc_attr( $tag->name ) . '</option>';
2649
+ }
2650
+ } else {
2651
+ echo '<option value="">' . __( 'No Tags Found', 'option-tree' ) . '</option>';
2652
+ }
2653
+
2654
+ echo '</select>';
2655
+
2656
+ echo '</div>';
2657
+
2658
+ echo '</div>';
2659
+
2660
+ }
2661
+
2662
+ }
2663
+
2664
+ /**
2665
+ * Taxonomy Checkbox option type.
2666
+ *
2667
+ * See @ot_display_by_type to see the full list of available arguments.
2668
+ *
2669
+ * @param array An array of arguments.
2670
+ * @return string
2671
+ *
2672
+ * @access public
2673
+ * @since 2.0
2674
+ */
2675
+ if ( ! function_exists( 'ot_type_taxonomy_checkbox' ) ) {
2676
+
2677
+ function ot_type_taxonomy_checkbox( $args = array() ) {
2678
+
2679
+ /* turns arguments array into variables */
2680
+ extract( $args );
2681
+
2682
+ /* verify a description */
2683
+ $has_desc = $field_desc ? true : false;
2684
+
2685
+ /* format setting outer wrapper */
2686
+ echo '<div class="format-setting type-taxonomy-checkbox type-checkbox ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2687
+
2688
+ /* description */
2689
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2690
+
2691
+ /* format setting inner wrapper */
2692
+ echo '<div class="format-setting-inner">';
2693
+
2694
+ /* setup the taxonomy */
2695
+ $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
2696
+
2697
+ /* get taxonomies */
2698
+ $taxonomies = get_categories( apply_filters( 'ot_type_taxonomy_checkbox_query', array( 'hide_empty' => false, 'taxonomy' => $taxonomy ), $field_id ) );
2699
+
2700
+ /* has tags */
2701
+ if ( $taxonomies ) {
2702
+ foreach( $taxonomies as $taxonomy ) {
2703
+ echo '<p>';
2704
+ echo '<input type="checkbox" name="' . esc_attr( $field_name ) . '[' . esc_attr( $taxonomy->term_id ) . ']" id="' . esc_attr( $field_id ) . '-' . esc_attr( $taxonomy->term_id ) . '" value="' . esc_attr( $taxonomy->term_id ) . '" ' . ( isset( $field_value[$taxonomy->term_id] ) ? checked( $field_value[$taxonomy->term_id], $taxonomy->term_id, false ) : '' ) . ' class="option-tree-ui-checkbox ' . esc_attr( $field_class ) . '" />';
2705
+ echo '<label for="' . esc_attr( $field_id ) . '-' . esc_attr( $taxonomy->term_id ) . '">' . esc_attr( $taxonomy->name ) . '</label>';
2706
+ echo '</p>';
2707
+ }
2708
+ } else {
2709
+ echo '<p>' . __( 'No Taxonomies Found', 'option-tree' ) . '</p>';
2710
+ }
2711
+
2712
+ echo '</div>';
2713
+
2714
+ echo '</div>';
2715
+
2716
+ }
2717
+
2718
+ }
2719
+
2720
+ /**
2721
+ * Taxonomy Select option type.
2722
+ *
2723
+ * See @ot_display_by_type to see the full list of available arguments.
2724
+ *
2725
+ * @param array An array of arguments.
2726
+ * @return string
2727
+ *
2728
+ * @access public
2729
+ * @since 2.0
2730
+ */
2731
+ if ( ! function_exists( 'ot_type_taxonomy_select' ) ) {
2732
+
2733
+ function ot_type_taxonomy_select( $args = array() ) {
2734
+
2735
+ /* turns arguments array into variables */
2736
+ extract( $args );
2737
+
2738
+ /* verify a description */
2739
+ $has_desc = $field_desc ? true : false;
2740
+
2741
+ /* format setting outer wrapper */
2742
+ echo '<div class="format-setting type-tag-select ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2743
+
2744
+ /* description */
2745
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2746
+
2747
+ /* format setting inner wrapper */
2748
+ echo '<div class="format-setting-inner">';
2749
+
2750
+ /* build tag select */
2751
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" class="option-tree-ui-select ' . $field_class . '">';
2752
+
2753
+ /* setup the taxonomy */
2754
+ $taxonomy = isset( $field_taxonomy ) ? explode( ',', $field_taxonomy ) : array( 'category' );
2755
+
2756
+ /* get taxonomies */
2757
+ $taxonomies = get_categories( apply_filters( 'ot_type_taxonomy_select_query', array( 'hide_empty' => false, 'taxonomy' => $taxonomy ), $field_id ) );
2758
+
2759
+ /* has tags */
2760
+ if ( $taxonomies ) {
2761
+ echo '<option value="">-- ' . __( 'Choose One', 'option-tree' ) . ' --</option>';
2762
+ foreach( $taxonomies as $taxonomy ) {
2763
+ echo '<option value="' . esc_attr( $taxonomy->term_id ) . '"' . selected( $field_value, $taxonomy->term_id, false ) . '>' . esc_attr( $taxonomy->name ) . '</option>';
2764
+ }
2765
+ } else {
2766
+ echo '<option value="">' . __( 'No Taxonomies Found', 'option-tree' ) . '</option>';
2767
+ }
2768
+
2769
+ echo '</select>';
2770
+
2771
+ echo '</div>';
2772
+
2773
+ echo '</div>';
2774
+
2775
+ }
2776
+
2777
+ }
2778
+
2779
+ /**
2780
+ * Text option type.
2781
+ *
2782
+ * See @ot_display_by_type to see the full list of available arguments.
2783
+ *
2784
+ * @param array An array of arguments.
2785
+ * @return string
2786
+ *
2787
+ * @access public
2788
+ * @since 2.0
2789
+ */
2790
+ if ( ! function_exists( 'ot_type_text' ) ) {
2791
+
2792
+ function ot_type_text( $args = array() ) {
2793
+
2794
+ /* turns arguments array into variables */
2795
+ extract( $args );
2796
+
2797
+ /* verify a description */
2798
+ $has_desc = $field_desc ? true : false;
2799
+
2800
+ /* format setting outer wrapper */
2801
+ echo '<div class="format-setting type-text ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2802
+
2803
+ /* description */
2804
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2805
+
2806
+ /* format setting inner wrapper */
2807
+ echo '<div class="format-setting-inner">';
2808
+
2809
+ /* build text input */
2810
+ 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 ' . esc_attr( $field_class ) . '" />';
2811
+
2812
+ echo '</div>';
2813
+
2814
+ echo '</div>';
2815
+
2816
+ }
2817
+
2818
+ }
2819
+
2820
+ /**
2821
+ * Textarea option type.
2822
+ *
2823
+ * See @ot_display_by_type to see the full list of available arguments.
2824
+ *
2825
+ * @param array An array of arguments.
2826
+ * @return string
2827
+ *
2828
+ * @access public
2829
+ * @since 2.0
2830
+ */
2831
+ if ( ! function_exists( 'ot_type_textarea' ) ) {
2832
+
2833
+ function ot_type_textarea( $args = array() ) {
2834
+
2835
+ /* turns arguments array into variables */
2836
+ extract( $args );
2837
+
2838
+ /* verify a description */
2839
+ $has_desc = $field_desc ? true : false;
2840
+
2841
+ /* format setting outer wrapper */
2842
+ echo '<div class="format-setting type-textarea ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . ' fill-area">';
2843
+
2844
+ /* description */
2845
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2846
+
2847
+ /* format setting inner wrapper */
2848
+ echo '<div class="format-setting-inner">';
2849
+
2850
+ /* build textarea */
2851
+ wp_editor(
2852
+ $field_value,
2853
+ esc_attr( $field_id ),
2854
+ array(
2855
+ 'editor_class' => esc_attr( $field_class ),
2856
+ 'wpautop' => apply_filters( 'ot_wpautop', false, $field_id ),
2857
+ 'media_buttons' => apply_filters( 'ot_media_buttons', true, $field_id ),
2858
+ 'textarea_name' => esc_attr( $field_name ),
2859
+ 'textarea_rows' => esc_attr( $field_rows ),
2860
+ 'tinymce' => apply_filters( 'ot_tinymce', true, $field_id ),
2861
+ 'quicktags' => apply_filters( 'ot_quicktags', array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ), $field_id )
2862
+ )
2863
+ );
2864
+
2865
+ echo '</div>';
2866
+
2867
+ echo '</div>';
2868
+
2869
+ }
2870
+
2871
+ }
2872
+
2873
+ /**
2874
+ * Textarea Simple option type.
2875
+ *
2876
+ * See @ot_display_by_type to see the full list of available arguments.
2877
+ *
2878
+ * @param array An array of arguments.
2879
+ * @return string
2880
+ *
2881
+ * @access public
2882
+ * @since 2.0
2883
+ */
2884
+ if ( ! function_exists( 'ot_type_textarea_simple' ) ) {
2885
+
2886
+ function ot_type_textarea_simple( $args = array() ) {
2887
+
2888
+ /* turns arguments array into variables */
2889
+ extract( $args );
2890
+
2891
+ /* verify a description */
2892
+ $has_desc = $field_desc ? true : false;
2893
+
2894
+ /* format setting outer wrapper */
2895
+ echo '<div class="format-setting type-textarea simple ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
2896
+
2897
+ /* description */
2898
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
2899
+
2900
+ /* format setting inner wrapper */
2901
+ echo '<div class="format-setting-inner">';
2902
+
2903
+ /* filter to allow wpautop */
2904
+ $wpautop = apply_filters( 'ot_wpautop', false, $field_id );
2905
+
2906
+ /* wpautop $field_value */
2907
+ if ( $wpautop == true )
2908
+ $field_value = wpautop( $field_value );
2909
+
2910
+ /* build textarea simple */
2911
+ echo '<textarea class="textarea ' . esc_attr( $field_class ) . '" rows="' . esc_attr( $field_rows ) . '" cols="40" name="' . esc_attr( $field_name ) .'" id="' . esc_attr( $field_id ) . '">' . esc_textarea( $field_value ) . '</textarea>';
2912
+
2913
+ echo '</div>';
2914
+
2915
+ echo '</div>';
2916
+
2917
+ }
2918
+
2919
+ }
2920
+
2921
+ /**
2922
+ * Textblock option type.
2923
+ *
2924
+ * See @ot_display_by_type to see the full list of available arguments.
2925
+ *
2926
+ * @param array An array of arguments.
2927
+ * @return string
2928
+ *
2929
+ * @access public
2930
+ * @since 2.0
2931
+ */
2932
+ if ( ! function_exists( 'ot_type_textblock' ) ) {
2933
+
2934
+ function ot_type_textblock( $args = array() ) {
2935
+
2936
+ /* turns arguments array into variables */
2937
+ extract( $args );
2938
+
2939
+ /* format setting outer wrapper */
2940
+ echo '<div class="format-setting type-textblock wide-desc">';
2941
+
2942
+ /* description */
2943
+ echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
2944
+
2945
+ echo '</div>';
2946
+
2947
+ }
2948
+
2949
+ }
2950
+
2951
+ /**
2952
+ * Textblock Titled option type.
2953
+ *
2954
+ * See @ot_display_by_type to see the full list of available arguments.
2955
+ *
2956
+ * @param array An array of arguments.
2957
+ * @return string
2958
+ *
2959
+ * @access public
2960
+ * @since 2.0
2961
+ */
2962
+ if ( ! function_exists( 'ot_type_textblock_titled' ) ) {
2963
+
2964
+ function ot_type_textblock_titled( $args = array() ) {
2965
+
2966
+ /* turns arguments array into variables */
2967
+ extract( $args );
2968
+
2969
+ /* format setting outer wrapper */
2970
+ echo '<div class="format-setting type-textblock titled wide-desc">';
2971
+
2972
+ /* description */
2973
+ echo '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>';
2974
+
2975
+ echo '</div>';
2976
+
2977
+ }
2978
+
2979
+ }
2980
+
2981
+ /**
2982
+ * Typography option type.
2983
+ *
2984
+ * See @ot_display_by_type to see the full list of available arguments.
2985
+ *
2986
+ * @param array An array of arguments.
2987
+ * @return string
2988
+ *
2989
+ * @access public
2990
+ * @since 2.0
2991
+ */
2992
+ if ( ! function_exists( 'ot_type_typography' ) ) {
2993
+
2994
+ function ot_type_typography( $args = array() ) {
2995
+
2996
+ /* turns arguments array into variables */
2997
+ extract( $args );
2998
+
2999
+ /* verify a description */
3000
+ $has_desc = $field_desc ? true : false;
3001
+
3002
+ /* format setting outer wrapper */
3003
+ echo '<div class="format-setting type-typography ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
3004
+
3005
+ /* description */
3006
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
3007
+
3008
+ /* format setting inner wrapper */
3009
+ echo '<div class="format-setting-inner">';
3010
+
3011
+ /* allow fields to be filtered */
3012
+ $ot_recognized_typography_fields = apply_filters( 'ot_recognized_typography_fields', array(
3013
+ 'font-color',
3014
+ 'font-family',
3015
+ 'font-size',
3016
+ 'font-style',
3017
+ 'font-variant',
3018
+ 'font-weight',
3019
+ 'letter-spacing',
3020
+ 'line-height',
3021
+ 'text-decoration',
3022
+ 'text-transform'
3023
+ ), $field_id );
3024
+
3025
+ /* build font color */
3026
+ if ( in_array( 'font-color', $ot_recognized_typography_fields ) ) {
3027
+
3028
+ /* build colorpicker */
3029
+ echo '<div class="option-tree-ui-colorpicker-input-wrap">';
3030
+
3031
+ /* colorpicker JS */
3032
+ echo '<script>jQuery(document).ready(function($) { OT_UI.bind_colorpicker("' . esc_attr( $field_id ) . '-picker"); });</script>';
3033
+
3034
+ /* set background color */
3035
+ $background_color = isset( $field_value['font-color'] ) ? esc_attr( $field_value['font-color'] ) : '';
3036
+
3037
+ /* input */
3038
+ 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 ) . '" />';
3039
+
3040
+ echo '</div>';
3041
+
3042
+ }
3043
+
3044
+ /* build font family */
3045
+ if ( in_array( 'font-family', $ot_recognized_typography_fields ) ) {
3046
+ $font_family = isset( $field_value['font-family'] ) ? $field_value['font-family'] : '';
3047
+ echo '<select name="' . esc_attr( $field_name ) . '[font-family]" id="' . esc_attr( $field_id ) . '-font-family" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3048
+ echo '<option value="">font-family</option>';
3049
+ foreach ( ot_recognized_font_families( $field_id ) as $key => $value ) {
3050
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_family, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3051
+ }
3052
+ echo '</select>';
3053
+ }
3054
+
3055
+ /* build font size */
3056
+ if ( in_array( 'font-size', $ot_recognized_typography_fields ) ) {
3057
+ $font_size = isset( $field_value['font-size'] ) ? esc_attr( $field_value['font-size'] ) : '';
3058
+ echo '<select name="' . esc_attr( $field_name ) . '[font-size]" id="' . esc_attr( $field_id ) . '-font-size" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3059
+ echo '<option value="">font-size</option>';
3060
+ foreach( ot_recognized_font_sizes( $field_id ) as $option ) {
3061
+ echo '<option value="' . esc_attr( $option ) . '" ' . selected( $font_size, $option, false ) . '>' . esc_attr( $option ) . '</option>';
3062
+ }
3063
+ echo '</select>';
3064
+ }
3065
+
3066
+ /* build font style */
3067
+ if ( in_array( 'font-style', $ot_recognized_typography_fields ) ) {
3068
+ $font_style = isset( $field_value['font-style'] ) ? esc_attr( $field_value['font-style'] ) : '';
3069
+ echo '<select name="' . esc_attr( $field_name ) . '[font-style]" id="' . esc_attr( $field_id ) . '-font-style" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3070
+ echo '<option value="">font-style</option>';
3071
+ foreach ( ot_recognized_font_styles( $field_id ) as $key => $value ) {
3072
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_style, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3073
+ }
3074
+ echo '</select>';
3075
+ }
3076
+
3077
+ /* build font variant */
3078
+ if ( in_array( 'font-variant', $ot_recognized_typography_fields ) ) {
3079
+ $font_variant = isset( $field_value['font-variant'] ) ? esc_attr( $field_value['font-variant'] ) : '';
3080
+ echo '<select name="' . esc_attr( $field_name ) . '[font-variant]" id="' . esc_attr( $field_id ) . '-font-variant" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3081
+ echo '<option value="">font-variant</option>';
3082
+ foreach ( ot_recognized_font_variants( $field_id ) as $key => $value ) {
3083
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_variant, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3084
+ }
3085
+ echo '</select>';
3086
+ }
3087
+
3088
+ /* build font weight */
3089
+ if ( in_array( 'font-weight', $ot_recognized_typography_fields ) ) {
3090
+ $font_weight = isset( $field_value['font-weight'] ) ? esc_attr( $field_value['font-weight'] ) : '';
3091
+ echo '<select name="' . esc_attr( $field_name ) . '[font-weight]" id="' . esc_attr( $field_id ) . '-font-weight" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3092
+ echo '<option value="">font-weight</option>';
3093
+ foreach ( ot_recognized_font_weights( $field_id ) as $key => $value ) {
3094
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $font_weight, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3095
+ }
3096
+ echo '</select>';
3097
+ }
3098
+
3099
+ /* build letter spacing */
3100
+ if ( in_array( 'letter-spacing', $ot_recognized_typography_fields ) ) {
3101
+ $letter_spacing = isset( $field_value['letter-spacing'] ) ? esc_attr( $field_value['letter-spacing'] ) : '';
3102
+ echo '<select name="' . esc_attr( $field_name ) . '[letter-spacing]" id="' . esc_attr( $field_id ) . '-letter-spacing" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3103
+ echo '<option value="">letter-spacing</option>';
3104
+ foreach( ot_recognized_letter_spacing( $field_id ) as $option ) {
3105
+ echo '<option value="' . esc_attr( $option ) . '" ' . selected( $letter_spacing, $option, false ) . '>' . esc_attr( $option ) . '</option>';
3106
+ }
3107
+ echo '</select>';
3108
+ }
3109
+
3110
+ /* build line height */
3111
+ if ( in_array( 'line-height', $ot_recognized_typography_fields ) ) {
3112
+ $line_height = isset( $field_value['line-height'] ) ? esc_attr( $field_value['line-height'] ) : '';
3113
+ echo '<select name="' . esc_attr( $field_name ) . '[line-height]" id="' . esc_attr( $field_id ) . '-line-height" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3114
+ echo '<option value="">line-height</option>';
3115
+ foreach( ot_recognized_line_heights( $field_id ) as $option ) {
3116
+ echo '<option value="' . esc_attr( $option ) . '" ' . selected( $line_height, $option, false ) . '>' . esc_attr( $option ) . '</option>';
3117
+ }
3118
+ echo '</select>';
3119
+ }
3120
+
3121
+ /* build text decoration */
3122
+ if ( in_array( 'text-decoration', $ot_recognized_typography_fields ) ) {
3123
+ $text_decoration = isset( $field_value['text-decoration'] ) ? esc_attr( $field_value['text-decoration'] ) : '';
3124
+ echo '<select name="' . esc_attr( $field_name ) . '[text-decoration]" id="' . esc_attr( $field_id ) . '-text-decoration" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3125
+ echo '<option value="">text-decoration</option>';
3126
+ foreach ( ot_recognized_text_decorations( $field_id ) as $key => $value ) {
3127
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_decoration, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3128
+ }
3129
+ echo '</select>';
3130
+ }
3131
+
3132
+ /* build text transform */
3133
+ if ( in_array( 'text-transform', $ot_recognized_typography_fields ) ) {
3134
+ $text_transform = isset( $field_value['text-transform'] ) ? esc_attr( $field_value['text-transform'] ) : '';
3135
+ echo '<select name="' . esc_attr( $field_name ) . '[text-transform]" id="' . esc_attr( $field_id ) . '-text-transform" class="option-tree-ui-select ' . esc_attr( $field_class ) . '">';
3136
+ echo '<option value="">text-transform</option>';
3137
+ foreach ( ot_recognized_text_transformations( $field_id ) as $key => $value ) {
3138
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected( $text_transform, $key, false ) . '>' . esc_attr( $value ) . '</option>';
3139
+ }
3140
+ echo '</select>';
3141
+ }
3142
+
3143
+ echo '</div>';
3144
+
3145
+ echo '</div>';
3146
+
3147
+ }
3148
+
3149
+ }
3150
+
3151
+ /**
3152
+ * Upload option type.
3153
+ *
3154
+ * See @ot_display_by_type to see the full list of available arguments.
3155
+ *
3156
+ * @param array An array of arguments.
3157
+ * @return string
3158
+ *
3159
+ * @access public
3160
+ * @since 2.0
3161
+ */
3162
+ if ( ! function_exists( 'ot_type_upload' ) ) {
3163
+
3164
+ function ot_type_upload( $args = array() ) {
3165
+
3166
+ /* turns arguments array into variables */
3167
+ extract( $args );
3168
+
3169
+ /* verify a description */
3170
+ $has_desc = $field_desc ? true : false;
3171
+
3172
+ /* If an attachment ID is stored here fetch its URL and replace the value */
3173
+ if ( $field_value && wp_attachment_is_image( $field_value ) ) {
3174
+
3175
+ $attachment_data = wp_get_attachment_image_src( $field_value, 'original' );
3176
+
3177
+ /* check for attachment data */
3178
+ if ( $attachment_data ) {
3179
+
3180
+ $field_src = $attachment_data[0];
3181
+
3182
+ }
3183
+
3184
+ }
3185
+
3186
+ /* format setting outer wrapper */
3187
+ echo '<div class="format-setting type-upload ' . ( $has_desc ? 'has-desc' : 'no-desc' ) . '">';
3188
+
3189
+ /* description */
3190
+ echo $has_desc ? '<div class="description">' . htmlspecialchars_decode( $field_desc ) . '</div>' : '';
3191
+
3192
+ /* format setting inner wrapper */
3193
+ echo '<div class="format-setting-inner">';
3194
+
3195
+ /* build upload */
3196
+ echo '<div class="option-tree-ui-upload-parent">';
3197
+
3198
+ /* input */
3199
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $field_value ) . '" class="widefat option-tree-ui-upload-input ' . esc_attr( $field_class ) . '" />';
3200
+
3201
+ /* add media button */
3202
+ echo '<a href="javascript:void(0);" class="ot_upload_media option-tree-ui-button button button-primary light" rel="' . $post_id . '" title="' . __( 'Add Media', 'option-tree' ) . '"><span class="icon ot-icon-plus-circle"></span>' . __( 'Add Media', 'option-tree' ) . '</a>';
3203
+
3204
+ echo '</div>';
3205
+
3206
+ /* media */
3207
+ if ( $field_value ) {
3208
+
3209
+ echo '<div class="option-tree-ui-media-wrap" id="' . esc_attr( $field_id ) . '_media">';
3210
+
3211
+ /* replace image src */
3212
+ if ( isset( $field_src ) )
3213
+ $field_value = $field_src;
3214
+
3215
+ if ( preg_match( '/\.(?:jpe?g|png|gif|ico)$/i', $field_value ) )
3216
+ echo '<div class="option-tree-ui-image-wrap"><img src="' . esc_url( $field_value ) . '" alt="" /></div>';
3217
+
3218
+ echo '<a href="javascript:(void);" class="option-tree-ui-remove-media option-tree-ui-button button button-secondary light" title="' . __( 'Remove Media', 'option-tree' ) . '"><span class="icon ot-icon-minus-circle"></span>' . __( 'Remove Media', 'option-tree' ) . '</a>';
3219
+
3220
+ echo '</div>';
3221
+
3222
+ }
3223
+
3224
+ echo '</div>';
3225
+
3226
+ echo '</div>';
3227
+
3228
+ }
3229
+
3230
+ }
3231
+
3232
+ /* End of file ot-functions-option-types.php */
3233
+ /* Location: ./includes/ot-functions-option-types.php */
admin/includes/ot-settings-api.php CHANGED
@@ -11,13 +11,13 @@
11
  if ( ! class_exists( 'OT_Settings' ) ) {
12
 
13
  class OT_Settings {
14
-
15
  /* the options array */
16
  private $options;
17
-
18
  /* hooks for targeting admin pages */
19
  private $page_hook;
20
-
21
  /**
22
  * Constructor
23
  *
@@ -28,18 +28,18 @@ if ( ! class_exists( 'OT_Settings' ) ) {
28
  * @since 2.0
29
  */
30
  public function __construct( $args ) {
31
-
32
  $this->options = $args;
33
-
34
  /* return early if not viewing an admin page or no options */
35
  if ( ! is_admin() || ! is_array( $this->options ) )
36
  return false;
37
-
38
  /* load everything */
39
  $this->hooks();
40
-
41
  }
42
-
43
  /**
44
  * Execute the WordPress Hooks
45
  *
@@ -61,21 +61,21 @@ if ( ! class_exists( 'OT_Settings' ) ) {
61
 
62
  /* add pages & menu items */
63
  add_action( 'admin_menu', array( $this, 'add_page' ), $priority );
64
-
65
  /* register sections */
66
  add_action( 'admin_init', array( $this, 'add_sections' ) );
67
-
68
  /* register settings */
69
  add_action( 'admin_init', array( $this, 'add_settings' ) );
70
-
71
  /* reset options */
72
  add_action( 'admin_init', array( $this, 'reset_options' ), 10 );
73
-
74
  /* initialize settings */
75
  add_action( 'admin_init', array( $this, 'initialize_settings' ), 11 );
76
-
77
  }
78
-
79
  /**
80
  * Loads each admin page
81
  *
@@ -85,67 +85,67 @@ if ( ! class_exists( 'OT_Settings' ) ) {
85
  * @since 2.0
86
  */
87
  public function add_page() {
88
-
89
  /* loop through options */
90
  foreach( (array) $this->options as $option ) {
91
-
92
  /* loop through pages */
93
  foreach( (array) $this->get_pages( $option ) as $page ) {
94
-
95
  /**
96
  * Theme Check... stop nagging me about this kind of stuff.
97
  * The damn admin pages are required for OT to function, duh!
98
  */
99
  $theme_check_bs = 'add_menu_' . 'page';
100
  $theme_check_bs2 = 'add_submenu_' . 'page';
101
-
102
  /* load page in WP top level menu */
103
  if ( ! isset( $page['parent_slug'] ) || empty( $page['parent_slug'] ) ) {
104
- $page_hook = $theme_check_bs(
105
- $page['page_title'],
106
- $page['menu_title'],
107
- $page['capability'],
108
- $page['menu_slug'],
109
- array( $this, 'display_page' ),
110
  $page['icon_url'],
111
- $page['position']
112
  );
113
  /* load page in WP sub menu */
114
  } else {
115
- $page_hook = $theme_check_bs2(
116
- $page['parent_slug'],
117
- $page['page_title'],
118
- $page['menu_title'],
119
- $page['capability'],
120
- $page['menu_slug'],
121
- array( $this, 'display_page' )
122
  );
123
  }
124
-
125
  /* only load if not a hidden page */
126
  if ( ! isset( $page['hidden_page'] ) ) {
127
-
128
  /* associate $page_hook with page id */
129
  $this->page_hook[$page['id']] = $page_hook;
130
-
131
  /* add scripts */
132
  add_action( 'admin_print_scripts-' . $page_hook, array( $this, 'scripts' ) );
133
-
134
  /* add styles */
135
  add_action( 'admin_print_styles-' . $page_hook, array( $this, 'styles' ) );
136
-
137
  /* add contextual help */
138
  add_action( 'load-' . $page_hook, array( $this, 'help' ) );
139
-
140
  }
141
-
142
  }
143
-
144
  }
145
-
146
  return false;
147
  }
148
-
149
  /**
150
  * Loads the scripts
151
  *
@@ -157,7 +157,7 @@ if ( ! class_exists( 'OT_Settings' ) ) {
157
  public function scripts() {
158
  ot_admin_scripts();
159
  }
160
-
161
  /**
162
  * Loads the styles
163
  *
@@ -169,7 +169,7 @@ if ( ! class_exists( 'OT_Settings' ) ) {
169
  public function styles() {
170
  ot_admin_styles();
171
  }
172
-
173
  /**
174
  * Loads the contextual help for each page
175
  *
@@ -180,20 +180,20 @@ if ( ! class_exists( 'OT_Settings' ) ) {
180
  */
181
  public function help() {
182
  $screen = get_current_screen();
183
-
184
  /* loop through options */
185
  foreach( (array) $this->options as $option ) {
186
-
187
  /* loop through pages */
188
  foreach( (array) $this->get_pages( $option ) as $page ) {
189
-
190
  /* verify page */
191
  if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
192
-
193
  /* set up the help tabs */
194
  if ( ! empty( $page['contextual_help']['content'] ) ) {
195
  foreach( $page['contextual_help']['content'] as $contextual_help ) {
196
- $screen->add_help_tab(
197
  array(
198
  'id' => esc_attr( $contextual_help['id'] ),
199
  'title' => esc_attr( $contextual_help['title'] ),
@@ -202,21 +202,21 @@ if ( ! class_exists( 'OT_Settings' ) ) {
202
  );
203
  }
204
  }
205
-
206
  /* set up the help sidebar */
207
  if ( ! empty( $page['contextual_help']['sidebar'] ) ) {
208
  $screen->set_help_sidebar( htmlspecialchars_decode( $page['contextual_help']['sidebar'] ) );
209
  }
210
-
211
  }
212
-
213
  }
214
-
215
  }
216
-
217
  return false;
218
  }
219
-
220
  /**
221
  * Loads the content for each page
222
  *
@@ -227,162 +227,162 @@ if ( ! class_exists( 'OT_Settings' ) ) {
227
  */
228
  public function display_page() {
229
  $screen = get_current_screen();
230
-
231
  /* loop through settings */
232
  foreach( (array) $this->options as $option ) {
233
-
234
  /* loop through pages */
235
  foreach( (array) $this->get_pages( $option ) as $page ) {
236
-
237
  /* verify page */
238
  if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
239
-
240
  $show_buttons = isset( $page['show_buttons'] ) && $page['show_buttons'] == false ? false : true;
241
 
242
  /* update active layout content */
243
  if ( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) {
244
-
245
  $layouts = get_option( ot_layouts_id() );
246
-
247
  /* has active layout */
248
  if ( isset( $layouts['active_layout'] ) ) {
249
  $option_tree = get_option( $option['id'] );
250
  $layouts[$layouts['active_layout']] = ot_encode( serialize( $option_tree ) );
251
  update_option( ot_layouts_id(), $layouts );
252
  }
253
-
254
  }
255
-
256
  echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
257
-
258
  echo '<h2>' . $page['page_title'] . '</h2>';
259
-
260
  echo ot_alert_message( $page );
261
-
262
  settings_errors( 'option-tree' );
263
-
264
  /* Header */
265
  echo '<div id="option-tree-header-wrap">';
266
-
267
  echo '<ul id="option-tree-header">';
268
-
269
-
270
-
271
- echo '<li id="option-tree-version"><span>' . apply_filters( 'ot_header_version_text', 'Nifty options panel ' . OT_VERSION, $page['id'] ) . '</span></li>';
272
-
273
  // Add additional theme specific links here.
274
  do_action( 'ot_header_list', $page['id'] );
275
-
276
-
277
  echo '</ul>';
278
-
279
  /* layouts form */
280
  if ( $page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true )
281
  ot_theme_options_layouts_form();
282
-
283
  echo '</div>';
284
-
285
  /* remove forms on the custom settings pages */
286
  if ( $show_buttons ) {
287
-
288
  echo '<form action="options.php" method="post" id="option-tree-settings-api">';
289
-
290
  settings_fields( $option['id'] );
291
-
292
  } else {
293
-
294
  echo '<div id="option-tree-settings-api">';
295
-
296
  }
297
-
298
  /* Sub Header */
299
  echo '<div id="option-tree-sub-header">';
300
-
301
-
302
-
303
  if ( $show_buttons )
304
  echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
305
- echo '<a target="_blank" href="'. get_site_url().'/?get_preview=true"><div class="option-tree-ui-button button button-primary right">Live Preview</div></a>';
306
  echo '</div>';
307
-
308
-
309
-
310
  /* Navigation */
311
  echo '<div class="ui-tabs">';
312
-
313
  /* check for sections */
314
  if ( isset( $page['sections'] ) && count( $page['sections'] ) > 0 ) {
315
-
316
  echo '<ul class="ui-tabs-nav">';
317
-
318
  /* loop through page sections */
319
  foreach( (array) $page['sections'] as $section ) {
320
  echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
321
  }
322
-
323
  echo '</ul>';
324
-
325
  }
326
-
327
  /* sections */
328
  echo '<div id="poststuff" class="metabox-holder">';
329
-
330
  echo '<div id="post-body">';
331
-
332
  echo '<div id="post-body-content">';
333
-
334
  $this->do_settings_sections( $_GET['page'] );
335
-
336
  echo '</div>';
337
-
338
  echo '</div>';
339
-
340
  echo '</div>';
341
-
342
  echo '<div class="clear"></div>';
343
-
344
  echo '</div>';
345
-
346
  /* buttons */
347
  if ( $show_buttons ) {
348
-
349
  echo '<div class="option-tree-ui-buttons">';
350
-
351
  echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
352
-
353
  echo '</div>';
354
-
355
  }
356
-
357
  echo $show_buttons ? '</form>' : '</div>';
358
-
359
  /* reset button */
360
  if ( $show_buttons ) {
361
-
362
  echo '<form method="post" action="' . str_replace( '&settings-updated=true', '', $_SERVER["REQUEST_URI"] ) . '">';
363
-
364
  /* form nonce */
365
  wp_nonce_field( 'option_tree_reset_form', 'option_tree_reset_nonce' );
366
-
367
  echo '<input type="hidden" name="action" value="reset" />';
368
-
369
  echo '<button type="submit" class="option-tree-ui-button button button-secondary left reset-settings" title="' . __( 'Reset Options', 'option-tree' ) . '">' . __( 'Reset Options', 'option-tree' ) . '</button>';
370
-
371
  echo '</form>';
372
-
373
  }
374
-
375
  echo '</div>';
376
-
377
  }
378
-
379
  }
380
-
381
  }
382
-
383
  return false;
384
  }
385
-
386
  /**
387
  * Adds sections to the page
388
  *
@@ -392,33 +392,33 @@ if ( ! class_exists( 'OT_Settings' ) ) {
392
  * @since 2.0
393
  */
394
  public function add_sections() {
395
-
396
  /* loop through options */
397
  foreach( (array) $this->options as $option ) {
398
-
399
  /* loop through pages */
400
  foreach( (array) $this->get_pages( $option ) as $page ) {
401
-
402
  /* loop through page sections */
403
  foreach( (array) $this->get_sections( $page ) as $section ) {
404
-
405
  /* add each section */
406
- add_settings_section(
407
- $section['id'],
408
- $section['title'],
409
- array( $this, 'display_section' ),
410
- $page['menu_slug']
411
  );
412
-
413
  }
414
-
415
  }
416
-
417
  }
418
-
419
  return false;
420
  }
421
-
422
  /**
423
  * Callback for add_settings_section()
424
  *
@@ -430,7 +430,7 @@ if ( ! class_exists( 'OT_Settings' ) ) {
430
  public function display_section() {
431
  /* currently pointless */
432
  }
433
-
434
  /**
435
  * Add settings the the page
436
  *
@@ -440,44 +440,44 @@ if ( ! class_exists( 'OT_Settings' ) ) {
440
  * @since 2.0
441
  */
442
  public function add_settings() {
443
-
444
  /* loop through options */
445
  foreach( (array) $this->options as $option ) {
446
-
447
  register_setting( $option['id'], $option['id'], array ( $this, 'sanitize_callback' ) );
448
-
449
  /* loop through pages */
450
  foreach( (array) $this->get_pages( $option ) as $page ) {
451
-
452
  /* loop through page settings */
453
  foreach( (array) $this->get_the_settings( $page ) as $setting ) {
454
-
455
  /* skip if no setting ID */
456
  if ( ! isset( $setting['id'] ) )
457
  continue;
458
-
459
  /* add get_option param to the array */
460
  $setting['get_option'] = $option['id'];
461
-
462
  /* add each setting */
463
- add_settings_field(
464
- $setting['id'],
465
- $setting['label'],
466
- array( $this, 'display_setting' ),
467
  $page['menu_slug'],
468
  $setting['section'],
469
  $setting
470
  );
471
-
472
  }
473
-
474
  }
475
-
476
  }
477
-
478
  return false;
479
  }
480
-
481
  /**
482
  * Callback for add_settings_field() to build each setting by type
483
  *
@@ -490,18 +490,18 @@ if ( ! class_exists( 'OT_Settings' ) ) {
490
  public function display_setting( $args = array() ) {
491
 
492
  extract( $args );
493
-
494
  /* get current saved data */
495
  $options = get_option( $get_option, false );
496
-
497
  // Set field value
498
  $field_value = isset( $options[$id] ) ? $options[$id] : '';
499
-
500
  /* set standard value */
501
- if ( isset( $std ) ) {
502
  $field_value = ot_filter_std_value( $field_value, $std );
503
  }
504
-
505
  // Allow the descriptions to be filtered before being displayed
506
  $desc = apply_filters( 'ot_filter_description', ( isset( $desc ) ? $desc : '' ), $id );
507
 
@@ -525,17 +525,17 @@ if ( ! class_exists( 'OT_Settings' ) ) {
525
  'post_id' => ot_get_media_post_ID(),
526
  'get_option' => $get_option,
527
  );
528
-
529
  // Limit DB queries for Google Fonts.
530
  if ( $type == 'google-fonts' ) {
531
  ot_fetch_google_fonts();
532
  ot_set_google_fonts( $id, $field_value );
533
  }
534
-
535
  /* get the option HTML */
536
  echo ot_display_by_type( $_args );
537
  }
538
-
539
  /**
540
  * Sets the option standards if nothing yet exists.
541
  *
@@ -545,40 +545,40 @@ if ( ! class_exists( 'OT_Settings' ) ) {
545
  * @since 2.0
546
  */
547
  public function initialize_settings() {
548
-
549
  /* loop through options */
550
  foreach( (array) $this->options as $option ) {
551
-
552
  /* skip if option is already set */
553
  if ( isset( $option['id'] ) && get_option( $option['id'], false ) ) {
554
  return false;
555
  }
556
-
557
  $defaults = array();
558
-
559
  /* loop through pages */
560
  foreach( (array) $this->get_pages( $option ) as $page ) {
561
-
562
  /* loop through page settings */
563
  foreach( (array) $this->get_the_settings( $page ) as $setting ) {
564
-
565
  if ( isset( $setting['std'] ) ) {
566
-
567
  $defaults[$setting['id']] = ot_validate_setting( $setting['std'], $setting['type'], $setting['id'] );
568
 
569
  }
570
-
571
  }
572
-
573
  }
574
-
575
  update_option( $option['id'], $defaults );
576
-
577
  }
578
-
579
  return false;
580
  }
581
-
582
  /**
583
  * Sanitize callback for register_setting()
584
  *
@@ -588,23 +588,23 @@ if ( ! class_exists( 'OT_Settings' ) ) {
588
  * @since 2.0
589
  */
590
  public function sanitize_callback( $input ) {
591
-
592
  /* loop through options */
593
  foreach( (array) $this->options as $option ) {
594
-
595
  /* loop through pages */
596
  foreach( (array) $this->get_pages( $option ) as $page ) {
597
-
598
  /* loop through page settings */
599
  foreach( (array) $this->get_the_settings( $page ) as $setting ) {
600
 
601
  /* verify setting has a type & value */
602
  if ( isset( $setting['type'] ) && isset( $input[$setting['id']] ) ) {
603
-
604
  /* get the defaults */
605
  $current_settings = get_option( ot_settings_id() );
606
  $current_options = get_option( $option['id'] );
607
-
608
  /* validate setting */
609
  if ( is_array( $input[$setting['id']] ) && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
610
 
@@ -622,162 +622,162 @@ if ( ! class_exists( 'OT_Settings' ) ) {
622
  'choices' => array()
623
  )
624
  );
625
-
626
  /* get the settings array */
627
  $settings = isset( $_POST[$setting['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$setting['id'] . '_settings_array'] ) ) : array();
628
-
629
  /* settings are empty for some odd ass reason get the defaults */
630
  if ( empty( $settings ) ) {
631
- $settings = 'slider' == $setting['type'] ?
632
- ot_slider_settings( $setting['id'] ) :
633
  ot_list_item_settings( $setting['id'] );
634
  }
635
-
636
  /* merge the two settings array */
637
  $settings = array_merge( $required_setting, $settings );
638
-
639
  /* create an empty WPML id array */
640
  $wpml_ids = array();
641
-
642
  foreach( $input[$setting['id']] as $k => $setting_array ) {
643
 
644
  foreach( $settings as $sub_setting ) {
645
-
646
  /* setup the WPML ID */
647
  $wpml_id = $setting['id'] . '_' . $sub_setting['id'] . '_' . $k;
648
-
649
  /* add id to array */
650
  $wpml_ids[] = $wpml_id;
651
-
652
  /* verify sub setting has a type & value */
653
  if ( isset( $sub_setting['type'] ) && isset( $input[$setting['id']][$k][$sub_setting['id']] ) ) {
654
 
655
  /* validate setting */
656
  $input[$setting['id']][$k][$sub_setting['id']] = ot_validate_setting( $input[$setting['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'], $wpml_id );
657
-
658
  }
659
-
660
  }
661
-
662
  }
663
-
664
  } else if ( is_array( $input[$setting['id']] ) && $setting['type'] == 'social-links' ) {
665
-
666
  /* get the settings array */
667
  $settings = isset( $_POST[$setting['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$setting['id'] . '_settings_array'] ) ) : array();
668
-
669
  /* settings are empty get the defaults */
670
  if ( empty( $settings ) ) {
671
  $settings = ot_social_links_settings( $setting['id'] );
672
  }
673
-
674
  /* create an empty WPML id array */
675
  $wpml_ids = array();
676
-
677
  foreach( $input[$setting['id']] as $k => $setting_array ) {
678
 
679
  foreach( $settings as $sub_setting ) {
680
-
681
  /* setup the WPML ID */
682
  $wpml_id = $setting['id'] . '_' . $sub_setting['id'] . '_' . $k;
683
-
684
  /* add id to array */
685
  $wpml_ids[] = $wpml_id;
686
-
687
  /* verify sub setting has a type & value */
688
  if ( isset( $sub_setting['type'] ) && isset( $input[$setting['id']][$k][$sub_setting['id']] ) ) {
689
 
690
  /* validate setting */
691
  $input[$setting['id']][$k][$sub_setting['id']] = ot_validate_setting( $input[$setting['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'], $wpml_id );
692
-
693
  }
694
-
695
  }
696
-
697
  }
698
 
699
  } else {
700
-
701
  $input[$setting['id']] = ot_validate_setting( $input[$setting['id']], $setting['type'], $setting['id'], $setting['id'] );
702
-
703
  }
704
-
705
  }
706
-
707
  /* unregister WPML strings that were deleted from lists and sliders */
708
  if ( isset( $current_settings['settings'] ) && isset( $setting['type'] ) && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
709
-
710
  if ( ! isset( $wpml_ids ) )
711
  $wpml_ids = array();
712
-
713
  foreach( $current_settings['settings'] as $check_setting ) {
714
-
715
  if ( $setting['id'] == $check_setting['id'] && ! empty( $current_options[$setting['id']] ) ) {
716
-
717
  foreach( $current_options[$setting['id']] as $key => $value ) {
718
-
719
  foreach( $value as $ckey => $cvalue ) {
720
-
721
  $id = $setting['id'] . '_' . $ckey . '_' . $key;
722
-
723
  if ( ! in_array( $id, $wpml_ids ) ) {
724
-
725
  ot_wpml_unregister_string( $id );
726
-
727
  }
728
-
729
  }
730
-
731
  }
732
-
733
  }
734
-
735
  }
736
-
737
  }
738
-
739
  /* unregister WPML strings that were deleted from social links */
740
  if ( isset( $current_settings['settings'] ) && isset( $setting['type'] ) && $setting['type'] == 'social-links' ) {
741
-
742
  if ( ! isset( $wpml_ids ) )
743
  $wpml_ids = array();
744
-
745
  foreach( $current_settings['settings'] as $check_setting ) {
746
-
747
  if ( $setting['id'] == $check_setting['id'] && ! empty( $current_options[$setting['id']] ) ) {
748
-
749
  foreach( $current_options[$setting['id']] as $key => $value ) {
750
-
751
  foreach( $value as $ckey => $cvalue ) {
752
-
753
  $id = $setting['id'] . '_' . $ckey . '_' . $key;
754
-
755
  if ( ! in_array( $id, $wpml_ids ) ) {
756
-
757
  ot_wpml_unregister_string( $id );
758
-
759
  }
760
-
761
  }
762
-
763
  }
764
-
765
  }
766
-
767
  }
768
-
769
  }
770
-
771
  }
772
-
773
  }
774
-
775
  }
776
-
777
  return $input;
778
-
779
  }
780
-
781
  /**
782
  * Helper function to get the pages array for an option
783
  *
@@ -788,21 +788,21 @@ if ( ! class_exists( 'OT_Settings' ) ) {
788
  * @since 2.0
789
  */
790
  public function get_pages( $option = array() ) {
791
-
792
  if ( empty( $option ) )
793
  return false;
794
-
795
  /* check for pages */
796
  if ( isset( $option['pages'] ) && ! empty( $option['pages'] ) ) {
797
-
798
  /* return pages array */
799
  return $option['pages'];
800
-
801
  }
802
-
803
  return false;
804
  }
805
-
806
  /**
807
  * Helper function to get the sections array for a page
808
  *
@@ -813,21 +813,21 @@ if ( ! class_exists( 'OT_Settings' ) ) {
813
  * @since 2.0
814
  */
815
  public function get_sections( $page = array() ) {
816
-
817
  if ( empty( $page ) )
818
  return false;
819
-
820
  /* check for sections */
821
  if ( isset( $page['sections'] ) && ! empty( $page['sections'] ) ) {
822
-
823
  /* return sections array */
824
  return $page['sections'];
825
-
826
  }
827
-
828
  return false;
829
  }
830
-
831
  /**
832
  * Helper function to get the settings array for a page
833
  *
@@ -838,21 +838,21 @@ if ( ! class_exists( 'OT_Settings' ) ) {
838
  * @since 2.0
839
  */
840
  public function get_the_settings( $page = array() ) {
841
-
842
  if ( empty( $page ) )
843
  return false;
844
-
845
  /* check for settings */
846
  if ( isset( $page['settings'] ) && ! empty( $page['settings'] ) ) {
847
-
848
  /* return settings array */
849
  return $page['settings'];
850
-
851
  }
852
-
853
  return false;
854
  }
855
-
856
  /**
857
  * Prints out all settings sections added to a particular settings page
858
  *
@@ -917,7 +917,7 @@ if ( ! class_exists( 'OT_Settings' ) ) {
917
  }
918
 
919
  }
920
-
921
  /**
922
  * Print out the settings fields for a particular settings section
923
  *
@@ -932,10 +932,10 @@ if ( ! class_exists( 'OT_Settings' ) ) {
932
  */
933
  public function do_settings_fields( $page, $section ) {
934
  global $wp_settings_fields;
935
-
936
  if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
937
  return;
938
-
939
  foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
940
 
941
  $conditions = '';
@@ -946,50 +946,50 @@ if ( ! class_exists( 'OT_Settings' ) ) {
946
  $conditions.= isset( $field['args']['operator'] ) && in_array( $field['args']['operator'], array( 'and', 'AND', 'or', 'OR' ) ) ? ' data-operator="' . $field['args']['operator'] . '"' : '';
947
 
948
  }
949
-
950
  // Build the setting CSS class
951
  if ( isset( $field['args']['class'] ) && ! empty( $field['args']['class'] ) ) {
952
-
953
  $classes = explode( ' ', $field['args']['class'] );
954
-
955
  foreach( $classes as $key => $value ) {
956
-
957
  $classes[$key] = $value . '-wrap';
958
-
959
  }
960
-
961
  $class = 'format-settings ' . implode( ' ', $classes );
962
-
963
  } else {
964
-
965
  $class = 'format-settings';
966
-
967
  }
968
-
969
  echo '<div id="setting_' . $field['id'] . '" class="' . $class . '"' . $conditions . '>';
970
-
971
  echo '<div class="format-setting-wrap">';
972
-
973
  if ( $field['args']['type'] != 'textblock' && ! empty( $field['title'] ) ) {
974
-
975
  echo '<div class="format-setting-label">';
976
-
977
- echo '<h3 class="label">' . $field['title'] . '</h3>';
978
-
979
  echo '</div>';
980
-
981
  }
982
-
983
  call_user_func( $field['callback'], $field['args'] );
984
-
985
  echo '</div>';
986
-
987
  echo '</div>';
988
-
989
  }
990
-
991
  }
992
-
993
  /**
994
  * Resets page options before the screen is displayed
995
  *
@@ -999,34 +999,34 @@ if ( ! class_exists( 'OT_Settings' ) ) {
999
  * @since 2.0
1000
  */
1001
  public function reset_options() {
1002
-
1003
  /* check for reset action */
1004
  if ( isset( $_POST['option_tree_reset_nonce'] ) && wp_verify_nonce( $_POST['option_tree_reset_nonce'], 'option_tree_reset_form' ) ) {
1005
-
1006
  /* loop through options */
1007
  foreach( (array) $this->options as $option ) {
1008
-
1009
  /* loop through pages */
1010
  foreach( (array) $this->get_pages( $option ) as $page ) {
1011
-
1012
  /* verify page */
1013
  if ( isset( $_GET['page'] ) && $_GET['page'] == $page['menu_slug'] ) {
1014
-
1015
  /* reset options */
1016
  delete_option( $option['id'] );
1017
-
1018
  }
1019
-
1020
  }
1021
-
1022
  }
1023
-
1024
  }
1025
-
1026
  return false;
1027
-
1028
  }
1029
-
1030
  }
1031
 
1032
  }
@@ -1047,7 +1047,7 @@ if ( ! function_exists( 'ot_register_settings' ) ) {
1047
  function ot_register_settings( $args ) {
1048
  if ( ! $args )
1049
  return;
1050
-
1051
  $ot_settings = new OT_Settings( $args );
1052
  }
1053
 
11
  if ( ! class_exists( 'OT_Settings' ) ) {
12
 
13
  class OT_Settings {
14
+
15
  /* the options array */
16
  private $options;
17
+
18
  /* hooks for targeting admin pages */
19
  private $page_hook;
20
+
21
  /**
22
  * Constructor
23
  *
28
  * @since 2.0
29
  */
30
  public function __construct( $args ) {
31
+
32
  $this->options = $args;
33
+
34
  /* return early if not viewing an admin page or no options */
35
  if ( ! is_admin() || ! is_array( $this->options ) )
36
  return false;
37
+
38
  /* load everything */
39
  $this->hooks();
40
+
41
  }
42
+
43
  /**
44
  * Execute the WordPress Hooks
45
  *
61
 
62
  /* add pages & menu items */
63
  add_action( 'admin_menu', array( $this, 'add_page' ), $priority );
64
+
65
  /* register sections */
66
  add_action( 'admin_init', array( $this, 'add_sections' ) );
67
+
68
  /* register settings */
69
  add_action( 'admin_init', array( $this, 'add_settings' ) );
70
+
71
  /* reset options */
72
  add_action( 'admin_init', array( $this, 'reset_options' ), 10 );
73
+
74
  /* initialize settings */
75
  add_action( 'admin_init', array( $this, 'initialize_settings' ), 11 );
76
+
77
  }
78
+
79
  /**
80
  * Loads each admin page
81
  *
85
  * @since 2.0
86
  */
87
  public function add_page() {
88
+
89
  /* loop through options */
90
  foreach( (array) $this->options as $option ) {
91
+
92
  /* loop through pages */
93
  foreach( (array) $this->get_pages( $option ) as $page ) {
94
+
95
  /**
96
  * Theme Check... stop nagging me about this kind of stuff.
97
  * The damn admin pages are required for OT to function, duh!
98
  */
99
  $theme_check_bs = 'add_menu_' . 'page';
100
  $theme_check_bs2 = 'add_submenu_' . 'page';
101
+
102
  /* load page in WP top level menu */
103
  if ( ! isset( $page['parent_slug'] ) || empty( $page['parent_slug'] ) ) {
104
+ $page_hook = $theme_check_bs(
105
+ $page['page_title'],
106
+ $page['menu_title'],
107
+ $page['capability'],
108
+ $page['menu_slug'],
109
+ array( $this, 'display_page' ),
110
  $page['icon_url'],
111
+ $page['position']
112
  );
113
  /* load page in WP sub menu */
114
  } else {
115
+ $page_hook = $theme_check_bs2(
116
+ $page['parent_slug'],
117
+ $page['page_title'],
118
+ $page['menu_title'],
119
+ $page['capability'],
120
+ $page['menu_slug'],
121
+ array( $this, 'display_page' )
122
  );
123
  }
124
+
125
  /* only load if not a hidden page */
126
  if ( ! isset( $page['hidden_page'] ) ) {
127
+
128
  /* associate $page_hook with page id */
129
  $this->page_hook[$page['id']] = $page_hook;
130
+
131
  /* add scripts */
132
  add_action( 'admin_print_scripts-' . $page_hook, array( $this, 'scripts' ) );
133
+
134
  /* add styles */
135
  add_action( 'admin_print_styles-' . $page_hook, array( $this, 'styles' ) );
136
+
137
  /* add contextual help */
138
  add_action( 'load-' . $page_hook, array( $this, 'help' ) );
139
+
140
  }
141
+
142
  }
143
+
144
  }
145
+
146
  return false;
147
  }
148
+
149
  /**
150
  * Loads the scripts
151
  *
157
  public function scripts() {
158
  ot_admin_scripts();
159
  }
160
+
161
  /**
162
  * Loads the styles
163
  *
169
  public function styles() {
170
  ot_admin_styles();
171
  }
172
+
173
  /**
174
  * Loads the contextual help for each page
175
  *
180
  */
181
  public function help() {
182
  $screen = get_current_screen();
183
+
184
  /* loop through options */
185
  foreach( (array) $this->options as $option ) {
186
+
187
  /* loop through pages */
188
  foreach( (array) $this->get_pages( $option ) as $page ) {
189
+
190
  /* verify page */
191
  if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
192
+
193
  /* set up the help tabs */
194
  if ( ! empty( $page['contextual_help']['content'] ) ) {
195
  foreach( $page['contextual_help']['content'] as $contextual_help ) {
196
+ $screen->add_help_tab(
197
  array(
198
  'id' => esc_attr( $contextual_help['id'] ),
199
  'title' => esc_attr( $contextual_help['title'] ),
202
  );
203
  }
204
  }
205
+
206
  /* set up the help sidebar */
207
  if ( ! empty( $page['contextual_help']['sidebar'] ) ) {
208
  $screen->set_help_sidebar( htmlspecialchars_decode( $page['contextual_help']['sidebar'] ) );
209
  }
210
+
211
  }
212
+
213
  }
214
+
215
  }
216
+
217
  return false;
218
  }
219
+
220
  /**
221
  * Loads the content for each page
222
  *
227
  */
228
  public function display_page() {
229
  $screen = get_current_screen();
230
+
231
  /* loop through settings */
232
  foreach( (array) $this->options as $option ) {
233
+
234
  /* loop through pages */
235
  foreach( (array) $this->get_pages( $option ) as $page ) {
236
+
237
  /* verify page */
238
  if ( ! isset( $page['hidden_page'] ) && $screen->id == $this->page_hook[$page['id']] ) {
239
+
240
  $show_buttons = isset( $page['show_buttons'] ) && $page['show_buttons'] == false ? false : true;
241
 
242
  /* update active layout content */
243
  if ( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) {
244
+
245
  $layouts = get_option( ot_layouts_id() );
246
+
247
  /* has active layout */
248
  if ( isset( $layouts['active_layout'] ) ) {
249
  $option_tree = get_option( $option['id'] );
250
  $layouts[$layouts['active_layout']] = ot_encode( serialize( $option_tree ) );
251
  update_option( ot_layouts_id(), $layouts );
252
  }
253
+
254
  }
255
+
256
  echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
257
+
258
  echo '<h2>' . $page['page_title'] . '</h2>';
259
+
260
  echo ot_alert_message( $page );
261
+
262
  settings_errors( 'option-tree' );
263
+
264
  /* Header */
265
  echo '<div id="option-tree-header-wrap">';
266
+
267
  echo '<ul id="option-tree-header">';
268
+
269
+
270
+
271
+ //echo '<li id="option-tree-version"><span>' . apply_filters( 'ot_header_version_text', 'Nifty options panel ' . OT_VERSION, $page['id'] ) . '</span></li>';
272
+
273
  // Add additional theme specific links here.
274
  do_action( 'ot_header_list', $page['id'] );
275
+
276
+
277
  echo '</ul>';
278
+
279
  /* layouts form */
280
  if ( $page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true )
281
  ot_theme_options_layouts_form();
282
+
283
  echo '</div>';
284
+
285
  /* remove forms on the custom settings pages */
286
  if ( $show_buttons ) {
287
+
288
  echo '<form action="options.php" method="post" id="option-tree-settings-api">';
289
+
290
  settings_fields( $option['id'] );
291
+
292
  } else {
293
+
294
  echo '<div id="option-tree-settings-api">';
295
+
296
  }
297
+
298
  /* Sub Header */
299
  echo '<div id="option-tree-sub-header">';
300
+
301
+
302
+
303
  if ( $show_buttons )
304
  echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
305
+ echo '<a target="_blank" href="'. get_site_url().'/?get_preview=true"><div class="option-tree-ui-button button right">Live Preview</div></a>';
306
  echo '</div>';
307
+
308
+
309
+
310
  /* Navigation */
311
  echo '<div class="ui-tabs">';
312
+
313
  /* check for sections */
314
  if ( isset( $page['sections'] ) && count( $page['sections'] ) > 0 ) {
315
+
316
  echo '<ul class="ui-tabs-nav">';
317
+
318
  /* loop through page sections */
319
  foreach( (array) $page['sections'] as $section ) {
320
  echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
321
  }
322
+
323
  echo '</ul>';
324
+
325
  }
326
+
327
  /* sections */
328
  echo '<div id="poststuff" class="metabox-holder">';
329
+
330
  echo '<div id="post-body">';
331
+
332
  echo '<div id="post-body-content">';
333
+
334
  $this->do_settings_sections( $_GET['page'] );
335
+
336
  echo '</div>';
337
+
338
  echo '</div>';
339
+
340
  echo '</div>';
341
+
342
  echo '<div class="clear"></div>';
343
+
344
  echo '</div>';
345
+
346
  /* buttons */
347
  if ( $show_buttons ) {
348
+
349
  echo '<div class="option-tree-ui-buttons">';
350
+
351
  echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
352
+
353
  echo '</div>';
354
+
355
  }
356
+
357
  echo $show_buttons ? '</form>' : '</div>';
358
+
359
  /* reset button */
360
  if ( $show_buttons ) {
361
+
362
  echo '<form method="post" action="' . str_replace( '&settings-updated=true', '', $_SERVER["REQUEST_URI"] ) . '">';
363
+
364
  /* form nonce */
365
  wp_nonce_field( 'option_tree_reset_form', 'option_tree_reset_nonce' );
366
+
367
  echo '<input type="hidden" name="action" value="reset" />';
368
+
369
  echo '<button type="submit" class="option-tree-ui-button button button-secondary left reset-settings" title="' . __( 'Reset Options', 'option-tree' ) . '">' . __( 'Reset Options', 'option-tree' ) . '</button>';
370
+
371
  echo '</form>';
372
+
373
  }
374
+
375
  echo '</div>';
376
+
377
  }
378
+
379
  }
380
+
381
  }
382
+
383
  return false;
384
  }
385
+
386
  /**
387
  * Adds sections to the page
388
  *
392
  * @since 2.0
393
  */
394
  public function add_sections() {
395
+
396
  /* loop through options */
397
  foreach( (array) $this->options as $option ) {
398
+
399
  /* loop through pages */
400
  foreach( (array) $this->get_pages( $option ) as $page ) {
401
+
402
  /* loop through page sections */
403
  foreach( (array) $this->get_sections( $page ) as $section ) {
404
+
405
  /* add each section */
406
+ add_settings_section(
407
+ $section['id'],
408
+ $section['title'],
409
+ array( $this, 'display_section' ),
410
+ $page['menu_slug']
411
  );
412
+
413
  }
414
+
415
  }
416
+
417
  }
418
+
419
  return false;
420
  }
421
+
422
  /**
423
  * Callback for add_settings_section()
424
  *
430
  public function display_section() {
431
  /* currently pointless */
432
  }
433
+
434
  /**
435
  * Add settings the the page
436
  *
440
  * @since 2.0
441
  */
442
  public function add_settings() {
443
+
444
  /* loop through options */
445
  foreach( (array) $this->options as $option ) {
446
+
447
  register_setting( $option['id'], $option['id'], array ( $this, 'sanitize_callback' ) );
448
+
449
  /* loop through pages */
450
  foreach( (array) $this->get_pages( $option ) as $page ) {
451
+
452
  /* loop through page settings */
453
  foreach( (array) $this->get_the_settings( $page ) as $setting ) {
454
+
455
  /* skip if no setting ID */
456
  if ( ! isset( $setting['id'] ) )
457
  continue;
458
+
459
  /* add get_option param to the array */
460
  $setting['get_option'] = $option['id'];
461
+
462
  /* add each setting */
463
+ add_settings_field(
464
+ $setting['id'],
465
+ $setting['label'],
466
+ array( $this, 'display_setting' ),
467
  $page['menu_slug'],
468
  $setting['section'],
469
  $setting
470
  );
471
+
472
  }
473
+
474
  }
475
+
476
  }
477
+
478
  return false;
479
  }
480
+
481
  /**
482
  * Callback for add_settings_field() to build each setting by type
483
  *
490
  public function display_setting( $args = array() ) {
491
 
492
  extract( $args );
493
+
494
  /* get current saved data */
495
  $options = get_option( $get_option, false );
496
+
497
  // Set field value
498
  $field_value = isset( $options[$id] ) ? $options[$id] : '';
499
+
500
  /* set standard value */
501
+ if ( isset( $std ) ) {
502
  $field_value = ot_filter_std_value( $field_value, $std );
503
  }
504
+
505
  // Allow the descriptions to be filtered before being displayed
506
  $desc = apply_filters( 'ot_filter_description', ( isset( $desc ) ? $desc : '' ), $id );
507
 
525
  'post_id' => ot_get_media_post_ID(),
526
  'get_option' => $get_option,
527
  );
528
+
529
  // Limit DB queries for Google Fonts.
530
  if ( $type == 'google-fonts' ) {
531
  ot_fetch_google_fonts();
532
  ot_set_google_fonts( $id, $field_value );
533
  }
534
+
535
  /* get the option HTML */
536
  echo ot_display_by_type( $_args );
537
  }
538
+
539
  /**
540
  * Sets the option standards if nothing yet exists.
541
  *
545
  * @since 2.0
546
  */
547
  public function initialize_settings() {
548
+
549
  /* loop through options */
550
  foreach( (array) $this->options as $option ) {
551
+
552
  /* skip if option is already set */
553
  if ( isset( $option['id'] ) && get_option( $option['id'], false ) ) {
554
  return false;
555
  }
556
+
557
  $defaults = array();
558
+
559
  /* loop through pages */
560
  foreach( (array) $this->get_pages( $option ) as $page ) {
561
+
562
  /* loop through page settings */
563
  foreach( (array) $this->get_the_settings( $page ) as $setting ) {
564
+
565
  if ( isset( $setting['std'] ) ) {
566
+
567
  $defaults[$setting['id']] = ot_validate_setting( $setting['std'], $setting['type'], $setting['id'] );
568
 
569
  }
570
+
571
  }
572
+
573
  }
574
+
575
  update_option( $option['id'], $defaults );
576
+
577
  }
578
+
579
  return false;
580
  }
581
+
582
  /**
583
  * Sanitize callback for register_setting()
584
  *
588
  * @since 2.0
589
  */
590
  public function sanitize_callback( $input ) {
591
+
592
  /* loop through options */
593
  foreach( (array) $this->options as $option ) {
594
+
595
  /* loop through pages */
596
  foreach( (array) $this->get_pages( $option ) as $page ) {
597
+
598
  /* loop through page settings */
599
  foreach( (array) $this->get_the_settings( $page ) as $setting ) {
600
 
601
  /* verify setting has a type & value */
602
  if ( isset( $setting['type'] ) && isset( $input[$setting['id']] ) ) {
603
+
604
  /* get the defaults */
605
  $current_settings = get_option( ot_settings_id() );
606
  $current_options = get_option( $option['id'] );
607
+
608
  /* validate setting */
609
  if ( is_array( $input[$setting['id']] ) && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
610
 
622
  'choices' => array()
623
  )
624
  );
625
+
626
  /* get the settings array */
627
  $settings = isset( $_POST[$setting['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$setting['id'] . '_settings_array'] ) ) : array();
628
+
629
  /* settings are empty for some odd ass reason get the defaults */
630
  if ( empty( $settings ) ) {
631
+ $settings = 'slider' == $setting['type'] ?
632
+ ot_slider_settings( $setting['id'] ) :
633
  ot_list_item_settings( $setting['id'] );
634
  }
635
+
636
  /* merge the two settings array */
637
  $settings = array_merge( $required_setting, $settings );
638
+
639
  /* create an empty WPML id array */
640
  $wpml_ids = array();
641
+
642
  foreach( $input[$setting['id']] as $k => $setting_array ) {
643
 
644
  foreach( $settings as $sub_setting ) {
645
+
646
  /* setup the WPML ID */
647
  $wpml_id = $setting['id'] . '_' . $sub_setting['id'] . '_' . $k;
648
+
649
  /* add id to array */
650
  $wpml_ids[] = $wpml_id;
651
+
652
  /* verify sub setting has a type & value */
653
  if ( isset( $sub_setting['type'] ) && isset( $input[$setting['id']][$k][$sub_setting['id']] ) ) {
654
 
655
  /* validate setting */
656
  $input[$setting['id']][$k][$sub_setting['id']] = ot_validate_setting( $input[$setting['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'], $wpml_id );
657
+
658
  }
659
+
660
  }
661
+
662
  }
663
+
664
  } else if ( is_array( $input[$setting['id']] ) && $setting['type'] == 'social-links' ) {
665
+
666
  /* get the settings array */
667
  $settings = isset( $_POST[$setting['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$setting['id'] . '_settings_array'] ) ) : array();
668
+
669
  /* settings are empty get the defaults */
670
  if ( empty( $settings ) ) {
671
  $settings = ot_social_links_settings( $setting['id'] );
672
  }
673
+
674
  /* create an empty WPML id array */
675
  $wpml_ids = array();
676
+
677
  foreach( $input[$setting['id']] as $k => $setting_array ) {
678
 
679
  foreach( $settings as $sub_setting ) {
680
+
681
  /* setup the WPML ID */
682
  $wpml_id = $setting['id'] . '_' . $sub_setting['id'] . '_' . $k;
683
+
684
  /* add id to array */
685
  $wpml_ids[] = $wpml_id;
686
+
687
  /* verify sub setting has a type & value */
688
  if ( isset( $sub_setting['type'] ) && isset( $input[$setting['id']][$k][$sub_setting['id']] ) ) {
689
 
690
  /* validate setting */
691
  $input[$setting['id']][$k][$sub_setting['id']] = ot_validate_setting( $input[$setting['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'], $wpml_id );
692
+
693
  }
694
+
695
  }
696
+
697
  }
698
 
699
  } else {
700
+
701
  $input[$setting['id']] = ot_validate_setting( $input[$setting['id']], $setting['type'], $setting['id'], $setting['id'] );
702
+
703
  }
704
+
705
  }
706
+
707
  /* unregister WPML strings that were deleted from lists and sliders */
708
  if ( isset( $current_settings['settings'] ) && isset( $setting['type'] ) && in_array( $setting['type'], array( 'list-item', 'slider' ) ) ) {
709
+
710
  if ( ! isset( $wpml_ids ) )
711
  $wpml_ids = array();
712
+
713
  foreach( $current_settings['settings'] as $check_setting ) {
714
+
715
  if ( $setting['id'] == $check_setting['id'] && ! empty( $current_options[$setting['id']] ) ) {
716
+
717
  foreach( $current_options[$setting['id']] as $key => $value ) {
718
+
719
  foreach( $value as $ckey => $cvalue ) {
720
+
721
  $id = $setting['id'] . '_' . $ckey . '_' . $key;
722
+
723
  if ( ! in_array( $id, $wpml_ids ) ) {
724
+
725
  ot_wpml_unregister_string( $id );
726
+
727
  }
728
+
729
  }
730
+
731
  }
732
+
733
  }
734
+
735
  }
736
+
737
  }
738
+
739
  /* unregister WPML strings that were deleted from social links */
740
  if ( isset( $current_settings['settings'] ) && isset( $setting['type'] ) && $setting['type'] == 'social-links' ) {
741
+
742
  if ( ! isset( $wpml_ids ) )
743
  $wpml_ids = array();
744
+
745
  foreach( $current_settings['settings'] as $check_setting ) {
746
+
747
  if ( $setting['id'] == $check_setting['id'] && ! empty( $current_options[$setting['id']] ) ) {
748
+
749
  foreach( $current_options[$setting['id']] as $key => $value ) {
750
+
751
  foreach( $value as $ckey => $cvalue ) {
752
+
753
  $id = $setting['id'] . '_' . $ckey . '_' . $key;
754
+
755
  if ( ! in_array( $id, $wpml_ids ) ) {
756
+
757
  ot_wpml_unregister_string( $id );
758
+
759
  }
760
+
761
  }
762
+
763
  }
764
+
765
  }
766
+
767
  }
768
+
769
  }
770
+
771
  }
772
+
773
  }
774
+
775
  }
776
+
777
  return $input;
778
+
779
  }
780
+
781
  /**
782
  * Helper function to get the pages array for an option
783
  *
788
  * @since 2.0
789
  */
790
  public function get_pages( $option = array() ) {
791
+
792
  if ( empty( $option ) )
793
  return false;
794
+
795
  /* check for pages */
796
  if ( isset( $option['pages'] ) && ! empty( $option['pages'] ) ) {
797
+
798
  /* return pages array */
799
  return $option['pages'];
800
+
801
  }
802
+
803
  return false;
804
  }
805
+
806
  /**
807
  * Helper function to get the sections array for a page
808
  *
813
  * @since 2.0
814
  */
815
  public function get_sections( $page = array() ) {
816
+
817
  if ( empty( $page ) )
818
  return false;
819
+
820
  /* check for sections */
821
  if ( isset( $page['sections'] ) && ! empty( $page['sections'] ) ) {
822
+
823
  /* return sections array */
824
  return $page['sections'];
825
+
826
  }
827
+
828
  return false;
829
  }
830
+
831
  /**
832
  * Helper function to get the settings array for a page
833
  *
838
  * @since 2.0
839
  */
840
  public function get_the_settings( $page = array() ) {
841
+
842
  if ( empty( $page ) )
843
  return false;
844
+
845
  /* check for settings */
846
  if ( isset( $page['settings'] ) && ! empty( $page['settings'] ) ) {
847
+
848
  /* return settings array */
849
  return $page['settings'];
850
+
851
  }
852
+
853
  return false;
854
  }
855
+
856
  /**
857
  * Prints out all settings sections added to a particular settings page
858
  *
917
  }
918
 
919
  }
920
+
921
  /**
922
  * Print out the settings fields for a particular settings section
923
  *
932
  */
933
  public function do_settings_fields( $page, $section ) {
934
  global $wp_settings_fields;
935
+
936
  if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
937
  return;
938
+
939
  foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
940
 
941
  $conditions = '';
946
  $conditions.= isset( $field['args']['operator'] ) && in_array( $field['args']['operator'], array( 'and', 'AND', 'or', 'OR' ) ) ? ' data-operator="' . $field['args']['operator'] . '"' : '';
947
 
948
  }
949
+
950
  // Build the setting CSS class
951
  if ( isset( $field['args']['class'] ) && ! empty( $field['args']['class'] ) ) {
952
+
953
  $classes = explode( ' ', $field['args']['class'] );
954
+
955
  foreach( $classes as $key => $value ) {
956
+
957
  $classes[$key] = $value . '-wrap';
958
+
959
  }
960
+
961
  $class = 'format-settings ' . implode( ' ', $classes );
962
+
963
  } else {
964
+
965
  $class = 'format-settings';
966
+
967
  }
968
+
969
  echo '<div id="setting_' . $field['id'] . '" class="' . $class . '"' . $conditions . '>';
970
+
971
  echo '<div class="format-setting-wrap">';
972
+
973
  if ( $field['args']['type'] != 'textblock' && ! empty( $field['title'] ) ) {
974
+
975
  echo '<div class="format-setting-label">';
976
+
977
+ echo '<h3 class="label">' . $field['title'] . '</h3>';
978
+
979
  echo '</div>';
980
+
981
  }
982
+
983
  call_user_func( $field['callback'], $field['args'] );
984
+
985
  echo '</div>';
986
+
987
  echo '</div>';
988
+
989
  }
990
+
991
  }
992
+
993
  /**
994
  * Resets page options before the screen is displayed
995
  *
999
  * @since 2.0
1000
  */
1001
  public function reset_options() {
1002
+
1003
  /* check for reset action */
1004
  if ( isset( $_POST['option_tree_reset_nonce'] ) && wp_verify_nonce( $_POST['option_tree_reset_nonce'], 'option_tree_reset_form' ) ) {
1005
+
1006
  /* loop through options */
1007
  foreach( (array) $this->options as $option ) {
1008
+
1009
  /* loop through pages */
1010
  foreach( (array) $this->get_pages( $option ) as $page ) {
1011
+
1012
  /* verify page */
1013
  if ( isset( $_GET['page'] ) && $_GET['page'] == $page['menu_slug'] ) {
1014
+
1015
  /* reset options */
1016
  delete_option( $option['id'] );
1017
+
1018
  }
1019
+
1020
  }
1021
+
1022
  }
1023
+
1024
  }
1025
+
1026
  return false;
1027
+
1028
  }
1029
+
1030
  }
1031
 
1032
  }
1047
  function ot_register_settings( $args ) {
1048
  if ( ! $args )
1049
  return;
1050
+
1051
  $ot_settings = new OT_Settings( $args );
1052
  }
1053
 
admin/main-options.php CHANGED
@@ -13,42 +13,544 @@ add_action( 'init', 'nifty_cs_custom_theme_options' );
13
  /**
14
  * Build the custom settings & update OptionTree.
15
  */
16
-
17
  function nifty_cs_custom_theme_options() {
18
-
19
  /* OptionTree is not loaded yet7, or this is not an admin request */
20
  if ( ! function_exists( 'ot_settings_id' ) || ! is_admin() )
21
  return false;
22
-
23
  /**
24
- * Get a copy of the saved settings array.
25
  */
26
-
27
  $saved_settings = get_option( ot_settings_id(), array() );
28
-
29
-
30
  // Google Fonts support
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  /**
33
  * Returns an array of system fonts
34
  * Feel free to edit this, update the font fallbacks, etc.
35
- */
36
- $google_fonts = nifty_cs_get_google_webfonts();
37
  foreach( $google_fonts as $font ) {
38
  $google_webfonts_array[$font['family']]['label'] = $font['family'];
39
  $google_webfonts_array[$font['family']]['value'] = $font['family'];
40
- }
41
-
42
-
43
- $custom_settings = array(
44
- 'contextual_help' => array(
45
  'sidebar' => ''
46
  ),
47
- 'sections' => array(
48
  array(
49
  'id' => 'general_settings',
50
  'title' => 'General Settings'
51
  ),
 
 
 
 
52
  array(
53
  'id' => 'design_and_layout',
54
  'title' => 'Design and Layout'
@@ -66,7 +568,19 @@ function nifty_cs_custom_theme_options() {
66
  'title' => 'Documentation'
67
  )
68
  ),
69
- 'settings' => array(
 
 
 
 
 
 
 
 
 
 
 
 
70
  array(
71
  'id' => 'general_settings',
72
  'label' => 'General settings',
@@ -77,7 +591,7 @@ function nifty_cs_custom_theme_options() {
77
  'min_max_step'=> '',
78
  'class' => '',
79
  'condition' => '',
80
-
81
  'operator' => 'and'
82
  ),
83
  array(
@@ -100,7 +614,7 @@ function nifty_cs_custom_theme_options() {
100
  'std' => 'on',
101
  'type' => 'on-off',
102
  'section' => 'general_settings',
103
-
104
  ),
105
  array(
106
  'id' => 'enable_preloader',
@@ -109,7 +623,7 @@ function nifty_cs_custom_theme_options() {
109
  'std' => 'on',
110
  'type' => 'on-off',
111
  'section' => 'general_settings',
112
-
113
  ),
114
  array(
115
  'id' => 'enable_sign_up_form',
@@ -118,7 +632,7 @@ function nifty_cs_custom_theme_options() {
118
  'std' => 'on',
119
  'type' => 'on-off',
120
  'section' => 'general_settings',
121
-
122
  ),
123
  array(
124
  'id' => 'insert_custom_signup_form',
@@ -139,7 +653,7 @@ function nifty_cs_custom_theme_options() {
139
  'std' => 'on',
140
  'type' => 'on-off',
141
  'section' => 'general_settings',
142
-
143
  ),
144
  array(
145
  'id' => 'enable_social_links',
@@ -148,7 +662,7 @@ function nifty_cs_custom_theme_options() {
148
  'std' => 'on',
149
  'type' => 'on-off',
150
  'section' => 'general_settings',
151
-
152
  ),
153
  array(
154
  'id' => 'disable_navigation',
@@ -157,7 +671,7 @@ function nifty_cs_custom_theme_options() {
157
  'std' => 'on',
158
  'type' => 'on-off',
159
  'section' => 'general_settings',
160
-
161
  ),
162
  array(
163
  'id' => 'disable_animation',
@@ -166,16 +680,16 @@ function nifty_cs_custom_theme_options() {
166
  'std' => 'on',
167
  'type' => 'on-off',
168
  'section' => 'general_settings',
169
-
170
  ),
171
  array(
172
  'id' => 'insert_google_analytics_code',
173
  'label' => 'Google Analytics code',
174
- 'desc' => 'Enter your Google Analytics code that will be added in your coming soon page footer.',
175
  'std' => '',
176
  'type' => 'javascript',
177
  'section' => 'general_settings',
178
-
179
  ),
180
  array(
181
  'id' => 'insert_additional_css',
@@ -184,9 +698,9 @@ function nifty_cs_custom_theme_options() {
184
  'std' => '',
185
  'type' => 'css',
186
  'section' => 'general_settings',
187
-
188
  ),
189
-
190
  array(
191
  'id' => 'design_and_layout_settings',
192
  'label' => 'Design and Layout settings',
@@ -194,7 +708,7 @@ function nifty_cs_custom_theme_options() {
194
  'std' => '',
195
  'type' => 'textblock-titled',
196
  'section' => 'design_and_layout',
197
-
198
  ),
199
  array(
200
  'id' => 'disable_logo',
@@ -203,7 +717,7 @@ function nifty_cs_custom_theme_options() {
203
  'std' => 'on',
204
  'type' => 'on-off',
205
  'section' => 'design_and_layout',
206
-
207
  ),
208
  array(
209
  'id' => 'upload_your_logo',
@@ -238,7 +752,7 @@ function nifty_cs_custom_theme_options() {
238
  'std' => 'Our website is coming very soon',
239
  'type' => 'text',
240
  'section' => 'design_and_layout',
241
-
242
  ),
243
  array(
244
  'id' => 'enter_second_coming_soon_message',
@@ -247,7 +761,7 @@ function nifty_cs_custom_theme_options() {
247
  'std' => 'Feel free to drop-by any time soon',
248
  'type' => 'text',
249
  'section' => 'design_and_layout',
250
-
251
  ),
252
  array(
253
  'id' => 'setup_the_count_down_timer',
@@ -256,7 +770,7 @@ function nifty_cs_custom_theme_options() {
256
  'std' => '',
257
  'type' => 'date-time-picker',
258
  'section' => 'design_and_layout',
259
-
260
  ),
261
  array(
262
  'id' => 'background_color',
@@ -265,7 +779,7 @@ function nifty_cs_custom_theme_options() {
265
  'std' => '',
266
  'type' => 'colorpicker',
267
  'section' => 'design_and_layout',
268
-
269
  ),
270
  array(
271
  'id' => 'sign_up_button_color',
@@ -274,7 +788,7 @@ function nifty_cs_custom_theme_options() {
274
  'std' => '#9e0039',
275
  'type' => 'colorpicker',
276
  'section' => 'design_and_layout',
277
-
278
  ),
279
  array(
280
  'id' => 'sign_up_button_color_hover',
@@ -283,7 +797,7 @@ function nifty_cs_custom_theme_options() {
283
  'std' => '#9e0039',
284
  'type' => 'colorpicker',
285
  'section' => 'design_and_layout',
286
-
287
  ),
288
  array(
289
  'id' => 'disable_background_image_slider',
@@ -292,7 +806,7 @@ function nifty_cs_custom_theme_options() {
292
  'std' => 'on',
293
  'type' => 'on-off',
294
  'section' => 'design_and_layout',
295
-
296
  ),
297
  array(
298
  'id' => 'background_slider_time',
@@ -361,7 +875,7 @@ function nifty_cs_custom_theme_options() {
361
  'desc' => 'Here you can select the desired animation between background slides, you can use the Random option and use all.',
362
  'std' => 'random',
363
  'type' => 'select',
364
- 'choices' => array(
365
  array(
366
  'value' => 'random',
367
  'label' => 'Random',
@@ -478,7 +992,7 @@ function nifty_cs_custom_theme_options() {
478
  'value' => 'flash2',
479
  'label' => 'Flash 2',
480
  ),
481
-
482
  ),
483
  'section' => 'design_and_layout',
484
  'min_max_step'=> '',
@@ -497,7 +1011,7 @@ function nifty_cs_custom_theme_options() {
497
  'class' => '',
498
  'condition' => 'disable_background_image_slider:not(off)',
499
  'operator' => 'and',
500
- 'choices' => array(
501
  array(
502
  'value' => '01.png',
503
  'label' => 'Pattern 1',
@@ -600,7 +1114,7 @@ function nifty_cs_custom_theme_options() {
600
  'type' => 'select',
601
  'section' => 'design_and_layout',
602
  'choices' => $google_webfonts_array,
603
-
604
  ),
605
  array(
606
  'id' => 'choose_heading_font',
@@ -610,7 +1124,7 @@ function nifty_cs_custom_theme_options() {
610
  'type' => 'select',
611
  'section' => 'design_and_layout',
612
  'choices' => $google_webfonts_array,
613
-
614
  ),
615
  array(
616
  'id' => 'choose_counter_font',
@@ -620,7 +1134,7 @@ function nifty_cs_custom_theme_options() {
620
  'type' => 'select',
621
  'section' => 'design_and_layout',
622
  'choices' => $google_webfonts_array,
623
-
624
  ),
625
  array(
626
  'id' => 'choose_paragraph_font',
@@ -630,7 +1144,7 @@ function nifty_cs_custom_theme_options() {
630
  'type' => 'select',
631
  'section' => 'design_and_layout',
632
  'choices' => $google_webfonts_array,
633
-
634
  ),
635
  array(
636
  'id' => 'enter_you_website_or_company_name',
@@ -639,7 +1153,7 @@ function nifty_cs_custom_theme_options() {
639
  'std' => 'ACME COMPANY',
640
  'type' => 'text',
641
  'section' => 'design_and_layout',
642
-
643
  ),
644
  array(
645
  'id' => 'enter_your_address',
@@ -648,7 +1162,7 @@ function nifty_cs_custom_theme_options() {
648
  'std' => '230 New Found lane, 8900 New City',
649
  'type' => 'text',
650
  'section' => 'design_and_layout',
651
-
652
  ),
653
  array(
654
  'id' => 'enter_your_phone_number',
@@ -657,7 +1171,7 @@ function nifty_cs_custom_theme_options() {
657
  'std' => '+555 53211 777',
658
  'type' => 'text',
659
  'section' => 'design_and_layout',
660
-
661
  ),
662
  array(
663
  'id' => 'enter_your_email_address',
@@ -666,7 +1180,7 @@ function nifty_cs_custom_theme_options() {
666
  'std' => 'someone@example.com',
667
  'type' => 'text',
668
  'section' => 'design_and_layout',
669
-
670
  ),
671
  array(
672
  'id' => 'translation_settings',
@@ -675,7 +1189,7 @@ function nifty_cs_custom_theme_options() {
675
  'std' => '',
676
  'type' => 'textblock-titled',
677
  'section' => 'translation',
678
-
679
  ),
680
  array(
681
  'id' => 'sign_up_form_intro_text',
@@ -684,7 +1198,7 @@ function nifty_cs_custom_theme_options() {
684
  'std' => 'Sign up to find out when we launch',
685
  'type' => 'text',
686
  'section' => 'translation',
687
-
688
  ),
689
  array(
690
  'id' => 'sign_up_button_text',
@@ -693,7 +1207,7 @@ function nifty_cs_custom_theme_options() {
693
  'std' => 'Sign Up',
694
  'type' => 'text',
695
  'section' => 'translation',
696
-
697
  ),
698
  array(
699
  'id' => 'social_links_intro_text',
@@ -702,7 +1216,7 @@ function nifty_cs_custom_theme_options() {
702
  'std' => 'Are you social? We are, find us below ;)',
703
  'type' => 'text',
704
  'section' => 'translation',
705
-
706
  ),
707
  array(
708
  'id' => 'enter_email_text',
@@ -711,7 +1225,7 @@ function nifty_cs_custom_theme_options() {
711
  'std' => 'Enter Email...',
712
  'type' => 'text',
713
  'section' => 'translation',
714
-
715
  ),
716
  array(
717
  'id' => 'email_confirmation___error',
@@ -720,7 +1234,7 @@ function nifty_cs_custom_theme_options() {
720
  'std' => 'Please, enter valid email address.',
721
  'type' => 'text',
722
  'section' => 'translation',
723
-
724
  ),
725
  array(
726
  'id' => 'email_confirmation___success',
@@ -729,7 +1243,7 @@ function nifty_cs_custom_theme_options() {
729
  'std' => 'You will be notified, thanks.',
730
  'type' => 'text',
731
  'section' => 'translation',
732
-
733
  ),
734
  array(
735
  'id' => 'nifty_days_translate',
@@ -738,7 +1252,7 @@ function nifty_cs_custom_theme_options() {
738
  'std' => 'days',
739
  'type' => 'text',
740
  'section' => 'translation',
741
-
742
  ),
743
  array(
744
  'id' => 'nifty_hours_translate',
@@ -747,7 +1261,7 @@ function nifty_cs_custom_theme_options() {
747
  'std' => 'hours',
748
  'type' => 'text',
749
  'section' => 'translation',
750
-
751
  ),
752
  array(
753
  'id' => 'nifty_minutes_translate',
@@ -756,7 +1270,7 @@ function nifty_cs_custom_theme_options() {
756
  'std' => 'minutes',
757
  'type' => 'text',
758
  'section' => 'translation',
759
-
760
  ),
761
  array(
762
  'id' => 'nifty_seconds_translate',
@@ -765,7 +1279,7 @@ function nifty_cs_custom_theme_options() {
765
  'std' => 'seconds',
766
  'type' => 'text',
767
  'section' => 'translation',
768
-
769
  ),
770
  array(
771
  'id' => 'social_settings',
@@ -774,67 +1288,67 @@ function nifty_cs_custom_theme_options() {
774
  'std' => '',
775
  'type' => 'textblock-titled',
776
  'section' => 'social_links',
777
-
778
  ),
779
  array(
780
  'id' => 'facebook_page_or_profile_url',
781
  'label' => 'Facebook page or profile URL',
782
  'desc' => 'Enter your full Facebook page or profile URL along with https://',
783
- 'std' => '#',
784
  'type' => 'text',
785
  'section' => 'social_links',
786
-
787
  ),
788
  array(
789
  'id' => 'twitter_url',
790
  'label' => 'Twitter URL',
791
  'desc' => 'Enter your Twitter URL along with https://',
792
- 'std' => '#',
793
  'type' => 'text',
794
  'section' => 'social_links',
795
-
796
  ),
797
  array(
798
  'id' => 'linkedin_profile_url',
799
  'label' => 'LinkedIn profile URL',
800
  'desc' => 'Enter your LinkedIn profile URL along with https://',
801
- 'std' => '#',
802
  'type' => 'text',
803
  'section' => 'social_links',
804
-
805
  ),
806
  array(
807
  'id' => 'pinterest_url',
808
  'label' => 'Pinterest URL',
809
  'desc' => 'Enter your Pinterest URL along with https://',
810
- 'std' => '#',
811
  'type' => 'text',
812
  'section' => 'social_links',
813
-
814
  ),
815
  array(
816
  'id' => 'instagram_url',
817
  'label' => 'Instagram profile URL',
818
  'desc' => 'Enter your Instagram profile URL along with https://',
819
- 'std' => '#',
820
  'type' => 'text',
821
  'section' => 'social_links',
822
-
823
  ),
824
  array(
825
  'id' => 'google___profile_or_page_url',
826
  'label' => 'Google + profile or page URL',
827
  'desc' => 'Enter your Google+ page or profile URL along with https://',
828
- 'std' => '#',
829
  'type' => 'text',
830
  'section' => 'social_links',
831
-
832
  ),
833
  array(
834
  'id' => 'documentation_and_faq',
835
  'label' => 'Documentation and FAQ',
836
  'desc' => '<h3 class="label">NIFTY COMING SOON - Documentation</strong></h3>
837
-
838
  <p>Plugin documentation will be added once the plugin reaches more mature levels. As for now we have stable version that works and offer many cool features.</p>
839
  <p>Feel free to get in touch and ask for help.
840
  <h3 class="label">RATE THE PLUGIN WITH 5 STARS</h3>
@@ -843,35 +1357,34 @@ function nifty_cs_custom_theme_options() {
843
  <p>Thanks. :)</p>
844
  <hr>
845
  <ul>
846
- <li><a href="https://themeadviser.com/nifty-coming-soon/" target="_blank">Official plugin Home page</a></li>
847
  <li><a href="https://wordpress.org/support/plugin/nifty-coming-soon-and-under-construction-page" target="_blank">WordPress Support forum</a></li>
848
- <li><a href="https://twitter.com/ThemeAdviser" target="_blank">Follow on Twitter</a></li>
849
  </ul>
850
  </p>
851
-
852
  ',
853
  'std' => '',
854
  'type' => 'textblock',
855
  'section' => 'documentation',
856
-
857
  )
858
  )
859
  );
860
-
861
-
862
-
863
  /* allow settings to be filtered before saving */
864
  $custom_settings = apply_filters( ot_settings_id() . '_args', $custom_settings );
865
-
866
  /* settings are not the same update the DB */
867
  if ( $saved_settings !== $custom_settings ) {
868
- update_option( ot_settings_id(), $custom_settings );
869
  }
870
-
871
  /* Lets OptionTree know the UI Builder is being overridden */
872
  global $ot_has_custom_theme_options;
873
  $ot_has_custom_theme_options = true;
874
-
875
  }
876
 
877
  add_filter( 'ot_show_pages', '__return_false' );
13
  /**
14
  * Build the custom settings & update OptionTree.
15
  */
16
+
17
  function nifty_cs_custom_theme_options() {
18
+
19
  /* OptionTree is not loaded yet7, or this is not an admin request */
20
  if ( ! function_exists( 'ot_settings_id' ) || ! is_admin() )
21
  return false;
22
+
23
  /**
24
+ * Get a copy of the saved settings array.
25
  */
26
+
27
  $saved_settings = get_option( ot_settings_id(), array() );
28
+
29
+
30
  // Google Fonts support
31
 
32
+
33
+ function ot_type_custom_themes() {
34
+ $themes =
35
+ array (
36
+ 0 =>
37
+ array (
38
+ 'type' => 'CSMM PRO',
39
+ 'version' => '5.005',
40
+ 'last_edit' => 'Thu, 22 Feb 2018 18:45:00 +0000',
41
+ 'name' => 'Aeroplane Company',
42
+ 'description' => 'Andrea',
43
+ 'frontpage' => '1',
44
+ 'status' => 'pro',
45
+ 'name_clean' => 'aeroplane-company',
46
+ ),
47
+ 1 =>
48
+ array (
49
+ 'type' => 'CSMM PRO',
50
+ 'version' => '15.05',
51
+ 'last_edit' => 'Fri, 02 Mar 2018 12:43:04 +0000',
52
+ 'name' => 'Animated Clock',
53
+ 'description' => 'Andrea',
54
+ 'frontpage' => '0',
55
+ 'status' => 'pro',
56
+ 'name_clean' => 'animated-clock',
57
+ ),
58
+ 2 =>
59
+ array (
60
+ 'type' => 'CSMM PRO',
61
+ 'version' => '5.05',
62
+ 'last_edit' => 'Wed, 28 Feb 2018 10:30:46 +0000',
63
+ 'name' => 'Bicycle Race',
64
+ 'description' => 'Andrea',
65
+ 'frontpage' => '0',
66
+ 'status' => 'agency',
67
+ 'name_clean' => 'bicycle-race',
68
+ ),
69
+ 3 =>
70
+ array (
71
+ 'type' => 'CSMM PRO',
72
+ 'version' => '5.005',
73
+ 'last_edit' => 'Sat, 24 Feb 2018 11:48:50 +0000',
74
+ 'name' => 'Bitcoin Miners',
75
+ 'description' => '',
76
+ 'frontpage' => '1',
77
+ 'status' => 'agency',
78
+ 'name_clean' => 'bitcoin-miners',
79
+ ),
80
+ 4 =>
81
+ array (
82
+ 'type' => 'CSMM PRO',
83
+ 'version' => '5.005',
84
+ 'last_edit' => 'Mon, 26 Feb 2018 18:01:26 +0000',
85
+ 'name' => 'Blogging',
86
+ 'description' => 'Andrea',
87
+ 'frontpage' => '1',
88
+ 'status' => 'agency',
89
+ 'name_clean' => 'blogging',
90
+ ),
91
+ 5 =>
92
+ array (
93
+ 'type' => 'CSMM PRO',
94
+ 'version' => '5.005',
95
+ 'last_edit' => 'Tue, 27 Feb 2018 09:56:05 +0000',
96
+ 'name' => 'Book Lovers',
97
+ 'description' => 'Andrea',
98
+ 'frontpage' => '1',
99
+ 'status' => 'agency',
100
+ 'name_clean' => 'book-lovers',
101
+ ),
102
+ 6 =>
103
+ array (
104
+ 'type' => 'CSMM PRO',
105
+ 'version' => '5.001',
106
+ 'last_edit' => 'Thu, 15 Feb 2018 16:24:58 +0000',
107
+ 'name' => 'Business Company',
108
+ 'description' => '',
109
+ 'frontpage' => '0',
110
+ 'status' => 'agency',
111
+ 'name_clean' => 'business-company',
112
+ ),
113
+ 7 =>
114
+ array (
115
+ 'type' => 'CSMM PRO',
116
+ 'version' => '5.005',
117
+ 'last_edit' => 'Thu, 22 Feb 2018 18:45:40 +0000',
118
+ 'name' => 'Coffee Shop',
119
+ 'description' => 'Andrea',
120
+ 'frontpage' => '1',
121
+ 'status' => 'agency',
122
+ 'name_clean' => 'coffee-shop',
123
+ ),
124
+ 8 =>
125
+ array (
126
+ 'type' => 'CSMM PRO',
127
+ 'version' => '5.005',
128
+ 'last_edit' => 'Mon, 26 Feb 2018 20:41:31 +0000',
129
+ 'name' => 'Default',
130
+ 'description' => 'Default settings, nothing more.',
131
+ 'frontpage' => '0',
132
+ 'status' => 'pro',
133
+ 'name_clean' => 'default',
134
+ ),
135
+ 9 =>
136
+ array (
137
+ 'type' => 'CSMM PRO',
138
+ 'version' => '15.05',
139
+ 'last_edit' => 'Fri, 02 Mar 2018 13:12:54 +0000',
140
+ 'name' => 'Dental Clinic',
141
+ 'description' => 'Andrea',
142
+ 'frontpage' => '1',
143
+ 'status' => 'agency',
144
+ 'name_clean' => 'dental-clinic',
145
+ ),
146
+ 10 =>
147
+ array (
148
+ 'type' => 'CSMM PRO',
149
+ 'version' => '5.001',
150
+ 'last_edit' => 'Tue, 20 Feb 2018 09:14:59 +0000',
151
+ 'name' => 'Dog Training and Behavior Consulting',
152
+ 'description' => '',
153
+ 'frontpage' => '1',
154
+ 'status' => 'agency',
155
+ 'name_clean' => 'dog-training-and-behavior-consulting',
156
+ ),
157
+ 11 =>
158
+ array (
159
+ 'type' => 'CSMM PRO',
160
+ 'version' => '15.05',
161
+ 'last_edit' => 'Fri, 02 Mar 2018 12:33:55 +0000',
162
+ 'name' => 'Flower Shop',
163
+ 'description' => '',
164
+ 'frontpage' => '1',
165
+ 'status' => 'agency',
166
+ 'name_clean' => 'flower-shop',
167
+ ),
168
+ 12 =>
169
+ array (
170
+ 'type' => 'CSMM PRO',
171
+ 'version' => '5.05',
172
+ 'last_edit' => 'Wed, 28 Feb 2018 11:20:03 +0000',
173
+ 'name' => 'Homemade Chocolate Gifts',
174
+ 'description' => 'Andrea',
175
+ 'frontpage' => '0',
176
+ 'status' => 'pro',
177
+ 'name_clean' => 'homemade-chocolate-gifts',
178
+ ),
179
+ 13 =>
180
+ array (
181
+ 'type' => 'CSMM PRO',
182
+ 'version' => '15.05',
183
+ 'last_edit' => 'Fri, 02 Mar 2018 12:59:44 +0000',
184
+ 'name' => 'Interior Design',
185
+ 'description' => 'Andrea',
186
+ 'frontpage' => '1',
187
+ 'status' => 'agency',
188
+ 'name_clean' => 'interior-design',
189
+ ),
190
+ 14 =>
191
+ array (
192
+ 'type' => 'CSMM PRO',
193
+ 'version' => '5.005',
194
+ 'last_edit' => 'Fri, 23 Feb 2018 12:01:58 +0000',
195
+ 'name' => 'LEGO Bricks',
196
+ 'description' => '',
197
+ 'frontpage' => '1',
198
+ 'status' => 'pro',
199
+ 'name_clean' => 'lego-bricks',
200
+ ),
201
+ 15 =>
202
+ array (
203
+ 'type' => 'CSMM PRO',
204
+ 'version' => '5.005',
205
+ 'last_edit' => 'Fri, 23 Feb 2018 11:58:49 +0000',
206
+ 'name' => 'Lonely Road',
207
+ 'description' => 'Andrea',
208
+ 'frontpage' => '1',
209
+ 'status' => 'agency',
210
+ 'name_clean' => 'lonely-road',
211
+ ),
212
+ 16 =>
213
+ array (
214
+ 'type' => 'CSMM PRO',
215
+ 'version' => '5.001',
216
+ 'last_edit' => 'Thu, 15 Feb 2018 18:05:56 +0000',
217
+ 'name' => 'Luxury Car',
218
+ 'description' => '',
219
+ 'frontpage' => '1',
220
+ 'status' => 'pro',
221
+ 'name_clean' => 'luxury-car',
222
+ ),
223
+ 17 =>
224
+ array (
225
+ 'type' => 'CSMM PRO',
226
+ 'version' => '5.005',
227
+ 'last_edit' => 'Mon, 26 Feb 2018 18:31:18 +0000',
228
+ 'name' => 'Maintenance Mode',
229
+ 'description' => 'Andrea',
230
+ 'frontpage' => '0',
231
+ 'status' => 'pro',
232
+ 'name_clean' => 'maintenance-mode',
233
+ ),
234
+ 18 =>
235
+ array (
236
+ 'type' => 'CSMM PRO',
237
+ 'version' => '5.005',
238
+ 'last_edit' => 'Mon, 26 Feb 2018 17:59:30 +0000',
239
+ 'name' => 'Makeup Artist Training',
240
+ 'description' => 'Andrea',
241
+ 'frontpage' => '1',
242
+ 'status' => 'agency',
243
+ 'name_clean' => 'makeup-artist-training',
244
+ ),
245
+ 19 =>
246
+ array (
247
+ 'type' => 'CSMM PRO',
248
+ 'version' => '15.05',
249
+ 'last_edit' => 'Fri, 02 Mar 2018 11:54:45 +0000',
250
+ 'name' => 'Mobile Designer',
251
+ 'description' => 'Andrea',
252
+ 'frontpage' => '0',
253
+ 'status' => 'agency',
254
+ 'name_clean' => 'mobile-designer',
255
+ ),
256
+ 20 =>
257
+ array (
258
+ 'type' => 'CSMM PRO',
259
+ 'version' => '5.005',
260
+ 'last_edit' => 'Mon, 26 Feb 2018 18:04:32 +0000',
261
+ 'name' => 'Modern Blog',
262
+ 'description' => '',
263
+ 'frontpage' => '1',
264
+ 'status' => 'pro',
265
+ 'name_clean' => 'modern-blog',
266
+ ),
267
+ 21 =>
268
+ array (
269
+ 'type' => 'CSMM PRO',
270
+ 'version' => '15.05',
271
+ 'last_edit' => 'Fri, 02 Mar 2018 10:14:21 +0000',
272
+ 'name' => 'Modern Office',
273
+ 'description' => 'Andrea',
274
+ 'frontpage' => '0',
275
+ 'status' => 'agency',
276
+ 'name_clean' => 'modern-office',
277
+ ),
278
+ 22 =>
279
+ array (
280
+ 'type' => 'CSMM PRO',
281
+ 'version' => '5.001',
282
+ 'last_edit' => 'Thu, 15 Feb 2018 18:56:47 +0000',
283
+ 'name' => 'Mountain Slide',
284
+ 'description' => '',
285
+ 'frontpage' => '1',
286
+ 'status' => 'pro',
287
+ 'name_clean' => 'mountain-slide',
288
+ ),
289
+ 23 =>
290
+ array (
291
+ 'type' => 'CSMM PRO',
292
+ 'version' => '5.05',
293
+ 'last_edit' => 'Thu, 01 Mar 2018 10:49:52 +0000',
294
+ 'name' => 'Mountain',
295
+ 'description' => 'Andrea',
296
+ 'frontpage' => '0',
297
+ 'status' => 'pro',
298
+ 'name_clean' => 'mountain',
299
+ ),
300
+ 24 =>
301
+ array (
302
+ 'type' => 'CSMM PRO',
303
+ 'version' => '15.05',
304
+ 'last_edit' => 'Fri, 02 Mar 2018 10:17:02 +0000',
305
+ 'name' => 'Nature',
306
+ 'description' => 'Andrea',
307
+ 'frontpage' => '0',
308
+ 'status' => 'agency',
309
+ 'name_clean' => 'nature',
310
+ ),
311
+ 25 =>
312
+ array (
313
+ 'type' => 'CSMM PRO',
314
+ 'version' => '15.05',
315
+ 'last_edit' => 'Fri, 02 Mar 2018 12:35:44 +0000',
316
+ 'name' => 'Office Theme',
317
+ 'description' => '',
318
+ 'frontpage' => '1',
319
+ 'status' => 'agency',
320
+ 'name_clean' => 'office-theme',
321
+ ),
322
+ 26 =>
323
+ array (
324
+ 'type' => 'CSMM PRO',
325
+ 'version' => '5.005',
326
+ 'last_edit' => 'Mon, 26 Feb 2018 18:07:28 +0000',
327
+ 'name' => 'Online Learning',
328
+ 'description' => 'Andrea',
329
+ 'frontpage' => '1',
330
+ 'status' => 'agency',
331
+ 'name_clean' => 'online-learning',
332
+ ),
333
+ 27 =>
334
+ array (
335
+ 'type' => 'CSMM PRO',
336
+ 'version' => '5.005',
337
+ 'last_edit' => 'Mon, 26 Feb 2018 18:10:05 +0000',
338
+ 'name' => 'Pancake House',
339
+ 'description' => 'Andrea',
340
+ 'frontpage' => '0',
341
+ 'status' => 'pro',
342
+ 'name_clean' => 'pancake-house',
343
+ ),
344
+ 28 =>
345
+ array (
346
+ 'type' => 'CSMM PRO',
347
+ 'version' => '5.05',
348
+ 'last_edit' => 'Wed, 28 Feb 2018 10:03:34 +0000',
349
+ 'name' => 'Parenting',
350
+ 'description' => 'Andrea',
351
+ 'frontpage' => '0',
352
+ 'status' => 'pro',
353
+ 'name_clean' => 'parenting',
354
+ ),
355
+ 29 =>
356
+ array (
357
+ 'type' => 'CSMM PRO',
358
+ 'version' => '5.001',
359
+ 'last_edit' => 'Thu, 15 Feb 2018 18:34:58 +0000',
360
+ 'name' => 'Running Blog',
361
+ 'description' => '',
362
+ 'frontpage' => '1',
363
+ 'status' => 'agency',
364
+ 'name_clean' => 'running-blog',
365
+ ),
366
+ 30 =>
367
+ array (
368
+ 'type' => 'CSMM PRO',
369
+ 'version' => '5.005',
370
+ 'last_edit' => 'Mon, 26 Feb 2018 11:17:32 +0000',
371
+ 'name' => 'Shoes Store',
372
+ 'description' => 'Andrea',
373
+ 'frontpage' => '1',
374
+ 'status' => 'agency',
375
+ 'name_clean' => 'shoes-store',
376
+ ),
377
+ 31 =>
378
+ array (
379
+ 'type' => 'CSMM PRO',
380
+ 'version' => '5.05',
381
+ 'last_edit' => 'Thu, 01 Mar 2018 11:33:14 +0000',
382
+ 'name' => 'Simple Beige Design',
383
+ 'description' => 'Andrea',
384
+ 'frontpage' => '0',
385
+ 'status' => 'pro',
386
+ 'name_clean' => 'simple-beige-design',
387
+ ),
388
+ 32 =>
389
+ array (
390
+ 'type' => 'CSMM PRO',
391
+ 'version' => '5.001',
392
+ 'last_edit' => 'Tue, 20 Feb 2018 09:14:02 +0000',
393
+ 'name' => 'Snowboarding Blog',
394
+ 'description' => '',
395
+ 'frontpage' => '1',
396
+ 'status' => 'pro',
397
+ 'name_clean' => 'snowboarding-blog',
398
+ ),
399
+ 33 =>
400
+ array (
401
+ 'type' => 'CSMM PRO',
402
+ 'version' => '5.005',
403
+ 'last_edit' => 'Fri, 23 Feb 2018 12:43:09 +0000',
404
+ 'name' => 'The Big City Newsletter',
405
+ 'description' => 'Andrea',
406
+ 'frontpage' => '1',
407
+ 'status' => 'agency',
408
+ 'name_clean' => 'the-big-city-newsletter',
409
+ ),
410
+ 34 =>
411
+ array (
412
+ 'type' => 'CSMM PRO',
413
+ 'version' => '5.001',
414
+ 'last_edit' => 'Tue, 20 Feb 2018 10:57:27 +0000',
415
+ 'name' => 'Travel Agency',
416
+ 'description' => '',
417
+ 'frontpage' => '1',
418
+ 'status' => 'pro',
419
+ 'name_clean' => 'travel-agency',
420
+ ),
421
+ 35 =>
422
+ array (
423
+ 'type' => 'CSMM PRO',
424
+ 'version' => '15.05',
425
+ 'last_edit' => 'Fri, 02 Mar 2018 12:39:22 +0000',
426
+ 'name' => 'Travel Blog',
427
+ 'description' => 'Andrea',
428
+ 'frontpage' => '1',
429
+ 'status' => 'agency',
430
+ 'name_clean' => 'travel-blog',
431
+ ),
432
+ 36 =>
433
+ array (
434
+ 'type' => 'CSMM PRO',
435
+ 'version' => '5.001',
436
+ 'last_edit' => 'Mon, 19 Feb 2018 12:31:48 +0000',
437
+ 'name' => 'Video Production',
438
+ 'description' => '',
439
+ 'frontpage' => '1',
440
+ 'status' => 'pro',
441
+ 'name_clean' => 'video-production',
442
+ ),
443
+ 37 =>
444
+ array (
445
+ 'type' => 'CSMM PRO',
446
+ 'version' => '5.005',
447
+ 'last_edit' => 'Mon, 26 Feb 2018 19:54:07 +0000',
448
+ 'name' => 'Webinar',
449
+ 'description' => 'Andrea',
450
+ 'frontpage' => '1',
451
+ 'status' => 'agency',
452
+ 'name_clean' => 'webinar',
453
+ ),
454
+ 38 =>
455
+ array (
456
+ 'type' => 'CSMM PRO',
457
+ 'version' => '5.005',
458
+ 'last_edit' => 'Fri, 23 Feb 2018 11:53:23 +0000',
459
+ 'name' => 'Wedding Blog',
460
+ 'description' => 'Andrea',
461
+ 'frontpage' => '1',
462
+ 'status' => 'agency',
463
+ 'name_clean' => 'wedding-blog',
464
+ ),
465
+ 39 =>
466
+ array (
467
+ 'type' => 'CSMM PRO',
468
+ 'version' => '15.05',
469
+ 'last_edit' => 'Fri, 02 Mar 2018 12:36:42 +0000',
470
+ 'name' => 'Workplace',
471
+ 'description' => 'Andrea',
472
+ 'frontpage' => '1',
473
+ 'status' => 'agency',
474
+ 'name_clean' => 'workplace',
475
+ ),
476
+ );
477
+
478
+ $path = plugins_url('', __FILE__);
479
+
480
+ echo '<p><b>Need to quickly set up a new site with top notch SEO that will get you indexed and ranked quickly? Check out our PRO themes.</b></p>';
481
+
482
+ foreach ($themes as $theme) {
483
+ echo '<div class="theme-thumb" data-theme="' . $theme['name_clean'] . '">';
484
+ if ($theme['status'] != 'free') {
485
+ echo '<a href="' . nifty_generate_web_link('preview-theme-thumb-' . $theme['name_clean'], 'theme-preview', array('theme' => $theme['name_clean'])) . '" target="_blank"><img src="' . $path . '/assets/images/themes/pro/' . $theme['name_clean'] . '.jpg" alt="Preview ' . $theme['name'] . '" title="Preview ' . $theme['name'] . '"></a>';
486
+ } else {
487
+ echo '<img src="' . CSMM_URL . '/framework/admin/img/themes/' . $theme['name_clean'] . '.jpg" alt="' . $theme['name'] . '" title="' . $theme['name'] . '">';
488
+ }
489
+ echo '<span class="name">' . $theme['name'] . '</span>';
490
+ echo '<span name="actions">';
491
+ if ($theme['status'] != 'free') {
492
+ echo '<a href="' . nifty_generate_web_link('get-theme-' . $theme['name_clean']) . '" class="button button-primary" target="_blank">Get this theme</a>&nbsp; &nbsp;';
493
+ echo '<a target="_blank" class="button button-secondary" href="' . nifty_generate_web_link('preview-theme-' . $theme['name_clean'], 'theme-preview', array('theme' => $theme['name_clean'])) . '">Preview</a>';
494
+ } else {
495
+ echo '<a href="' . add_query_arg(array('action' => 'csmm_activate_theme', 'theme' => $theme['name_clean'], 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php')) . '" class="signals-btn confirm-action" data-confirm="Are you sure you want to activate the selected theme? Customizations you made on the current design will be lost.">Activate</a>&nbsp; &nbsp;';
496
+ }
497
+ echo '</span>';
498
+ if ($theme['status'] != 'free') {
499
+ echo '<div class="ribbon"><i>PRO</i></div>';
500
+ }
501
+ echo '</div>';
502
+
503
+ } // foreach theme
504
+ }
505
+
506
+
507
+ // helper function to generate tagged buy links
508
+ function nifty_generate_web_link($placement = '', $page = '/', $params = array(), $anchor = '') {
509
+ $base_url = 'https://comingsoonwp.com';
510
+
511
+ if ('/' != $page) {
512
+ $page = '/' . trim($page, '/') . '/';
513
+ }
514
+ if ($page == '//') {
515
+ $page = '/';
516
+ }
517
+
518
+ $parts = array_merge(array('utm_source' => 'nifty-free', 'utm_medium' => 'plugin', 'utm_content' => $placement, 'utm_campaign' => 'nifty-free-v' . nifty_get_plugin_version()), $params);
519
+
520
+ if (!empty($anchor)) {
521
+ $anchor = '#' . trim($anchor, '#');
522
+ }
523
+
524
+ $out = $base_url . $page . '?' . http_build_query($parts, '', '&amp;') . $anchor;
525
+
526
+ return $out;
527
+ } // generate_web_link
528
+
529
+
530
  /**
531
  * Returns an array of system fonts
532
  * Feel free to edit this, update the font fallbacks, etc.
533
+ */
534
+ $google_fonts = nifty_cs_get_google_webfonts();
535
  foreach( $google_fonts as $font ) {
536
  $google_webfonts_array[$font['family']]['label'] = $font['family'];
537
  $google_webfonts_array[$font['family']]['value'] = $font['family'];
538
+ }
539
+
540
+
541
+ $custom_settings = array(
542
+ 'contextual_help' => array(
543
  'sidebar' => ''
544
  ),
545
+ 'sections' => array(
546
  array(
547
  'id' => 'general_settings',
548
  'title' => 'General Settings'
549
  ),
550
+ array(
551
+ 'id' => 'themes',
552
+ 'title' => 'Themes'
553
+ ),
554
  array(
555
  'id' => 'design_and_layout',
556
  'title' => 'Design and Layout'
568
  'title' => 'Documentation'
569
  )
570
  ),
571
+ 'settings' => array(
572
+ array(
573
+ 'id' => 'themes2',
574
+ 'label' => 'Themes',
575
+ 'desc' => '',
576
+ 'std' => '',
577
+ 'type' => 'custom_themes',
578
+ 'section' => 'themes',
579
+ 'min_max_step'=> '',
580
+ 'class' => '',
581
+ 'condition' => '',
582
+ 'operator' => 'and'
583
+ ),
584
  array(
585
  'id' => 'general_settings',
586
  'label' => 'General settings',
591
  'min_max_step'=> '',
592
  'class' => '',
593
  'condition' => '',
594
+
595
  'operator' => 'and'
596
  ),
597
  array(
614
  'std' => 'on',
615
  'type' => 'on-off',
616
  'section' => 'general_settings',
617
+
618
  ),
619
  array(
620
  'id' => 'enable_preloader',
623
  'std' => 'on',
624
  'type' => 'on-off',
625
  'section' => 'general_settings',
626
+
627
  ),
628
  array(
629
  'id' => 'enable_sign_up_form',
632
  'std' => 'on',
633
  'type' => 'on-off',
634
  'section' => 'general_settings',
635
+
636
  ),
637
  array(
638
  'id' => 'insert_custom_signup_form',
653
  'std' => 'on',
654
  'type' => 'on-off',
655
  'section' => 'general_settings',
656
+
657
  ),
658
  array(
659
  'id' => 'enable_social_links',
662
  'std' => 'on',
663
  'type' => 'on-off',
664
  'section' => 'general_settings',
665
+
666
  ),
667
  array(
668
  'id' => 'disable_navigation',
671
  'std' => 'on',
672
  'type' => 'on-off',
673
  'section' => 'general_settings',
674
+
675
  ),
676
  array(
677
  'id' => 'disable_animation',
680
  'std' => 'on',
681
  'type' => 'on-off',
682
  'section' => 'general_settings',
683
+
684
  ),
685
  array(
686
  'id' => 'insert_google_analytics_code',
687
  'label' => 'Google Analytics code',
688
+ 'desc' => 'Enter your Google Analytics code that will be added in your coming soon page footer. Make sure to include &lt; script &gt; tags.',
689
  'std' => '',
690
  'type' => 'javascript',
691
  'section' => 'general_settings',
692
+
693
  ),
694
  array(
695
  'id' => 'insert_additional_css',
698
  'std' => '',
699
  'type' => 'css',
700
  'section' => 'general_settings',
701
+
702
  ),
703
+
704
  array(
705
  'id' => 'design_and_layout_settings',
706
  'label' => 'Design and Layout settings',
708
  'std' => '',
709
  'type' => 'textblock-titled',
710
  'section' => 'design_and_layout',
711
+
712
  ),
713
  array(
714
  'id' => 'disable_logo',
717
  'std' => 'on',
718
  'type' => 'on-off',
719
  'section' => 'design_and_layout',
720
+
721
  ),
722
  array(
723
  'id' => 'upload_your_logo',
752
  'std' => 'Our website is coming very soon',
753
  'type' => 'text',
754
  'section' => 'design_and_layout',
755
+
756
  ),
757
  array(
758
  'id' => 'enter_second_coming_soon_message',
761
  'std' => 'Feel free to drop-by any time soon',
762
  'type' => 'text',
763
  'section' => 'design_and_layout',
764
+
765
  ),
766
  array(
767
  'id' => 'setup_the_count_down_timer',
770
  'std' => '',
771
  'type' => 'date-time-picker',
772
  'section' => 'design_and_layout',
773
+
774
  ),
775
  array(
776
  'id' => 'background_color',
779
  'std' => '',
780
  'type' => 'colorpicker',
781
  'section' => 'design_and_layout',
782
+
783
  ),
784
  array(
785
  'id' => 'sign_up_button_color',
788
  'std' => '#9e0039',
789
  'type' => 'colorpicker',
790
  'section' => 'design_and_layout',
791
+
792
  ),
793
  array(
794
  'id' => 'sign_up_button_color_hover',
797
  'std' => '#9e0039',
798
  'type' => 'colorpicker',
799
  'section' => 'design_and_layout',
800
+
801
  ),
802
  array(
803
  'id' => 'disable_background_image_slider',
806
  'std' => 'on',
807
  'type' => 'on-off',
808
  'section' => 'design_and_layout',
809
+
810
  ),
811
  array(
812
  'id' => 'background_slider_time',
875
  'desc' => 'Here you can select the desired animation between background slides, you can use the Random option and use all.',
876
  'std' => 'random',
877
  'type' => 'select',
878
+ 'choices' => array(
879
  array(
880
  'value' => 'random',
881
  'label' => 'Random',
992
  'value' => 'flash2',
993
  'label' => 'Flash 2',
994
  ),
995
+
996
  ),
997
  'section' => 'design_and_layout',
998
  'min_max_step'=> '',
1011
  'class' => '',
1012
  'condition' => 'disable_background_image_slider:not(off)',
1013
  'operator' => 'and',
1014
+ 'choices' => array(
1015
  array(
1016
  'value' => '01.png',
1017
  'label' => 'Pattern 1',
1114
  'type' => 'select',
1115
  'section' => 'design_and_layout',
1116
  'choices' => $google_webfonts_array,
1117
+
1118
  ),
1119
  array(
1120
  'id' => 'choose_heading_font',
1124
  'type' => 'select',
1125
  'section' => 'design_and_layout',
1126
  'choices' => $google_webfonts_array,
1127
+
1128
  ),
1129
  array(
1130
  'id' => 'choose_counter_font',
1134
  'type' => 'select',
1135
  'section' => 'design_and_layout',
1136
  'choices' => $google_webfonts_array,
1137
+
1138
  ),
1139
  array(
1140
  'id' => 'choose_paragraph_font',
1144
  'type' => 'select',
1145
  'section' => 'design_and_layout',
1146
  'choices' => $google_webfonts_array,
1147
+
1148
  ),
1149
  array(
1150
  'id' => 'enter_you_website_or_company_name',
1153
  'std' => 'ACME COMPANY',
1154
  'type' => 'text',
1155
  'section' => 'design_and_layout',
1156
+
1157
  ),
1158
  array(
1159
  'id' => 'enter_your_address',
1162
  'std' => '230 New Found lane, 8900 New City',
1163
  'type' => 'text',
1164
  'section' => 'design_and_layout',
1165
+
1166
  ),
1167
  array(
1168
  'id' => 'enter_your_phone_number',
1171
  'std' => '+555 53211 777',
1172
  'type' => 'text',
1173
  'section' => 'design_and_layout',
1174
+
1175
  ),
1176
  array(
1177
  'id' => 'enter_your_email_address',
1180
  'std' => 'someone@example.com',
1181
  'type' => 'text',
1182
  'section' => 'design_and_layout',
1183
+
1184
  ),
1185
  array(
1186
  'id' => 'translation_settings',
1189
  'std' => '',
1190
  'type' => 'textblock-titled',
1191
  'section' => 'translation',
1192
+
1193
  ),
1194
  array(
1195
  'id' => 'sign_up_form_intro_text',
1198
  'std' => 'Sign up to find out when we launch',
1199
  'type' => 'text',
1200
  'section' => 'translation',
1201
+
1202
  ),
1203
  array(
1204
  'id' => 'sign_up_button_text',
1207
  'std' => 'Sign Up',
1208
  'type' => 'text',
1209
  'section' => 'translation',
1210
+
1211
  ),
1212
  array(
1213
  'id' => 'social_links_intro_text',
1216
  'std' => 'Are you social? We are, find us below ;)',
1217
  'type' => 'text',
1218
  'section' => 'translation',
1219
+
1220
  ),
1221
  array(
1222
  'id' => 'enter_email_text',
1225
  'std' => 'Enter Email...',
1226
  'type' => 'text',
1227
  'section' => 'translation',
1228
+
1229
  ),
1230
  array(
1231
  'id' => 'email_confirmation___error',
1234
  'std' => 'Please, enter valid email address.',
1235
  'type' => 'text',
1236
  'section' => 'translation',
1237
+
1238
  ),
1239
  array(
1240
  'id' => 'email_confirmation___success',
1243
  'std' => 'You will be notified, thanks.',
1244
  'type' => 'text',
1245
  'section' => 'translation',
1246
+
1247
  ),
1248
  array(
1249
  'id' => 'nifty_days_translate',
1252
  'std' => 'days',
1253
  'type' => 'text',
1254
  'section' => 'translation',
1255
+
1256
  ),
1257
  array(
1258
  'id' => 'nifty_hours_translate',
1261
  'std' => 'hours',
1262
  'type' => 'text',
1263
  'section' => 'translation',
1264
+
1265
  ),
1266
  array(
1267
  'id' => 'nifty_minutes_translate',
1270
  'std' => 'minutes',
1271
  'type' => 'text',
1272
  'section' => 'translation',
1273
+
1274
  ),
1275
  array(
1276
  'id' => 'nifty_seconds_translate',
1279
  'std' => 'seconds',
1280
  'type' => 'text',
1281
  'section' => 'translation',
1282
+
1283
  ),
1284
  array(
1285
  'id' => 'social_settings',
1288
  'std' => '',
1289
  'type' => 'textblock-titled',
1290
  'section' => 'social_links',
1291
+
1292
  ),
1293
  array(
1294
  'id' => 'facebook_page_or_profile_url',
1295
  'label' => 'Facebook page or profile URL',
1296
  'desc' => 'Enter your full Facebook page or profile URL along with https://',
1297
+ 'std' => '#link',
1298
  'type' => 'text',
1299
  'section' => 'social_links',
1300
+
1301
  ),
1302
  array(
1303
  'id' => 'twitter_url',
1304
  'label' => 'Twitter URL',
1305
  'desc' => 'Enter your Twitter URL along with https://',
1306
+ 'std' => '#link',
1307
  'type' => 'text',
1308
  'section' => 'social_links',
1309
+
1310
  ),
1311
  array(
1312
  'id' => 'linkedin_profile_url',
1313
  'label' => 'LinkedIn profile URL',
1314
  'desc' => 'Enter your LinkedIn profile URL along with https://',
1315
+ 'std' => '',
1316
  'type' => 'text',
1317
  'section' => 'social_links',
1318
+
1319
  ),
1320
  array(
1321
  'id' => 'pinterest_url',
1322
  'label' => 'Pinterest URL',
1323
  'desc' => 'Enter your Pinterest URL along with https://',
1324
+ 'std' => '',
1325
  'type' => 'text',
1326
  'section' => 'social_links',
1327
+
1328
  ),
1329
  array(
1330
  'id' => 'instagram_url',
1331
  'label' => 'Instagram profile URL',
1332
  'desc' => 'Enter your Instagram profile URL along with https://',
1333
+ 'std' => '#link',
1334
  'type' => 'text',
1335
  'section' => 'social_links',
1336
+
1337
  ),
1338
  array(
1339
  'id' => 'google___profile_or_page_url',
1340
  'label' => 'Google + profile or page URL',
1341
  'desc' => 'Enter your Google+ page or profile URL along with https://',
1342
+ 'std' => '',
1343
  'type' => 'text',
1344
  'section' => 'social_links',
1345
+
1346
  ),
1347
  array(
1348
  'id' => 'documentation_and_faq',
1349
  'label' => 'Documentation and FAQ',
1350
  'desc' => '<h3 class="label">NIFTY COMING SOON - Documentation</strong></h3>
1351
+
1352
  <p>Plugin documentation will be added once the plugin reaches more mature levels. As for now we have stable version that works and offer many cool features.</p>
1353
  <p>Feel free to get in touch and ask for help.
1354
  <h3 class="label">RATE THE PLUGIN WITH 5 STARS</h3>
1357
  <p>Thanks. :)</p>
1358
  <hr>
1359
  <ul>
 
1360
  <li><a href="https://wordpress.org/support/plugin/nifty-coming-soon-and-under-construction-page" target="_blank">WordPress Support forum</a></li>
1361
+ <li><a href="https://twitter.com/WebFactoryLtd" target="_blank">Follow on Twitter</a></li>
1362
  </ul>
1363
  </p>
1364
+
1365
  ',
1366
  'std' => '',
1367
  'type' => 'textblock',
1368
  'section' => 'documentation',
1369
+
1370
  )
1371
  )
1372
  );
1373
+
1374
+
1375
+
1376
  /* allow settings to be filtered before saving */
1377
  $custom_settings = apply_filters( ot_settings_id() . '_args', $custom_settings );
1378
+
1379
  /* settings are not the same update the DB */
1380
  if ( $saved_settings !== $custom_settings ) {
1381
+ update_option( ot_settings_id(), $custom_settings );
1382
  }
1383
+
1384
  /* Lets OptionTree know the UI Builder is being overridden */
1385
  global $ot_has_custom_theme_options;
1386
  $ot_has_custom_theme_options = true;
1387
+
1388
  }
1389
 
1390
  add_filter( 'ot_show_pages', '__return_false' );
admin/ot-loader.php CHANGED
@@ -14,17 +14,17 @@
14
  * Forces Plugin Mode when OptionTree is already loaded and displays an admin notice.
15
  */
16
  if ( class_exists( 'OT_Loader' ) && defined( 'OT_PLUGIN_MODE' ) && OT_PLUGIN_MODE == true ) {
17
-
18
  add_filter( 'ot_theme_mode', '__return_false', 999 );
19
-
20
  function ot_conflict_notice() {
21
-
22
  echo '<div class="error"><p>' . __( 'OptionTree is installed as a plugin and also embedded in your current theme. Please deactivate the plugin to load the theme dependent version of OptionTree, and remove this warning.', 'option-tree' ) . '</p></div>';
23
-
24
  }
25
-
26
  add_action( 'admin_notices', 'ot_conflict_notice' );
27
-
28
  }
29
 
30
  /**
@@ -37,7 +37,7 @@ if ( class_exists( 'OT_Loader' ) && defined( 'OT_PLUGIN_MODE' ) && OT_PLUGIN_MOD
37
  if ( ! class_exists( 'OT_Loader' ) ) {
38
 
39
  class OT_Loader {
40
-
41
  /**
42
  * PHP5 constructor method.
43
  *
@@ -49,15 +49,15 @@ if ( ! class_exists( 'OT_Loader' ) ) {
49
  * @since 2.0
50
  */
51
  public function __construct() {
52
-
53
  /* load languages */
54
  $this->load_languages();
55
-
56
  /* load OptionTree */
57
  add_action( 'after_setup_theme', array( $this, 'load_option_tree' ), 1 );
58
-
59
  }
60
-
61
  /**
62
  * Load the languages before everything else.
63
  *
@@ -67,16 +67,16 @@ if ( ! class_exists( 'OT_Loader' ) ) {
67
  * @since 2.1.3
68
  */
69
  private function load_languages() {
70
-
71
  /**
72
  * A quick check to see if we're in plugin mode.
73
  *
74
  * @since 2.1.3
75
  */
76
  define( 'OT_PLUGIN_MODE', strpos( dirname( __FILE__ ), 'plugins' . DIRECTORY_SEPARATOR . basename( dirname( __FILE__ ) ) ) !== false ? true : false );
77
-
78
  /**
79
- * Path to the languages directory.
80
  *
81
  * This path will be relative in plugin mode and absolute in theme mode.
82
  *
@@ -84,40 +84,40 @@ if ( ! class_exists( 'OT_Loader' ) ) {
84
  * @updated 2.4.1
85
  */
86
  if ( OT_PLUGIN_MODE ) {
87
-
88
  define( 'OT_LANG_DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) . trailingslashit( 'languages' ) );
89
-
90
  } else {
91
-
92
  if ( apply_filters( 'ot_child_theme_mode', false ) == true ) {
93
-
94
  $path = @explode( get_stylesheet(), str_replace( '\\', '/', dirname( __FILE__ ) ) );
95
  $path = ltrim( end( $path ), '/' );
96
  define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_stylesheet_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
97
-
98
  } else {
99
-
100
  $path = @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) );
101
  $path = ltrim( end( $path ), '/' );
102
  define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
103
-
104
  }
105
-
106
  }
107
 
108
  /* load the text domain */
109
  if ( OT_PLUGIN_MODE ) {
110
-
111
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
112
-
113
  } else {
114
-
115
  add_action( 'after_setup_theme', array( $this, 'load_textdomain' ) );
116
-
117
  }
118
-
119
  }
120
-
121
  /**
122
  * Load the text domain.
123
  *
@@ -127,21 +127,21 @@ if ( ! class_exists( 'OT_Loader' ) ) {
127
  * @since 2.0
128
  */
129
  public function load_textdomain() {
130
-
131
  if ( OT_PLUGIN_MODE ) {
132
-
133
  load_plugin_textdomain( 'option-tree', false, OT_LANG_DIR );
134
-
135
  } else {
136
-
137
  load_theme_textdomain( 'option-tree', OT_LANG_DIR );
138
-
139
  }
140
-
141
  }
142
-
143
- /**
144
- * Load OptionTree on the 'after_setup_theme' action. Then filters will
145
  * be availble to the theme, and not only when in Theme Mode.
146
  *
147
  * @return void
@@ -150,25 +150,25 @@ if ( ! class_exists( 'OT_Loader' ) ) {
150
  * @since 2.1.2
151
  */
152
  public function load_option_tree() {
153
-
154
  /* setup the constants */
155
  $this->constants();
156
-
157
  /* include the required admin files */
158
  $this->admin_includes();
159
-
160
  /* include the required files */
161
  $this->includes();
162
-
163
  /* hook into WordPress */
164
  $this->hooks();
165
-
166
  }
167
 
168
  /**
169
  * Constants
170
  *
171
- * Defines the constants for use within OptionTree. Constants
172
  * are prefixed with 'OT_' to avoid any naming collisions.
173
  *
174
  * @return void
@@ -177,36 +177,36 @@ if ( ! class_exists( 'OT_Loader' ) ) {
177
  * @since 2.0
178
  */
179
  private function constants() {
180
-
181
  /**
182
  * Current Version number.
183
  */
184
  define( 'OT_VERSION', '1.1.2' );
185
-
186
  /**
187
  * For developers: Theme mode.
188
  *
189
  * Run a filter and set to true to enable OptionTree theme mode.
190
- * You must have this files parent directory inside of
191
- * your themes root directory. As well, you must include
192
  * a reference to this file in your themes functions.php.
193
  *
194
  * @since 2.0
195
  */
196
  define( 'OT_THEME_MODE', apply_filters( 'ot_theme_mode', false ) );
197
-
198
  /**
199
  * For developers: Child Theme mode. TODO document
200
  *
201
  * Run a filter and set to true to enable OptionTree child theme mode.
202
- * You must have this files parent directory inside of
203
- * your themes root directory. As well, you must include
204
  * a reference to this file in your themes functions.php.
205
  *
206
  * @since 2.0.15
207
  */
208
  define( 'OT_CHILD_THEME_MODE', apply_filters( 'ot_child_theme_mode', false ) );
209
-
210
  /**
211
  * For developers: Show Pages.
212
  *
@@ -216,7 +216,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
216
  * @since 2.0
217
  */
218
  define( 'OT_SHOW_PAGES', apply_filters( 'ot_show_pages', true ) );
219
-
220
  /**
221
  * For developers: Show Theme Options UI Builder
222
  *
@@ -226,7 +226,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
226
  * @since 2.1
227
  */
228
  define( 'OT_SHOW_OPTIONS_UI', apply_filters( 'ot_show_options_ui', true ) );
229
-
230
  /**
231
  * For developers: Show Settings Import
232
  *
@@ -236,7 +236,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
236
  * @since 2.1
237
  */
238
  define( 'OT_SHOW_SETTINGS_IMPORT', apply_filters( 'ot_show_settings_import', true ) );
239
-
240
  /**
241
  * For developers: Show Settings Export
242
  *
@@ -246,7 +246,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
246
  * @since 2.1
247
  */
248
  define( 'OT_SHOW_SETTINGS_EXPORT', apply_filters( 'ot_show_settings_export', true ) );
249
-
250
  /**
251
  * For developers: Show New Layout.
252
  *
@@ -256,7 +256,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
256
  * @since 2.0.10
257
  */
258
  define( 'OT_SHOW_NEW_LAYOUT', apply_filters( 'ot_show_new_layout', true ) );
259
-
260
  /**
261
  * For developers: Show Documentation
262
  *
@@ -265,17 +265,17 @@ if ( ! class_exists( 'OT_Loader' ) ) {
265
  * @since 2.1
266
  */
267
  define( 'OT_SHOW_DOCS', apply_filters( 'ot_show_docs', true ) );
268
-
269
  /**
270
  * For developers: Custom Theme Option page
271
  *
272
- * Run a filter and set to false if you want to hide the OptionTree
273
  * Theme Option page and build your own.
274
  *
275
  * @since 2.1
276
  */
277
  define( 'OT_USE_THEME_OPTIONS', apply_filters( 'ot_use_theme_options', true ) );
278
-
279
  /**
280
  * For developers: Meta Boxes.
281
  *
@@ -285,7 +285,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
285
  * @since 2.0
286
  */
287
  define( 'OT_META_BOXES', apply_filters( 'ot_meta_boxes', true ) );
288
-
289
  /**
290
  * For developers: Allow Unfiltered HTML in all the textareas.
291
  *
@@ -301,19 +301,19 @@ if ( ! class_exists( 'OT_Loader' ) ) {
301
  /**
302
  * For developers: Post Formats.
303
  *
304
- * Run a filter and set to true if you want OptionTree
305
  * to load meta boxes for post formats.
306
  *
307
  * @since 2.4.0
308
  */
309
  define( 'OT_POST_FORMATS', apply_filters( 'ot_post_formats', false ) );
310
-
311
  /**
312
  * Check if in theme mode.
313
  *
314
- * If OT_THEME_MODE and OT_CHILD_THEME_MODE is false, set the
315
- * directory path & URL like any other plugin. Otherwise, use
316
- * the parent or child themes root directory.
317
  *
318
  * @since 2.0
319
  */
@@ -331,7 +331,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
331
  define( 'OT_URL', trailingslashit( trailingslashit( get_template_directory_uri() ) . $path ) );
332
  }
333
  }
334
-
335
  /**
336
  * Template directory URI for the current theme.
337
  *
@@ -342,9 +342,9 @@ if ( ! class_exists( 'OT_Loader' ) ) {
342
  } else {
343
  define( 'OT_THEME_URL', get_template_directory_uri() );
344
  }
345
-
346
  }
347
-
348
  /**
349
  * Include admin files
350
  *
@@ -356,46 +356,46 @@ if ( ! class_exists( 'OT_Loader' ) ) {
356
  * @since 2.0
357
  */
358
  private function admin_includes() {
359
-
360
  /* exit early if we're not on an admin page */
361
  if ( ! is_admin() )
362
  return false;
363
-
364
  /* global include files */
365
- $files = array(
366
  'ot-functions-admin',
367
  'ot-functions-option-types',
368
  'ot-functions-compat',
369
  'ot-settings-api'
370
  );
371
-
372
  /* include the meta box api */
373
  if ( OT_META_BOXES == true ) {
374
  $files[] = 'ot-meta-box-api';
375
  }
376
-
377
  /* include the post formats api */
378
  if ( OT_META_BOXES == true && OT_POST_FORMATS == true ) {
379
  $files[] = 'ot-post-formats-api';
380
  }
381
-
382
  /* include the settings & docs pages */
383
  if ( OT_SHOW_PAGES == true ) {
384
  $files[] = 'ot-functions-settings-page';
385
  $files[] = 'ot-functions-docs-page';
386
  }
387
-
388
  /* include the cleanup api */
389
  $files[] = 'ot-cleanup-api';
390
-
391
  /* require the files */
392
  foreach ( $files as $file ) {
393
  $this->load_file( OT_DIR . "includes" . DIRECTORY_SEPARATOR . "{$file}.php" );
394
  }
395
-
396
  /* Registers the Theme Option page */
397
  add_action( 'init', 'ot_register_theme_options_page' );
398
-
399
  /* Registers the Settings page */
400
  if ( OT_SHOW_PAGES == true ) {
401
  add_action( 'init', 'ot_register_settings_page' );
@@ -403,13 +403,13 @@ if ( ! class_exists( 'OT_Loader' ) ) {
403
  /* global CSS */
404
  add_action( 'admin_head', array( $this, 'global_admin_css' ) );
405
  }
406
-
407
  }
408
-
409
  /**
410
  * Include front-end files
411
  *
412
- * These functions are included on every page load
413
  * incase other plugins need to access them.
414
  *
415
  * @return void
@@ -418,8 +418,8 @@ if ( ! class_exists( 'OT_Loader' ) ) {
418
  * @since 2.0
419
  */
420
  private function includes() {
421
-
422
- $files = array(
423
  'ot-functions',
424
  'ot-functions-deprecated'
425
  );
@@ -428,9 +428,9 @@ if ( ! class_exists( 'OT_Loader' ) ) {
428
  foreach ( $files as $file ) {
429
  $this->load_file( OT_DIR . "includes" . DIRECTORY_SEPARATOR . "{$file}.php" );
430
  }
431
-
432
  }
433
-
434
  /**
435
  * Execute the WordPress Hooks
436
  *
@@ -440,106 +440,106 @@ if ( ! class_exists( 'OT_Loader' ) ) {
440
  * @since 2.0
441
  */
442
  private function hooks() {
443
-
444
  // Attempt to migrate the settings
445
  if ( function_exists( 'ot_maybe_migrate_settings' ) )
446
  add_action( 'init', 'ot_maybe_migrate_settings', 1 );
447
-
448
  // Attempt to migrate the Options
449
  if ( function_exists( 'ot_maybe_migrate_options' ) )
450
  add_action( 'init', 'ot_maybe_migrate_options', 1 );
451
-
452
  // Attempt to migrate the Layouts
453
  if ( function_exists( 'ot_maybe_migrate_layouts' ) )
454
  add_action( 'init', 'ot_maybe_migrate_layouts', 1 );
455
 
456
  /* load the Meta Box assets */
457
  if ( OT_META_BOXES == true ) {
458
-
459
  /* add scripts for metaboxes to post-new.php & post.php */
460
  add_action( 'admin_print_scripts-post-new.php', 'ot_admin_scripts', 11 );
461
  add_action( 'admin_print_scripts-post.php', 'ot_admin_scripts', 11 );
462
-
463
  /* add styles for metaboxes to post-new.php & post.php */
464
  add_action( 'admin_print_styles-post-new.php', 'ot_admin_styles', 11 );
465
  add_action( 'admin_print_styles-post.php', 'ot_admin_styles', 11 );
466
-
467
  }
468
-
469
  /* Adds the Theme Option page to the admin bar */
470
-
471
-
472
  /* prepares the after save do_action */
473
  add_action( 'admin_init', 'ot_after_theme_options_save', 1 );
474
-
475
  /* default settings */
476
  add_action( 'admin_init', 'ot_default_settings', 2 );
477
-
478
  /* add xml to upload filetypes array */
479
  add_action( 'admin_init', 'ot_add_xml_to_upload_filetypes', 3 );
480
-
481
  /* import */
482
  add_action( 'admin_init', 'ot_import', 4 );
483
-
484
  /* export */
485
  add_action( 'admin_init', 'ot_export', 5 );
486
-
487
  /* save settings */
488
  add_action( 'admin_init', 'ot_save_settings', 6 );
489
-
490
  /* save layouts */
491
  add_action( 'admin_init', 'ot_modify_layouts', 7 );
492
-
493
  /* create media post */
494
  add_action( 'admin_init', 'ot_create_media_post', 8 );
495
 
496
  /* Google Fonts front-end CSS */
497
  add_action( 'wp_enqueue_scripts', 'ot_load_google_fonts_css', 1 );
498
-
499
  /* dynamic front-end CSS */
500
  add_action( 'wp_enqueue_scripts', 'ot_load_dynamic_css', 999 );
501
 
502
  /* insert theme CSS dynamically */
503
  add_action( 'ot_after_theme_options_save', 'ot_save_css' );
504
-
505
  /* AJAX call to create a new section */
506
  add_action( 'wp_ajax_add_section', array( $this, 'add_section' ) );
507
-
508
  /* AJAX call to create a new setting */
509
  add_action( 'wp_ajax_add_setting', array( $this, 'add_setting' ) );
510
-
511
  /* AJAX call to create a new contextual help */
512
  add_action( 'wp_ajax_add_the_contextual_help', array( $this, 'add_the_contextual_help' ) );
513
-
514
  /* AJAX call to create a new choice */
515
  add_action( 'wp_ajax_add_choice', array( $this, 'add_choice' ) );
516
-
517
  /* AJAX call to create a new list item setting */
518
  add_action( 'wp_ajax_add_list_item_setting', array( $this, 'add_list_item_setting' ) );
519
-
520
  /* AJAX call to create a new layout */
521
  add_action( 'wp_ajax_add_layout', array( $this, 'add_layout' ) );
522
-
523
  /* AJAX call to create a new list item */
524
  add_action( 'wp_ajax_add_list_item', array( $this, 'add_list_item' ) );
525
-
526
  /* AJAX call to create a new social link */
527
  add_action( 'wp_ajax_add_social_links', array( $this, 'add_social_links' ) );
528
 
529
  /* AJAX call to retrieve Google Font data */
530
  add_action( 'wp_ajax_ot_google_font', array( $this, 'retrieve_google_font' ) );
531
-
532
  // Adds the temporary hacktastic shortcode
533
  add_filter( 'media_view_settings', array( $this, 'shortcode' ), 10, 2 );
534
-
535
  // AJAX update
536
  add_action( 'wp_ajax_gallery_update', array( $this, 'ajax_gallery_update' ) );
537
-
538
  /* Modify the media uploader button */
539
  add_filter( 'gettext', array( $this, 'change_image_button' ), 10, 3 );
540
-
541
  }
542
-
543
  /**
544
  * Load a file
545
  *
@@ -549,21 +549,21 @@ if ( ! class_exists( 'OT_Loader' ) ) {
549
  * @since 2.0.15
550
  */
551
  private function load_file( $file ){
552
-
553
  include_once( $file );
554
-
555
  }
556
-
557
  /**
558
  * Adds the global CSS to fix the menu icon.
559
  */
560
  public function global_admin_css() {
561
  global $wp_version;
562
-
563
  $wp_38plus = version_compare( $wp_version, '3.8', '>=' ) ? true : false;
564
  $fontsize = $wp_38plus ? '20px' : '16px';
565
  $wp_38minus = '';
566
-
567
  if ( ! $wp_38plus ) {
568
  $wp_38minus = '
569
  #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image {
@@ -605,7 +605,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
605
  </style>
606
  ';
607
  }
608
-
609
  /**
610
  * AJAX utility function for adding a new section.
611
  */
@@ -613,7 +613,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
613
  echo ot_sections_view( ot_settings_id() . '[sections]', $_REQUEST['count'] );
614
  die();
615
  }
616
-
617
  /**
618
  * AJAX utility function for adding a new setting.
619
  */
@@ -621,7 +621,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
621
  echo ot_settings_view( $_REQUEST['name'], $_REQUEST['count'] );
622
  die();
623
  }
624
-
625
  /**
626
  * AJAX utility function for adding a new list item setting.
627
  */
@@ -629,7 +629,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
629
  echo ot_settings_view( $_REQUEST['name'] . '[settings]', $_REQUEST['count'] );
630
  die();
631
  }
632
-
633
  /**
634
  * AJAX utility function for adding new contextual help content.
635
  */
@@ -637,7 +637,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
637
  echo ot_contextual_help_view( $_REQUEST['name'], $_REQUEST['count'] );
638
  die();
639
  }
640
-
641
  /**
642
  * AJAX utility function for adding a new choice.
643
  */
@@ -645,7 +645,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
645
  echo ot_choices_view( $_REQUEST['name'], $_REQUEST['count'] );
646
  die();
647
  }
648
-
649
  /**
650
  * AJAX utility function for adding a new layout.
651
  */
@@ -653,7 +653,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
653
  echo ot_layout_view( $_REQUEST['count'] );
654
  die();
655
  }
656
-
657
  /**
658
  * AJAX utility function for adding a new list item.
659
  */
@@ -662,7 +662,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
662
  ot_list_item_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] );
663
  die();
664
  }
665
-
666
  /**
667
  * AJAX utility function for adding a new social link.
668
  */
@@ -671,12 +671,12 @@ if ( ! class_exists( 'OT_Loader' ) ) {
671
  ot_social_links_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] );
672
  die();
673
  }
674
-
675
  /**
676
  * Fake the gallery shortcode
677
  *
678
- * The JS takes over and creates the actual shortcode with
679
- * the real attachment IDs on the fly. Here we just need to
680
  * pass in the post ID to get the ball rolling.
681
  *
682
  * @param array The current settings
@@ -701,19 +701,19 @@ if ( ! class_exists( 'OT_Loader' ) ) {
701
  }
702
  $settings['post']['id'] = $post_id;
703
  }
704
-
705
  // No ID return settings
706
  if ( $settings['post']['id'] == 0 )
707
  return $settings;
708
-
709
  // Set the fake shortcode
710
  $settings['ot_gallery'] = array( 'shortcode' => "[gallery id='{$settings['post']['id']}']" );
711
-
712
  // Return settings
713
  return $settings;
714
-
715
  }
716
-
717
  /**
718
  * Returns the AJAX images
719
  *
@@ -723,24 +723,24 @@ if ( ! class_exists( 'OT_Loader' ) ) {
723
  * @since 2.2.0
724
  */
725
  public function ajax_gallery_update() {
726
-
727
  if ( ! empty( $_POST['ids'] ) ) {
728
-
729
  $return = '';
730
-
731
  foreach( $_POST['ids'] as $id ) {
732
-
733
  $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
734
-
735
  $return .= '<li><img src="' . $thumbnail[0] . '" width="75" height="75" /></li>';
736
-
737
  }
738
-
739
  echo $return;
740
  exit();
741
-
742
  }
743
-
744
  }
745
 
746
  /**
@@ -754,9 +754,9 @@ if ( ! class_exists( 'OT_Loader' ) ) {
754
  public function retrieve_google_font() {
755
 
756
  if ( isset( $_POST['field_id'], $_POST['family'] ) ) {
757
-
758
  ot_fetch_google_fonts();
759
-
760
  echo json_encode( array(
761
  'variants' => ot_recognized_google_font_variants( $_POST['field_id'], $_POST['family'] ),
762
  'subsets' => ot_recognized_google_font_subsets( $_POST['field_id'], $_POST['family'] )
@@ -766,7 +766,7 @@ if ( ! class_exists( 'OT_Loader' ) ) {
766
  }
767
 
768
  }
769
-
770
  /**
771
  * Filters the media uploader button.
772
  *
@@ -777,22 +777,22 @@ if ( ! class_exists( 'OT_Loader' ) ) {
777
  */
778
  public function change_image_button( $translation, $text, $domain ) {
779
  global $pagenow;
780
-
781
  if ( $pagenow == apply_filters( 'ot_theme_options_parent_slug', 'themes.php' ) && 'default' == $domain && 'Insert into post' == $text ) {
782
-
783
  // Once is enough.
784
  remove_filter( 'gettext', array( $this, 'ot_change_image_button' ) );
785
  return apply_filters( 'ot_upload_text', __( 'Add to coming soon page', 'option-tree' ) );
786
-
787
  }
788
-
789
  return $translation;
790
-
791
  }
792
-
793
-
794
  }
795
-
796
  /**
797
  * Instantiate the OptionTree loader class.
798
  *
14
  * Forces Plugin Mode when OptionTree is already loaded and displays an admin notice.
15
  */
16
  if ( class_exists( 'OT_Loader' ) && defined( 'OT_PLUGIN_MODE' ) && OT_PLUGIN_MODE == true ) {
17
+
18
  add_filter( 'ot_theme_mode', '__return_false', 999 );
19
+
20
  function ot_conflict_notice() {
21
+
22
  echo '<div class="error"><p>' . __( 'OptionTree is installed as a plugin and also embedded in your current theme. Please deactivate the plugin to load the theme dependent version of OptionTree, and remove this warning.', 'option-tree' ) . '</p></div>';
23
+
24
  }
25
+
26
  add_action( 'admin_notices', 'ot_conflict_notice' );
27
+
28
  }
29
 
30
  /**
37
  if ( ! class_exists( 'OT_Loader' ) ) {
38
 
39
  class OT_Loader {
40
+
41
  /**
42
  * PHP5 constructor method.
43
  *
49
  * @since 2.0
50
  */
51
  public function __construct() {
52
+
53
  /* load languages */
54
  $this->load_languages();
55
+
56
  /* load OptionTree */
57
  add_action( 'after_setup_theme', array( $this, 'load_option_tree' ), 1 );
58
+
59
  }
60
+
61
  /**
62
  * Load the languages before everything else.
63
  *
67
  * @since 2.1.3
68
  */
69
  private function load_languages() {
70
+
71
  /**
72
  * A quick check to see if we're in plugin mode.
73
  *
74
  * @since 2.1.3
75
  */
76
  define( 'OT_PLUGIN_MODE', strpos( dirname( __FILE__ ), 'plugins' . DIRECTORY_SEPARATOR . basename( dirname( __FILE__ ) ) ) !== false ? true : false );
77
+
78
  /**
79
+ * Path to the languages directory.
80
  *
81
  * This path will be relative in plugin mode and absolute in theme mode.
82
  *
84
  * @updated 2.4.1
85
  */
86
  if ( OT_PLUGIN_MODE ) {
87
+
88
  define( 'OT_LANG_DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) . trailingslashit( 'languages' ) );
89
+
90
  } else {
91
+
92
  if ( apply_filters( 'ot_child_theme_mode', false ) == true ) {
93
+
94
  $path = @explode( get_stylesheet(), str_replace( '\\', '/', dirname( __FILE__ ) ) );
95
  $path = ltrim( end( $path ), '/' );
96
  define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_stylesheet_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
97
+
98
  } else {
99
+
100
  $path = @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) );
101
  $path = ltrim( end( $path ), '/' );
102
  define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
103
+
104
  }
105
+
106
  }
107
 
108
  /* load the text domain */
109
  if ( OT_PLUGIN_MODE ) {
110
+
111
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
112
+
113
  } else {
114
+
115
  add_action( 'after_setup_theme', array( $this, 'load_textdomain' ) );
116
+
117
  }
118
+
119
  }
120
+
121
  /**
122
  * Load the text domain.
123
  *
127
  * @since 2.0
128
  */
129
  public function load_textdomain() {
130
+
131
  if ( OT_PLUGIN_MODE ) {
132
+
133
  load_plugin_textdomain( 'option-tree', false, OT_LANG_DIR );
134
+
135
  } else {
136
+
137
  load_theme_textdomain( 'option-tree', OT_LANG_DIR );
138
+
139
  }
140
+
141
  }
142
+
143
+ /**
144
+ * Load OptionTree on the 'after_setup_theme' action. Then filters will
145
  * be availble to the theme, and not only when in Theme Mode.
146
  *
147
  * @return void
150
  * @since 2.1.2
151
  */
152
  public function load_option_tree() {
153
+
154
  /* setup the constants */
155
  $this->constants();
156
+
157
  /* include the required admin files */
158
  $this->admin_includes();
159
+
160
  /* include the required files */
161
  $this->includes();
162
+
163
  /* hook into WordPress */
164
  $this->hooks();
165
+
166
  }
167
 
168
  /**
169
  * Constants
170
  *
171
+ * Defines the constants for use within OptionTree. Constants
172
  * are prefixed with 'OT_' to avoid any naming collisions.
173
  *
174
  * @return void
177
  * @since 2.0
178
  */
179
  private function constants() {
180
+
181
  /**
182
  * Current Version number.
183
  */
184
  define( 'OT_VERSION', '1.1.2' );
185
+
186
  /**
187
  * For developers: Theme mode.
188
  *
189
  * Run a filter and set to true to enable OptionTree theme mode.
190
+ * You must have this files parent directory inside of
191
+ * your themes root directory. As well, you must include
192
  * a reference to this file in your themes functions.php.
193
  *
194
  * @since 2.0
195
  */
196
  define( 'OT_THEME_MODE', apply_filters( 'ot_theme_mode', false ) );
197
+
198
  /**
199
  * For developers: Child Theme mode. TODO document
200
  *
201
  * Run a filter and set to true to enable OptionTree child theme mode.
202
+ * You must have this files parent directory inside of
203
+ * your themes root directory. As well, you must include
204
  * a reference to this file in your themes functions.php.
205
  *
206
  * @since 2.0.15
207
  */
208
  define( 'OT_CHILD_THEME_MODE', apply_filters( 'ot_child_theme_mode', false ) );
209
+
210
  /**
211
  * For developers: Show Pages.
212
  *
216
  * @since 2.0
217
  */
218
  define( 'OT_SHOW_PAGES', apply_filters( 'ot_show_pages', true ) );
219
+
220
  /**
221
  * For developers: Show Theme Options UI Builder
222
  *
226
  * @since 2.1
227
  */
228
  define( 'OT_SHOW_OPTIONS_UI', apply_filters( 'ot_show_options_ui', true ) );
229
+
230
  /**
231
  * For developers: Show Settings Import
232
  *
236
  * @since 2.1
237
  */
238
  define( 'OT_SHOW_SETTINGS_IMPORT', apply_filters( 'ot_show_settings_import', true ) );
239
+
240
  /**
241
  * For developers: Show Settings Export
242
  *
246
  * @since 2.1
247
  */
248
  define( 'OT_SHOW_SETTINGS_EXPORT', apply_filters( 'ot_show_settings_export', true ) );
249
+
250
  /**
251
  * For developers: Show New Layout.
252
  *
256
  * @since 2.0.10
257
  */
258
  define( 'OT_SHOW_NEW_LAYOUT', apply_filters( 'ot_show_new_layout', true ) );
259
+
260
  /**
261
  * For developers: Show Documentation
262
  *
265
  * @since 2.1
266
  */
267
  define( 'OT_SHOW_DOCS', apply_filters( 'ot_show_docs', true ) );
268
+
269
  /**
270
  * For developers: Custom Theme Option page
271
  *
272
+ * Run a filter and set to false if you want to hide the OptionTree
273
  * Theme Option page and build your own.
274
  *
275
  * @since 2.1
276
  */
277
  define( 'OT_USE_THEME_OPTIONS', apply_filters( 'ot_use_theme_options', true ) );
278
+
279
  /**
280
  * For developers: Meta Boxes.
281
  *
285
  * @since 2.0
286
  */
287
  define( 'OT_META_BOXES', apply_filters( 'ot_meta_boxes', true ) );
288
+
289
  /**
290
  * For developers: Allow Unfiltered HTML in all the textareas.
291
  *
301
  /**
302
  * For developers: Post Formats.
303
  *
304
+ * Run a filter and set to true if you want OptionTree
305
  * to load meta boxes for post formats.
306
  *
307
  * @since 2.4.0
308
  */
309
  define( 'OT_POST_FORMATS', apply_filters( 'ot_post_formats', false ) );
310
+
311
  /**
312
  * Check if in theme mode.
313
  *
314
+ * If OT_THEME_MODE and OT_CHILD_THEME_MODE is false, set the
315
+ * directory path & URL like any other plugin. Otherwise, use
316
+ * the parent or child themes root directory.
317
  *
318
  * @since 2.0
319
  */
331
  define( 'OT_URL', trailingslashit( trailingslashit( get_template_directory_uri() ) . $path ) );
332
  }
333
  }
334
+
335
  /**
336
  * Template directory URI for the current theme.
337
  *
342
  } else {
343
  define( 'OT_THEME_URL', get_template_directory_uri() );
344
  }
345
+
346
  }
347
+
348
  /**
349
  * Include admin files
350
  *
356
  * @since 2.0
357
  */
358
  private function admin_includes() {
359
+
360
  /* exit early if we're not on an admin page */
361
  if ( ! is_admin() )
362
  return false;
363
+
364
  /* global include files */
365
+ $files = array(
366
  'ot-functions-admin',
367
  'ot-functions-option-types',
368
  'ot-functions-compat',
369
  'ot-settings-api'
370
  );
371
+
372
  /* include the meta box api */
373
  if ( OT_META_BOXES == true ) {
374
  $files[] = 'ot-meta-box-api';
375
  }
376
+
377
  /* include the post formats api */
378
  if ( OT_META_BOXES == true && OT_POST_FORMATS == true ) {
379
  $files[] = 'ot-post-formats-api';
380
  }
381
+
382
  /* include the settings & docs pages */
383
  if ( OT_SHOW_PAGES == true ) {
384
  $files[] = 'ot-functions-settings-page';
385
  $files[] = 'ot-functions-docs-page';
386
  }
387
+
388
  /* include the cleanup api */
389
  $files[] = 'ot-cleanup-api';
390
+
391
  /* require the files */
392
  foreach ( $files as $file ) {
393
  $this->load_file( OT_DIR . "includes" . DIRECTORY_SEPARATOR . "{$file}.php" );
394
  }
395
+
396
  /* Registers the Theme Option page */
397
  add_action( 'init', 'ot_register_theme_options_page' );
398
+
399
  /* Registers the Settings page */
400
  if ( OT_SHOW_PAGES == true ) {
401
  add_action( 'init', 'ot_register_settings_page' );
403
  /* global CSS */
404
  add_action( 'admin_head', array( $this, 'global_admin_css' ) );
405
  }
406
+
407
  }
408
+
409
  /**
410
  * Include front-end files
411
  *
412
+ * These functions are included on every page load
413
  * incase other plugins need to access them.
414
  *
415
  * @return void
418
  * @since 2.0
419
  */
420
  private function includes() {
421
+
422
+ $files = array(
423
  'ot-functions',
424
  'ot-functions-deprecated'
425
  );
428
  foreach ( $files as $file ) {
429
  $this->load_file( OT_DIR . "includes" . DIRECTORY_SEPARATOR . "{$file}.php" );
430
  }
431
+
432
  }
433
+
434
  /**
435
  * Execute the WordPress Hooks
436
  *
440
  * @since 2.0
441
  */
442
  private function hooks() {
443
+
444
  // Attempt to migrate the settings
445
  if ( function_exists( 'ot_maybe_migrate_settings' ) )
446
  add_action( 'init', 'ot_maybe_migrate_settings', 1 );
447
+
448
  // Attempt to migrate the Options
449
  if ( function_exists( 'ot_maybe_migrate_options' ) )
450
  add_action( 'init', 'ot_maybe_migrate_options', 1 );
451
+
452
  // Attempt to migrate the Layouts
453
  if ( function_exists( 'ot_maybe_migrate_layouts' ) )
454
  add_action( 'init', 'ot_maybe_migrate_layouts', 1 );
455
 
456
  /* load the Meta Box assets */
457
  if ( OT_META_BOXES == true ) {
458
+
459
  /* add scripts for metaboxes to post-new.php & post.php */
460
  add_action( 'admin_print_scripts-post-new.php', 'ot_admin_scripts', 11 );
461
  add_action( 'admin_print_scripts-post.php', 'ot_admin_scripts', 11 );
462
+
463
  /* add styles for metaboxes to post-new.php & post.php */
464
  add_action( 'admin_print_styles-post-new.php', 'ot_admin_styles', 11 );
465
  add_action( 'admin_print_styles-post.php', 'ot_admin_styles', 11 );
466
+
467
  }
468
+
469
  /* Adds the Theme Option page to the admin bar */
470
+
471
+
472
  /* prepares the after save do_action */
473
  add_action( 'admin_init', 'ot_after_theme_options_save', 1 );
474
+
475
  /* default settings */
476
  add_action( 'admin_init', 'ot_default_settings', 2 );
477
+
478
  /* add xml to upload filetypes array */
479
  add_action( 'admin_init', 'ot_add_xml_to_upload_filetypes', 3 );
480
+
481
  /* import */
482
  add_action( 'admin_init', 'ot_import', 4 );
483
+
484
  /* export */
485
  add_action( 'admin_init', 'ot_export', 5 );
486
+
487
  /* save settings */
488
  add_action( 'admin_init', 'ot_save_settings', 6 );
489
+
490
  /* save layouts */
491
  add_action( 'admin_init', 'ot_modify_layouts', 7 );
492
+
493
  /* create media post */
494
  add_action( 'admin_init', 'ot_create_media_post', 8 );
495
 
496
  /* Google Fonts front-end CSS */
497
  add_action( 'wp_enqueue_scripts', 'ot_load_google_fonts_css', 1 );
498
+
499
  /* dynamic front-end CSS */
500
  add_action( 'wp_enqueue_scripts', 'ot_load_dynamic_css', 999 );
501
 
502
  /* insert theme CSS dynamically */
503
  add_action( 'ot_after_theme_options_save', 'ot_save_css' );
504
+
505
  /* AJAX call to create a new section */
506
  add_action( 'wp_ajax_add_section', array( $this, 'add_section' ) );
507
+
508
  /* AJAX call to create a new setting */
509
  add_action( 'wp_ajax_add_setting', array( $this, 'add_setting' ) );
510
+
511
  /* AJAX call to create a new contextual help */
512
  add_action( 'wp_ajax_add_the_contextual_help', array( $this, 'add_the_contextual_help' ) );
513
+
514
  /* AJAX call to create a new choice */
515
  add_action( 'wp_ajax_add_choice', array( $this, 'add_choice' ) );
516
+
517
  /* AJAX call to create a new list item setting */
518
  add_action( 'wp_ajax_add_list_item_setting', array( $this, 'add_list_item_setting' ) );
519
+
520
  /* AJAX call to create a new layout */
521
  add_action( 'wp_ajax_add_layout', array( $this, 'add_layout' ) );
522
+
523
  /* AJAX call to create a new list item */
524
  add_action( 'wp_ajax_add_list_item', array( $this, 'add_list_item' ) );
525
+
526
  /* AJAX call to create a new social link */
527
  add_action( 'wp_ajax_add_social_links', array( $this, 'add_social_links' ) );
528
 
529
  /* AJAX call to retrieve Google Font data */
530
  add_action( 'wp_ajax_ot_google_font', array( $this, 'retrieve_google_font' ) );
531
+
532
  // Adds the temporary hacktastic shortcode
533
  add_filter( 'media_view_settings', array( $this, 'shortcode' ), 10, 2 );
534
+
535
  // AJAX update
536
  add_action( 'wp_ajax_gallery_update', array( $this, 'ajax_gallery_update' ) );
537
+
538
  /* Modify the media uploader button */
539
  add_filter( 'gettext', array( $this, 'change_image_button' ), 10, 3 );
540
+
541
  }
542
+
543
  /**
544
  * Load a file
545
  *
549
  * @since 2.0.15
550
  */
551
  private function load_file( $file ){
552
+
553
  include_once( $file );
554
+
555
  }
556
+
557
  /**
558
  * Adds the global CSS to fix the menu icon.
559
  */
560
  public function global_admin_css() {
561
  global $wp_version;
562
+
563
  $wp_38plus = version_compare( $wp_version, '3.8', '>=' ) ? true : false;
564
  $fontsize = $wp_38plus ? '20px' : '16px';
565
  $wp_38minus = '';
566
+
567
  if ( ! $wp_38plus ) {
568
  $wp_38minus = '
569
  #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image {
605
  </style>
606
  ';
607
  }
608
+
609
  /**
610
  * AJAX utility function for adding a new section.
611
  */
613
  echo ot_sections_view( ot_settings_id() . '[sections]', $_REQUEST['count'] );
614
  die();
615
  }
616
+
617
  /**
618
  * AJAX utility function for adding a new setting.
619
  */
621
  echo ot_settings_view( $_REQUEST['name'], $_REQUEST['count'] );
622
  die();
623
  }
624
+
625
  /**
626
  * AJAX utility function for adding a new list item setting.
627
  */
629
  echo ot_settings_view( $_REQUEST['name'] . '[settings]', $_REQUEST['count'] );
630
  die();
631
  }
632
+
633
  /**
634
  * AJAX utility function for adding new contextual help content.
635
  */
637
  echo ot_contextual_help_view( $_REQUEST['name'], $_REQUEST['count'] );
638
  die();
639
  }
640
+
641
  /**
642
  * AJAX utility function for adding a new choice.
643
  */
645
  echo ot_choices_view( $_REQUEST['name'], $_REQUEST['count'] );
646
  die();
647
  }
648
+
649
  /**
650
  * AJAX utility function for adding a new layout.
651
  */
653
  echo ot_layout_view( $_REQUEST['count'] );
654
  die();
655
  }
656
+
657
  /**
658
  * AJAX utility function for adding a new list item.
659
  */
662
  ot_list_item_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] );
663
  die();
664
  }
665
+
666
  /**
667
  * AJAX utility function for adding a new social link.
668
  */
671
  ot_social_links_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] );
672
  die();
673
  }
674
+
675
  /**
676
  * Fake the gallery shortcode
677
  *
678
+ * The JS takes over and creates the actual shortcode with
679
+ * the real attachment IDs on the fly. Here we just need to
680
  * pass in the post ID to get the ball rolling.
681
  *
682
  * @param array The current settings
701
  }
702
  $settings['post']['id'] = $post_id;
703
  }
704
+
705
  // No ID return settings
706
  if ( $settings['post']['id'] == 0 )
707
  return $settings;
708
+
709
  // Set the fake shortcode
710
  $settings['ot_gallery'] = array( 'shortcode' => "[gallery id='{$settings['post']['id']}']" );
711
+
712
  // Return settings
713
  return $settings;
714
+
715
  }
716
+
717
  /**
718
  * Returns the AJAX images
719
  *
723
  * @since 2.2.0
724
  */
725
  public function ajax_gallery_update() {
726
+
727
  if ( ! empty( $_POST['ids'] ) ) {
728
+
729
  $return = '';
730
+
731
  foreach( $_POST['ids'] as $id ) {
732
+
733
  $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
734
+
735
  $return .= '<li><img src="' . $thumbnail[0] . '" width="75" height="75" /></li>';
736
+
737
  }
738
+
739
  echo $return;
740
  exit();
741
+
742
  }
743
+
744
  }
745
 
746
  /**
754
  public function retrieve_google_font() {
755
 
756
  if ( isset( $_POST['field_id'], $_POST['family'] ) ) {
757
+
758
  ot_fetch_google_fonts();
759
+
760
  echo json_encode( array(
761
  'variants' => ot_recognized_google_font_variants( $_POST['field_id'], $_POST['family'] ),
762
  'subsets' => ot_recognized_google_font_subsets( $_POST['field_id'], $_POST['family'] )
766
  }
767
 
768
  }
769
+
770
  /**
771
  * Filters the media uploader button.
772
  *
777
  */
778
  public function change_image_button( $translation, $text, $domain ) {
779
  global $pagenow;
780
+
781
  if ( $pagenow == apply_filters( 'ot_theme_options_parent_slug', 'themes.php' ) && 'default' == $domain && 'Insert into post' == $text ) {
782
+
783
  // Once is enough.
784
  remove_filter( 'gettext', array( $this, 'ot_change_image_button' ) );
785
  return apply_filters( 'ot_upload_text', __( 'Add to coming soon page', 'option-tree' ) );
786
+
787
  }
788
+
789
  return $translation;
790
+
791
  }
792
+
793
+
794
  }
795
+
796
  /**
797
  * Instantiate the OptionTree loader class.
798
  *
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // silence is golden
license.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
nifty-coming-soon.php CHANGED
@@ -1,14 +1,13 @@
1
  <?php
2
  /*
3
- Plugin Name: Nifty Coming Soon and Maintenance page
4
  Plugin URI: https://wordpress.org/plugins/nifty-coming-soon-and-under-construction-page/
5
  Description: Easy to setup Coming soon, Maintenance and Under Construction page. It features Responsive design, Countdown timer, Animations, Live Preview, Background Slider, Subscription form and more.
6
- Version: 1.1.2
7
- Author: Davor Veselinovic
8
- Author URI: https://themeadviser.com/
9
- License: GPL2
10
- License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
- Text Domain: niftycs
12
  */
13
 
14
 
@@ -25,13 +24,13 @@ function nifty_cs_custom_menu()
25
  global $wp_admin_bar;
26
  $value=ot_get_option( 'coming_soon_mode_on___off' );
27
  if ( $value != "off" ) {
28
-
29
  $argsParent=array(
30
  'id' => 'niftycs_custom_menu',
31
  'title' => 'Nifty Coming Soon Enabled',
32
  'href' => admin_url('?page=niftycs-options#section_general_settings'),
33
  'meta' => array( 'class' => 'red-hot-button' ),
34
-
35
  );
36
  $wp_admin_bar->add_menu($argsParent);
37
  }
@@ -72,63 +71,23 @@ color:#F3F3F3 !important;
72
 
73
  add_action('admin_head', 'nifty_cs_admin_custom_colors');
74
 
75
- // Admin widget
76
-
77
- function nifty_cs_add_dashboard_widgets() {
78
-
79
- wp_add_dashboard_widget(
80
- 'nifty_cs_dashboard_widget',
81
- 'Nifty Coming Soon - Need a help?',
82
- 'nifty_cs_dashboard_widget_function'
83
- );
84
- }
85
- add_action( 'wp_dashboard_setup', 'nifty_cs_add_dashboard_widgets' );
86
-
87
- function nifty_cs_dashboard_widget_function() {
88
-
89
- // Message to our beloved users :)
90
-
91
- $nifty_cs_banner_url = 'https://themeadviser.com/static/nifty-coming-soon-admin-baner.png';
92
- $nifty_cs_support_url = 'https://wordpress.org/support/plugin/nifty-coming-soon-and-under-construction-page';
93
- $nifty_cs_theme1_banner_url = 'https://themeadviser.com/static/pinhole_screenshot.jpg';
94
- $nifty_cs_theme1_demo_url = 'http://demo.mekshq.com/?theme=pinhole&utm_source=themeadviser&utm_campaign=nifty-coming-soon';
95
- $nifty_cs_theme2_banner_url = 'https://themeadviser.com/static/vlog_screenshot.jpg';
96
- $nifty_cs_theme2_demo_url = 'http://demo.mekshq.com/?theme=vlog&utm_source=themeadviser&utm_campaign=nifty-coming-soon';
97
- $nifty_cs_theme3_banner_url = 'https://themeadviser.com/static/herald_screenshot.jpg';
98
- $nifty_cs_theme3_demo_url = 'http://demo.mekshq.com/?theme=herald&utm_source=themeadviser&utm_campaign=nifty-coming-soon';
99
- $nifty_cs_theme4_banner_url = 'https://themeadviser.com/static/voice_screenshot.jpg';
100
- $nifty_cs_theme4_demo_url = 'http://demo.mekshq.com/?theme=voice&utm_source=themeadviser&utm_campaign=nifty-coming-soon';
101
- $nifty_cs_theme5_banner_url = 'https://themeadviser.com/static/gridlove_screenshot.jpg';
102
- $nifty_cs_theme5_demo_url = 'http://demo.mekshq.com/?theme=gridlove&utm_source=themeadviser&utm_campaign=nifty-coming-soon';
103
-
104
-
105
- echo "<img style='max-width:100%; margin-top:5px;' src='".$nifty_cs_banner_url."'>";
106
- echo "<p>You have succefully installed Nifty Coming soon plugin and you can freely work on your website while the coming soon mode is active. </br> If you need help with the plugin, feel free to drop us the message, <a href=".$nifty_cs_support_url." target='_blank'/>right here</a><hr>In the meantime, you are most likely looking for a <u>good theme</u> to start you work. So, we picked some worthy themes for you if you don't mind. :)</p>";
107
- echo "<h3 style='padding-top:10px;'><strong>*** AMAZING 5 STAR RATED THEMES ***</strong></h3>";
108
- echo "<div style='width:100%;'>";
109
- echo "<div style='width:49%;float:left;padding-top:15px;'><a target='_blank' href='".$nifty_cs_theme1_demo_url."'><img style='max-width:95%;' src='".$nifty_cs_theme1_banner_url."'></a></div><div style='width:49%;float:right;'><p><strong><a target='_blank' href='".$nifty_cs_theme1_demo_url."'>PINHOLE</a></strong></br> Top Tier Gallery theme for Photographers. Perfect gallery theme for WordPress with unique image features.</p></div><div style='clear:both;'></div>";
110
- echo "<div style='width:49%;float:left;padding-top:15px;'><a target='_blank' href='".$nifty_cs_theme2_demo_url."'><img style='max-width:95%;' src='".$nifty_cs_theme2_banner_url."'></a></div><div style='width:49%;float:right;'><p><strong><a target='_blank' href='".$nifty_cs_theme2_demo_url."'>VLOG</a></strong></br> Vloggers gonna love this one, imagine fully featured magazine theme specialized in videos and vlogging.</p></div><div style='clear:both;'></div>";
111
- echo "<div style='width:49%;float:left;padding-top:15px;'><a target='_blank' href='".$nifty_cs_theme3_demo_url."'><img style='max-width:95%;' src='".$nifty_cs_theme3_banner_url."'></a></div><div style='width:49%;float:right;'><p><strong><a target='_blank' href='".$nifty_cs_theme3_demo_url."'>HERALD</a></strong></br> Start your news portal or magazine in a bold manner. Herald offers everything that successful magazines need.</p></div><div style='clear:both;'></div>";
112
- echo "<div style='width:49%;float:left;padding-top:15px;'><a target='_blank' href='".$nifty_cs_theme4_demo_url."'><img style='max-width:95%;' src='".$nifty_cs_theme4_banner_url."'></a></div><div style='width:49%;float:right;'><p><strong><a target='_blank' href='".$nifty_cs_theme4_demo_url."'>VOICE</a></strong></br> Best rated and most popular personal blog / magazine WordPress theme with the trust of a couple of thousands users.</p></div><div style='clear:both;'></div>";
113
- echo "<div style='width:49%;float:left;padding-top:15px;'><a target='_blank' href='".$nifty_cs_theme5_demo_url."'><img style='max-width:95%;' src='".$nifty_cs_theme5_banner_url."'></a></div><div style='width:49%;float:right;'><p><strong><a target='_blank' href='".$nifty_cs_theme5_demo_url."'>GRIDLOVE</a></strong></br> Modern material design and grid inspired magazine theme. Powerful and easy to use, 5 star rated.</p></div><div style='clear:both;'></div>";
114
-
115
-
116
- echo "</div>";
117
- }
118
 
 
 
119
 
120
-
121
- // Redirection starts here
122
 
123
  function nifty_cs_redirect()
124
- {
125
-
126
  // Check if the coming soon mode is enabled in the general settings
127
-
128
  $value = ot_get_option( 'coming_soon_mode_on___off' );
129
-
130
  if ( $value != "off" ) {
131
-
132
  if(!is_feed())
133
  {
134
  // Guests are redirected to the coming soon page
@@ -144,7 +103,7 @@ function nifty_cs_redirect()
144
  if (is_user_logged_in() )
145
  {
146
  // Get logined in user role
147
- global $current_user;
148
  $LoggedInUserID = $current_user->ID;
149
  $UserData = get_userdata( $LoggedInUserID );
150
  // If user is not having administrator, editor, author or contributor role he will be server the coming soon page too :)
@@ -160,25 +119,25 @@ function nifty_cs_redirect()
160
  }
161
  }
162
  }
163
-
164
- // Live Preview
165
-
166
  add_action('init','nifty_cs_get_preview');
167
 
168
  function nifty_cs_get_preview ()
169
  {
170
-
171
  if ( (isset($_GET['get_preview']) && $_GET['get_preview'] == 'true') )
172
  {
173
-
174
  $template_path = plugin_dir_path(__FILE__).'template/index.php';
175
  include($template_path);
176
  exit();
177
  }
178
  }
179
-
180
  // Prevent wp-login.php to be blocked by the Coming soon page.
181
-
182
  add_action('init','nifty_cs_skip_redirect_on_login');
183
 
184
  function nifty_cs_skip_redirect_on_login ()
@@ -186,20 +145,48 @@ function nifty_cs_skip_redirect_on_login ()
186
  global $currentpage;
187
  if ('wp-login.php' == $currentpage)
188
  {
189
- return;
190
- } else
191
  {
192
- add_action( 'template_redirect', 'nifty_cs_redirect' );
193
  }
194
  }
195
 
196
- // Calling plugins option panel
197
- include_once 'admin/main-options.php';
198
 
199
- include_once 'admin/ot-loader.php';
 
 
200
 
201
- // Calling Google fonts array
 
 
 
 
 
 
 
 
 
 
 
202
 
203
- include_once 'admin/includes/google-fonts.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
 
205
- ?>
1
  <?php
2
  /*
3
+ Plugin Name: Nifty Coming Soon & Maintenance page
4
  Plugin URI: https://wordpress.org/plugins/nifty-coming-soon-and-under-construction-page/
5
  Description: Easy to setup Coming soon, Maintenance and Under Construction page. It features Responsive design, Countdown timer, Animations, Live Preview, Background Slider, Subscription form and more.
6
+ Version: 1.2
7
+ Author: Web Factory Ltd
8
+ Author URI: https://webfactoryltd.com/
9
+ License: GPLv3
10
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
 
11
  */
12
 
13
 
24
  global $wp_admin_bar;
25
  $value=ot_get_option( 'coming_soon_mode_on___off' );
26
  if ( $value != "off" ) {
27
+
28
  $argsParent=array(
29
  'id' => 'niftycs_custom_menu',
30
  'title' => 'Nifty Coming Soon Enabled',
31
  'href' => admin_url('?page=niftycs-options#section_general_settings'),
32
  'meta' => array( 'class' => 'red-hot-button' ),
33
+
34
  );
35
  $wp_admin_bar->add_menu($argsParent);
36
  }
71
 
72
  add_action('admin_head', 'nifty_cs_admin_custom_colors');
73
 
74
+ // Redirection starts here
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
+ function nifty_get_plugin_version() {
77
+ $plugin_data = get_file_data(__FILE__, array('version' => 'Version'), 'plugin');
78
 
79
+ return $plugin_data['version'];
80
+ } // nifty_get_plugin_version
81
 
82
  function nifty_cs_redirect()
83
+ {
84
+
85
  // Check if the coming soon mode is enabled in the general settings
86
+
87
  $value = ot_get_option( 'coming_soon_mode_on___off' );
88
+
89
  if ( $value != "off" ) {
90
+
91
  if(!is_feed())
92
  {
93
  // Guests are redirected to the coming soon page
103
  if (is_user_logged_in() )
104
  {
105
  // Get logined in user role
106
+ global $current_user;
107
  $LoggedInUserID = $current_user->ID;
108
  $UserData = get_userdata( $LoggedInUserID );
109
  // If user is not having administrator, editor, author or contributor role he will be server the coming soon page too :)
119
  }
120
  }
121
  }
122
+
123
+ // Live Preview
124
+
125
  add_action('init','nifty_cs_get_preview');
126
 
127
  function nifty_cs_get_preview ()
128
  {
129
+
130
  if ( (isset($_GET['get_preview']) && $_GET['get_preview'] == 'true') )
131
  {
132
+
133
  $template_path = plugin_dir_path(__FILE__).'template/index.php';
134
  include($template_path);
135
  exit();
136
  }
137
  }
138
+
139
  // Prevent wp-login.php to be blocked by the Coming soon page.
140
+
141
  add_action('init','nifty_cs_skip_redirect_on_login');
142
 
143
  function nifty_cs_skip_redirect_on_login ()
145
  global $currentpage;
146
  if ('wp-login.php' == $currentpage)
147
  {
148
+ return;
149
+ } else
150
  {
151
+ add_action( 'template_redirect', 'nifty_cs_redirect' );
152
  }
153
  }
154
 
155
+ add_action( 'wp_ajax_nifty_subscribe', 'nifty_subscribe' );
156
+ add_action( 'wp_ajax_nopriv_nifty_subscribe', 'nifty_subscribe' );
157
 
158
+ function nifty_subscribe() {
159
+ // Email Submit
160
+ if ( isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
161
 
162
+ // Detect & prevent header injections
163
+ $receiver = $_POST['email'];
164
+ $mail_subject = 'New subscriber from coming soon page';
165
+ $mail_text = 'Hello, we have a new subscription from the Coming soon page. Email address: ';
166
+ $admin_mail = ot_get_option( 'enter_your_email_address' );
167
+ $test = "/(content-type|bcc:|cc:|to:)/i";
168
+
169
+ foreach ( $_POST as $key => $val ) {
170
+ if ( preg_match( $test, $val ) ) {
171
+ exit;
172
+ }
173
+ }
174
 
175
+ $sanitized_email = sanitize_email($receiver);
176
+ $receiver_sanitized = $sanitized_email;
177
+
178
+ // Send email
179
+ mail( $admin_mail, $mail_subject, $mail_text .$_POST['email'], "From:" . $_POST['email'] );
180
+
181
+ die('1');
182
+ }
183
+
184
+ } // nifty_subscribe
185
+
186
+ // Calling plugins option panel
187
+ require_once 'admin/main-options.php';
188
+ require_once 'admin/ot-loader.php';
189
+
190
+ // Calling Google fonts array
191
 
192
+ require_once 'admin/includes/google-fonts.php';
readme.txt CHANGED
@@ -1,11 +1,10 @@
1
- === Coming soon & Under Construction Maintenance page ===
2
- Contributors: ArissDJ
3
- Tags: coming soon, coming soon page, maintenance, maintenance mode, under construction, under construction, offline page
4
- Requires at least: 3.8.0
5
- Tested up to: 4.9.1
6
- License: GPLv2 or later License
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
- Stable tag: trunk
9
 
10
  Nifty Coming soon and Under Construction / Maintenance page builder plugin helps you create awesome coming soon page with all premium like features for free.
11
 
@@ -15,7 +14,7 @@ Nice and easy to setup Coming soon / Under Construction and Maintenance plugin w
15
 
16
  Coming soon plugin features responsive design and will adapt to any device. You can setup background slider with overlay pattern and opacity. Easily alter animated text on the coming soon page and use the built in count down timer, subscription form and more.
17
 
18
- You can activate or deactivate any section of the page, select Google Fonts and have all like premium features for FREE.
19
 
20
  ### Main Features
21
 
@@ -41,17 +40,14 @@ Nifty Coming soon plugin will help you to quickly launch Maintenance mode for th
41
 
42
  The plugin should work with any WordPress theme and the installation and setup are really straight forward.
43
 
44
- ### DEMO / PLUGIN IN ACTION
45
 
46
- You can see a plugin in action, right here: [Plugin DEMO](https://demo.themeadviser.com/nifty-coming-soon)
47
 
48
- ### COMING SOON PLUGINs OFFICIAL PAGE
49
-
50
- Nifty Coming soon / Maintenance and Under Construction official page - [Plugin Page](https://themeadviser.com/nifty-coming-soon)
51
 
52
  ### PROPOSE NEW FEATURES
53
 
54
- If you have an idea how to make this plugin even better or you need some specific feature that could also benefit the rest of the plugin users and the community, feel free to reach out.
55
 
56
  Feel free to ask for help and don't forget to rate our Coming Soon plugin with 5 stars if you feel like its the real thing. :)
57
 
@@ -82,14 +78,30 @@ As from the update of 1.0.9, the plugin offers the way to Live Preview you're Co
82
 
83
 
84
  == Screenshots ==
85
- 1. coming Soon Plugin in action
86
  2. You can setup desired fonts, background slider images, pattern overlay and opacity.
87
  3. General settings preview
88
  4. Design and layout settings preview
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  = 1.1.2 =
 
93
  * Maintenance update
94
  * Fixed missing hex color field in color picker tool
95
  * Fixed small admin menu issue with focus state on Chrome
@@ -97,7 +109,7 @@ As from the update of 1.0.9, the plugin offers the way to Live Preview you're Co
97
  * Small enhancements
98
 
99
  = 1.1.1 =
100
- * Fixed timming issue with Vegas slider
101
  * Added option to define transition effects time
102
 
103
  = 1.1.0 =
@@ -109,8 +121,8 @@ As from the update of 1.0.9, the plugin offers the way to Live Preview you're Co
109
  * Mobile user experience optimization
110
  * Small enhancements and code optimization
111
 
112
-
113
  = 1.0.9 =
 
114
  * Fixed small bug with URL of Coming soon notice on the Frontpage Admin bar
115
  * Editor, Author and Contributer roles can now access the website while the Cooming soon mode is active
116
  * You can now preview your Coming soon page from the admin menu using the "Live Preview" button in the header.
@@ -120,14 +132,13 @@ As from the update of 1.0.9, the plugin offers the way to Live Preview you're Co
120
  = 1.0.8 =
121
  * Added the option to disable Logo and display Site title or remove both
122
  * Added option for setting up font for Site title option
123
- * New background slider demo images. Curtesy of Mia Baker, Sabri Tuzcu
124
  * Small enhancements and tweaks
125
 
126
  = 1.0.7 =
127
  * Added option for embedding MailChimp or any custom Sign-up form to be used instead of the plugin built it subscription form.
128
  * Small styling enhancements
129
 
130
-
131
  = 1.0.6 =
132
  * Additional CSS field added back
133
  * Fixed language bug reported by user
@@ -148,7 +159,6 @@ As from the update of 1.0.9, the plugin offers the way to Live Preview you're Co
148
  * Added translation translation for countdown elements
149
  * Optimized plugin code
150
 
151
-
152
  = 1.0.1 =
153
  * Fixed Jquery loading specific issues.
154
  * Added new settings
@@ -157,4 +167,5 @@ As from the update of 1.0.9, the plugin offers the way to Live Preview you're Co
157
  * Fixed some small styling issues.
158
 
159
  = 1.0.0 =
160
- * First release.
 
1
+ === Coming Soon & Under Construction Maintenance Page ===
2
+ Contributors: WebFactory
3
+ Tags: coming soon, coming soon page, launch page, maintenance mode, mailchimp, coming soon mode, under construction, maintenance mode page, landing page, offline page, subscribe form, maintenance
4
+ Tested up to: 4.9
5
+ License: GPLv3
 
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
+ Stable tag: 1.2
8
 
9
  Nifty Coming soon and Under Construction / Maintenance page builder plugin helps you create awesome coming soon page with all premium like features for free.
10
 
14
 
15
  Coming soon plugin features responsive design and will adapt to any device. You can setup background slider with overlay pattern and opacity. Easily alter animated text on the coming soon page and use the built in count down timer, subscription form and more.
16
 
17
+ You can activate or deactivate any section of the page, select Google Fonts and have all like premium features for FREE.
18
 
19
  ### Main Features
20
 
40
 
41
  The plugin should work with any WordPress theme and the installation and setup are really straight forward.
42
 
43
+ ### NEED MORE THEMES?
44
 
45
+ Check out <a href="https://comingsoonwp.com/?utm_source=wordpressorg&utm_medium=content&utm_campaign=readme-nifty&utm_content=theme-demos">theme demos</a> plugin ! We have over 40!
46
 
 
 
 
47
 
48
  ### PROPOSE NEW FEATURES
49
 
50
+ If you have an idea how to make this plugin even better or you need some specific feature that could also benefit the rest of the plugin users and the community, feel free to reach out.
51
 
52
  Feel free to ask for help and don't forget to rate our Coming Soon plugin with 5 stars if you feel like its the real thing. :)
53
 
78
 
79
 
80
  == Screenshots ==
81
+ 1. Coming Soon Plugin in action
82
  2. You can setup desired fonts, background slider images, pattern overlay and opacity.
83
  3. General settings preview
84
  4. Design and layout settings preview
85
 
86
  == Changelog ==
87
 
88
+ = 1.2 =
89
+ * 2018/03/06
90
+ * 9k installs & 34.5k downloads
91
+ * a lot of minor fixes
92
+ * started advertising PRO themes
93
+ * fixed countdown clock
94
+ * fixed subscribe form
95
+ * unused social icons can now be hidden
96
+
97
+ = 1.1.3 =
98
+ * 2017/12/28
99
+ * WebFactory took over development
100
+ * 5k installs & 22k downloads
101
+ * minor cleanup
102
+
103
  = 1.1.2 =
104
+ * 2017/12/14
105
  * Maintenance update
106
  * Fixed missing hex color field in color picker tool
107
  * Fixed small admin menu issue with focus state on Chrome
109
  * Small enhancements
110
 
111
  = 1.1.1 =
112
+ * Fixed timing issue with Vegas slider
113
  * Added option to define transition effects time
114
 
115
  = 1.1.0 =
121
  * Mobile user experience optimization
122
  * Small enhancements and code optimization
123
 
 
124
  = 1.0.9 =
125
+ * 2017/11/28
126
  * Fixed small bug with URL of Coming soon notice on the Frontpage Admin bar
127
  * Editor, Author and Contributer roles can now access the website while the Cooming soon mode is active
128
  * You can now preview your Coming soon page from the admin menu using the "Live Preview" button in the header.
132
  = 1.0.8 =
133
  * Added the option to disable Logo and display Site title or remove both
134
  * Added option for setting up font for Site title option
135
+ * New background slider demo images. Curtesy of Mia Baker, Sabri Tuzcu
136
  * Small enhancements and tweaks
137
 
138
  = 1.0.7 =
139
  * Added option for embedding MailChimp or any custom Sign-up form to be used instead of the plugin built it subscription form.
140
  * Small styling enhancements
141
 
 
142
  = 1.0.6 =
143
  * Additional CSS field added back
144
  * Fixed language bug reported by user
159
  * Added translation translation for countdown elements
160
  * Optimized plugin code
161
 
 
162
  = 1.0.1 =
163
  * Fixed Jquery loading specific issues.
164
  * Added new settings
167
  * Fixed some small styling issues.
168
 
169
  = 1.0.0 =
170
+ * 2016/07/19
171
+ * First release.
template/assets/js/scripts.js CHANGED
@@ -4,14 +4,14 @@ jQuery(document).ready(function($){
4
 
5
  jQuery('.bxslider').bxSlider({
6
  pagerCustom: '#slider-navigation',
7
- controls: false,
8
  });
9
 
10
- });
11
 
12
  // Preloader //
13
 
14
- jQuery(document).ready(function($) {
15
  $(window).load(function(){
16
  $('#preloader').fadeOut('fast',function(){$(this).remove();});
17
  });
@@ -21,16 +21,16 @@ $(window).load(function(){
21
  $("#contact").submit(function(e){
22
  e.preventDefault();
23
  var email = $("#email").val();
24
- var dataString = '&email=' + email;
25
  function isValidEmail(emailAddress) {
26
  var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
27
  return pattern.test(emailAddress);
28
  };
29
-
30
  if (isValidEmail(email)){
31
  $.ajax({
32
  type: "POST",
33
- url: "index.php",
34
  data: dataString,
35
  success: function(){
36
  $('.nifty-success').fadeIn(1000);
@@ -41,7 +41,7 @@ $("#contact").submit(function(e){
41
  $('.nifty-error').fadeIn(1000);
42
  $('.nifty-error').delay(3000).fadeOut(1000);
43
  }
44
-
45
  return false;
46
  });
47
 
4
 
5
  jQuery('.bxslider').bxSlider({
6
  pagerCustom: '#slider-navigation',
7
+ controls: false,
8
  });
9
 
10
+ });
11
 
12
  // Preloader //
13
 
14
+ jQuery(document).ready(function($) {
15
  $(window).load(function(){
16
  $('#preloader').fadeOut('fast',function(){$(this).remove();});
17
  });
21
  $("#contact").submit(function(e){
22
  e.preventDefault();
23
  var email = $("#email").val();
24
+ var dataString = '&action=nifty_subscribe&email=' + email;
25
  function isValidEmail(emailAddress) {
26
  var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
27
  return pattern.test(emailAddress);
28
  };
29
+
30
  if (isValidEmail(email)){
31
  $.ajax({
32
  type: "POST",
33
+ url: $('#contact').attr('action'),
34
  data: dataString,
35
  success: function(){
36
  $('.nifty-success').fadeIn(1000);
41
  $('.nifty-error').fadeIn(1000);
42
  $('.nifty-error').delay(3000).fadeOut(1000);
43
  }
44
+
45
  return false;
46
  });
47
 
template/index.php CHANGED
@@ -6,29 +6,28 @@ Main Coming soon page template
6
  */
7
 
8
  ?>
9
-
10
  <!DOCTYPE html <?php language_attributes(); ?>>
11
  <!--[if IE 8]> <html class="no-js lt-ie9" lang="en" > <![endif]-->
12
  <!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?> > <!--<![endif]-->
13
  <head>
14
  <meta charset="utf-8">
15
  <meta name="viewport" content="width=device-width">
16
-
17
  <title><?php bloginfo('name'); ?></title>
18
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/normalize.css',dirname(__FILE__)); ?>">
19
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/foundation.css',dirname(__FILE__)); ?>">
20
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/animate.css',dirname(__FILE__)); ?>">
21
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/icomoon.css',dirname(__FILE__)); ?>">
22
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/style.css',dirname(__FILE__)); ?>">
23
-
24
  <script src="<?php echo plugins_url('template/assets/js/vendor/custom.modernizr.js',dirname(__FILE__)); ?>"></script>
25
-
26
  <!-- Default WordPress jQuery lib (sorry, it just have to go this way because of template system limitations) -->
27
-
28
  <script src="<?php echo includes_url('js/jquery/jquery.js',dirname(__FILE__)); ?>"></script>
29
 
30
- <?php
31
-
32
  $background_color = ot_get_option( 'background_color' );
33
  $sitetitle_font = ot_get_option( 'choose_sitetitle_font' );
34
  $heading_font = ot_get_option( 'choose_heading_font' );
@@ -36,8 +35,8 @@ Main Coming soon page template
36
  $counter_font = ot_get_option( 'choose_counter_font' );
37
  $button_color = ot_get_option( 'sign_up_button_color' );
38
  $button_color_hover = ot_get_option( 'sign_up_button_color_hover' );
39
-
40
-
41
  echo "<link href='https://fonts.googleapis.com/css?family=".$sitetitle_font."&subset=latin,latin-ext' rel='stylesheet' type='text/css'>";
42
  echo "<link href='https://fonts.googleapis.com/css?family=".$heading_font."&subset=latin,latin-ext' rel='stylesheet' type='text/css'>";
43
  echo "<link href='https://fonts.googleapis.com/css?family=".$paragraph_font."&subset=latin,latin-ext' rel='stylesheet' type='text/css'>";
@@ -52,18 +51,18 @@ Main Coming soon page template
52
  echo '</style>'
53
 
54
  ?>
55
-
56
-
57
-
58
  </head>
59
  <body <?php body_class(); ?>>
60
  <div class="nifty-main-wrapper" id="nifty-full-wrapper">
61
-
62
  <!-- Page Preloader -->
63
-
64
  <?php
65
  $preloader = ot_get_option( 'enable_preloader' );
66
-
67
  if( 'off' != $preloader ) {
68
  echo '<div id="preloader"></div>';
69
  } else {
@@ -74,7 +73,7 @@ Main Coming soon page template
74
  <div class="nifty-content-wrapper">
75
  <header class="nifty-row ">
76
  <div class="large-12 columns text-center">
77
-
78
  <!-- Logo and navigation -->
79
  <?php
80
  $niftylogo = ot_get_option( 'disable_logo' );
@@ -86,26 +85,26 @@ Main Coming soon page template
86
  echo '<div class="nifty-logo"><a href="'.$sitepath.'"><img src="'.$logopath.'" alt="'.$blogname.'" /></a></div>';
87
  } else {
88
  echo '<div class="nifty-logo"><h1 class="nifty-title">'.$blogname.'</h1></div>';
89
-
90
  }
91
  ?>
92
-
93
-
94
-
95
  <?php
96
  $navigation = ot_get_option( 'disable_navigation' );
97
  if( 'off' != $navigation ) {
98
  echo '<div id="slider-navigation">
99
  <a data-slide-index="0" href=""><span aria-hidden="true" class="icon-paperplane"></span></a>
100
- <a data-slide-index="1" href=""><span aria-hidden="true" class="icon-location"></span></a>
101
- <a data-slide-index="2" href=""><span aria-hidden="true" class="icon-thumbs-up"></span></a>
102
  </div>';
103
  } else {
104
  ;
105
  }
106
  ?>
107
-
108
- </div>
109
  </div>
110
  </header>
111
  <div class="nifty-row">
@@ -120,18 +119,18 @@ Main Coming soon page template
120
  </div>
121
  </div>
122
  </div>
123
-
124
- <!-- Timer Section -->
125
-
126
  <?php
127
  $nifty_timer = ot_get_option( 'display_count_down_timer' );
128
  $nifty_days = ot_get_option( 'nifty_days_translate' );
129
  $nifty_hours = ot_get_option( 'nifty_hours_translate' );
130
  $nifty_minutes = ot_get_option( 'nifty_minutes_translate' );
131
- $nifty_seconds = ot_get_option( 'nifty_seconds_translate' );
132
-
133
  if( 'off' != $nifty_timer ) {
134
- echo '<div class="nifty-row" id="clock">
135
  <div class="large-8 small-centered columns">
136
  <div class="large-3 small-3 columns">
137
  <div class="timer-item">
@@ -162,35 +161,35 @@ Main Coming soon page template
162
  } else {
163
  ;
164
  }
165
-
166
- ?>
167
-
168
- <!-- Content Section -->
169
-
170
  <div class="nifty-content-full">
171
- <div class="nifty-row">
172
-
173
- <!-- Slider Section -->
174
-
175
  <ul class="bxslider">
176
-
177
- <!-- Slide One - Subscribe Here -->
178
-
179
  <?php
180
  $nifty_form = ot_get_option( 'enable_sign_up_form' );
181
-
182
  if( 'off' != $nifty_form ) {
183
  echo '<li>
184
  <section class="large-12 columns"> ';
185
- echo '<form id="contact" method="post">
186
  <div class="large-4 small-centered columns">
187
  <div class="nifty-inform">';
188
-
189
- echo ot_get_option( 'sign_up_form_intro_text' );
190
  echo' </div> <div class="nifty-row collapse">
191
  <div class="small-8 columns">
192
  <input type="text" name="email" id="email" autocomplete="off" placeholder="';
193
- echo ot_get_option( 'enter_email_text' );
194
  echo '">
195
  </div>
196
  <div class="small-4 columns">
@@ -199,24 +198,24 @@ Main Coming soon page template
199
  echo '" name="submit" class="button prefix">
200
  </div>
201
  <div class="nifty-success" style="display:none">';
202
- echo ot_get_option( 'email_confirmation___success' );
203
  echo '</div>
204
  <div class="nifty-error" style="display:none"> ';
205
- echo ot_get_option( 'email_confirmation___error' );
206
  echo '</div>
207
  </div>
208
- </div>
209
  </form>
210
  </section>
211
- </li>
212
-
213
  ';
214
  } else {
215
  echo ot_get_option( 'insert_custom_signup_form' );
216
  }
217
 
218
- ?>
219
-
220
  <!-- Slide Two - About Us -->
221
 
222
  <?php
@@ -225,11 +224,11 @@ Main Coming soon page template
225
  $contact_address = ot_get_option( 'enter_your_address' );
226
  $contact_phone = ot_get_option( 'enter_your_phone_number' );
227
  $contact_email = ot_get_option( 'enter_your_email_address' );
228
-
229
-
230
  if( 'off' != $nifty_contact ) {
231
  echo '<li>
232
- <section class="small-12 small-centered columns">
233
  <div class="nifty-contact-details">
234
  <p><strong>'.$contact_website.'
235
  </strong></p>
@@ -237,18 +236,18 @@ Main Coming soon page template
237
  '.$contact_address.'</p>
238
  <p><span aria-hidden="true" class="icon-phone"></span>
239
  '.$contact_phone.'</p><p> <span aria-hidden="true" class="icon-mail"></span> <a href="mailto:'.$contact_email.'">'.$contact_email.'</a></p></div>
240
-
241
  </section>
242
  </li>';
243
-
244
-
245
  } else {
246
  ;
247
  }
248
  ?>
249
-
250
  <!-- Slide Three - Social links -->
251
-
252
  <?php
253
  $nifty_social = ot_get_option( 'enable_social_links' );
254
  $social_intro = ot_get_option( 'social_links_intro_text' );
@@ -258,44 +257,51 @@ Main Coming soon page template
258
  $social_linkedin = ot_get_option( 'linkedin_profile_url' );
259
  $social_pinterest = ot_get_option( 'pinterest_url' );
260
  $social_instagram = ot_get_option( 'instagram_url' );
261
-
262
  if( 'off' != $nifty_social ) {
263
  echo '<li>
264
- <section class="large-12 columns">
265
  <div class="nifty-row">
266
  <div class="small-12 small-centered columns">
267
  <div class="nifty-inform">'.$social_intro.
268
- '</div>
269
- <a href="'.$social_facebook.'"><span aria-hidden="true" class="icon-facebook"></span></a>
270
- <a href="'.$social_twitter.'"><span aria-hidden="true" class="icon-twitter"></span></a>
271
- <a href="'.$social_linkedin.'"><span aria-hidden="true" class="icon-linkedin"></span></a>
272
- <a href="'.$social_pinterest.'"><span aria-hidden="true" class="icon-pinterest"></span></a>
273
- <a href="'.$social_instagram.'"><span aria-hidden="true" class="icon-instagram"></span></a>
274
- <a href="'.$social_googleplus.'"><span aria-hidden="true" class="icon-google-plus"></span></a>
275
- </div>
 
 
 
 
 
 
 
276
  </div>
277
  </section>
278
  </li>
279
  '
280
-
281
  ;
282
  } else {
283
  echo '<section class="large-12 columns"><div class="nifty-row"></div></section>';
284
  }
285
  ?>
286
-
287
-
288
- </ul>
289
  </div>
290
- </div>
291
  </div>
292
-
293
-
294
- <!-- jQuery Vegas Background Slider -->
295
-
 
296
  <?php
297
  $nifty_background_slider = ot_get_option( 'disable_background_image_slider' );
298
-
299
  if( 'off' != $nifty_background_slider ) {
300
  $slide_1 = ot_get_option( 'upload_slider_images' );
301
  $slide_2 = ot_get_option( 'upload_slider_images_2' );
@@ -308,7 +314,7 @@ Main Coming soon page template
308
  $pattern = ot_get_option( 'select_pattern_overlay' );
309
  $pattern_opacity = ot_get_option( 'pattern_overlay_opacity' );
310
  $pattern_lib = OT_URL .'/assets/images/patterns/';
311
-
312
  echo "<script>
313
  jQuery(document).ready(function($){
314
  $('".$body."').vegas({
@@ -324,13 +330,13 @@ Main Coming soon page template
324
  { src:'".$slide_1."'},
325
  { src:'".$slide_2."'},
326
  { src:'".$slide_3."'}
327
- ]
328
  }); });
329
  </script>";
330
-
331
  } else {
332
  }
333
-
334
  ?>
335
 
336
 
@@ -338,13 +344,13 @@ Main Coming soon page template
338
 
339
  // Timer Settings //
340
 
341
- jQuery(function($) {
342
- $('div#clock').countdown("<?php
343
- $timer_state = ot_get_option( 'setup_the_count_down_timer' );
344
- $time_updated = date("Y/m/d", strtotime($timer_state));
345
  echo $time_updated;
346
-
347
- ?>", function(event) {
348
  var $this = $(this);
349
  switch(event.type) {
350
  case "seconds":
@@ -354,7 +360,7 @@ jQuery(function($) {
354
  case "weeks":
355
  case "daysLeft":
356
  $this.find('span#'+event.type).html(event.value);
357
-
358
  break;
359
  case "finished":
360
  $this.hide();
@@ -364,33 +370,6 @@ jQuery(function($) {
364
  });
365
  </script>
366
 
367
- <?php
368
-
369
- // Email Submit
370
- if ( isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
371
-
372
- // Detect & prevent header injections
373
- $receiver = $_POST['email'];
374
- $mail_subject = 'New subscriber from coming soon page';
375
- $mail_text = 'Hello, we have a new subscription from the Coming soon page. Email address: ';
376
- $admin_mail = ot_get_option( 'enter_your_email_address' );
377
- $test = "/(content-type|bcc:|cc:|to:)/i";
378
-
379
- foreach ( $_POST as $key => $val ) {
380
- if ( preg_match( $test, $val ) ) {
381
- exit;
382
- }
383
- }
384
-
385
- $sanitized_email = sanitize_email($receiver);
386
- $receiver_sanitized = $sanitized_email;
387
-
388
- // Send email
389
- mail( $admin_mail, $mail_subject, $mail_text .$_POST['email'], "From:" . $_POST['email'] );
390
-
391
- }
392
-
393
- ?>
394
 
395
  <!-- Footer js scripts -->
396
 
@@ -404,7 +383,7 @@ if ( isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL
404
 
405
  <?php
406
  $animation = ot_get_option( 'disable_animation' );
407
-
408
  if( 'off' != $animation ) {
409
  echo "<script>
410
  jQuery(document).ready(function($){
@@ -476,7 +455,7 @@ if ( isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL
476
 
477
  <!-- Additional CSS -->
478
 
479
- <?php
480
  $additional_css_code = ot_get_option( 'insert_additional_css' );
481
 
482
  echo "<style>".$additional_css_code."</style>";
6
  */
7
 
8
  ?>
 
9
  <!DOCTYPE html <?php language_attributes(); ?>>
10
  <!--[if IE 8]> <html class="no-js lt-ie9" lang="en" > <![endif]-->
11
  <!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?> > <!--<![endif]-->
12
  <head>
13
  <meta charset="utf-8">
14
  <meta name="viewport" content="width=device-width">
15
+
16
  <title><?php bloginfo('name'); ?></title>
17
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/normalize.css',dirname(__FILE__)); ?>">
18
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/foundation.css',dirname(__FILE__)); ?>">
19
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/animate.css',dirname(__FILE__)); ?>">
20
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/icomoon.css',dirname(__FILE__)); ?>">
21
  <link rel="stylesheet" href="<?php echo plugins_url('template/assets/css/style.css',dirname(__FILE__)); ?>">
22
+
23
  <script src="<?php echo plugins_url('template/assets/js/vendor/custom.modernizr.js',dirname(__FILE__)); ?>"></script>
24
+
25
  <!-- Default WordPress jQuery lib (sorry, it just have to go this way because of template system limitations) -->
26
+
27
  <script src="<?php echo includes_url('js/jquery/jquery.js',dirname(__FILE__)); ?>"></script>
28
 
29
+ <?php
30
+
31
  $background_color = ot_get_option( 'background_color' );
32
  $sitetitle_font = ot_get_option( 'choose_sitetitle_font' );
33
  $heading_font = ot_get_option( 'choose_heading_font' );
35
  $counter_font = ot_get_option( 'choose_counter_font' );
36
  $button_color = ot_get_option( 'sign_up_button_color' );
37
  $button_color_hover = ot_get_option( 'sign_up_button_color_hover' );
38
+
39
+
40
  echo "<link href='https://fonts.googleapis.com/css?family=".$sitetitle_font."&subset=latin,latin-ext' rel='stylesheet' type='text/css'>";
41
  echo "<link href='https://fonts.googleapis.com/css?family=".$heading_font."&subset=latin,latin-ext' rel='stylesheet' type='text/css'>";
42
  echo "<link href='https://fonts.googleapis.com/css?family=".$paragraph_font."&subset=latin,latin-ext' rel='stylesheet' type='text/css'>";
51
  echo '</style>'
52
 
53
  ?>
54
+
55
+
56
+
57
  </head>
58
  <body <?php body_class(); ?>>
59
  <div class="nifty-main-wrapper" id="nifty-full-wrapper">
60
+
61
  <!-- Page Preloader -->
62
+
63
  <?php
64
  $preloader = ot_get_option( 'enable_preloader' );
65
+
66
  if( 'off' != $preloader ) {
67
  echo '<div id="preloader"></div>';
68
  } else {
73
  <div class="nifty-content-wrapper">
74
  <header class="nifty-row ">
75
  <div class="large-12 columns text-center">
76
+
77
  <!-- Logo and navigation -->
78
  <?php
79
  $niftylogo = ot_get_option( 'disable_logo' );
85
  echo '<div class="nifty-logo"><a href="'.$sitepath.'"><img src="'.$logopath.'" alt="'.$blogname.'" /></a></div>';
86
  } else {
87
  echo '<div class="nifty-logo"><h1 class="nifty-title">'.$blogname.'</h1></div>';
88
+
89
  }
90
  ?>
91
+
92
+
93
+
94
  <?php
95
  $navigation = ot_get_option( 'disable_navigation' );
96
  if( 'off' != $navigation ) {
97
  echo '<div id="slider-navigation">
98
  <a data-slide-index="0" href=""><span aria-hidden="true" class="icon-paperplane"></span></a>
99
+ <a data-slide-index="1" href=""><span aria-hidden="true" class="icon-location"></span></a>
100
+ <a data-slide-index="2" href=""><span aria-hidden="true" class="icon-thumbs-up"></span></a>
101
  </div>';
102
  } else {
103
  ;
104
  }
105
  ?>
106
+
107
+ </div>
108
  </div>
109
  </header>
110
  <div class="nifty-row">
119
  </div>
120
  </div>
121
  </div>
122
+
123
+ <!-- Timer Section -->
124
+
125
  <?php
126
  $nifty_timer = ot_get_option( 'display_count_down_timer' );
127
  $nifty_days = ot_get_option( 'nifty_days_translate' );
128
  $nifty_hours = ot_get_option( 'nifty_hours_translate' );
129
  $nifty_minutes = ot_get_option( 'nifty_minutes_translate' );
130
+ $nifty_seconds = ot_get_option( 'nifty_seconds_translate' );
131
+
132
  if( 'off' != $nifty_timer ) {
133
+ echo '<div class="nifty-row" id="clock">
134
  <div class="large-8 small-centered columns">
135
  <div class="large-3 small-3 columns">
136
  <div class="timer-item">
161
  } else {
162
  ;
163
  }
164
+
165
+ ?>
166
+
167
+ <!-- Content Section -->
168
+
169
  <div class="nifty-content-full">
170
+ <div class="nifty-row">
171
+
172
+ <!-- Slider Section -->
173
+
174
  <ul class="bxslider">
175
+
176
+ <!-- Slide One - Subscribe Here -->
177
+
178
  <?php
179
  $nifty_form = ot_get_option( 'enable_sign_up_form' );
180
+
181
  if( 'off' != $nifty_form ) {
182
  echo '<li>
183
  <section class="large-12 columns"> ';
184
+ echo '<form id="contact" method="post" action="' . admin_url( 'admin-ajax.php' ) . '">
185
  <div class="large-4 small-centered columns">
186
  <div class="nifty-inform">';
187
+
188
+ echo ot_get_option( 'sign_up_form_intro_text' );
189
  echo' </div> <div class="nifty-row collapse">
190
  <div class="small-8 columns">
191
  <input type="text" name="email" id="email" autocomplete="off" placeholder="';
192
+ echo ot_get_option( 'enter_email_text' );
193
  echo '">
194
  </div>
195
  <div class="small-4 columns">
198
  echo '" name="submit" class="button prefix">
199
  </div>
200
  <div class="nifty-success" style="display:none">';
201
+ echo ot_get_option( 'email_confirmation___success' );
202
  echo '</div>
203
  <div class="nifty-error" style="display:none"> ';
204
+ echo ot_get_option( 'email_confirmation___error' );
205
  echo '</div>
206
  </div>
207
+ </div>
208
  </form>
209
  </section>
210
+ </li>
211
+
212
  ';
213
  } else {
214
  echo ot_get_option( 'insert_custom_signup_form' );
215
  }
216
 
217
+ ?>
218
+
219
  <!-- Slide Two - About Us -->
220
 
221
  <?php
224
  $contact_address = ot_get_option( 'enter_your_address' );
225
  $contact_phone = ot_get_option( 'enter_your_phone_number' );
226
  $contact_email = ot_get_option( 'enter_your_email_address' );
227
+
228
+
229
  if( 'off' != $nifty_contact ) {
230
  echo '<li>
231
+ <section class="small-12 small-centered columns">
232
  <div class="nifty-contact-details">
233
  <p><strong>'.$contact_website.'
234
  </strong></p>
236
  '.$contact_address.'</p>
237
  <p><span aria-hidden="true" class="icon-phone"></span>
238
  '.$contact_phone.'</p><p> <span aria-hidden="true" class="icon-mail"></span> <a href="mailto:'.$contact_email.'">'.$contact_email.'</a></p></div>
239
+
240
  </section>
241
  </li>';
242
+
243
+
244
  } else {
245
  ;
246
  }
247
  ?>
248
+
249
  <!-- Slide Three - Social links -->
250
+
251
  <?php
252
  $nifty_social = ot_get_option( 'enable_social_links' );
253
  $social_intro = ot_get_option( 'social_links_intro_text' );
257
  $social_linkedin = ot_get_option( 'linkedin_profile_url' );
258
  $social_pinterest = ot_get_option( 'pinterest_url' );
259
  $social_instagram = ot_get_option( 'instagram_url' );
260
+
261
  if( 'off' != $nifty_social ) {
262
  echo '<li>
263
+ <section class="large-12 columns">
264
  <div class="nifty-row">
265
  <div class="small-12 small-centered columns">
266
  <div class="nifty-inform">'.$social_intro.
267
+ '</div>';
268
+ if (!empty($social_facebook) && $social_facebook != '#')
269
+ echo '<a href="'.$social_facebook.'"><span aria-hidden="true" class="icon-facebook"></span></a>';
270
+ if (!empty($social_twitter) && $social_twitter != '#')
271
+ echo '<a href="'.$social_twitter.'"><span aria-hidden="true" class="icon-twitter"></span></a>';
272
+ if (!empty($social_linkedin) && $social_linkedin != '#')
273
+ echo '<a href="'.$social_linkedin.'"><span aria-hidden="true" class="icon-linkedin"></span></a>';
274
+ if (!empty($social_pinterest) && $social_pinterest != '#')
275
+ echo '<a href="'.$social_pinterest.'"><span aria-hidden="true" class="icon-pinterest"></span></a>';
276
+ if (!empty($social_instagram) && $social_instagram != '#')
277
+ echo '<a href="'.$social_instagram.'"><span aria-hidden="true" class="icon-instagram"></span></a>';
278
+ if (!empty($social_googleplus) && $social_googleplus!= '#')
279
+ echo '<a href="'.$social_googleplus.'"><span aria-hidden="true" class="icon-google-plus"></span></a>';
280
+
281
+ echo '</div>
282
  </div>
283
  </section>
284
  </li>
285
  '
286
+
287
  ;
288
  } else {
289
  echo '<section class="large-12 columns"><div class="nifty-row"></div></section>';
290
  }
291
  ?>
292
+
293
+
294
+ </ul>
295
  </div>
 
296
  </div>
297
+ </div>
298
+
299
+
300
+ <!-- jQuery Vegas Background Slider -->
301
+
302
  <?php
303
  $nifty_background_slider = ot_get_option( 'disable_background_image_slider' );
304
+
305
  if( 'off' != $nifty_background_slider ) {
306
  $slide_1 = ot_get_option( 'upload_slider_images' );
307
  $slide_2 = ot_get_option( 'upload_slider_images_2' );
314
  $pattern = ot_get_option( 'select_pattern_overlay' );
315
  $pattern_opacity = ot_get_option( 'pattern_overlay_opacity' );
316
  $pattern_lib = OT_URL .'/assets/images/patterns/';
317
+
318
  echo "<script>
319
  jQuery(document).ready(function($){
320
  $('".$body."').vegas({
330
  { src:'".$slide_1."'},
331
  { src:'".$slide_2."'},
332
  { src:'".$slide_3."'}
333
+ ]
334
  }); });
335
  </script>";
336
+
337
  } else {
338
  }
339
+
340
  ?>
341
 
342
 
344
 
345
  // Timer Settings //
346
 
347
+ jQuery(function($) {
348
+ $('div#clock').countdown("<?php
349
+ $timer_state = ot_get_option( 'setup_the_count_down_timer' );
350
+ $time_updated = date("Y/m/d H:i", strtotime($timer_state));
351
  echo $time_updated;
352
+
353
+ ?>", function(event) {
354
  var $this = $(this);
355
  switch(event.type) {
356
  case "seconds":
360
  case "weeks":
361
  case "daysLeft":
362
  $this.find('span#'+event.type).html(event.value);
363
+
364
  break;
365
  case "finished":
366
  $this.hide();
370
  });
371
  </script>
372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
 
374
  <!-- Footer js scripts -->
375
 
383
 
384
  <?php
385
  $animation = ot_get_option( 'disable_animation' );
386
+
387
  if( 'off' != $animation ) {
388
  echo "<script>
389
  jQuery(document).ready(function($){
455
 
456
  <!-- Additional CSS -->
457
 
458
+ <?php
459
  $additional_css_code = ot_get_option( 'insert_additional_css' );
460
 
461
  echo "<style>".$additional_css_code."</style>";