YITH WooCommerce Zoom Magnifier - Version 1.2.18

Version Description

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Zoom Magnifier
Version 1.2.18
Comparing to
See all releases

Code changes from version 1.2.17 to 1.2.18

Files changed (85) hide show
  1. README.txt +246 -240
  2. assets/css/admin.css +19 -19
  3. assets/css/frontend.css +64 -64
  4. assets/css/yith_magnifier.css +70 -70
  5. assets/js/frontend.js +47 -47
  6. assets/js/yith_magnifier.js +790 -790
  7. class.yith-wcmg-admin.php +168 -168
  8. class.yith-wcmg-frontend.php +165 -165
  9. class.yith-wcmg.php +79 -79
  10. functions.yith-wcmg.php +78 -78
  11. init.php +158 -158
  12. lib/class.yith-woocommerce-zoom-magnifier.php +85 -85
  13. lib/class.yith-ywzm-custom-types.php +180 -180
  14. lib/class.yith-ywzm-plugin-fw-loader.php +300 -300
  15. plugin-fw/assets/css/colorbox.css +66 -0
  16. plugin-fw/assets/css/metaboxes.css +663 -629
  17. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  18. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_flat_10_000000_40x100.png +0 -0
  19. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  20. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  21. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  22. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  23. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  24. plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  25. plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_222222_256x240.png +0 -0
  26. plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_228ef1_256x240.png +0 -0
  27. plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_ef8c08_256x240.png +0 -0
  28. plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_ffd27a_256x240.png +0 -0
  29. plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_ffffff_256x240.png +0 -0
  30. plugin-fw/assets/css/overcast/jquery-ui-custom/jquery-ui-1.8.9.custom.css +578 -0
  31. plugin-fw/assets/css/yit-plugin-panel-sidebar.css +377 -0
  32. plugin-fw/assets/css/yit-plugin-panel.css +713 -664
  33. plugin-fw/assets/css/yit-upgrade-to-pro.css +77 -0
  34. plugin-fw/assets/css/yit-upgrader.css +13 -13
  35. plugin-fw/assets/images/colorbox/border1.png +0 -0
  36. plugin-fw/assets/images/colorbox/border2.png +0 -0
  37. plugin-fw/assets/images/colorbox/loading.gif +0 -0
  38. plugin-fw/assets/images/upgrade-page/01.jpg +0 -0
  39. plugin-fw/assets/images/upgrade-page/02.jpg +0 -0
  40. plugin-fw/assets/images/upgrade-page/03.jpg +0 -0
  41. plugin-fw/assets/images/upgrade-page/04.jpg +0 -0
  42. plugin-fw/assets/images/upgrade-page/05.jpg +0 -0
  43. plugin-fw/assets/images/upgrade-page/06.jpg +0 -0
  44. plugin-fw/assets/images/upgrade-page/07.jpg +0 -0
  45. plugin-fw/assets/images/upgrade-page/08.jpg +0 -0
  46. plugin-fw/assets/images/upgrade-page/09.jpg +0 -0
  47. plugin-fw/assets/images/widgets/box-icon.png +0 -0
  48. plugin-fw/assets/images/widgets/box-white-icon.png +0 -0
  49. plugin-fw/assets/images/widgets/despacho.png +0 -0
  50. plugin-fw/assets/images/widgets/info-icon.png +0 -0
  51. plugin-fw/assets/images/widgets/link-bg.png +0 -0
  52. plugin-fw/assets/images/widgets/link-bg2.png +0 -0
  53. plugin-fw/assets/images/widgets/link-icon.png +0 -0
  54. plugin-fw/assets/images/widgets/membership-bg.png +0 -0
  55. plugin-fw/assets/js/jquery.colorbox.js +1105 -0
  56. plugin-fw/assets/js/metabox.js +354 -353
  57. plugin-fw/assets/js/metabox.min.js +8 -8
  58. plugin-fw/assets/js/multisite-updater.js +216 -216
  59. plugin-fw/assets/js/multisite-updater.min.js +3 -3
  60. plugin-fw/assets/js/yit-cpt-unlimited.js +78 -78
  61. plugin-fw/assets/js/yit-cptu-sortable-posts.js +31 -31
  62. plugin-fw/assets/js/yit-plugin-panel-sidebar.js +56 -0
  63. plugin-fw/assets/js/yit-plugin-panel-sidebar.min.js +1 -0
  64. plugin-fw/assets/js/yit-plugin-panel.js +328 -328
  65. plugin-fw/assets/js/yit-plugin-panel.min.js +2 -2
  66. plugin-fw/assets/js/yit-wp-pointer.js +83 -83
  67. plugin-fw/assets/js/yit-wp-pointer.min.js +2 -2
  68. plugin-fw/init.php +56 -56
  69. plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
  70. plugin-fw/languages/yith-plugin-fw-it_IT.po +235 -89
  71. plugin-fw/languages/yith-plugin-fw.pot +96 -86
  72. plugin-fw/lib/yit-ajax.php +76 -0
  73. plugin-fw/lib/yit-cpt-unlimited.php +1774 -1774
  74. plugin-fw/lib/yit-metabox.php +549 -549
  75. plugin-fw/lib/yit-plugin-common.php +1259 -1259
  76. plugin-fw/lib/yit-plugin-gradients.php +535 -535
  77. plugin-fw/lib/yit-plugin-panel-sidebar.php +427 -0
  78. plugin-fw/lib/yit-plugin-panel-wc.php +450 -427
  79. plugin-fw/lib/yit-plugin-panel.php +920 -802
  80. plugin-fw/lib/yit-plugin-subpanel.php +164 -164
  81. plugin-fw/lib/yit-pointers.php +389 -389
  82. plugin-fw/lib/yit-upgrade.php +556 -556
  83. plugin-fw/lib/yit-video.php +199 -199
  84. plugin-fw/licence/assets/css/yit-licence.css +439 -439
  85. plugin-fw/licence/assets/js/yit-licence.js +173 -195
README.txt CHANGED
@@ -1,241 +1,247 @@
1
- === YITH WooCommerce Zoom Magnifier ===
2
-
3
- Contributors: yithemes
4
- Tags: zoom, magnifier, woocommerce, product image, themes, yit, e-commerce, shop, thumbnail, thumbnail slider, zoom image, carousel, image carousel
5
- Requires at least: 3.5.1
6
- Tested up to: 4.4.2
7
- Stable tag: 1.2.17
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- YITH WooCommerce Zoom Magnifier add zoom effect to product images and a customizable image slider.
12
-
13
- == Description ==
14
-
15
- = Improve the user experience, improve your sales =
16
-
17
- Offer to your visitors a chance to inspect in detail the quality of your products. With YITH WooCommerce Zoom Magnifier you can add a zoom effect to all your product images.
18
- The Wordpress plugin also adds a slider below the featured image with your product gallery images.
19
-
20
- = Main features =
21
-
22
- * Show a bigger size product image on mouseover.
23
- * Customize zoom area width and height and the size of the image to show as zoomed image.
24
- * Enable or disable it on mobile devices.
25
- * Add a slider showing product image thumbnails.
26
- * Customize the slider behavior.
27
-
28
- For a more detailed list of options and features of the plugin, please look at the [official documentation](http://yithemes.com/docs-plugins/yith_woocommerce_magnifier/ "Yith WooCommerce Zoom Magnifier official documentation").
29
-
30
- Discover all the features of the plugin and install it in your theme: the result will be extremely satisfying.
31
-
32
- == Installation ==
33
- Important: First of all, you have to download and activate WooCommerce plugin, which is mandatory for Yith WooCommerce Zoom Magnifier to be working.
34
-
35
- 1. Unzip the downloaded zip file.
36
- 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
37
- 3. Activate `YITH WooCommerce Zoom Magnifier` from Plugins page
38
-
39
- = Configuration =
40
-
41
- YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "YIT Plugins" menu item. There, you will find all Yithemes plugins with quick access to plugin setting page.
42
-
43
- == Frequently Asked Questions ==
44
-
45
- = The size of the Zoom image is not the size I setted. Why? =
46
- If you enabled the plugin after you uploaded the images of the product you need to [regenerate the thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/ "regenerate the thumbnails") before to use it. Another reason could be that the size setted for the zoom images is greather than the original image size.
47
-
48
- = I'm not able to change the sizes of Zoom Image. Why? =
49
- The size of the Zoom Image is automatically setted. If you want to change these values you just need to untick the option Forcing Zoom Image sizes.
50
-
51
- == Screenshots ==
52
-
53
- 1. The General plugin settings page. You can disable the plugin for mobile devices.
54
- 2. The Magnifier settings page. Choose the size of the zoom area, the size of the image to be shown in zoom area and the its position (on the right or over the image).
55
- 3. The slider settings page. You can choose to use the slider for product image thumbnails, set how many images to show within the slider, and the behavior of the slider, choosing if circular, infinite or standard carousel.
56
- 4. The zoom applied to a product image, showing zoomed image on the right side.
57
- 5. The zoom applied to a product image, showing zoomed image over the same image.
58
- 6. Choose how many items the slider should show, the image thumbnails will fit the available width.
59
-
60
- == Changelog ==
61
-
62
- = Version 1.2.17 - Released: Feb 24, 2016 =
63
-
64
- * Updated: YITH Plugin FW
65
- * Fixed: removed trailing comma in JS script that break the page rendering on old IE browser
66
-
67
- = Version 1.2.16 - Released: Jan 18, 2016 =
68
-
69
- * Updated: YITH Plugin FW loading remove unused YIT constant
70
- * Added: filter yith_ywzm_zoom_wrap_additional_css for customizing CSS class for the wrapping div
71
- * Updated: plugin ready for WooCommerce 2.5
72
-
73
- = Version 1.2.15 - Released: Jan 04, 2016 =
74
-
75
- * Fixed: Cannot redeclare yith_ywzm_install_woocommerce_admin_notice() when the plugin is loaded from YITH Essential Kit
76
-
77
- = Version 1.2.14 - Released: Dec 29, 2015 =
78
-
79
- * Added: Compatibility with YIT WooCommerce Featured Audio & Video Content
80
-
81
- = Version 1.2.13 - Released: Dec 21, 2015 =
82
-
83
- * Fixed: multiple wrap of zoom element with the div with class yith_magnifier_zoom_wrap
84
- * Updated: jquery-ui.css is no more linked as external resource but shipped within the plugin, as wordpress.org asked
85
-
86
- = Version 1.2.12 - Released: Oct 29, 2015 =
87
-
88
- * Updated: YITH plugin framework
89
-
90
- = Version 1.2.11 - Released: Oct 23, 2015 =
91
-
92
- * Updated: compatibility with YITH WooCommerce Quick View.
93
-
94
- = Version 1.2.10 - Released: Sep 24, 2015 =
95
-
96
- * Updated: changed text domain as translate.wordpress.org requisite.
97
-
98
- = Version 1.2.9 - Released: Sep 04, 2015 =
99
-
100
- * Updated: Languages file
101
- * Fixed: Changed plugin text domain from yit to ywmz
102
- * Fixed: featured image shown one time on slider.
103
- * Fixed: div not shown if loading text is empty.
104
-
105
- = Version 1.2.8 - Released: Sep 01, 2015 =
106
-
107
- * Fixed: removed deprecated woocommerce_update_option_X hook.
108
-
109
- = Version 1.2.7 - Released: Aug 27, 2015 =
110
-
111
- * Fixed: resolved XSS vulnerability.
112
-
113
- = Version 1.2.6 - Released: Aug 12, 2015 =
114
-
115
- * Tweak: update YITH Plugin framework.
116
-
117
- = Version 1.2.5 - Released: Jul 23, 2015 =
118
-
119
- * Added: italian language.
120
-
121
- = Version 1.2.4 - Released: Jun 26, 2015 =
122
-
123
- * Added: support to srcset and src-orig attributes.
124
-
125
- = Version 1.2.3 - Released: May 29, 2015 =
126
-
127
- * Added: included jquery-migrate as prerequisite.
128
-
129
- = Version 1.2.2 - Released: May 22, 2015 =
130
-
131
- * Fixed: CSS fix for EssentialGrid conflicts.
132
-
133
- = Version 1.2.1 - Released: May 04, 2015 =
134
-
135
- * Fixed: removed z-index that made the zoom area hiding other elements in certain themes.
136
-
137
- = Version 1.2.0 - Released: Apr 22, 2015 =
138
-
139
- * Fix : security issue (https://make.wordpress.org/plugins/2015/04/20/fixing-add_query_arg-and-remove_query_arg-usage/)
140
- * Tweak : support up to Wordpress 4.2
141
-
142
- = 1.1.8 =
143
-
144
- * Fixed: compatibility with some YITHEMES themes.
145
-
146
- = 1.1.7 =
147
-
148
- * Fixed: Unwanted expand link on product image.
149
-
150
- = 1.1.6 =
151
-
152
- * Added: the plugin can be disabled on mobile devices.
153
-
154
- = 1.1.5 =
155
-
156
- * Fixed: multiple wrap
157
-
158
- = 1.1.4 =
159
-
160
- * Tweak: WooCommerce 2.2. support
161
- * Fixed: Placeholder in product without featured image
162
- * Fixed: Slider items number options doesn't work
163
-
164
- = 1.1.3 =
165
-
166
- * Added: Support to WC 2.2.2
167
- * Updated: Plugin Core Framework
168
-
169
- = 1.1.2 =
170
-
171
- * Restored: Image size options on WC 2.1.x
172
- * Fixed: Items number option on thumb slider
173
- * Fixed: Hard crop issue on WC 2.1.x
174
-
175
- = 1.1.1 =
176
-
177
- * Fixed: Thumbnails slider direction on single product page
178
-
179
- = 1.1.0 =
180
-
181
- * Added: Support to WooCommerce 2.1.x
182
-
183
- = 1.0.8 =
184
-
185
- * Added: ability to change the slider programmatically
186
-
187
- = 1.0.7 =
188
-
189
- * Fixed: zoomed image did not change when select a variation
190
-
191
- = 1.0.6 =
192
-
193
- * Removed white space from frontend.php
194
-
195
- = 1.0.5 =
196
-
197
- * Fixed: magnifier override the plugin for featured video
198
-
199
- = 1.0.4 =
200
-
201
- * Minor bugs fixes
202
-
203
- = 1.0.3 =
204
-
205
- * Added ability to load the plugin even when WooCommerce is installed in a different folder
206
-
207
- = 1.0.2 =
208
-
209
- * Fixed fatal error to yit_debug with yit themes
210
-
211
- = 1.0.1 =
212
-
213
- * Optimized images
214
- * Updated internal framework
215
-
216
- = 1.0.0 =
217
-
218
- * Initial release
219
-
220
- == Suggestions ==
221
-
222
- If you have suggestions about how to improve YITH WooCommerce Zoom Magnifier, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH Zoom WooCommerce Magnifier.
223
-
224
- == Translators ==
225
-
226
- = Available Languages =
227
- * English (Default)
228
- * Italiano
229
-
230
- If you have created your own language pack, or have an update for an existing one, you can send [gettext PO and MO file](http://codex.wordpress.org/Translating_WordPress "Translating WordPress")
231
- [use](http://yithemes.com/contact/ "Your Inspiration Themes") so we can bundle it into YITH WooCommerce Zoom Magnfier Languages.
232
-
233
- == Documentation ==
234
-
235
- Full documentation is available [here](http://yithemes.com/docs-plugins/yith_woocommerce_magnifier/).
236
-
237
- == Upgrade notice ==
238
-
239
- = 1.0.0 =
240
-
 
 
 
 
 
 
241
  Initial release
1
+ === YITH WooCommerce Zoom Magnifier ===
2
+
3
+ Contributors: yithemes
4
+ Tags: zoom, magnifier, woocommerce, product image, themes, yit, e-commerce, shop, thumbnail, thumbnail slider, zoom image, carousel, image carousel
5
+ Requires at least: 3.5.1
6
+ Tested up to: 4.5
7
+ Stable tag: 1.2.18
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ YITH WooCommerce Zoom Magnifier add zoom effect to product images and a customizable image slider.
12
+
13
+ == Description ==
14
+
15
+ = Improve the user experience, improve your sales =
16
+
17
+ Offer to your visitors a chance to inspect in detail the quality of your products. With YITH WooCommerce Zoom Magnifier you can add a zoom effect to all your product images.
18
+ The Wordpress plugin also adds a slider below the featured image with your product gallery images.
19
+
20
+ = Main features =
21
+
22
+ * Show a bigger size product image on mouseover.
23
+ * Customize zoom area width and height and the size of the image to show as zoomed image.
24
+ * Enable or disable it on mobile devices.
25
+ * Add a slider showing product image thumbnails.
26
+ * Customize the slider behavior.
27
+
28
+ For a more detailed list of options and features of the plugin, please look at the [official documentation](http://yithemes.com/docs-plugins/yith_woocommerce_magnifier/ "Yith WooCommerce Zoom Magnifier official documentation").
29
+
30
+ Discover all the features of the plugin and install it in your theme: the result will be extremely satisfying.
31
+
32
+ == Installation ==
33
+ Important: First of all, you have to download and activate WooCommerce plugin, which is mandatory for Yith WooCommerce Zoom Magnifier to be working.
34
+
35
+ 1. Unzip the downloaded zip file.
36
+ 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
37
+ 3. Activate `YITH WooCommerce Zoom Magnifier` from Plugins page
38
+
39
+ = Configuration =
40
+
41
+ YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "YIT Plugins" menu item. There, you will find all Yithemes plugins with quick access to plugin setting page.
42
+
43
+ == Frequently Asked Questions ==
44
+
45
+ = The size of the Zoom image is not the size I setted. Why? =
46
+ If you enabled the plugin after you uploaded the images of the product you need to [regenerate the thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/ "regenerate the thumbnails") before to use it. Another reason could be that the size setted for the zoom images is greather than the original image size.
47
+
48
+ = I'm not able to change the sizes of Zoom Image. Why? =
49
+ The size of the Zoom Image is automatically setted. If you want to change these values you just need to untick the option Forcing Zoom Image sizes.
50
+
51
+ == Screenshots ==
52
+
53
+ 1. The General plugin settings page. You can disable the plugin for mobile devices.
54
+ 2. The Magnifier settings page. Choose the size of the zoom area, the size of the image to be shown in zoom area and the its position (on the right or over the image).
55
+ 3. The slider settings page. You can choose to use the slider for product image thumbnails, set how many images to show within the slider, and the behavior of the slider, choosing if circular, infinite or standard carousel.
56
+ 4. The zoom applied to a product image, showing zoomed image on the right side.
57
+ 5. The zoom applied to a product image, showing zoomed image over the same image.
58
+ 6. Choose how many items the slider should show, the image thumbnails will fit the available width.
59
+
60
+ == Changelog ==
61
+
62
+ = Version 1.2.18 - Released: May 02, 2016 =
63
+
64
+ * Updated: plugin compatible with WordPress 4.5
65
+ * Updated: plugin author name
66
+ * Updated: YITH Plugin Framework
67
+
68
+ = Version 1.2.17 - Released: Feb 24, 2016 =
69
+
70
+ * Updated: YITH Plugin FW
71
+ * Fixed: removed trailing comma in JS script that break the page rendering on old IE browser
72
+
73
+ = Version 1.2.16 - Released: Jan 18, 2016 =
74
+
75
+ * Updated: YITH Plugin FW loading remove unused YIT constant
76
+ * Added: filter yith_ywzm_zoom_wrap_additional_css for customizing CSS class for the wrapping div
77
+ * Updated: plugin ready for WooCommerce 2.5
78
+
79
+ = Version 1.2.15 - Released: Jan 04, 2016 =
80
+
81
+ * Fixed: Cannot redeclare yith_ywzm_install_woocommerce_admin_notice() when the plugin is loaded from YITH Essential Kit
82
+
83
+ = Version 1.2.14 - Released: Dec 29, 2015 =
84
+
85
+ * Added: Compatibility with YIT WooCommerce Featured Audio & Video Content
86
+
87
+ = Version 1.2.13 - Released: Dec 21, 2015 =
88
+
89
+ * Fixed: multiple wrap of zoom element with the div with class yith_magnifier_zoom_wrap
90
+ * Updated: jquery-ui.css is no more linked as external resource but shipped within the plugin, as wordpress.org asked
91
+
92
+ = Version 1.2.12 - Released: Oct 29, 2015 =
93
+
94
+ * Updated: YITH plugin framework
95
+
96
+ = Version 1.2.11 - Released: Oct 23, 2015 =
97
+
98
+ * Updated: compatibility with YITH WooCommerce Quick View.
99
+
100
+ = Version 1.2.10 - Released: Sep 24, 2015 =
101
+
102
+ * Updated: changed text domain as translate.wordpress.org requisite.
103
+
104
+ = Version 1.2.9 - Released: Sep 04, 2015 =
105
+
106
+ * Updated: Languages file
107
+ * Fixed: Changed plugin text domain from yit to ywmz
108
+ * Fixed: featured image shown one time on slider.
109
+ * Fixed: div not shown if loading text is empty.
110
+
111
+ = Version 1.2.8 - Released: Sep 01, 2015 =
112
+
113
+ * Fixed: removed deprecated woocommerce_update_option_X hook.
114
+
115
+ = Version 1.2.7 - Released: Aug 27, 2015 =
116
+
117
+ * Fixed: resolved XSS vulnerability.
118
+
119
+ = Version 1.2.6 - Released: Aug 12, 2015 =
120
+
121
+ * Tweak: update YITH Plugin framework.
122
+
123
+ = Version 1.2.5 - Released: Jul 23, 2015 =
124
+
125
+ * Added: italian language.
126
+
127
+ = Version 1.2.4 - Released: Jun 26, 2015 =
128
+
129
+ * Added: support to srcset and src-orig attributes.
130
+
131
+ = Version 1.2.3 - Released: May 29, 2015 =
132
+
133
+ * Added: included jquery-migrate as prerequisite.
134
+
135
+ = Version 1.2.2 - Released: May 22, 2015 =
136
+
137
+ * Fixed: CSS fix for EssentialGrid conflicts.
138
+
139
+ = Version 1.2.1 - Released: May 04, 2015 =
140
+
141
+ * Fixed: removed z-index that made the zoom area hiding other elements in certain themes.
142
+
143
+ = Version 1.2.0 - Released: Apr 22, 2015 =
144
+
145
+ * Fix : security issue (https://make.wordpress.org/plugins/2015/04/20/fixing-add_query_arg-and-remove_query_arg-usage/)
146
+ * Tweak : support up to Wordpress 4.2
147
+
148
+ = 1.1.8 =
149
+
150
+ * Fixed: compatibility with some YITHEMES themes.
151
+
152
+ = 1.1.7 =
153
+
154
+ * Fixed: Unwanted expand link on product image.
155
+
156
+ = 1.1.6 =
157
+
158
+ * Added: the plugin can be disabled on mobile devices.
159
+
160
+ = 1.1.5 =
161
+
162
+ * Fixed: multiple wrap
163
+
164
+ = 1.1.4 =
165
+
166
+ * Tweak: WooCommerce 2.2. support
167
+ * Fixed: Placeholder in product without featured image
168
+ * Fixed: Slider items number options doesn't work
169
+
170
+ = 1.1.3 =
171
+
172
+ * Added: Support to WC 2.2.2
173
+ * Updated: Plugin Core Framework
174
+
175
+ = 1.1.2 =
176
+
177
+ * Restored: Image size options on WC 2.1.x
178
+ * Fixed: Items number option on thumb slider
179
+ * Fixed: Hard crop issue on WC 2.1.x
180
+
181
+ = 1.1.1 =
182
+
183
+ * Fixed: Thumbnails slider direction on single product page
184
+
185
+ = 1.1.0 =
186
+
187
+ * Added: Support to WooCommerce 2.1.x
188
+
189
+ = 1.0.8 =
190
+
191
+ * Added: ability to change the slider programmatically
192
+
193
+ = 1.0.7 =
194
+
195
+ * Fixed: zoomed image did not change when select a variation
196
+
197
+ = 1.0.6 =
198
+
199
+ * Removed white space from frontend.php
200
+
201
+ = 1.0.5 =
202
+
203
+ * Fixed: magnifier override the plugin for featured video
204
+
205
+ = 1.0.4 =
206
+
207
+ * Minor bugs fixes
208
+
209
+ = 1.0.3 =
210
+
211
+ * Added ability to load the plugin even when WooCommerce is installed in a different folder
212
+
213
+ = 1.0.2 =
214
+
215
+ * Fixed fatal error to yit_debug with yit themes
216
+
217
+ = 1.0.1 =
218
+
219
+ * Optimized images
220
+ * Updated internal framework
221
+
222
+ = 1.0.0 =
223
+
224
+ * Initial release
225
+
226
+ == Suggestions ==
227
+
228
+ If you have suggestions about how to improve YITH WooCommerce Zoom Magnifier, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH Zoom WooCommerce Magnifier.
229
+
230
+ == Translators ==
231
+
232
+ = Available Languages =
233
+ * English (Default)
234
+ * Italiano
235
+
236
+ If you have created your own language pack, or have an update for an existing one, you can send [gettext PO and MO file](http://codex.wordpress.org/Translating_WordPress "Translating WordPress")
237
+ [use](http://yithemes.com/contact/ "Your Inspiration Themes") so we can bundle it into YITH WooCommerce Zoom Magnfier Languages.
238
+
239
+ == Documentation ==
240
+
241
+ Full documentation is available [here](http://yithemes.com/docs-plugins/yith_woocommerce_magnifier/).
242
+
243
+ == Upgrade notice ==
244
+
245
+ = 1.0.0 =
246
+
247
  Initial release
assets/css/admin.css CHANGED
@@ -1,20 +1,20 @@
1
- .yith_woocommerce_slider {
2
- width: 300px;
3
- float: left
4
- }
5
- .yith_woocommerce_slider_value {
6
- margin-top: -5px;
7
- margin-left: 10px;
8
- width: 50px;
9
- float: left;
10
- text-align: center;
11
- font-weight: bold;
12
- }
13
-
14
- .yith_banner {
15
- margin-top: 10px;
16
- }
17
-
18
- #eg-wrap .select_fake {/* solve back-end conflict with Essential Grid */
19
- height: 24px;
20
  }
1
+ .yith_woocommerce_slider {
2
+ width: 300px;
3
+ float: left
4
+ }
5
+ .yith_woocommerce_slider_value {
6
+ margin-top: -5px;
7
+ margin-left: 10px;
8
+ width: 50px;
9
+ float: left;
10
+ text-align: center;
11
+ font-weight: bold;
12
+ }
13
+
14
+ .yith_banner {
15
+ margin-top: 10px;
16
+ }
17
+
18
+ #eg-wrap .select_fake {/* solve back-end conflict with Essential Grid */
19
+ height: 24px;
20
  }
assets/css/frontend.css CHANGED
@@ -1,65 +1,65 @@
1
- /* gallery */
2
- .yith_magnifier_gallery {
3
- margin: 0;
4
- padding: 0;
5
- }
6
-
7
- .yith_magnifier_gallery li {
8
- position: relative;
9
- float: left;
10
- display: block;
11
- }
12
-
13
- .yith_magnifier_gallery li.last {
14
- margin-right: 0;
15
- }
16
-
17
- .yith_magnifier_gallery li a {
18
- width: 100% !important;
19
- display: block;
20
- margin-top: 10px;
21
- height: auto !important;
22
- }
23
-
24
- /* next/prev */
25
- .single-product.woocommerce .thumbnails {
26
- position: relative;
27
- }
28
-
29
- .single-product.woocommerce .thumbnails #slider-prev,
30
- .single-product.woocommerce .thumbnails #slider-next {
31
- display: none !important;
32
- cursor: pointer;
33
- width: 27px;
34
- height: 26px;
35
- background: url('../images/slider-arrow.png') no-repeat left center;
36
- position: absolute;
37
- top: 48%;
38
- margin-top: -2px;
39
- }
40
-
41
- .single-product.woocommerce .thumbnails #slider-prev {
42
- background-position: left center;
43
- left: 0px;
44
- }
45
-
46
- .single-product.woocommerce .thumbnails #slider-next {
47
- background-position: right center;
48
- right: 0px;
49
- }
50
-
51
- .single-product.woocommerce .thumbnails:hover #slider-prev,
52
- .single-product.woocommerce .thumbnails:hover #slider-next {
53
- display: block !important;
54
- }
55
-
56
- span.onsale {
57
- z-index: 10000
58
- }
59
-
60
- div.pp_woocommerce a.pp_expand {
61
- display: inline;
62
- bottom: 10px;
63
- top: initial;
64
- left: 10px;
65
  }
1
+ /* gallery */
2
+ .yith_magnifier_gallery {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ .yith_magnifier_gallery li {
8
+ position: relative;
9
+ float: left;
10
+ display: block;
11
+ }
12
+
13
+ .yith_magnifier_gallery li.last {
14
+ margin-right: 0;
15
+ }
16
+
17
+ .yith_magnifier_gallery li a {
18
+ width: 100% !important;
19
+ display: block;
20
+ margin-top: 10px;
21
+ height: auto !important;
22
+ }
23
+
24
+ /* next/prev */
25
+ .single-product.woocommerce .thumbnails {
26
+ position: relative;
27
+ }
28
+
29
+ .single-product.woocommerce .thumbnails #slider-prev,
30
+ .single-product.woocommerce .thumbnails #slider-next {
31
+ display: none !important;
32
+ cursor: pointer;
33
+ width: 27px;
34
+ height: 26px;
35
+ background: url('../images/slider-arrow.png') no-repeat left center;
36
+ position: absolute;
37
+ top: 48%;
38
+ margin-top: -2px;
39
+ }
40
+
41
+ .single-product.woocommerce .thumbnails #slider-prev {
42
+ background-position: left center;
43
+ left: 0px;
44
+ }
45
+
46
+ .single-product.woocommerce .thumbnails #slider-next {
47
+ background-position: right center;
48
+ right: 0px;
49
+ }
50
+
51
+ .single-product.woocommerce .thumbnails:hover #slider-prev,
52
+ .single-product.woocommerce .thumbnails:hover #slider-next {
53
+ display: block !important;
54
+ }
55
+
56
+ span.onsale {
57
+ z-index: 10000
58
+ }
59
+
60
+ div.pp_woocommerce a.pp_expand {
61
+ display: inline;
62
+ bottom: 10px;
63
+ top: initial;
64
+ left: 10px;
65
  }
assets/css/yith_magnifier.css CHANGED
@@ -1,70 +1,70 @@
1
- .yith_magnifier_zoom_wrap {
2
- top: 0;
3
- position: relative;
4
- }
5
-
6
- .yith_magnifier_loading {
7
- color:white;
8
- background:#222;
9
- padding:3px;
10
- border:1px solid #000;
11
- position: absolute;
12
- text-align: center;
13
- top: 10%;
14
- z-index: 9999;
15
- }
16
-
17
- .yith_magnifier_zoom {
18
- position: relative;
19
- display: block;
20
- }
21
-
22
- .yith_magnifier_zoom img {
23
- display: block;
24
- }
25
-
26
- .yith_magnifier_mousetrap {
27
- z-index: 999;
28
- position: absolute;
29
- width: 0px;
30
- height :0px;
31
- left: 0;
32
- top: 0;
33
- }
34
-
35
- /* ie fix */
36
- .ie .yith_magnifier_mousetrap {
37
- background-image: url(".");
38
- }
39
-
40
- .yith_magnifier_lens {
41
- display: none;
42
- z-index:98;
43
- position:absolute;
44
- overflow: hidden;
45
-
46
- border: 1px solid #ccc;
47
- }
48
-
49
- .yith_magnifier_lens img {
50
- width: auto !important;
51
- max-width: none !important;
52
-
53
- -webkit-transition: all ease-in-out 0s !important;
54
- -moz-transition: all ease-in-out 0s !important;
55
- -o-transition: all ease-in-out 0s !important;
56
- transition: all ease-in-out 0s !important;
57
- }
58
-
59
- .yith_magnifier_zoom_magnifier {
60
- display:none;
61
- position:absolute;
62
- z-index: 99;
63
-
64
- border:4px solid #ccc;
65
- overflow:hidden;
66
- }
67
-
68
- .yith_magnifier_gallery {
69
- list-style: none;
70
- }
1
+ .yith_magnifier_zoom_wrap {
2
+ top: 0;
3
+ position: relative;
4
+ }
5
+
6
+ .yith_magnifier_loading {
7
+ color:white;
8
+ background:#222;
9
+ padding:3px;
10
+ border:1px solid #000;
11
+ position: absolute;
12
+ text-align: center;
13
+ top: 10%;
14
+ z-index: 9999;
15
+ }
16
+
17
+ .yith_magnifier_zoom {
18
+ position: relative;
19
+ display: block;
20
+ }
21
+
22
+ .yith_magnifier_zoom img {
23
+ display: block;
24
+ }
25
+
26
+ .yith_magnifier_mousetrap {
27
+ z-index: 999;
28
+ position: absolute;
29
+ width: 0px;
30
+ height :0px;
31
+ left: 0;
32
+ top: 0;
33
+ }
34
+
35
+ /* ie fix */
36
+ .ie .yith_magnifier_mousetrap {
37
+ background-image: url(".");
38
+ }
39
+
40
+ .yith_magnifier_lens {
41
+ display: none;
42
+ z-index:98;
43
+ position:absolute;
44
+ overflow: hidden;
45
+
46
+ border: 1px solid #ccc;
47
+ }
48
+
49
+ .yith_magnifier_lens img {
50
+ width: auto !important;
51
+ max-width: none !important;
52
+
53
+ -webkit-transition: all ease-in-out 0s !important;
54
+ -moz-transition: all ease-in-out 0s !important;
55
+ -o-transition: all ease-in-out 0s !important;
56
+ transition: all ease-in-out 0s !important;
57
+ }
58
+
59
+ .yith_magnifier_zoom_magnifier {
60
+ display:none;
61
+ position:absolute;
62
+ z-index: 99;
63
+
64
+ border:4px solid #ccc;
65
+ overflow:hidden;
66
+ }
67
+
68
+ .yith_magnifier_gallery {
69
+ list-style: none;
70
+ }
assets/js/frontend.js CHANGED
@@ -1,48 +1,48 @@
1
- /**
2
- * frontend.js
3
- *
4
- * @author Your Inspiration Themes
5
- * @package YITH WooCommerce Zoom Magnifier
6
- */
7
- jQuery(document).ready(function ($) {
8
-
9
- var yith_wcmg = $('.images');
10
- var yith_wcmg_zoom = $('.yith_magnifier_zoom');
11
- var yith_wcmg_image = $('.yith_magnifier_zoom img');
12
-
13
- var yith_wcmg_default_zoom = yith_wcmg.find('.yith_magnifier_zoom').attr('href');
14
- var yith_wcmg_default_image = yith_wcmg.find('.yith_magnifier_zoom img').attr('src');
15
-
16
- if( typeof yith_magnifier_options == 'undefined' ) {
17
- return false;
18
- }
19
-
20
- yith_wcmg.yith_magnifier(yith_magnifier_options);
21
-
22
- $(document).on('found_variation', 'form.variations_form', function (event, variation) {
23
- var image_magnifier = variation.image_magnifier ? variation.image_magnifier : yith_wcmg_default_zoom;
24
- var image_src = variation.image_src ? variation.image_src : yith_wcmg_default_image;
25
-
26
- yith_wcmg_zoom.attr('href', image_magnifier);
27
- yith_wcmg_image.attr('src', image_src);
28
- yith_wcmg_image.attr('srcset', image_src);
29
- yith_wcmg_image.attr('src-orig', image_src);
30
-
31
- if (yith_wcmg.data('yith_magnifier')) {
32
- yith_wcmg.yith_magnifier('destroy');
33
- }
34
-
35
- yith_wcmg.yith_magnifier(yith_magnifier_options);
36
- }).on('reset_image', function (event) {
37
- yith_wcmg_zoom.attr('href', yith_wcmg_default_zoom);
38
- yith_wcmg_image.attr('src', yith_wcmg_default_image);
39
- yith_wcmg_image.attr('srcset', yith_wcmg_default_image);
40
- yith_wcmg_image.attr('src-orig', yith_wcmg_default_image);
41
-
42
- if (yith_wcmg.data('yith_magnifier')) {
43
- yith_wcmg.yith_magnifier('destroy');
44
- }
45
-
46
- yith_wcmg.yith_magnifier(yith_magnifier_options);
47
- });
48
  });
1
+ /**
2
+ * frontend.js
3
+ *
4
+ * @author Your Inspiration Themes
5
+ * @package YITH WooCommerce Zoom Magnifier
6
+ */
7
+ jQuery(document).ready(function ($) {
8
+
9
+ var yith_wcmg = $('.images');
10
+ var yith_wcmg_zoom = $('.yith_magnifier_zoom');
11
+ var yith_wcmg_image = $('.yith_magnifier_zoom img');
12
+
13
+ var yith_wcmg_default_zoom = yith_wcmg.find('.yith_magnifier_zoom').attr('href');
14
+ var yith_wcmg_default_image = yith_wcmg.find('.yith_magnifier_zoom img').attr('src');
15
+
16
+ if( typeof yith_magnifier_options == 'undefined' ) {
17
+ return false;
18
+ }
19
+
20
+ yith_wcmg.yith_magnifier(yith_magnifier_options);
21
+
22
+ $(document).on('found_variation', 'form.variations_form', function (event, variation) {
23
+ var image_magnifier = variation.image_magnifier ? variation.image_magnifier : yith_wcmg_default_zoom;
24
+ var image_src = variation.image_src ? variation.image_src : yith_wcmg_default_image;
25
+
26
+ yith_wcmg_zoom.attr('href', image_magnifier);
27
+ yith_wcmg_image.attr('src', image_src);
28
+ yith_wcmg_image.attr('srcset', image_src);
29
+ yith_wcmg_image.attr('src-orig', image_src);
30
+
31
+ if (yith_wcmg.data('yith_magnifier')) {
32
+ yith_wcmg.yith_magnifier('destroy');
33
+ }
34
+
35
+ yith_wcmg.yith_magnifier(yith_magnifier_options);
36
+ }).on('reset_image', function (event) {
37
+ yith_wcmg_zoom.attr('href', yith_wcmg_default_zoom);
38
+ yith_wcmg_image.attr('src', yith_wcmg_default_image);
39
+ yith_wcmg_image.attr('srcset', yith_wcmg_default_image);
40
+ yith_wcmg_image.attr('src-orig', yith_wcmg_default_image);
41
+
42
+ if (yith_wcmg.data('yith_magnifier')) {
43
+ yith_wcmg.yith_magnifier('destroy');
44
+ }
45
+
46
+ yith_wcmg.yith_magnifier(yith_magnifier_options);
47
+ });
48
  });
assets/js/yith_magnifier.js CHANGED
@@ -1,791 +1,791 @@
1
- /**
2
- * YITH Magnifier
3
- *
4
- * @version 0.1
5
- * @author Your Inspiration Themes Team <info@yithemes.com>
6
- *
7
- * MIT License.
8
- */
9
-
10
- ;
11
- (function (window, $, undefined) {
12
- 'use strict';
13
-
14
- //include imagesLoaded plugin
15
- if ($.fn.imagesLoaded === undefined) {
16
- /*!
17
- * jQuery imagesLoaded plugin v2.1.1
18
- * http://github.com/desandro/imagesloaded
19
- *
20
- * MIT License. by Paul Irish et al.
21
- */
22
-
23
- /*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */
24
- /*global jQuery: false */
25
-
26
- ;
27
- (function ($, undefined) {
28
- 'use strict';
29
-
30
- // blank image data-uri bypasses webkit log warning (thx doug jones)
31
- var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
32
-
33
- $.fn.imagesLoaded = function (callback) {
34
- var $this = this,
35
- deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
36
- hasNotify = $.isFunction(deferred.notify),
37
- $images = $this.find('img').add($this.filter('img')),
38
- loaded = [],
39
- proper = [],
40
- broken = [];
41
-
42
- // Register deferred callbacks
43
- if ($.isPlainObject(callback)) {
44
- $.each(callback, function (key, value) {
45
- if (key === 'callback') {
46
- callback = value;
47
- } else if (deferred) {
48
- deferred[key](value);
49
- }
50
- });
51
- }
52
-
53
- function doneLoading() {
54
- var $proper = $(proper),
55
- $broken = $(broken);
56
-
57
- if (deferred) {
58
- if (broken.length) {
59
- deferred.reject($images, $proper, $broken);
60
- } else {
61
- deferred.resolve($images);
62
- }
63
- }
64
-
65
- if ($.isFunction(callback)) {
66
- callback.call($this, $images, $proper, $broken);
67
- }
68
- }
69
-
70
- function imgLoadedHandler(event) {
71
- imgLoaded(event.target, event.type === 'error');
72
- }
73
-
74
- function imgLoaded(img, isBroken) {
75
- // don't proceed if BLANK image, or image is already loaded
76
- if (img.src === BLANK || $.inArray(img, loaded) !== -1) {
77
- return;
78
- }
79
-
80
- // store element in loaded images array
81
- loaded.push(img);
82
-
83
- // keep track of broken and properly loaded images
84
- if (isBroken) {
85
- broken.push(img);
86
- } else {
87
- proper.push(img);
88
- }
89
-
90
- // cache image and its state for future calls
91
- $.data(img, 'imagesLoaded', {isBroken: isBroken, src: img.src});
92
-
93
- // trigger deferred progress method if present
94
- if (hasNotify) {
95
- deferred.notifyWith($(img), [isBroken, $images, $(proper), $(broken)]);
96
- }
97
-
98
- // call doneLoading and clean listeners if all images are loaded
99
- if ($images.length === loaded.length) {
100
- setTimeout(doneLoading);
101
- $images.unbind('.imagesLoaded', imgLoadedHandler);
102
- }
103
- }
104
-
105
- // if no images, trigger immediately
106
- if (!$images.length) {
107
- doneLoading();
108
- } else {
109
- $images.bind('load.imagesLoaded error.imagesLoaded', imgLoadedHandler)
110
- .each(function (i, el) {
111
- var src = el.src;
112
-
113
- // find out if this image has been already checked for status
114
- // if it was, and src has not changed, call imgLoaded on it
115
- var cached = $.data(el, 'imagesLoaded');
116
- if (cached && cached.src === src) {
117
- imgLoaded(el, cached.isBroken);
118
- return;
119
- }
120
-
121
- // if complete is true and browser supports natural sizes, try
122
- // to check for image status manually
123
- if (el.complete && el.naturalWidth !== undefined) {
124
- imgLoaded(el, el.naturalWidth === 0 || el.naturalHeight === 0);
125
- return;
126
- }
127
-
128
- // cached images don't fire load sometimes, so we reset src, but only when
129
- // dealing with IE, or image is complete (loaded) and failed manual check
130
- // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
131
- if (el.readyState || el.complete) {
132
- el.src = BLANK;
133
- el.src = src;
134
- }
135
- });
136
- }
137
-
138
- return deferred ? deferred.promise($this) : $this;
139
- };
140
-
141
- })(jQuery);
142
- }
143
-
144
- $.yith_magnifier = function (options, element) {
145
- this.t = element;
146
- this.element = $(element);
147
- this._init(options);
148
- };
149
-
150
- $.yith_magnifier.defaults = {
151
- zoomWidth: 'auto',
152
- zoomHeight: 'auto',
153
- position: 'right',
154
- tint: false,
155
- tintOpacity: 0.5,
156
- lensOpacity: 0.5,
157
- softFocus: false,
158
- smoothMove: 3,
159
- showTitle: true,
160
- titleOpacity: 0.5,
161
- adjustX: 0,
162
- adjustY: 0,
163
-
164
- phoneBehavior: 'inside', //allowed values: inside, disable, default
165
- loadingLabel: 'Loading...',
166
-
167
- enableSlider: true,
168
- slider: 'carouFredSel',
169
- sliderOptions: {},
170
-
171
- onLoad: function () {
172
- return false;
173
- },
174
- onEnter: function () {
175
- return false
176
- },
177
- onLeave: function () {
178
- return false
179
- },
180
- onMove: function () {
181
- return false
182
- },
183
- onClick: function () {
184
- return false;
185
- },
186
-
187
- elements: {
188
- zoom: $('.yith_magnifier_zoom'),
189
- zoomImage: $('.yith_magnifier_zoom img'),
190
- gallery: $('.yith_magnifier_gallery li a')
191
- }
192
- };
193
-
194
- $.yith_magnifier.prototype = {
195
- /**
196
- * Let's start the magnifier
197
- *
198
- * @param {Object} options
199
- *
200
- * @private
201
- */
202
- _init: function (options) {
203
- var self = this;
204
-
205
- $(document).trigger('yith_magnifier_before_init');
206
-
207
- $.each($.yith_magnifier.defaults.elements, function (i, v) {
208
- var el = $.yith_magnifier.defaults.elements;
209
- el[i] = $(v, self);
210
- });
211
- self.options = $.extend(true, {}, $.yith_magnifier.defaults, options);
212
- self.isPhone = self._isPhone();
213
-
214
- self._loading();
215
-
216
- self.element.imagesLoaded(function () {
217
- self.options.onLoad();
218
- self._initZoom();
219
- self._initGallery();
220
- });
221
-
222
- $(document).trigger('yith_magnifier_after_init');
223
- },
224
-
225
-
226
- /**
227
- * Init gallery handlers
228
- *
229
- * @private
230
- *
231
- */
232
- _initGallery: function () {
233
- var self = this;
234
- var elements = self.options.elements;
235
-
236
- var gallery = elements.gallery;
237
- var zoom = elements.zoom;
238
- var zoomImage = elements.zoomImage;
239
-
240
- if (gallery.length > 0) {
241
- gallery.on('click', function (e) {
242
- e.preventDefault();
243
-
244
- var t = $(this);
245
- self.destroy();
246
-
247
- zoom.attr('href', this.href);
248
- zoomImage.attr('src', t.data('small'))
249
- .attr('srcset', t.data('small'))
250
- .attr('src-orig', t.data('small'))
251
- .attr('title', '')
252
- .attr('title', t.attr('title'));
253
-
254
- $.data(self.t, 'yith_magnifier', new $.yith_magnifier(self.options, self.element));
255
- });
256
-
257
- //gallery.filter(':first').trigger('click');
258
-
259
- if (self.options.enableSlider) {
260
- gallery.closest('ul').trigger('yith_magnifier_slider_destroy');
261
- gallery.closest('ul')[self.options.slider](self.options.sliderOptions);
262
- }
263
-
264
- } else {
265
- gallery.on('click', function (e) {
266
- e.preventDefault();
267
- return false;
268
- })
269
- }
270
- },
271
-
272
- /**
273
- * Show a loading icon while image isn't properly loaded
274
- *
275
- * @private
276
- */
277
- _loading: function () {
278
- if (this.options.disableRightClick) {
279
- $(document).on('contextmenu', function (e) {
280
- return false;
281
- });
282
- }
283
-
284
- if (this.mouseTrap === undefined) {
285
- var w = this.options.elements.zoom.width();
286
-
287
- if (this.options.loadingLabel) {
288
- $('<div class="yith_magnifier_loading">' + this.options.loadingLabel + '</div>').css({
289
- 'width': w,
290
- 'text-align': 'center',
291
- opacity: .5
292
- }).appendTo(this.options.elements.zoom.parent());
293
- }
294
- }
295
- },
296
-
297
- /**
298
- * Initialize the zoom images
299
- *
300
- * @private
301
- */
302
- _initZoom: function () {
303
- var self = this;
304
-
305
- self.zoom = self.options.elements.zoom;
306
- self.zoomImage = self.options.elements.zoomImage;
307
-
308
- //wrap the zoom image with a div
309
- var zoom_wrap_css_class = "yith_magnifier_zoom_wrap";
310
-
311
-
312
- if (self.options.zoom_wrap_additional_css) {
313
- if ( !$('.' + zoom_wrap_css_class).length ) {
314
-
315
- zoom_wrap_css_class += " " + self.options.zoom_wrap_additional_css;
316
- }
317
- }
318
-
319
- self.zoom.wrap('<div class="' + zoom_wrap_css_class + '"></div>');
320
-
321
- self.IMG_zoomImage = new Image();
322
- self.IMG_zoomImage.src = self.zoom.attr('href');
323
-
324
- self.IMG_smallImage = new Image();
325
- self.IMG_smallImage.src = self.zoomImage.attr('src');
326
-
327
- if ($.browser.msie && $.browser.version == 8) {
328
- $(self.IMG_zoomImage).load(function () {
329
-
330
- self._initTrap();
331
- });
332
- } else {
333
-
334
- $([self.IMG_zoomImage, self.IMG_smallImage]).imagesLoaded(function () {
335
-
336
- self._initTrap();
337
- });
338
- }
339
-
340
- $(document).trigger('yith_magnifier_after_init_zoom')
341
- },
342
-
343
- /**
344
- * Create the mouse trap
345
- *
346
- * @private
347
- */
348
- _initTrap: function () {
349
- var self = this;
350
- var zoomImg = self.IMG_zoomImage,
351
- thumbImg = self.IMG_smallImage;
352
-
353
- self.mx = 0;
354
- self.my = 0;
355
- self.controlTimer = 0;
356
- self.lens = null;
357
- self.tint = null;
358
- self.softFocus = null;
359
- self.zoomDiv = null;
360
- self.cw = 0;
361
- self.ch = 0;
362
- self.zw = 0;
363
- self.destU = 0;
364
- self.destV = 0;
365
- self.currU = 0;
366
- self.currV = 0;
367
- self.mouseTrap = null;
368
-
369
- var zoom = self.options.elements.zoom;
370
- var zoomImage = self.options.elements.zoomImage;
371
-
372
- //remove loading div
373
- //this.zoom.parent().siblings('.yith_magnifier_loading').remove();
374
- $('.yith_magnifier_loading').remove();
375
-
376
- if (this.element.find('.yith_magnifier_mousetrap')) {
377
- this.element.find('.yith_magnifier_mousetrap').remove();
378
- }
379
-
380
- this.mouseTrap = $('<div class="yith_magnifier_mousetrap" />').css({
381
- width: '100%', //zoomImage.outerWidth(),
382
- height: '100%', //zoomImage.outerHeight(),
383
- top: 0,
384
- left: 0
385
- }).appendTo(zoom.parent());
386
-
387
- // Detect device type, normal mouse or touchy(ipad android) by albanx
388
- var touchy = ("ontouchstart" in document.documentElement) ? true : false;
389
- var event_move = 'touchmove mousemove';
390
- var event_end = 'touchend mouseleave';
391
- var event_ent = 'touchstart mouseenter';
392
- var event_click = 'touchstart click';
393
-
394
- this.mouseTrap.on(event_move, this, function (e) {
395
- self.options.onMove();
396
-
397
- self.mx = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageX : e.pageX;
398
- self.my = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageY : e.pageY;
399
-
400
- }).on(event_end, this, function (e) {
401
-
402
- clearTimeout(self.controlTimer);
403
- //event.data.removeBits();
404
- if (self.lens) {
405
- self.lens.fadeOut(299);
406
- }
407
- if (self.tint) {
408
- self.tint.fadeOut(299);
409
- }
410
- if (self.softFocus) {
411
- self.softFocus.fadeOut(299);
412
- }
413
- self.zoomDiv.fadeOut(300, function () {
414
- self._onLeave();
415
- });
416
-
417
- return false;
418
-
419
- }).on(event_click, this, function (e) {
420
- self.options.onClick();
421
- }).on(event_ent, this, function (e) {
422
- self.options.onEnter();
423
-
424
- if (touchy) {
425
- e.preventDefault();
426
- }
427
-
428
- self.mx = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageX : e.pageX;
429
- self.my = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageY : e.pageY;
430
-
431
- self.zw = e.data;
432
- if (self.zoomDiv) {
433
- self.zoomDiv.stop(true, false);
434
- self.zoomDiv.remove();
435
- }
436
-
437
- var xPos = self.options.adjustX,
438
- yPos = self.options.adjustY;
439
-
440
- var siw = zoomImage.outerWidth();
441
- var sih = zoomImage.outerHeight();
442
-
443
- var w = self.options.zoomWidth;
444
- var h = self.options.zoomHeight;
445
-
446
- if (self.options.zoomWidth == 'auto') {
447
- w = siw;
448
- }
449
-
450
- if (self.options.zoomHeight == 'auto') {
451
- h = sih;
452
- }
453
-
454
- var appendTo = zoom.parent();
455
- switch (self.options.position) {
456
- case 'top':
457
- yPos -= h;
458
- break;
459
- case 'right':
460
- xPos += siw;
461
- break;
462
- case 'bottom':
463
- yPos += sih;
464
- break;
465
- case 'left':
466
- xPos -= w;
467
- break;
468
- case 'inside':
469
- w = siw;
470
- h = sih;
471
- break;
472
-
473
- // All other values, try and find an id in the dom to attach to.
474
- default:
475
- appendTo = $('#' + self.options.position);
476
- // If dom element doesn't exit, just use 'right' position as default.
477
- if (!appendTo.length) {
478
- appendTo = zoom;
479
- xPos += siw; //+ opts.adjustX;
480
- yPos += sih; // + opts.adjustY;
481
- } else {
482
- w = appendTo.innerWidth();
483
- h = appendTo.innerHeight();
484
- }
485
- }
486
-
487
- if (self.isPhone && self.options.phoneBehavior == 'inside') {
488
- w = siw;
489
- h = sih;
490
- xPos = 0;
491
- yPos = 0;
492
- }
493
-
494
- self.zoomDiv = $('<div class="yith_magnifier_zoom_magnifier" />').css({
495
- left: xPos,
496
- top: yPos,
497
- width: w,
498
- height: h,
499
- 'background-repeat': 'no-repeat',
500
- backgroundImage: 'url(' + zoomImg.src + ')'
501
- }).appendTo(appendTo);
502
-
503
- // Add the title from title tag.
504
- if (zoomImage.attr('title') && self.options.showTitle) {
505
- $('<div class="yith_magnifier_title">' + zoomImage.attr('title') + '</div>').appendTo(self.zoomDiv);
506
- }
507
-
508
- if (self.isPhone) {
509
- if (self.options.phoneBehavior != 'disable') {
510
- self.zoomDiv.fadeIn(500);
511
- } else {
512
- self.lens.fadeOut(299);
513
- }
514
- } else {
515
- self.zoomDiv.fadeIn(500);
516
- }
517
-
518
- if (self.lens) {
519
- self.lens.remove();
520
- self.lens = null;
521
- }
522
-
523
- if (zoomImg.width <= 1) {
524
- self.cw = (zoomImage.outerWidth() / zoomImg.naturalWidth) * self.zoomDiv.width();
525
- } else {
526
- self.cw = (zoomImage.outerWidth() / zoomImg.width) * self.zoomDiv.width();
527
- }
528
-
529
- if (zoomImg.height <= 1) {
530
- self.ch = (zoomImage.outerHeight() / zoomImg.naturalHeight) * self.zoomDiv.height();
531
- } else {
532
- self.ch = (zoomImage.outerHeight() / zoomImg.height) * self.zoomDiv.height();
533
- }
534
-
535
- // Attach mouse, initially invisible to prevent first frame glitch
536
- self.lens = $('<div class="yith_magnifier_lens" />').css({
537
- width: self.cw,
538
- height: self.ch
539
- }).appendTo(zoom);
540
-
541
- self.mouseTrap.css('cursor', self.lens.css('cursor'));
542
-
543
- var noTrans = false;
544
-
545
-
546
- // Init tint layer if needed. (Not relevant if using inside mode)
547
- if (self.options.tint) {
548
- //self.lens.css('background', 'url("' + zoomImage.attr('src') + '")');
549
- self.tint = $('<div />').css({
550
- display: 'none',
551
- position: 'absolute',
552
- left: 0,
553
- top: 0,
554
- width: zoomImage.outerWidth(),
555
- height: zoomImage.outerHeight(),
556
- backgroundColor: self.options.tint,
557
- opacity: self.options.tintOpacity
558
- }).appendTo(zoom);
559
-
560
-
561
- self.lens.append($('<img />', {
562
- src: zoomImage.attr('src')
563
- }));
564
-
565
- noTrans = true;
566
- self.tint.fadeIn(500);
567
- }
568
-
569
- if (self.options.softFocus) {
570
- //self.lens.css('background', 'url("' + zoomImage.attr('src') + '")');
571
- self.softFocus = $('<div />').css({
572
- position: 'absolute',
573
- display: 'none',
574
- top: '1px',
575
- left: '1px',
576
- width: zoomImage.outerWidth(),
577
- height: zoomImage.outerHeight(),
578
- //background: 'url("' + zoomImage.attr('src') + '")',
579
- //backgroundSize: '100%',
580
- opacity: .5
581
- }).appendTo(zoom);
582
-
583
- self.softFocus.append($('<img />', {
584
- src: zoomImage.attr('src')
585
- }));
586
-
587
- if (self.lens.find('img').length == 0) {
588
- self.lens.append($('<img />', {
589
- src: zoomImage.attr('src')
590
- }));
591
- }
592
-
593
- noTrans = true;
594
- self.softFocus.fadeIn(500);
595
- }
596
-
597
-
598
- if (!noTrans) {
599
- self.lens.css('opacity', self.options.lensOpacity);
600
- }
601
- if (self.options.position !== 'inside') {
602
- self.lens.fadeIn(500);
603
- }
604
-
605
- // Start processing.
606
- self.zw._controlLoop();
607
-
608
- return; // Don't return false here otherwise opera will not detect change of the mouse pointer type.
609
- });
610
- },
611
-
612
- /**
613
- *
614
- *
615
- * @private
616
- */
617
- _controlLoop: function () {
618
- var self = this;
619
-
620
- if (this.lens) {
621
- var x = (this.mx - this.zoomImage.offset().left - (this.cw * 0.5)) >> 0;
622
- var y = (this.my - this.zoomImage.offset().top - (this.ch * 0.5)) >> 0;
623
-
624
- if (x < 0) {
625
- x = 0;
626
- } else if (x > (this.zoomImage.outerWidth() - this.cw)) {
627
- x = (this.zoomImage.outerWidth() - this.cw);
628
- }
629
-
630
- if (y < 0) {
631
- y = 0;
632
- } else if (y > (this.zoomImage.outerHeight() - this.ch)) {
633
- y = (this.zoomImage.outerHeight() - this.ch);
634
- }
635
-
636
- this.lens.css({
637
- left: x - 2,
638
- top: y - 1
639
- });
640
-
641
- //this.lens.css('background-position', (-x) + 'px ' + (-y) + 'px');
642
-
643
-
644
- this.lens.find('img').css({
645
- width: this.zoomImage.outerWidth(),
646
- height: this.zoomImage.outerHeight(),
647
- marginLeft: (-x) + 'px ',
648
- marginTop: (-y) + 'px'
649
- });
650
-
651
-
652
- if (this.IMG_zoomImage.width <= 1) {
653
- this.destU = (((x) / this.zoomImage.outerWidth()) * this.IMG_zoomImage.naturalWidth) >> 0;
654
- } else {
655
- this.destU = (((x) / this.zoomImage.outerWidth()) * this.IMG_zoomImage.width) >> 0;
656
- }
657
-
658
- if (this.IMG_zoomImage.height <= 1) {
659
- this.destV = (((y) / this.zoomImage.outerHeight()) * this.IMG_zoomImage.naturalHeight) >> 0;
660
- } else {
661
- this.destV = (((y) / this.zoomImage.outerHeight()) * this.IMG_zoomImage.height) >> 0;
662
- }
663
-
664
-
665
- this.currU += (this.destU - this.currU) / this.options.smoothMove;
666
- this.currV += (this.destV - this.currV) / this.options.smoothMove;
667
-
668
- this.zoomDiv.css('background-position', (-(this.currU >> 0) + 'px ') + (-(this.currV >> 0) + 'px'));
669
- }
670
-
671
- this.controlTimer = setTimeout(function () {
672
- self._controlLoop();
673
- }, 30);
674
- },
675
-
676
- /**
677
- * This method is called when the mouse leave the image
678
- *
679
- * @private
680
- */
681
- _onLeave: function () {
682
- this.options.onLeave();
683
-
684
- if (this.zoomDiv) {
685
- this.zoomDiv.remove();
686
- this.zoomDiv = null;
687
- }
688
-
689
- this._removeElements();
690
- },
691
-
692
- /**
693
- * Remove lens, tint and softfocus
694
- *
695
- * @private
696
- */
697
- _removeElements: function () {
698
- if (this.lens) {
699
- this.lens.remove();
700
- this.lens = null;
701
- }
702
-
703
- if (this.tint) {
704
- this.tint.remove();
705
- this.tint = null;
706
- }
707
-
708
- if (this.softFocus) {
709
- this.softFocus.remove();
710
- this.softFocus = null;
711
- }
712
-
713
- if (this.element.find('.yith_magnifier_loading').length > 0) {
714
- this.element.find('.yith_magnifier_loading').remove();
715
- }
716
- },
717
-
718
- /**
719
- * Detect if user is using a phone device (eg iPhone)
720
- *
721
- * @private
722
- */
723
- _isPhone: function () {
724
- var userAgent = navigator.userAgent.toLowerCase();
725
-
726
- return ( userAgent.match(/iphone/i) || userAgent.match(/ipod/i) || userAgent.match(/android/i) );
727
- },
728
-
729
- /**
730
- * Destroy the instance
731
- *
732
- */
733
- destroy: function () {
734
- if (this.zoom) {
735
- this.zoom.unwrap();
736
- }
737
-
738
- if (this.mouseTrap) {
739
- this.mouseTrap.unbind();
740
- this.mouseTrap.remove();
741
- this.mouseTrap = null;
742
- }
743
-
744
- if (this.zoomDiv) {
745
- this.zoomDiv.remove();
746
- this.zoomDiv = null;
747
- }
748
-
749
- if (this.options.disableRightClick) {
750
- $(document).unbind();
751
- }
752
-
753
- this._removeElements();
754
- this.options.elements.gallery.unbind();
755
- this.element.removeData('yith_magnifier');
756
- }
757
- };
758
-
759
- $.fn.yith_magnifier = function (options) {
760
-
761
- if (typeof options === 'string') {
762
- var args = Array.prototype.slice.call(arguments, 1);
763
-
764
- this.each(function () {
765
- var instance = $.data(this, 'yith_magnifier');
766
- if (!instance) {
767
- $.error("cannot call methods on yith_magnifier prior to initialization; " +
768
- "attempted to call method '" + options + "'");
769
- return;
770
- }
771
- if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
772
- $.error("no such method '" + options + "' for yith_magnifier instance");
773
- return;
774
- }
775
- instance[options].apply(instance, args);
776
- });
777
- } else {
778
- this.each(function () {
779
- var instance = $.data(this, 'yith_magnifier');
780
- if (!instance) {
781
- $.data(this, 'yith_magnifier', new $.yith_magnifier(options, this));
782
- } else {
783
- $.error('yith_magnifier already istantiated.');
784
- }
785
- });
786
- }
787
- return this;
788
- };
789
-
790
-
791
  })(window, jQuery);
1
+ /**
2
+ * YITH Magnifier
3
+ *
4
+ * @version 0.1
5
+ * @author Your Inspiration Themes Team <info@yithemes.com>
6
+ *
7
+ * MIT License.
8
+ */
9
+
10
+ ;
11
+ (function (window, $, undefined) {
12
+ 'use strict';
13
+
14
+ //include imagesLoaded plugin
15
+ if ($.fn.imagesLoaded === undefined) {
16
+ /*!
17
+ * jQuery imagesLoaded plugin v2.1.1
18
+ * http://github.com/desandro/imagesloaded
19
+ *
20
+ * MIT License. by Paul Irish et al.
21
+ */
22
+
23
+ /*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */
24
+ /*global jQuery: false */
25
+
26
+ ;
27
+ (function ($, undefined) {
28
+ 'use strict';
29
+
30
+ // blank image data-uri bypasses webkit log warning (thx doug jones)
31
+ var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
32
+
33
+ $.fn.imagesLoaded = function (callback) {
34
+ var $this = this,
35
+ deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
36
+ hasNotify = $.isFunction(deferred.notify),
37
+ $images = $this.find('img').add($this.filter('img')),
38
+ loaded = [],
39
+ proper = [],
40
+ broken = [];
41
+
42
+ // Register deferred callbacks
43
+ if ($.isPlainObject(callback)) {
44
+ $.each(callback, function (key, value) {
45
+ if (key === 'callback') {
46
+ callback = value;
47
+ } else if (deferred) {
48
+ deferred[key](value);
49
+ }
50
+ });
51
+ }
52
+
53
+ function doneLoading() {
54
+ var $proper = $(proper),
55
+ $broken = $(broken);
56
+
57
+ if (deferred) {
58
+ if (broken.length) {
59
+ deferred.reject($images, $proper, $broken);
60
+ } else {
61
+ deferred.resolve($images);
62
+ }
63
+ }
64
+
65
+ if ($.isFunction(callback)) {
66
+ callback.call($this, $images, $proper, $broken);
67
+ }
68
+ }
69
+
70
+ function imgLoadedHandler(event) {
71
+ imgLoaded(event.target, event.type === 'error');
72
+ }
73
+
74
+ function imgLoaded(img, isBroken) {
75
+ // don't proceed if BLANK image, or image is already loaded
76
+ if (img.src === BLANK || $.inArray(img, loaded) !== -1) {
77
+ return;
78
+ }
79
+
80
+ // store element in loaded images array
81
+ loaded.push(img);
82
+
83
+ // keep track of broken and properly loaded images
84
+ if (isBroken) {
85
+ broken.push(img);
86
+ } else {
87
+ proper.push(img);
88
+ }
89
+
90
+ // cache image and its state for future calls
91
+ $.data(img, 'imagesLoaded', {isBroken: isBroken, src: img.src});
92
+
93
+ // trigger deferred progress method if present
94
+ if (hasNotify) {
95
+ deferred.notifyWith($(img), [isBroken, $images, $(proper), $(broken)]);
96
+ }
97
+
98
+ // call doneLoading and clean listeners if all images are loaded
99
+ if ($images.length === loaded.length) {
100
+ setTimeout(doneLoading);
101
+ $images.unbind('.imagesLoaded', imgLoadedHandler);
102
+ }
103
+ }
104
+
105
+ // if no images, trigger immediately
106
+ if (!$images.length) {
107
+ doneLoading();
108
+ } else {
109
+ $images.bind('load.imagesLoaded error.imagesLoaded', imgLoadedHandler)
110
+ .each(function (i, el) {
111
+ var src = el.src;
112
+
113
+ // find out if this image has been already checked for status
114
+ // if it was, and src has not changed, call imgLoaded on it
115
+ var cached = $.data(el, 'imagesLoaded');
116
+ if (cached && cached.src === src) {
117
+ imgLoaded(el, cached.isBroken);
118
+ return;
119
+ }
120
+
121
+ // if complete is true and browser supports natural sizes, try
122
+ // to check for image status manually
123
+ if (el.complete && el.naturalWidth !== undefined) {
124
+ imgLoaded(el, el.naturalWidth === 0 || el.naturalHeight === 0);
125
+ return;
126
+ }
127
+
128
+ // cached images don't fire load sometimes, so we reset src, but only when
129
+ // dealing with IE, or image is complete (loaded) and failed manual check
130
+ // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
131
+ if (el.readyState || el.complete) {
132
+ el.src = BLANK;
133
+ el.src = src;
134
+ }
135
+ });
136
+ }
137
+
138
+ return deferred ? deferred.promise($this) : $this;
139
+ };
140
+
141
+ })(jQuery);
142
+ }
143
+
144
+ $.yith_magnifier = function (options, element) {
145
+ this.t = element;
146
+ this.element = $(element);
147
+ this._init(options);
148
+ };
149
+
150
+ $.yith_magnifier.defaults = {
151
+ zoomWidth: 'auto',
152
+ zoomHeight: 'auto',
153
+ position: 'right',
154
+ tint: false,
155
+ tintOpacity: 0.5,
156
+ lensOpacity: 0.5,
157
+ softFocus: false,
158
+ smoothMove: 3,
159
+ showTitle: true,
160
+ titleOpacity: 0.5,
161
+ adjustX: 0,
162
+ adjustY: 0,
163
+
164
+ phoneBehavior: 'inside', //allowed values: inside, disable, default
165
+ loadingLabel: 'Loading...',
166
+
167
+ enableSlider: true,
168
+ slider: 'carouFredSel',
169
+ sliderOptions: {},
170
+
171
+ onLoad: function () {
172
+ return false;
173
+ },
174
+ onEnter: function () {
175
+ return false
176
+ },
177
+ onLeave: function () {
178
+ return false
179
+ },
180
+ onMove: function () {
181
+ return false
182
+ },
183
+ onClick: function () {
184
+ return false;
185
+ },
186
+
187
+ elements: {
188
+ zoom: $('.yith_magnifier_zoom'),
189
+ zoomImage: $('.yith_magnifier_zoom img'),
190
+ gallery: $('.yith_magnifier_gallery li a')
191
+ }
192
+ };
193
+
194
+ $.yith_magnifier.prototype = {
195
+ /**
196
+ * Let's start the magnifier
197
+ *
198
+ * @param {Object} options
199
+ *
200
+ * @private
201
+ */
202
+ _init: function (options) {
203
+ var self = this;
204
+
205
+ $(document).trigger('yith_magnifier_before_init');
206
+
207
+ $.each($.yith_magnifier.defaults.elements, function (i, v) {
208
+ var el = $.yith_magnifier.defaults.elements;
209
+ el[i] = $(v, self);
210
+ });
211
+ self.options = $.extend(true, {}, $.yith_magnifier.defaults, options);
212
+ self.isPhone = self._isPhone();
213
+
214
+ self._loading();
215
+
216
+ self.element.imagesLoaded(function () {
217
+ self.options.onLoad();
218
+ self._initZoom();
219
+ self._initGallery();
220
+ });
221
+
222
+ $(document).trigger('yith_magnifier_after_init');
223
+ },
224
+
225
+
226
+ /**
227
+ * Init gallery handlers
228
+ *
229
+ * @private
230
+ *
231
+ */
232
+ _initGallery: function () {
233
+ var self = this;
234
+ var elements = self.options.elements;
235
+
236
+ var gallery = elements.gallery;
237
+ var zoom = elements.zoom;
238
+ var zoomImage = elements.zoomImage;
239
+
240
+ if (gallery.length > 0) {
241
+ gallery.on('click', function (e) {
242
+ e.preventDefault();
243
+
244
+ var t = $(this);
245
+ self.destroy();
246
+
247
+ zoom.attr('href', this.href);
248
+ zoomImage.attr('src', t.data('small'))
249
+ .attr('srcset', t.data('small'))
250
+ .attr('src-orig', t.data('small'))
251
+ .attr('title', '')
252
+ .attr('title', t.attr('title'));
253
+
254
+ $.data(self.t, 'yith_magnifier', new $.yith_magnifier(self.options, self.element));
255
+ });
256
+
257
+ //gallery.filter(':first').trigger('click');
258
+
259
+ if (self.options.enableSlider) {
260
+ gallery.closest('ul').trigger('yith_magnifier_slider_destroy');
261
+ gallery.closest('ul')[self.options.slider](self.options.sliderOptions);
262
+ }
263
+
264
+ } else {
265
+ gallery.on('click', function (e) {
266
+ e.preventDefault();
267
+ return false;
268
+ })
269
+ }
270
+ },
271
+
272
+ /**
273
+ * Show a loading icon while image isn't properly loaded
274
+ *
275
+ * @private
276
+ */
277
+ _loading: function () {
278
+ if (this.options.disableRightClick) {
279
+ $(document).on('contextmenu', function (e) {
280
+ return false;
281
+ });
282
+ }
283
+
284
+ if (this.mouseTrap === undefined) {
285
+ var w = this.options.elements.zoom.width();
286
+
287
+ if (this.options.loadingLabel) {
288
+ $('<div class="yith_magnifier_loading">' + this.options.loadingLabel + '</div>').css({
289
+ 'width': w,
290
+ 'text-align': 'center',
291
+ opacity: .5
292
+ }).appendTo(this.options.elements.zoom.parent());
293
+ }
294
+ }
295
+ },
296
+
297
+ /**
298
+ * Initialize the zoom images
299
+ *
300
+ * @private
301
+ */
302
+ _initZoom: function () {
303
+ var self = this;
304
+
305
+ self.zoom = self.options.elements.zoom;
306
+ self.zoomImage = self.options.elements.zoomImage;
307
+
308
+ //wrap the zoom image with a div
309
+ var zoom_wrap_css_class = "yith_magnifier_zoom_wrap";
310
+
311
+
312
+ if (self.options.zoom_wrap_additional_css) {
313
+ if ( !$('.' + zoom_wrap_css_class).length ) {
314
+
315
+ zoom_wrap_css_class += " " + self.options.zoom_wrap_additional_css;
316
+ }
317
+ }
318
+
319
+ self.zoom.wrap('<div class="' + zoom_wrap_css_class + '"></div>');
320
+
321
+ self.IMG_zoomImage = new Image();
322
+ self.IMG_zoomImage.src = self.zoom.attr('href');
323
+
324
+ self.IMG_smallImage = new Image();
325
+ self.IMG_smallImage.src = self.zoomImage.attr('src');
326
+
327
+ if ($.browser.msie && $.browser.version == 8) {
328
+ $(self.IMG_zoomImage).load(function () {
329
+
330
+ self._initTrap();
331
+ });
332
+ } else {
333
+
334
+ $([self.IMG_zoomImage, self.IMG_smallImage]).imagesLoaded(function () {
335
+
336
+ self._initTrap();
337
+ });
338
+ }
339
+
340
+ $(document).trigger('yith_magnifier_after_init_zoom')
341
+ },
342
+
343
+ /**
344
+ * Create the mouse trap
345
+ *
346
+ * @private
347
+ */
348
+ _initTrap: function () {
349
+ var self = this;
350
+ var zoomImg = self.IMG_zoomImage,
351
+ thumbImg = self.IMG_smallImage;
352
+
353
+ self.mx = 0;
354
+ self.my = 0;
355
+ self.controlTimer = 0;
356
+ self.lens = null;
357
+ self.tint = null;
358
+ self.softFocus = null;
359
+ self.zoomDiv = null;
360
+ self.cw = 0;
361
+ self.ch = 0;
362
+ self.zw = 0;
363
+ self.destU = 0;
364
+ self.destV = 0;
365
+ self.currU = 0;
366
+ self.currV = 0;
367
+ self.mouseTrap = null;
368
+
369
+ var zoom = self.options.elements.zoom;
370
+ var zoomImage = self.options.elements.zoomImage;
371
+
372
+ //remove loading div
373
+ //this.zoom.parent().siblings('.yith_magnifier_loading').remove();
374
+ $('.yith_magnifier_loading').remove();
375
+
376
+ if (this.element.find('.yith_magnifier_mousetrap')) {
377
+ this.element.find('.yith_magnifier_mousetrap').remove();
378
+ }
379
+
380
+ this.mouseTrap = $('<div class="yith_magnifier_mousetrap" />').css({
381
+ width: '100%', //zoomImage.outerWidth(),
382
+ height: '100%', //zoomImage.outerHeight(),
383
+ top: 0,
384
+ left: 0
385
+ }).appendTo(zoom.parent());
386
+
387
+ // Detect device type, normal mouse or touchy(ipad android) by albanx
388
+ var touchy = ("ontouchstart" in document.documentElement) ? true : false;
389
+ var event_move = 'touchmove mousemove';
390
+ var event_end = 'touchend mouseleave';
391
+ var event_ent = 'touchstart mouseenter';
392
+ var event_click = 'touchstart click';
393
+
394
+ this.mouseTrap.on(event_move, this, function (e) {
395
+ self.options.onMove();
396
+
397
+ self.mx = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageX : e.pageX;
398
+ self.my = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageY : e.pageY;
399
+
400
+ }).on(event_end, this, function (e) {
401
+
402
+ clearTimeout(self.controlTimer);
403
+ //event.data.removeBits();
404
+ if (self.lens) {
405
+ self.lens.fadeOut(299);
406
+ }
407
+ if (self.tint) {
408
+ self.tint.fadeOut(299);
409
+ }
410
+ if (self.softFocus) {
411
+ self.softFocus.fadeOut(299);
412
+ }
413
+ self.zoomDiv.fadeOut(300, function () {
414
+ self._onLeave();
415
+ });
416
+
417
+ return false;
418
+
419
+ }).on(event_click, this, function (e) {
420
+ self.options.onClick();
421
+ }).on(event_ent, this, function (e) {
422
+ self.options.onEnter();
423
+
424
+ if (touchy) {
425
+ e.preventDefault();
426
+ }
427
+
428
+ self.mx = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageX : e.pageX;
429
+ self.my = ( typeof(e.originalEvent.touches) != 'undefined' ) ? e.originalEvent.touches[0].pageY : e.pageY;
430
+
431
+ self.zw = e.data;
432
+ if (self.zoomDiv) {
433
+ self.zoomDiv.stop(true, false);
434
+ self.zoomDiv.remove();
435
+ }
436
+
437
+ var xPos = self.options.adjustX,
438
+ yPos = self.options.adjustY;
439
+
440
+ var siw = zoomImage.outerWidth();
441
+ var sih = zoomImage.outerHeight();
442
+
443
+ var w = self.options.zoomWidth;
444
+ var h = self.options.zoomHeight;
445
+
446
+ if (self.options.zoomWidth == 'auto') {
447
+ w = siw;
448
+ }
449
+
450
+ if (self.options.zoomHeight == 'auto') {
451
+ h = sih;
452
+ }
453
+
454
+ var appendTo = zoom.parent();
455
+ switch (self.options.position) {
456
+ case 'top':
457
+ yPos -= h;
458
+ break;
459
+ case 'right':
460
+ xPos += siw;
461
+ break;
462
+ case 'bottom':
463
+ yPos += sih;
464
+ break;
465
+ case 'left':
466
+ xPos -= w;
467
+ break;
468
+ case 'inside':
469
+ w = siw;
470
+ h = sih;
471
+ break;
472
+
473
+ // All other values, try and find an id in the dom to attach to.
474
+ default:
475
+ appendTo = $('#' + self.options.position);
476
+ // If dom element doesn't exit, just use 'right' position as default.
477
+ if (!appendTo.length) {
478
+ appendTo = zoom;
479
+ xPos += siw; //+ opts.adjustX;
480
+ yPos += sih; // + opts.adjustY;
481
+ } else {
482
+ w = appendTo.innerWidth();
483
+ h = appendTo.innerHeight();
484
+ }
485
+ }
486
+
487
+ if (self.isPhone && self.options.phoneBehavior == 'inside') {
488
+ w = siw;
489
+ h = sih;
490
+ xPos = 0;
491
+ yPos = 0;
492
+ }
493
+
494
+ self.zoomDiv = $('<div class="yith_magnifier_zoom_magnifier" />').css({
495
+ left: xPos,
496
+ top: yPos,
497
+ width: w,
498
+ height: h,
499
+ 'background-repeat': 'no-repeat',
500
+ backgroundImage: 'url(' + zoomImg.src + ')'
501
+ }).appendTo(appendTo);
502
+
503
+ // Add the title from title tag.
504
+ if (zoomImage.attr('title') && self.options.showTitle) {
505
+ $('<div class="yith_magnifier_title">' + zoomImage.attr('title') + '</div>').appendTo(self.zoomDiv);
506
+ }
507
+
508
+ if (self.isPhone) {
509
+ if (self.options.phoneBehavior != 'disable') {
510
+ self.zoomDiv.fadeIn(500);
511
+ } else {
512
+ self.lens.fadeOut(299);
513
+ }
514
+ } else {
515
+ self.zoomDiv.fadeIn(500);
516
+ }
517
+
518
+ if (self.lens) {
519
+ self.lens.remove();
520
+ self.lens = null;
521
+ }
522
+
523
+ if (zoomImg.width <= 1) {
524
+ self.cw = (zoomImage.outerWidth() / zoomImg.naturalWidth) * self.zoomDiv.width();
525
+ } else {
526
+ self.cw = (zoomImage.outerWidth() / zoomImg.width) * self.zoomDiv.width();
527
+ }
528
+
529
+ if (zoomImg.height <= 1) {
530
+ self.ch = (zoomImage.outerHeight() / zoomImg.naturalHeight) * self.zoomDiv.height();
531
+ } else {
532
+ self.ch = (zoomImage.outerHeight() / zoomImg.height) * self.zoomDiv.height();
533
+ }
534
+
535
+ // Attach mouse, initially invisible to prevent first frame glitch
536
+ self.lens = $('<div class="yith_magnifier_lens" />').css({
537
+ width: self.cw,
538
+ height: self.ch
539
+ }).appendTo(zoom);
540
+
541
+ self.mouseTrap.css('cursor', self.lens.css('cursor'));
542
+
543
+ var noTrans = false;
544
+
545
+
546
+ // Init tint layer if needed. (Not relevant if using inside mode)
547
+ if (self.options.tint) {
548
+ //self.lens.css('background', 'url("' + zoomImage.attr('src') + '")');
549
+ self.tint = $('<div />').css({
550
+ display: 'none',
551
+ position: 'absolute',
552
+ left: 0,
553
+ top: 0,
554
+ width: zoomImage.outerWidth(),
555
+ height: zoomImage.outerHeight(),
556
+ backgroundColor: self.options.tint,
557
+ opacity: self.options.tintOpacity
558
+ }).appendTo(zoom);
559
+
560
+
561
+ self.lens.append($('<img />', {
562
+ src: zoomImage.attr('src')
563
+ }));
564
+
565
+ noTrans = true;
566
+ self.tint.fadeIn(500);
567
+ }
568
+
569
+ if (self.options.softFocus) {
570
+ //self.lens.css('background', 'url("' + zoomImage.attr('src') + '")');
571
+ self.softFocus = $('<div />').css({
572
+ position: 'absolute',
573
+ display: 'none',
574
+ top: '1px',
575
+ left: '1px',
576
+ width: zoomImage.outerWidth(),
577
+ height: zoomImage.outerHeight(),
578
+ //background: 'url("' + zoomImage.attr('src') + '")',
579
+ //backgroundSize: '100%',
580
+ opacity: .5
581
+ }).appendTo(zoom);
582
+
583
+ self.softFocus.append($('<img />', {
584
+ src: zoomImage.attr('src')
585
+ }));
586
+
587
+ if (self.lens.find('img').length == 0) {
588
+ self.lens.append($('<img />', {
589
+ src: zoomImage.attr('src')
590
+ }));
591
+ }
592
+
593
+ noTrans = true;
594
+ self.softFocus.fadeIn(500);
595
+ }
596
+
597
+
598
+ if (!noTrans) {
599
+ self.lens.css('opacity', self.options.lensOpacity);
600
+ }
601
+ if (self.options.position !== 'inside') {
602
+ self.lens.fadeIn(500);
603
+ }
604
+
605
+ // Start processing.
606
+ self.zw._controlLoop();
607
+
608
+ return; // Don't return false here otherwise opera will not detect change of the mouse pointer type.
609
+ });
610
+ },
611
+
612
+ /**
613
+ *
614
+ *
615
+ * @private
616
+ */
617
+ _controlLoop: function () {
618
+ var self = this;
619
+
620
+ if (this.lens) {
621
+ var x = (this.mx - this.zoomImage.offset().left - (this.cw * 0.5)) >> 0;
622
+ var y = (this.my - this.zoomImage.offset().top - (this.ch * 0.5)) >> 0;
623
+
624
+ if (x < 0) {
625
+ x = 0;
626
+ } else if (x > (this.zoomImage.outerWidth() - this.cw)) {
627
+ x = (this.zoomImage.outerWidth() - this.cw);
628
+ }
629
+
630
+ if (y < 0) {
631
+ y = 0;
632
+ } else if (y > (this.zoomImage.outerHeight() - this.ch)) {
633
+ y = (this.zoomImage.outerHeight() - this.ch);
634
+ }
635
+
636
+ this.lens.css({
637
+ left: x - 2,
638
+ top: y - 1
639
+ });
640
+
641
+ //this.lens.css('background-position', (-x) + 'px ' + (-y) + 'px');
642
+
643
+
644
+ this.lens.find('img').css({
645
+ width: this.zoomImage.outerWidth(),
646
+ height: this.zoomImage.outerHeight(),
647
+ marginLeft: (-x) + 'px ',
648
+ marginTop: (-y) + 'px'
649
+ });
650
+
651
+
652
+ if (this.IMG_zoomImage.width <= 1) {
653
+ this.destU = (((x) / this.zoomImage.outerWidth()) * this.IMG_zoomImage.naturalWidth) >> 0;
654
+ } else {
655
+ this.destU = (((x) / this.zoomImage.outerWidth()) * this.IMG_zoomImage.width) >> 0;
656
+ }
657
+
658
+ if (this.IMG_zoomImage.height <= 1) {
659
+ this.destV = (((y) / this.zoomImage.outerHeight()) * this.IMG_zoomImage.naturalHeight) >> 0;
660
+ } else {
661
+ this.destV = (((y) / this.zoomImage.outerHeight()) * this.IMG_zoomImage.height) >> 0;
662
+ }
663
+
664
+
665
+ this.currU += (this.destU - this.currU) / this.options.smoothMove;
666
+ this.currV += (this.destV - this.currV) / this.options.smoothMove;
667
+
668
+ this.zoomDiv.css('background-position', (-(this.currU >> 0) + 'px ') + (-(this.currV >> 0) + 'px'));
669
+ }
670
+
671
+ this.controlTimer = setTimeout(function () {
672
+ self._controlLoop();
673
+ }, 30);
674
+ },
675
+
676
+ /**
677
+ * This method is called when the mouse leave the image
678
+ *
679
+ * @private
680
+ */
681
+ _onLeave: function () {
682
+ this.options.onLeave();
683
+
684
+ if (this.zoomDiv) {
685
+ this.zoomDiv.remove();
686
+ this.zoomDiv = null;
687
+ }
688
+
689
+ this._removeElements();
690
+ },
691
+
692
+ /**
693
+ * Remove lens, tint and softfocus
694
+ *
695
+ * @private
696
+ */
697
+ _removeElements: function () {
698
+ if (this.lens) {
699
+ this.lens.remove();
700
+ this.lens = null;
701
+ }
702
+
703
+ if (this.tint) {
704
+ this.tint.remove();
705
+ this.tint = null;
706
+ }
707
+
708
+ if (this.softFocus) {
709
+ this.softFocus.remove();
710
+ this.softFocus = null;
711
+ }
712
+
713
+ if (this.element.find('.yith_magnifier_loading').length > 0) {
714
+ this.element.find('.yith_magnifier_loading').remove();
715
+ }
716
+ },
717
+
718
+ /**
719
+ * Detect if user is using a phone device (eg iPhone)
720
+ *
721
+ * @private
722
+ */
723
+ _isPhone: function () {
724
+ var userAgent = navigator.userAgent.toLowerCase();
725
+
726
+ return ( userAgent.match(/iphone/i) || userAgent.match(/ipod/i) || userAgent.match(/android/i) );
727
+ },
728
+
729
+ /**
730
+ * Destroy the instance
731
+ *
732
+ */
733
+ destroy: function () {
734
+ if (this.zoom) {
735
+ this.zoom.unwrap();
736
+ }
737
+
738
+ if (this.mouseTrap) {
739
+ this.mouseTrap.unbind();
740
+ this.mouseTrap.remove();
741
+ this.mouseTrap = null;
742
+ }
743
+
744
+ if (this.zoomDiv) {
745
+ this.zoomDiv.remove();
746
+ this.zoomDiv = null;
747
+ }
748
+
749
+ if (this.options.disableRightClick) {
750
+ $(document).unbind();
751
+ }
752
+
753
+ this._removeElements();
754
+ this.options.elements.gallery.unbind();
755
+ this.element.removeData('yith_magnifier');
756
+ }
757
+ };
758
+
759
+ $.fn.yith_magnifier = function (options) {
760
+
761
+ if (typeof options === 'string') {
762
+ var args = Array.prototype.slice.call(arguments, 1);
763
+
764
+ this.each(function () {
765
+ var instance = $.data(this, 'yith_magnifier');
766
+ if (!instance) {
767
+ $.error("cannot call methods on yith_magnifier prior to initialization; " +
768
+ "attempted to call method '" + options + "'");
769
+ return;
770
+ }
771
+ if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
772
+ $.error("no such method '" + options + "' for yith_magnifier instance");
773
+ return;
774
+ }
775
+ instance[options].apply(instance, args);
776
+ });
777
+ } else {
778
+ this.each(function () {
779
+ var instance = $.data(this, 'yith_magnifier');
780
+ if (!instance) {
781
+ $.data(this, 'yith_magnifier', new $.yith_magnifier(options, this));
782
+ } else {
783
+ $.error('yith_magnifier already istantiated.');
784
+ }
785
+ });
786
+ }
787
+ return this;
788
+ };
789
+
790
+
791
  })(window, jQuery);
class.yith-wcmg-admin.php CHANGED
@@ -1,168 +1,168 @@
1
- <?php
2
- /**
3
- * Admin class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Zoom Magnifier
7
- * @version 1.1.2
8
- */
9
-
10
- if ( ! defined( 'YITH_WCMG' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_WCMG_Admin' ) ) {
15
- /**
16
- * Admin class.
17
- * The class manage all the admin behaviors.
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WCMG_Admin {
22
- /**
23
- * Plugin options
24
- *
25
- * @var array
26
- * @access public
27
- * @since 1.0.0
28
- */
29
- public $options = array();
30
-
31
- /**
32
- * Various links
33
- *
34
- * @var string
35
- * @access public
36
- * @since 1.0.0
37
- */
38
- public $banner_url = 'http://cdn.yithemes.com/plugins/yith_magnifier.php?url';
39
- public $banner_img = 'http://cdn.yithemes.com/plugins/yith_magnifier.php';
40
- public $doc_url = 'http://yithemes.com/docs-plugins/yith_magnifier/';
41
-
42
- /**
43
- * Constructor
44
- *
45
- * @access public
46
- * @since 1.0.0
47
- */
48
- public function __construct( ) {
49
-
50
- //Actions
51
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
52
-
53
- add_action( 'woocommerce_update_options_yith_wcmg', array( $this, 'update_options' ) );
54
-
55
- add_action( 'woocommerce_admin_field_banner', array( $this, 'admin_fields_banner' ) );
56
- add_action( 'admin_print_footer_scripts', array( $this, 'admin_fields_image_deps' ) );
57
-
58
- add_filter( 'woocommerce_catalog_settings', array( $this, 'add_catalog_image_size' ) );
59
-
60
- //Apply filters
61
- $this->banner_url = apply_filters( 'yith_wcmg_banner_url', $this->banner_url );
62
-
63
- // YITH WCMG Loaded
64
- do_action( 'yith_wcmg_loaded' );
65
- }
66
-
67
- /**
68
- * Add Zoom Image size to Woocommerce -> Catalog
69
- *
70
- * @access public
71
- *
72
- * @param array $settings
73
- *
74
- * @return array
75
- */
76
- public function add_catalog_image_size( $settings ) {
77
- $tmp = $settings[count( $settings ) - 1];
78
- unset( $settings[count( $settings ) - 1] );
79
-
80
- $settings[] = array(
81
- 'name' => __( 'Image Size', 'yith-woocommerce-zoom-magnifier' ),
82
- 'desc' => __( 'The size of the images used within the magnifier box', 'yith-woocommerce-zoom-magnifier' ),
83
- 'id' => 'woocommerce_magnifier_image',
84
- 'css' => '',
85
- 'type' => 'image_width',
86
- 'default' => array(
87
- 'width' => 600,
88
- 'height' => 600,
89
- 'crop' => true
90
- ),
91
- 'std' => array(
92
- 'width' => 600,
93
- 'height' => 600,
94
- 'crop' => true
95
- ),
96
- 'desc_tip' => true
97
- );
98
- $settings[] = $tmp;
99
- return $settings;
100
- }
101
-
102
- /**
103
- * Create new Woocommerce admin field: image deps
104
- *
105
- * @access public
106
- *
107
- * @param array $value
108
- *
109
- * @return void
110
- * @since 1.0.0
111
- */
112
- public function admin_fields_image_deps( $value ) {
113
- global $woocommerce;
114
-
115
- $force = get_option( 'yith_wcmg_force_sizes' ) == 'yes';
116
-
117
- if ( $force ) {
118
- $value['desc'] = 'These values ??are automatically calculated based on the values ??of the Single product. If you\'d like to customize yourself the values, please disable the "Forcing Zoom Image sizes" in "Magnifier" tab.';
119
- }
120
-
121
- if ( $force && isset( $_GET['page'] ) && isset( $_GET['tab'] ) && ( $_GET['page'] == 'woocommerce_settings' || $_GET['page'] == 'wc-settings' ) && $_GET['tab'] == 'catalog' ): ?>
122
- <script>
123
- jQuery(document).ready(function ($) {
124
- $('#woocommerce_magnifier_image-width, #woocommerce_magnifier_image-height, #woocommerce_magnifier_image-crop').attr('disabled', 'disabled');
125
-
126
- $('#shop_single_image_size-width, #shop_single_image_size-height').on('keyup', function () {
127
- var value = parseInt($(this).val());
128
- var input = (this.id).indexOf('width') >= 0 ? 'width' : 'height';
129
-
130
- if (!isNaN(value)) {
131
- $('#woocommerce_magnifier_image-' + input).val(value * 2);
132
- }
133
- });
134
-
135
- $('#shop_single_image_size-crop').on('change', function () {
136
- if ($(this).is(':checked')) {
137
- $('#woocommerce_magnifier_image-crop').attr('checked', 'checked');
138
- } else {
139
- $('#woocommerce_magnifier_image-crop').removeAttr('checked');
140
- }
141
- });
142
-
143
- $('#mainform').on('submit', function () {
144
- $(':disabled').removeAttr('disabled');
145
- });
146
- });
147
- </script>
148
- <?php endif;
149
- }
150
-
151
-
152
- /**
153
- * Enqueue admin styles and scripts
154
- *
155
- * @access public
156
- * @return void
157
- * @since 1.0.0
158
- */
159
- public function enqueue_styles_scripts() {
160
- wp_enqueue_script( 'jquery-ui' );
161
- wp_enqueue_script( 'jquery-ui-core' );
162
- wp_enqueue_script( 'jquery-ui-mouse' );
163
- wp_enqueue_script( 'jquery-ui-slider' );
164
-
165
- wp_enqueue_style( 'yith_wcmg_admin', YITH_WCMG_URL . 'assets/css/admin.css' );
166
- }
167
- }
168
- }
1
+ <?php
2
+ /**
3
+ * Admin class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Zoom Magnifier
7
+ * @version 1.1.2
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCMG' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists( 'YITH_WCMG_Admin' ) ) {
15
+ /**
16
+ * Admin class.
17
+ * The class manage all the admin behaviors.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WCMG_Admin {
22
+ /**
23
+ * Plugin options
24
+ *
25
+ * @var array
26
+ * @access public
27
+ * @since 1.0.0
28
+ */
29
+ public $options = array();
30
+
31
+ /**
32
+ * Various links
33
+ *
34
+ * @var string
35
+ * @access public
36
+ * @since 1.0.0
37
+ */
38
+ public $banner_url = 'http://cdn.yithemes.com/plugins/yith_magnifier.php?url';
39
+ public $banner_img = 'http://cdn.yithemes.com/plugins/yith_magnifier.php';
40
+ public $doc_url = 'http://yithemes.com/docs-plugins/yith_magnifier/';
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ * @access public
46
+ * @since 1.0.0
47
+ */
48
+ public function __construct( ) {
49
+
50
+ //Actions
51
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
52
+
53
+ add_action( 'woocommerce_update_options_yith_wcmg', array( $this, 'update_options' ) );
54
+
55
+ add_action( 'woocommerce_admin_field_banner', array( $this, 'admin_fields_banner' ) );
56
+ add_action( 'admin_print_footer_scripts', array( $this, 'admin_fields_image_deps' ) );
57
+
58
+ add_filter( 'woocommerce_catalog_settings', array( $this, 'add_catalog_image_size' ) );
59
+
60
+ //Apply filters
61
+ $this->banner_url = apply_filters( 'yith_wcmg_banner_url', $this->banner_url );
62
+
63
+ // YITH WCMG Loaded
64
+ do_action( 'yith_wcmg_loaded' );
65
+ }
66
+
67
+ /**
68
+ * Add Zoom Image size to Woocommerce -> Catalog
69
+ *
70
+ * @access public
71
+ *
72
+ * @param array $settings
73
+ *
74
+ * @return array
75
+ */
76
+ public function add_catalog_image_size( $settings ) {
77
+ $tmp = $settings[count( $settings ) - 1];
78
+ unset( $settings[count( $settings ) - 1] );
79
+
80
+ $settings[] = array(
81
+ 'name' => __( 'Image Size', 'yith-woocommerce-zoom-magnifier' ),
82
+ 'desc' => __( 'The size of the images used within the magnifier box', 'yith-woocommerce-zoom-magnifier' ),
83
+ 'id' => 'woocommerce_magnifier_image',
84
+ 'css' => '',
85
+ 'type' => 'image_width',
86
+ 'default' => array(
87
+ 'width' => 600,
88
+ 'height' => 600,
89
+ 'crop' => true
90
+ ),
91
+ 'std' => array(
92
+ 'width' => 600,
93
+ 'height' => 600,
94
+ 'crop' => true
95
+ ),
96
+ 'desc_tip' => true
97
+ );
98
+ $settings[] = $tmp;
99
+ return $settings;
100
+ }
101
+
102
+ /**
103
+ * Create new Woocommerce admin field: image deps
104
+ *
105
+ * @access public
106
+ *
107
+ * @param array $value
108
+ *
109
+ * @return void
110
+ * @since 1.0.0
111
+ */
112
+ public function admin_fields_image_deps( $value ) {
113
+ global $woocommerce;
114
+
115
+ $force = get_option( 'yith_wcmg_force_sizes' ) == 'yes';
116
+
117
+ if ( $force ) {
118
+ $value['desc'] = 'These values ??are automatically calculated based on the values ??of the Single product. If you\'d like to customize yourself the values, please disable the "Forcing Zoom Image sizes" in "Magnifier" tab.';
119
+ }
120
+
121
+ if ( $force && isset( $_GET['page'] ) && isset( $_GET['tab'] ) && ( $_GET['page'] == 'woocommerce_settings' || $_GET['page'] == 'wc-settings' ) && $_GET['tab'] == 'catalog' ): ?>
122
+ <script>
123
+ jQuery(document).ready(function ($) {
124
+ $('#woocommerce_magnifier_image-width, #woocommerce_magnifier_image-height, #woocommerce_magnifier_image-crop').attr('disabled', 'disabled');
125
+
126
+ $('#shop_single_image_size-width, #shop_single_image_size-height').on('keyup', function () {
127
+ var value = parseInt($(this).val());
128
+ var input = (this.id).indexOf('width') >= 0 ? 'width' : 'height';
129
+
130
+ if (!isNaN(value)) {
131
+ $('#woocommerce_magnifier_image-' + input).val(value * 2);
132
+ }
133
+ });
134
+
135
+ $('#shop_single_image_size-crop').on('change', function () {
136
+ if ($(this).is(':checked')) {
137
+ $('#woocommerce_magnifier_image-crop').attr('checked', 'checked');
138
+ } else {
139
+ $('#woocommerce_magnifier_image-crop').removeAttr('checked');
140
+ }
141
+ });
142
+
143
+ $('#mainform').on('submit', function () {
144
+ $(':disabled').removeAttr('disabled');
145
+ });
146
+ });
147
+ </script>
148
+ <?php endif;
149
+ }
150
+
151
+
152
+ /**
153
+ * Enqueue admin styles and scripts
154
+ *
155
+ * @access public
156
+ * @return void
157
+ * @since 1.0.0
158
+ */
159
+ public function enqueue_styles_scripts() {
160
+ wp_enqueue_script( 'jquery-ui' );
161
+ wp_enqueue_script( 'jquery-ui-core' );
162
+ wp_enqueue_script( 'jquery-ui-mouse' );
163
+ wp_enqueue_script( 'jquery-ui-slider' );
164
+
165
+ wp_enqueue_style( 'yith_wcmg_admin', YITH_WCMG_URL . 'assets/css/admin.css' );
166
+ }
167
+ }
168
+ }
class.yith-wcmg-frontend.php CHANGED
@@ -1,165 +1,165 @@
1
- <?php
2
- /**
3
- * Frontend class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Zoom Magnifier
7
- * @version 1.1.2
8
- */
9
-
10
- if ( ! defined ( 'YITH_WCMG' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists ( 'YITH_WCMG_Frontend' ) ) {
15
- /**
16
- * Admin class.
17
- * The class manage all the Frontend behaviors.
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WCMG_Frontend {
22
-
23
-
24
- /**
25
- * Constructor
26
- *
27
- * @access public
28
- * @since 1.0.0
29
- */
30
- public function __construct ( ) {
31
-
32
- // add the action only when the loop is initializate
33
- add_action ( 'template_redirect', array ( $this, 'render' ) );
34
- }
35
-
36
- public function render () {
37
- if ( yith_wcmg_is_enabled () && ! apply_filters ( 'yith_wczm_featured_video_enabled', false ) ) {
38
- //change the templates
39
- remove_action ( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
40
- remove_action ( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
41
- add_action ( 'woocommerce_before_single_product_summary', array ( $this, 'show_product_images' ), 20 );
42
- add_action ( 'woocommerce_product_thumbnails', array ( $this, 'show_product_thumbnails' ), 20 );
43
-
44
- //custom styles and javascripts
45
- add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles_scripts' ) );
46
-
47
- //add attributes to product variations
48
- add_filter ( 'woocommerce_available_variation', array ( $this, 'available_variation' ), 10, 3 );
49
- }
50
- }
51
-
52
-
53
- /**
54
- * Change product-single.php template
55
- *
56
- * @access public
57
- * @return void
58
- * @since 1.0.0
59
- */
60
- public function show_product_images () {
61
-
62
- /** FIX WOO 2.1 */
63
- $wc_get_template = function_exists ( 'wc_get_template' ) ? 'wc_get_template' : 'woocommerce_get_template';
64
- $wc_get_template( 'single-product/product-image-magnifier.php', array (), '', YITH_YWZM_DIR . 'templates/' );
65
- }
66
-
67
-
68
- /**
69
- * Change product-thumbnails.php template
70
- *
71
- * @access public
72
- * @return void
73
- * @since 1.0.0
74
- */
75
- public function show_product_thumbnails () {
76
-
77
- /** FIX WOO 2.1 */
78
- $wc_get_template = function_exists ( 'wc_get_template' ) ? 'wc_get_template' : 'woocommerce_get_template';
79
-
80
- $wc_get_template( 'single-product/product-thumbnails-magnifier.php', array (), '', YITH_YWZM_DIR . 'templates/' );
81
- }
82
-
83
-
84
- /**
85
- * Enqueue styles and scripts
86
- *
87
- * @access public
88
- * @return void
89
- * @since 1.0.0
90
- */
91
- public function enqueue_styles_scripts () {
92
- global $post;
93
-
94
- $suffix = defined ( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
95
-
96
- wp_register_script ( 'yith-magnifier-slider',
97
- YITH_WCMG_URL . 'assets/js/jquery.carouFredSel' . $suffix . '.js',
98
- array (
99
- 'jquery',
100
- 'jquery-migrate',
101
- ),
102
- YITH_YWZM_VERSION,
103
- true );
104
-
105
- wp_register_script ( 'yith-magnifier',
106
- YITH_WCMG_URL . 'assets/js/yith_magnifier' . $suffix . '.js',
107
- array ( 'jquery' ),
108
- YITH_YWZM_VERSION,
109
- true );
110
-
111
- wp_register_script ( 'yith_wcmg_frontend',
112
- YITH_WCMG_URL . 'assets/js/frontend' . $suffix . '.js',
113
- array (
114
- 'jquery',
115
- 'yith-magnifier',
116
- ),
117
- YITH_YWZM_VERSION,
118
- true );
119
-
120
- wp_register_style ( 'yith-magnifier', YITH_WCMG_URL . 'assets/css/yith_magnifier.css' );
121
-
122
- if ( is_product () || ( ! empty( $post->post_content ) && strstr ( $post->post_content, '[product_page' ) ) ) {
123
- wp_enqueue_script ( 'yith-magnifier-slider' );
124
- wp_enqueue_script ( 'yith-magnifier' );
125
- wp_enqueue_script ( 'yith_wcmg_frontend' );
126
-
127
- wp_enqueue_style ( 'yith-magnifier' );
128
-
129
- $css = file_exists ( get_stylesheet_directory () . '/woocommerce/yith_magnifier.css' ) ? get_stylesheet_directory_uri () . '/woocommerce/yith_magnifier.css' : YITH_WCMG_URL . 'assets/css/frontend.css';
130
- wp_enqueue_style ( 'yith_wcmg_frontend', $css );
131
- /*
132
- $append_text_css = '.yith_magnifier_zoom_wrap::after {
133
- content: "' . __ ( "Roll over image to zoom in", "yith-woocommerce-zoom-magnifier" ) . '";
134
- margin: 0 auto;
135
- display: inline-block;
136
- text-align:center;
137
- font-size: 10px;
138
- }
139
- ';
140
-
141
- wp_add_inline_style ( 'yith_wcmg_frontend', $append_text_css );
142
- */
143
- }
144
- }
145
-
146
-
147
- /**
148
- * Add attributes to product variations
149
- *
150
- * @access public
151
- * @return void
152
- * @since 1.0.0
153
- */
154
- public function available_variation ( $data, $wc_prod, $variation ) {
155
-
156
- $attachment_id = get_post_thumbnail_id ( $variation->get_variation_id () );
157
- $attachment = wp_get_attachment_image_src ( $attachment_id, 'shop_magnifier' );
158
-
159
- $data[ 'image_magnifier' ] = $attachment ? current ( $attachment ) : '';
160
-
161
- return $data;
162
- }
163
-
164
- }
165
- }
1
+ <?php
2
+ /**
3
+ * Frontend class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Zoom Magnifier
7
+ * @version 1.1.2
8
+ */
9
+
10
+ if ( ! defined ( 'YITH_WCMG' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists ( 'YITH_WCMG_Frontend' ) ) {
15
+ /**
16
+ * Admin class.
17
+ * The class manage all the Frontend behaviors.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WCMG_Frontend {
22
+
23
+
24
+ /**
25
+ * Constructor
26
+ *
27
+ * @access public
28
+ * @since 1.0.0
29
+ */
30
+ public function __construct ( ) {
31
+
32
+ // add the action only when the loop is initializate
33
+ add_action ( 'template_redirect', array ( $this, 'render' ) );
34
+ }
35
+
36
+ public function render () {
37
+ if ( yith_wcmg_is_enabled () && ! apply_filters ( 'yith_wczm_featured_video_enabled', false ) ) {
38
+ //change the templates
39
+ remove_action ( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
40
+ remove_action ( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
41
+ add_action ( 'woocommerce_before_single_product_summary', array ( $this, 'show_product_images' ), 20 );
42
+ add_action ( 'woocommerce_product_thumbnails', array ( $this, 'show_product_thumbnails' ), 20 );
43
+
44
+ //custom styles and javascripts
45
+ add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles_scripts' ) );
46
+
47
+ //add attributes to product variations
48
+ add_filter ( 'woocommerce_available_variation', array ( $this, 'available_variation' ), 10, 3 );
49
+ }
50
+ }
51
+
52
+
53
+ /**
54
+ * Change product-single.php template
55
+ *
56
+ * @access public
57
+ * @return void
58
+ * @since 1.0.0
59
+ */
60
+ public function show_product_images () {
61
+
62
+ /** FIX WOO 2.1 */
63
+ $wc_get_template = function_exists ( 'wc_get_template' ) ? 'wc_get_template' : 'woocommerce_get_template';
64
+ $wc_get_template( 'single-product/product-image-magnifier.php', array (), '', YITH_YWZM_DIR . 'templates/' );
65
+ }
66
+
67
+
68
+ /**
69
+ * Change product-thumbnails.php template
70
+ *
71
+ * @access public
72
+ * @return void
73
+ * @since 1.0.0
74
+ */
75
+ public function show_product_thumbnails () {
76
+
77
+ /** FIX WOO 2.1 */
78
+ $wc_get_template = function_exists ( 'wc_get_template' ) ? 'wc_get_template' : 'woocommerce_get_template';
79
+
80
+ $wc_get_template( 'single-product/product-thumbnails-magnifier.php', array (), '', YITH_YWZM_DIR . 'templates/' );
81
+ }
82
+
83
+
84
+ /**
85
+ * Enqueue styles and scripts
86
+ *
87
+ * @access public
88
+ * @return void
89
+ * @since 1.0.0
90
+ */
91
+ public function enqueue_styles_scripts () {
92
+ global $post;
93
+
94
+ $suffix = defined ( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
95
+
96
+ wp_register_script ( 'yith-magnifier-slider',
97
+ YITH_WCMG_URL . 'assets/js/jquery.carouFredSel' . $suffix . '.js',
98
+ array (
99
+ 'jquery',
100
+ 'jquery-migrate',
101
+ ),
102
+ YITH_YWZM_VERSION,
103
+ true );
104
+
105
+ wp_register_script ( 'yith-magnifier',
106
+ YITH_WCMG_URL . 'assets/js/yith_magnifier' . $suffix . '.js',
107
+ array ( 'jquery' ),
108
+ YITH_YWZM_VERSION,
109
+ true );
110
+
111
+ wp_register_script ( 'yith_wcmg_frontend',
112
+ YITH_WCMG_URL . 'assets/js/frontend' . $suffix . '.js',
113
+ array (
114
+ 'jquery',
115
+ 'yith-magnifier',
116
+ ),
117
+ YITH_YWZM_VERSION,
118
+ true );
119
+
120
+ wp_register_style ( 'yith-magnifier', YITH_WCMG_URL . 'assets/css/yith_magnifier.css' );
121
+
122
+ if ( is_product () || ( ! empty( $post->post_content ) && strstr ( $post->post_content, '[product_page' ) ) ) {
123
+ wp_enqueue_script ( 'yith-magnifier-slider' );
124
+ wp_enqueue_script ( 'yith-magnifier' );
125
+ wp_enqueue_script ( 'yith_wcmg_frontend' );
126
+
127
+ wp_enqueue_style ( 'yith-magnifier' );
128
+
129
+ $css = file_exists ( get_stylesheet_directory () . '/woocommerce/yith_magnifier.css' ) ? get_stylesheet_directory_uri () . '/woocommerce/yith_magnifier.css' : YITH_WCMG_URL . 'assets/css/frontend.css';
130
+ wp_enqueue_style ( 'yith_wcmg_frontend', $css );
131
+ /*
132
+ $append_text_css = '.yith_magnifier_zoom_wrap::after {
133
+ content: "' . __ ( "Roll over image to zoom in", "yith-woocommerce-zoom-magnifier" ) . '";
134
+ margin: 0 auto;
135
+ display: inline-block;
136
+ text-align:center;
137
+ font-size: 10px;
138
+ }
139
+ ';
140
+
141
+ wp_add_inline_style ( 'yith_wcmg_frontend', $append_text_css );
142
+ */
143
+ }
144
+ }
145
+
146
+
147
+ /**
148
+ * Add attributes to product variations
149
+ *
150
+ * @access public
151
+ * @return void
152
+ * @since 1.0.0
153
+ */
154
+ public function available_variation ( $data, $wc_prod, $variation ) {
155
+
156
+ $attachment_id = get_post_thumbnail_id ( $variation->get_variation_id () );
157
+ $attachment = wp_get_attachment_image_src ( $attachment_id, 'shop_magnifier' );
158
+
159
+ $data[ 'image_magnifier' ] = $attachment ? current ( $attachment ) : '';
160
+
161
+ return $data;
162
+ }
163
+
164
+ }
165
+ }
class.yith-wcmg.php CHANGED
@@ -1,80 +1,80 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Zoom Magnifier
7
- * @version 1.1.2
8
- */
9
-
10
- if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
11
-
12
- if( !class_exists( 'YITH_WCMG' ) ) {
13
- /**
14
- * WooCommerce Magnifier
15
- *
16
- * @since 1.0.0
17
- */
18
- class YITH_WCMG {
19
-
20
-
21
- /**
22
- * Plugin object
23
- *
24
- * @var string
25
- * @since 1.0.0
26
- */
27
- public $obj = null;
28
-
29
- /**
30
- * Constructor
31
- *
32
- * @return mixed|YITH_WCMG_Admin|YITH_WCMG_Frontend
33
- * @since 1.0.0
34
- */
35
- public function __construct() {
36
-
37
- // actions
38
- add_action( 'init', array( $this, 'init' ) );
39
-
40
- if( is_admin() ) {
41
- $this->obj = new YITH_WCMG_Admin( );
42
- } else {
43
- $this->obj = new YITH_WCMG_Frontend( );
44
- }
45
-
46
- return $this->obj;
47
- }
48
-
49
-
50
- /**
51
- * Init method:
52
- * - default options
53
- *
54
- * @access public
55
- * @since 1.0.0
56
- */
57
- public function init() {
58
- $this->_image_sizes();
59
- }
60
-
61
-
62
- /**
63
- * Add image sizes
64
- *
65
- * Init images
66
- *
67
- * @access protected
68
- * @return void
69
- * @since 1.0.0
70
- */
71
- protected function _image_sizes() {
72
- $size = get_option('woocommerce_magnifier_image');
73
- $width = $size['width'];
74
- $height = $size['height'];
75
- $crop = isset( $size['crop'] ) ? true : false;
76
-
77
- add_image_size( 'shop_magnifier', $width, $height, $crop );
78
- }
79
- }
80
  }
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Zoom Magnifier
7
+ * @version 1.1.2
8
+ */
9
+
10
+ if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
11
+
12
+ if( !class_exists( 'YITH_WCMG' ) ) {
13
+ /**
14
+ * WooCommerce Magnifier
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class YITH_WCMG {
19
+
20
+
21
+ /**
22
+ * Plugin object
23
+ *
24
+ * @var string
25
+ * @since 1.0.0
26
+ */
27
+ public $obj = null;
28
+
29
+ /**
30
+ * Constructor
31
+ *
32
+ * @return mixed|YITH_WCMG_Admin|YITH_WCMG_Frontend
33
+ * @since 1.0.0
34
+ */
35
+ public function __construct() {
36
+
37
+ // actions
38
+ add_action( 'init', array( $this, 'init' ) );
39
+
40
+ if( is_admin() ) {
41
+ $this->obj = new YITH_WCMG_Admin( );
42
+ } else {
43
+ $this->obj = new YITH_WCMG_Frontend( );
44
+ }
45
+
46
+ return $this->obj;
47
+ }
48
+
49
+
50
+ /**
51
+ * Init method:
52
+ * - default options
53
+ *
54
+ * @access public
55
+ * @since 1.0.0
56
+ */
57
+ public function init() {
58
+ $this->_image_sizes();
59
+ }
60
+
61
+
62
+ /**
63
+ * Add image sizes
64
+ *
65
+ * Init images
66
+ *
67
+ * @access protected
68
+ * @return void
69
+ * @since 1.0.0
70
+ */
71
+ protected function _image_sizes() {
72
+ $size = get_option('woocommerce_magnifier_image');
73
+ $width = $size['width'];
74
+ $height = $size['height'];
75
+ $crop = isset( $size['crop'] ) ? true : false;
76
+
77
+ add_image_size( 'shop_magnifier', $width, $height, $crop );
78
+ }
79
+ }
80
  }
functions.yith-wcmg.php CHANGED
@@ -1,78 +1,78 @@
1
- <?php
2
- /**
3
- * Functions
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Zoom Magnifier
7
- * @version 1.1.2
8
- */
9
-
10
- if ( ! defined ( 'YITH_WCMG' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! function_exists ( 'yith_wcmg_is_enabled' ) ) {
15
- /**
16
- * Check if the plugin is enabled for the current context
17
- *
18
- * @return bool
19
- * @since 1.0.0
20
- */
21
- function yith_wcmg_is_enabled () {
22
- if ( wp_is_mobile () ) {
23
- return ( 'yes' == get_option ( 'yith_wcmg_enable_mobile' ) );
24
- }
25
-
26
- return get_option ( 'yith_wcmg_enable_plugin' ) == 'yes';
27
- }
28
- }
29
-
30
- if ( ! function_exists ( 'yit_shop_single_w' ) ) {
31
- /**
32
- * Return the shop_single image width
33
- *
34
- * @return integer
35
- * @since 1.0.0
36
- */
37
- function yit_shop_single_w () {
38
- $size = yit_get_image_size ( 'shop_single' );
39
-
40
- return $size[ 'width' ];
41
- }
42
- }
43
-
44
- if ( ! function_exists ( 'yit_shop_thumbnail_w' ) ) {
45
- /**
46
- * Return the shop_thumbnail image width
47
- *
48
- * @return integer
49
- * @since 1.0.0
50
- */
51
- function yit_shop_thumbnail_w () {
52
- $size = yit_get_image_size ( 'shop_thumbnail' );
53
-
54
- return $size[ 'width' ];
55
- }
56
- }
57
-
58
- /* FIX TO WOOCOMMERCE 2.1 */
59
- if ( ! function_exists ( 'yit_get_image_size' ) ) {
60
- /**
61
- * Get default image size
62
- *
63
- * @param array $size current size
64
- *
65
- * @return array
66
- * @author Lorenzo Giuffrida
67
- * @since 1.0.0
68
- */
69
- function yit_get_image_size ( $size ) {
70
- if ( function_exists ( 'wc_get_image_size' ) ) {
71
- return wc_get_image_size ( $size );
72
- } else {
73
- global $woocommerce;
74
-
75
- return $woocommerce->get_image_size ( $size );
76
- }
77
- }
78
- }
1
+ <?php
2
+ /**
3
+ * Functions
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Zoom Magnifier
7
+ * @version 1.1.2
8
+ */
9
+
10
+ if ( ! defined ( 'YITH_WCMG' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! function_exists ( 'yith_wcmg_is_enabled' ) ) {
15
+ /**
16
+ * Check if the plugin is enabled for the current context
17
+ *
18
+ * @return bool
19
+ * @since 1.0.0
20
+ */
21
+ function yith_wcmg_is_enabled () {
22
+ if ( wp_is_mobile () ) {
23
+ return ( 'yes' == get_option ( 'yith_wcmg_enable_mobile' ) );
24
+ }
25
+
26
+ return get_option ( 'yith_wcmg_enable_plugin' ) == 'yes';
27
+ }
28
+ }
29
+
30
+ if ( ! function_exists ( 'yit_shop_single_w' ) ) {
31
+ /**
32
+ * Return the shop_single image width
33
+ *
34
+ * @return integer
35
+ * @since 1.0.0
36
+ */
37
+ function yit_shop_single_w () {
38
+ $size = yit_get_image_size ( 'shop_single' );
39
+
40
+ return $size[ 'width' ];
41
+ }
42
+ }
43
+
44
+ if ( ! function_exists ( 'yit_shop_thumbnail_w' ) ) {
45
+ /**
46
+ * Return the shop_thumbnail image width
47
+ *
48
+ * @return integer
49
+ * @since 1.0.0
50
+ */
51
+ function yit_shop_thumbnail_w () {
52
+ $size = yit_get_image_size ( 'shop_thumbnail' );
53
+
54
+ return $size[ 'width' ];
55
+ }
56
+ }
57
+
58
+ /* FIX TO WOOCOMMERCE 2.1 */
59
+ if ( ! function_exists ( 'yit_get_image_size' ) ) {
60
+ /**
61
+ * Get default image size
62
+ *
63
+ * @param array $size current size
64
+ *
65
+ * @return array
66
+ * @author Lorenzo Giuffrida
67
+ * @since 1.0.0
68
+ */
69
+ function yit_get_image_size ( $size ) {
70
+ if ( function_exists ( 'wc_get_image_size' ) ) {
71
+ return wc_get_image_size ( $size );
72
+ } else {
73
+ global $woocommerce;
74
+
75
+ return $woocommerce->get_image_size ( $size );
76
+ }
77
+ }
78
+ }
init.php CHANGED
@@ -1,159 +1,159 @@
1
- <?php
2
- /**
3
- * Plugin Name: YITH WooCommerce Zoom Magnifier
4
- * Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
5
- * Description: YITH WooCommerce Zoom Magnifier enables you to add a zoom effect to product images and a thumbnail slider for the product image gallery.
6
- * Version: 1.2.17
7
- * Author: Yithemes
8
- * Author URI: http://yithemes.com/
9
- * Text Domain: yith-woocommerce-zoom-magnifier
10
- * Domain Path: /languages/
11
- *
12
- * @author Your Inspiration Themes
13
- * @package YITH WooCommerce Magnifier
14
- * @version 1.2.17
15
- */
16
- /* Copyright 2013-2015 Your Inspiration Themes (email : plugins@yithemes.com)
17
-
18
- This program is free software; you can redistribute it and/or modify
19
- it under the terms of the GNU General Public License, version 2, as
20
- published by the Free Software Foundation.
21
-
22
- This program is distributed in the hope that it will be useful,
23
- but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
- GNU General Public License for more details.
26
-
27
- You should have received a copy of the GNU General Public License
28
- along with this program; if not, write to the Free Software
29
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
- */
31
-
32
- if ( ! defined ( 'ABSPATH' ) ) {
33
- exit;
34
- } // Exit if accessed directly
35
-
36
- if ( ! function_exists ( 'is_plugin_active' ) ) {
37
- require_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
38
- }
39
-
40
- if ( ! function_exists ( 'yith_ywzm_install_woocommerce_admin_notice' ) ) {
41
- /**
42
- * WooCommerce is not enabled, the plugin will not be effective
43
- *
44
- * @author Lorenzo Giuffrida
45
- * @since 1.0.0
46
- */
47
- function yith_ywzm_install_woocommerce_admin_notice () {
48
- ?>
49
- <div class="error">
50
- <p><?php _e ( 'YITH WooCommerce Zoom Magnifier is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-zoom-magnifier' ); ?></p>
51
- </div>
52
- <?php
53
- }
54
- }
55
-
56
- if ( ! function_exists ( 'yith_ywzm_install_free_admin_notice' ) ) {
57
- /**
58
- * Unable to activate the free version while the premium version is active
59
- *
60
- * @author Lorenzo Giuffrida
61
- * @since 1.0.0
62
- */
63
- function yith_ywzm_install_free_admin_notice () {
64
- ?>
65
- <div class="error">
66
- <p><?php _e ( 'You can\'t activate the free version of YITH WooCommerce Zoom Magnifier while you are using the premium one.', 'yith-woocommerce-zoom-magnifier' ); ?></p>
67
- </div>
68
- <?php
69
- }
70
- }
71
-
72
- if ( ! function_exists ( 'yith_plugin_registration_hook' ) ) {
73
- require_once 'plugin-fw/yit-plugin-registration-hook.php';
74
- }
75
-
76
- register_activation_hook ( __FILE__, 'yith_plugin_registration_hook' );
77
-
78
- defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
79
- defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.2.17' );
80
- defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
81
- defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
82
- defined ( 'YITH_YWZM_URL' ) || define ( 'YITH_YWZM_URL', plugins_url ( '/', __FILE__ ) );
83
- defined ( 'YITH_YWZM_ASSETS_URL' ) || define ( 'YITH_YWZM_ASSETS_URL', YITH_YWZM_URL . 'assets' );
84
- defined ( 'YITH_YWZM_TEMPLATE_DIR' ) || define ( 'YITH_YWZM_TEMPLATE_DIR', YITH_YWZM_DIR . 'templates' );
85
- defined ( 'YITH_YWZM_ASSETS_IMAGES_URL' ) || define ( 'YITH_YWZM_ASSETS_IMAGES_URL', YITH_YWZM_ASSETS_URL . '/images/' );
86
- defined ( 'YITH_YWZM_LIB_DIR' ) || define ( 'YITH_YWZM_LIB_DIR', YITH_YWZM_DIR . 'lib/' );
87
-
88
- /* Plugin Framework Version Check */
89
- if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) && file_exists ( YITH_YWZM_DIR . 'plugin-fw/init.php' ) ) {
90
- require_once ( YITH_YWZM_DIR . 'plugin-fw/init.php' );
91
- }
92
- yit_maybe_plugin_fw_loader ( YITH_YWZM_DIR );
93
-
94
- if ( ! function_exists ( 'yith_ywzm_init' ) ) {
95
- /**
96
- * Init the plugin
97
- *
98
- * @author Lorenzo Giuffrida
99
- * @since 1.0.0
100
- */
101
- function yith_ywzm_init () {
102
-
103
- /**
104
- * Required functions
105
- */
106
- if ( ! defined ( 'YITH_FUNCTIONS' ) ) {
107
- require_once ( 'yit-common/yit-functions.php' );
108
- }
109
-
110
- /**
111
- * Load text domain and start plugin
112
- */
113
- load_plugin_textdomain ( 'yith-woocommerce-zoom-magnifier', false, dirname ( plugin_basename ( __FILE__ ) ) . '/languages/' );
114
-
115
- add_option ( 'yith_wcmg_slider_direction', apply_filters ( 'yith_wcmg_slider_direction', 'left' ) );
116
-
117
- define ( 'YITH_WCMG', true );
118
- define ( 'YITH_WCMG_URL', plugin_dir_url ( __FILE__ ) );
119
-
120
- // Load required classes and functions
121
- require_once ( 'functions.yith-wcmg.php' );
122
- require_once ( 'class.yith-wcmg-admin.php' );
123
- require_once ( 'class.yith-wcmg-frontend.php' );
124
-
125
- require_once ( YITH_YWZM_LIB_DIR . 'class.yith-woocommerce-zoom-magnifier.php' );
126
- require_once ( YITH_YWZM_LIB_DIR . 'class.yith-ywzm-plugin-fw-loader.php' );
127
- require_once ( YITH_YWZM_LIB_DIR . 'class.yith-ywzm-custom-types.php' );
128
-
129
- YITH_YWZM_Plugin_FW_Loader::get_instance ();
130
-
131
- // Let's start the game!
132
- global $yith_wcmg;
133
-
134
- $yith_wcmg = new YITH_WooCommerce_Zoom_Magnifier();
135
- }
136
- }
137
- add_action ( 'yith_ywzm_init', 'yith_ywzm_init' );
138
-
139
- if ( ! function_exists ( 'yith_ywzm_install' ) ) {
140
- /**
141
- * install the plugin
142
- *
143
- * @author Lorenzo Giuffrida
144
- * @since 1.0.0
145
- */
146
- function yith_ywzm_install () {
147
-
148
- if ( ! function_exists ( 'WC' ) ) {
149
- add_action ( 'admin_notices', 'yith_ywzm_install_woocommerce_admin_notice' );
150
- } elseif ( defined ( 'YITH_YWZM_PREMIUM' ) ) {
151
- add_action ( 'admin_notices', 'yith_ywzm_install_free_admin_notice' );
152
- deactivate_plugins ( plugin_basename ( __FILE__ ) );
153
- } else {
154
- do_action ( 'yith_ywzm_init' );
155
- }
156
- }
157
- }
158
-
159
  add_action ( 'plugins_loaded', 'yith_ywzm_install', 11 );
1
+ <?php
2
+ /**
3
+ * Plugin Name: YITH WooCommerce Zoom Magnifier
4
+ * Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
5
+ * Description: YITH WooCommerce Zoom Magnifier enables you to add a zoom effect to product images and a thumbnail slider for the product image gallery.
6
+ * Version: 1.2.18
7
+ * Author: YITHEMES
8
+ * Author URI: http://yithemes.com/
9
+ * Text Domain: yith-woocommerce-zoom-magnifier
10
+ * Domain Path: /languages/
11
+ *
12
+ * @author Your Inspiration Themes
13
+ * @package YITH WooCommerce Magnifier
14
+ * @version 1.2.18
15
+ */
16
+ /* Copyright 2013-2015 Your Inspiration Themes (email : plugins@yithemes.com)
17
+
18
+ This program is free software; you can redistribute it and/or modify
19
+ it under the terms of the GNU General Public License, version 2, as
20
+ published by the Free Software Foundation.
21
+
22
+ This program is distributed in the hope that it will be useful,
23
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ GNU General Public License for more details.
26
+
27
+ You should have received a copy of the GNU General Public License
28
+ along with this program; if not, write to the Free Software
29
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
+ */
31
+
32
+ if ( ! defined ( 'ABSPATH' ) ) {
33
+ exit;
34
+ } // Exit if accessed directly
35
+
36
+ if ( ! function_exists ( 'is_plugin_active' ) ) {
37
+ require_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
38
+ }
39
+
40
+ if ( ! function_exists ( 'yith_ywzm_install_woocommerce_admin_notice' ) ) {
41
+ /**
42
+ * WooCommerce is not enabled, the plugin will not be effective
43
+ *
44
+ * @author Lorenzo Giuffrida
45
+ * @since 1.0.0
46
+ */
47
+ function yith_ywzm_install_woocommerce_admin_notice () {
48
+ ?>
49
+ <div class="error">
50
+ <p><?php _e ( 'YITH WooCommerce Zoom Magnifier is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-zoom-magnifier' ); ?></p>
51
+ </div>
52
+ <?php
53
+ }
54
+ }
55
+
56
+ if ( ! function_exists ( 'yith_ywzm_install_free_admin_notice' ) ) {
57
+ /**
58
+ * Unable to activate the free version while the premium version is active
59
+ *
60
+ * @author Lorenzo Giuffrida
61
+ * @since 1.0.0
62
+ */
63
+ function yith_ywzm_install_free_admin_notice () {
64
+ ?>
65
+ <div class="error">
66
+ <p><?php _e ( 'You can\'t activate the free version of YITH WooCommerce Zoom Magnifier while you are using the premium one.', 'yith-woocommerce-zoom-magnifier' ); ?></p>
67
+ </div>
68
+ <?php
69
+ }
70
+ }
71
+
72
+ if ( ! function_exists ( 'yith_plugin_registration_hook' ) ) {
73
+ require_once 'plugin-fw/yit-plugin-registration-hook.php';
74
+ }
75
+
76
+ register_activation_hook ( __FILE__, 'yith_plugin_registration_hook' );
77
+
78
+ defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
79
+ defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.2.18' );
80
+ defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
81
+ defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
82
+ defined ( 'YITH_YWZM_URL' ) || define ( 'YITH_YWZM_URL', plugins_url ( '/', __FILE__ ) );
83
+ defined ( 'YITH_YWZM_ASSETS_URL' ) || define ( 'YITH_YWZM_ASSETS_URL', YITH_YWZM_URL . 'assets' );
84
+ defined ( 'YITH_YWZM_TEMPLATE_DIR' ) || define ( 'YITH_YWZM_TEMPLATE_DIR', YITH_YWZM_DIR . 'templates' );
85
+ defined ( 'YITH_YWZM_ASSETS_IMAGES_URL' ) || define ( 'YITH_YWZM_ASSETS_IMAGES_URL', YITH_YWZM_ASSETS_URL . '/images/' );
86
+ defined ( 'YITH_YWZM_LIB_DIR' ) || define ( 'YITH_YWZM_LIB_DIR', YITH_YWZM_DIR . 'lib/' );
87
+
88
+ /* Plugin Framework Version Check */
89
+ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) && file_exists ( YITH_YWZM_DIR . 'plugin-fw/init.php' ) ) {
90
+ require_once ( YITH_YWZM_DIR . 'plugin-fw/init.php' );
91
+ }
92
+ yit_maybe_plugin_fw_loader ( YITH_YWZM_DIR );
93
+
94
+ if ( ! function_exists ( 'yith_ywzm_init' ) ) {
95
+ /**
96
+ * Init the plugin
97
+ *
98
+ * @author Lorenzo Giuffrida
99
+ * @since 1.0.0
100
+ */
101
+ function yith_ywzm_init () {
102
+
103
+ /**
104
+ * Required functions
105
+ */
106
+ if ( ! defined ( 'YITH_FUNCTIONS' ) ) {
107
+ require_once ( 'yit-common/yit-functions.php' );
108
+ }
109
+
110
+ /**
111
+ * Load text domain and start plugin
112
+ */
113
+ load_plugin_textdomain ( 'yith-woocommerce-zoom-magnifier', false, dirname ( plugin_basename ( __FILE__ ) ) . '/languages/' );
114
+
115
+ add_option ( 'yith_wcmg_slider_direction', apply_filters ( 'yith_wcmg_slider_direction', 'left' ) );
116
+
117
+ define ( 'YITH_WCMG', true );
118
+ define ( 'YITH_WCMG_URL', plugin_dir_url ( __FILE__ ) );
119
+
120
+ // Load required classes and functions
121
+ require_once ( 'functions.yith-wcmg.php' );
122
+ require_once ( 'class.yith-wcmg-admin.php' );
123
+ require_once ( 'class.yith-wcmg-frontend.php' );
124
+
125
+ require_once ( YITH_YWZM_LIB_DIR . 'class.yith-woocommerce-zoom-magnifier.php' );
126
+ require_once ( YITH_YWZM_LIB_DIR . 'class.yith-ywzm-plugin-fw-loader.php' );
127
+ require_once ( YITH_YWZM_LIB_DIR . 'class.yith-ywzm-custom-types.php' );
128
+
129
+ YITH_YWZM_Plugin_FW_Loader::get_instance ();
130
+
131
+ // Let's start the game!
132
+ global $yith_wcmg;
133
+
134
+ $yith_wcmg = new YITH_WooCommerce_Zoom_Magnifier();
135
+ }
136
+ }
137
+ add_action ( 'yith_ywzm_init', 'yith_ywzm_init' );
138
+
139
+ if ( ! function_exists ( 'yith_ywzm_install' ) ) {
140
+ /**
141
+ * install the plugin
142
+ *
143
+ * @author Lorenzo Giuffrida
144
+ * @since 1.0.0
145
+ */
146
+ function yith_ywzm_install () {
147
+
148
+ if ( ! function_exists ( 'WC' ) ) {
149
+ add_action ( 'admin_notices', 'yith_ywzm_install_woocommerce_admin_notice' );
150
+ } elseif ( defined ( 'YITH_YWZM_PREMIUM' ) ) {
151
+ add_action ( 'admin_notices', 'yith_ywzm_install_free_admin_notice' );
152
+ deactivate_plugins ( plugin_basename ( __FILE__ ) );
153
+ } else {
154
+ do_action ( 'yith_ywzm_init' );
155
+ }
156
+ }
157
+ }
158
+
159
  add_action ( 'plugins_loaded', 'yith_ywzm_install', 11 );
lib/class.yith-woocommerce-zoom-magnifier.php CHANGED
@@ -1,86 +1,86 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Zoom Magnifier
7
- * @version 1.1.2
8
- */
9
-
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
-
15
- if ( ! class_exists( 'YITH_WooCommerce_Zoom_Magnifier' ) ) {
16
- /**
17
- * YITH WooCommerce Zoom Magnifier
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WooCommerce_Zoom_Magnifier {
22
-
23
- /**
24
- * Plugin object
25
- *
26
- * @var string
27
- * @since 1.0.0
28
- */
29
- public $obj = null;
30
-
31
- /**
32
- * Constructor
33
- *
34
- * @return mixed|YITH_WCMG_Admin|YITH_WCMG_Frontend
35
- * @since 1.0.0
36
- */
37
- public function __construct() {
38
- /** Stop the plugin on mobile devices */
39
- if ( ( 'yes' != get_option( 'yith_wcmg_enable_mobile' ) ) && wp_is_mobile() ) {
40
- return;
41
- }
42
-
43
- // actions
44
- add_action( 'init', array( $this, 'init' ) );
45
-
46
- if ( is_admin() && ( ! isset( $_REQUEST['action'] ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] != 'yith_load_product_quick_view' ) ) ) {
47
- $this->obj = new YITH_WCMG_Admin( );
48
- } else {
49
- $this->obj = new YITH_WCMG_Frontend( );
50
- }
51
-
52
- return $this->obj;
53
- }
54
-
55
-
56
- /**
57
- * Init method:
58
- * - default options
59
- *
60
- * @access public
61
- * @since 1.0.0
62
- */
63
- public function init() {
64
- $this->_image_sizes();
65
- }
66
-
67
-
68
- /**
69
- * Add image sizes
70
- *
71
- * Init images
72
- *
73
- * @access protected
74
- * @return void
75
- * @since 1.0.0
76
- */
77
- protected function _image_sizes() {
78
- $size = get_option( 'woocommerce_magnifier_image' );
79
- $width = $size['width'];
80
- $height = $size['height'];
81
- $crop = isset( $size['crop'] ) ? true : false;
82
-
83
- add_image_size( 'shop_magnifier', $width, $height, $crop );
84
- }
85
- }
86
  }
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Zoom Magnifier
7
+ * @version 1.1.2
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+
15
+ if ( ! class_exists( 'YITH_WooCommerce_Zoom_Magnifier' ) ) {
16
+ /**
17
+ * YITH WooCommerce Zoom Magnifier
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WooCommerce_Zoom_Magnifier {
22
+
23
+ /**
24
+ * Plugin object
25
+ *
26
+ * @var string
27
+ * @since 1.0.0
28
+ */
29
+ public $obj = null;
30
+
31
+ /**
32
+ * Constructor
33
+ *
34
+ * @return mixed|YITH_WCMG_Admin|YITH_WCMG_Frontend
35
+ * @since 1.0.0
36
+ */
37
+ public function __construct() {
38
+ /** Stop the plugin on mobile devices */
39
+ if ( ( 'yes' != get_option( 'yith_wcmg_enable_mobile' ) ) && wp_is_mobile() ) {
40
+ return;
41
+ }
42
+
43
+ // actions
44
+ add_action( 'init', array( $this, 'init' ) );
45
+
46
+ if ( is_admin() && ( ! isset( $_REQUEST['action'] ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] != 'yith_load_product_quick_view' ) ) ) {
47
+ $this->obj = new YITH_WCMG_Admin( );
48
+ } else {
49
+ $this->obj = new YITH_WCMG_Frontend( );
50
+ }
51
+
52
+ return $this->obj;
53
+ }
54
+
55
+
56
+ /**
57
+ * Init method:
58
+ * - default options
59
+ *
60
+ * @access public
61
+ * @since 1.0.0
62
+ */
63
+ public function init() {
64
+ $this->_image_sizes();
65
+ }
66
+
67
+
68
+ /**
69
+ * Add image sizes
70
+ *
71
+ * Init images
72
+ *
73
+ * @access protected
74
+ * @return void
75
+ * @since 1.0.0
76
+ */
77
+ protected function _image_sizes() {
78
+ $size = get_option( 'woocommerce_magnifier_image' );
79
+ $width = $size['width'];
80
+ $height = $size['height'];
81
+ $crop = isset( $size['crop'] ) ? true : false;
82
+
83
+ add_image_size( 'shop_magnifier', $width, $height, $crop );
84
+ }
85
+ }
86
  }
lib/class.yith-ywzm-custom-types.php CHANGED
@@ -1,181 +1,181 @@
1
- <?php
2
- if (!defined('ABSPATH')) {
3
- exit; // Exit if accessed directly
4
- }
5
-
6
- if (!class_exists('YITH_YWZM_Custom_Types')) {
7
-
8
- /**
9
- * custom types fields
10
- *
11
- * @class YITH_YWZM_Custom_Types
12
- * @package Yithemes
13
- * @since 1.0.0
14
- * @author Your Inspiration Themes
15
- */
16
- class YITH_YWZM_Custom_Types
17
- {
18
-
19
- /**
20
- * Single instance of the class
21
- *
22
- * @since 1.0.0
23
- */
24
- protected static $instance;
25
-
26
- /**
27
- * Returns single instance of the class
28
- *
29
- * @since 1.0.0
30
- */
31
- public static function get_instance()
32
- {
33
- if (is_null(self::$instance)) {
34
- self::$instance = new self();
35
- }
36
-
37
- return self::$instance;
38
- }
39
-
40
- public function __construct()
41
- {
42
- /**
43
- * Register actions and filters for custom types used on the current plugin
44
- */
45
-
46
- /** Custom types : slider */
47
- add_action('woocommerce_admin_field_slider', array($this, 'admin_fields_slider'));
48
-
49
- add_action('woocommerce_admin_field_yith_ywzm_image_width', array(
50
- $this,
51
- 'admin_fields_yith_ywzm_image_width'
52
- ));
53
- }
54
-
55
- /**
56
- * Create new Woocommerce admin field: slider
57
- *
58
- * @access public
59
- *
60
- * @param array $value
61
- *
62
- * @return void
63
- * @since 1.0.0
64
- */
65
- public function admin_fields_slider($value)
66
- {
67
- $slider_value = (get_option($value['id']) !== false && get_option($value['id']) !== null) ?
68
- esc_attr(stripslashes(get_option($value['id']))) :
69
- esc_attr($value['std']);
70
-
71
- ?>
72
- <tr valign="top">
73
- <th scope="row" class="titledesc">
74
- <label for="<?php echo esc_attr($value['id']); ?>"><?php echo $value['name']; ?></label>
75
- </th>
76
- <td class="forminp">
77
- <div id="<?php echo esc_attr($value['id']); ?>_slider" class="yith_woocommerce_slider"
78
- style="width: 300px; float: left;"></div>
79
- <div id="<?php echo esc_attr($value['id']); ?>_value"
80
- class="yith_woocommerce_slider_value ui-state-default ui-corner-all"><?php echo $slider_value ?></div>
81
- <input name="<?php echo esc_attr($value['id']); ?>" id="<?php echo esc_attr($value['id']); ?>"
82
- type="hidden" value="<?php echo $slider_value ?>"/> <?php echo $value['desc']; ?>
83
- </td>
84
- </tr>
85
-
86
-
87
- <script>
88
- jQuery(document).ready(function ($) {
89
- $('#<?php echo esc_attr( $value['id'] ); ?>_slider').slider({
90
- min: <?php echo $value['min'] ?>,
91
- max: <?php echo $value['max'] ?>,
92
- step: <?php echo $value['step'] ?>,
93
- value: <?php echo $slider_value ?>,
94
- slide: function (event, ui) {
95
- $("#<?php echo esc_attr( $value['id'] ); ?>").val(ui.value);
96
- $("#<?php echo esc_attr( $value['id'] ); ?>_value").text(ui.value);
97
- }
98
- });
99
- });
100
- </script>
101
-
102
- <?php
103
- }
104
-
105
- /**
106
- * Save the admin field: slider
107
- *
108
- * @access public
109
- *
110
- * @param mixed $value
111
- *
112
- * @return void
113
- * @since 1.0.0
114
- */
115
- public function admin_update_option($value)
116
- {
117
- global $woocommerce;
118
-
119
- if (version_compare(preg_replace('/-beta-([0-9]+)/', '', $woocommerce->version), '2.1', '<')) {
120
- $wc_clean = 'woocommerce_clean';
121
- } else {
122
- $wc_clean = 'wc_clean';
123
- }
124
-
125
- update_option($value['id'], woocommerce_clean($_POST[$value['id']]));
126
- }
127
-
128
-
129
- /**
130
- * Create new Woocommerce admin field: yith_ywzm_image_width
131
- *
132
- * @access public
133
- * @param array $value
134
- * @return void
135
- * @since 1.1.3
136
- */
137
- public function admin_fields_yith_ywzm_image_width($value)
138
- {
139
-
140
- $width = WC_Admin_Settings::get_option($value['id'] . '[width]', $value['default']['width']);
141
- $height = WC_Admin_Settings::get_option($value['id'] . '[height]', $value['default']['height']);
142
- $crop = WC_Admin_Settings::get_option($value['id'] . '[crop]');
143
- $crop = ($crop == 'on' || $crop == '1') ? 1 : 0;
144
- $crop = checked(1, $crop, false);
145
-
146
- ?>
147
- <tr valign="top">
148
- <th scope="row" class="titledesc"><?php echo esc_html($value['title']) ?></th>
149
- <td class="forminp image_width_settings">
150
- <input name="<?php echo esc_attr($value['id']); ?>[width]"
151
- id="<?php echo esc_attr($value['id']); ?>-width" type="text" size="3"
152
- value="<?php echo $width; ?>"/> &times; <input
153
- name="<?php echo esc_attr($value['id']); ?>[height]"
154
- id="<?php echo esc_attr($value['id']); ?>-height" type="text" size="3"
155
- value="<?php echo $height; ?>"/>px <span class="description"><?php echo $value['desc'] ?></span>
156
- <br>
157
- <label><input name="<?php echo esc_attr($value['id']); ?>[crop]"
158
- id="<?php echo esc_attr($value['id']); ?>-crop"
159
- type="checkbox" <?php echo $crop; ?> /> <?php _e('Do you want to hard crop the image?', 'woocommerce'); ?>
160
- </label>
161
-
162
- </td>
163
- </tr><?php
164
-
165
- }
166
-
167
- /**
168
- * Update plugin options.
169
- *
170
- * @return void
171
- * @since 1.0.0
172
- */
173
- public function update_options()
174
- {
175
- foreach ($this->options as $option) {
176
- woocommerce_update_options($option);
177
- }
178
- }
179
-
180
- }
181
  }
1
+ <?php
2
+ if (!defined('ABSPATH')) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ if (!class_exists('YITH_YWZM_Custom_Types')) {
7
+
8
+ /**
9
+ * custom types fields
10
+ *
11
+ * @class YITH_YWZM_Custom_Types
12
+ * @package Yithemes
13
+ * @since 1.0.0
14
+ * @author Your Inspiration Themes
15
+ */
16
+ class YITH_YWZM_Custom_Types
17
+ {
18
+
19
+ /**
20
+ * Single instance of the class
21
+ *
22
+ * @since 1.0.0
23
+ */
24
+ protected static $instance;
25
+
26
+ /**
27
+ * Returns single instance of the class
28
+ *
29
+ * @since 1.0.0
30
+ */
31
+ public static function get_instance()
32
+ {
33
+ if (is_null(self::$instance)) {
34
+ self::$instance = new self();
35
+ }
36
+
37
+ return self::$instance;
38
+ }
39
+
40
+ public function __construct()
41
+ {
42
+ /**
43
+ * Register actions and filters for custom types used on the current plugin
44
+ */
45
+
46
+ /** Custom types : slider */
47
+ add_action('woocommerce_admin_field_slider', array($this, 'admin_fields_slider'));
48
+
49
+ add_action('woocommerce_admin_field_yith_ywzm_image_width', array(
50
+ $this,
51
+ 'admin_fields_yith_ywzm_image_width'
52
+ ));
53
+ }
54
+
55
+ /**
56
+ * Create new Woocommerce admin field: slider
57
+ *
58
+ * @access public
59
+ *
60
+ * @param array $value
61
+ *
62
+ * @return void
63
+ * @since 1.0.0
64
+ */
65
+ public function admin_fields_slider($value)
66
+ {
67
+ $slider_value = (get_option($value['id']) !== false && get_option($value['id']) !== null) ?
68
+ esc_attr(stripslashes(get_option($value['id']))) :
69
+ esc_attr($value['std']);
70
+
71
+ ?>
72
+ <tr valign="top">
73
+ <th scope="row" class="titledesc">
74
+ <label for="<?php echo esc_attr($value['id']); ?>"><?php echo $value['name']; ?></label>
75
+ </th>
76
+ <td class="forminp">
77
+ <div id="<?php echo esc_attr($value['id']); ?>_slider" class="yith_woocommerce_slider"
78
+ style="width: 300px; float: left;"></div>
79
+ <div id="<?php echo esc_attr($value['id']); ?>_value"
80
+ class="yith_woocommerce_slider_value ui-state-default ui-corner-all"><?php echo $slider_value ?></div>
81
+ <input name="<?php echo esc_attr($value['id']); ?>" id="<?php echo esc_attr($value['id']); ?>"
82
+ type="hidden" value="<?php echo $slider_value ?>"/> <?php echo $value['desc']; ?>
83
+ </td>
84
+ </tr>
85
+
86
+
87
+ <script>
88
+ jQuery(document).ready(function ($) {
89
+ $('#<?php echo esc_attr( $value['id'] ); ?>_slider').slider({
90
+ min: <?php echo $value['min'] ?>,
91
+ max: <?php echo $value['max'] ?>,
92
+ step: <?php echo $value['step'] ?>,
93
+ value: <?php echo $slider_value ?>,
94
+ slide: function (event, ui) {
95
+ $("#<?php echo esc_attr( $value['id'] ); ?>").val(ui.value);
96
+ $("#<?php echo esc_attr( $value['id'] ); ?>_value").text(ui.value);
97
+ }
98
+ });
99
+ });
100
+ </script>
101
+
102
+ <?php
103
+ }
104
+
105
+ /**
106
+ * Save the admin field: slider
107
+ *
108
+ * @access public
109
+ *
110
+ * @param mixed $value
111
+ *
112
+ * @return void
113
+ * @since 1.0.0
114
+ */
115
+ public function admin_update_option($value)
116
+ {
117
+ global $woocommerce;
118
+
119
+ if (version_compare(preg_replace('/-beta-([0-9]+)/', '', $woocommerce->version), '2.1', '<')) {
120
+ $wc_clean = 'woocommerce_clean';
121
+ } else {
122
+ $wc_clean = 'wc_clean';
123
+ }
124
+
125
+ update_option($value['id'], woocommerce_clean($_POST[$value['id']]));
126
+ }
127
+
128
+
129
+ /**
130
+ * Create new Woocommerce admin field: yith_ywzm_image_width
131
+ *
132
+ * @access public
133
+ * @param array $value
134
+ * @return void
135
+ * @since 1.1.3
136
+ */
137
+ public function admin_fields_yith_ywzm_image_width($value)
138
+ {
139
+
140
+ $width = WC_Admin_Settings::get_option($value['id'] . '[width]', $value['default']['width']);
141
+ $height = WC_Admin_Settings::get_option($value['id'] . '[height]', $value['default']['height']);
142
+ $crop = WC_Admin_Settings::get_option($value['id'] . '[crop]');
143
+ $crop = ($crop == 'on' || $crop == '1') ? 1 : 0;
144
+ $crop = checked(1, $crop, false);
145
+
146
+ ?>
147
+ <tr valign="top">
148
+ <th scope="row" class="titledesc"><?php echo esc_html($value['title']) ?></th>
149
+ <td class="forminp image_width_settings">
150
+ <input name="<?php echo esc_attr($value['id']); ?>[width]"
151
+ id="<?php echo esc_attr($value['id']); ?>-width" type="text" size="3"
152
+ value="<?php echo $width; ?>"/> &times; <input
153
+ name="<?php echo esc_attr($value['id']); ?>[height]"
154
+ id="<?php echo esc_attr($value['id']); ?>-height" type="text" size="3"
155
+ value="<?php echo $height; ?>"/>px <span class="description"><?php echo $value['desc'] ?></span>
156
+ <br>
157
+ <label><input name="<?php echo esc_attr($value['id']); ?>[crop]"
158
+ id="<?php echo esc_attr($value['id']); ?>-crop"
159
+ type="checkbox" <?php echo $crop; ?> /> <?php _e('Do you want to hard crop the image?', 'woocommerce'); ?>
160
+ </label>
161
+
162
+ </td>
163
+ </tr><?php
164
+
165
+ }
166
+
167
+ /**
168
+ * Update plugin options.
169
+ *
170
+ * @return void
171
+ * @since 1.0.0
172
+ */
173
+ public function update_options()
174
+ {
175
+ foreach ($this->options as $option) {
176
+ woocommerce_update_options($option);
177
+ }
178
+ }
179
+
180
+ }
181
  }
lib/class.yith-ywzm-plugin-fw-loader.php CHANGED
@@ -1,301 +1,301 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit; // Exit if accessed directly
4
- }
5
-
6
- if ( ! class_exists( 'YITH_YWZM_Plugin_FW_Loader' ) ) {
7
-
8
- /**
9
- * Implements features related to an invoice document
10
- *
11
- * @class YITH_YWZM_Plugin_FW_Loader
12
- * @package Yithemes
13
- * @since 1.0.0
14
- * @author Lorenzo Giuffrida
15
- */
16
- class YITH_YWZM_Plugin_FW_Loader {
17
-
18
- /**
19
- * @var $_panel Panel Object
20
- */
21
- protected $_panel;
22
-
23
- /**
24
- * @var $_premium string Premium tab template file name
25
- */
26
- protected $_premium = 'premium.php';
27
-
28
- /**
29
- * @var string Premium version landing link
30
- */
31
- protected $_premium_landing = 'http://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/';
32
-
33
- /**
34
- * @var string Plugin official documentation
35
- */
36
- protected $_official_documentation = 'http://yithemes.com/docs-plugins/yith-woocommerce-zoom-magnifier/';
37
-
38
- /**
39
- * @var string Plugin panel page
40
- */
41
- protected $_panel_page = 'yith_woocommerce_zoom-magnifier_panel';
42
-
43
- /**
44
- * Single instance of the class
45
- *
46
- * @since 1.0.0
47
- */
48
- protected static $instance;
49
-
50
- /**
51
- * Returns single instance of the class
52
- *
53
- * @since 1.0.0
54
- */
55
- public static function get_instance() {
56
- if ( is_null( self::$instance ) ) {
57
- self::$instance = new self();
58
- }
59
-
60
- return self::$instance;
61
- }
62
-
63
- public function __construct() {
64
- /**
65
- * Register actions and filters to be used for creating an entry on YIT Plugin menu
66
- */
67
- add_action( 'admin_init', array( $this, 'register_pointer' ) );
68
-
69
- add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 15 );
70
-
71
- //Add action links
72
- add_filter( 'plugin_action_links_' . plugin_basename( YITH_YWZM_DIR . '/' . basename( YITH_YWZM_FILE ) ), array(
73
- $this,
74
- 'action_links'
75
- ) );
76
-
77
- add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
78
-
79
- // Add stylesheets and scripts files
80
- add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
81
-
82
- if ( ! defined( 'YITH_YWZM_PREMIUM' ) ) {
83
- // Show plugin premium tab
84
- add_action( 'yith_zoom_magnifier_premium', array( $this, 'premium_tab' ) );
85
- } else {
86
-
87
- /**
88
- * register plugin to licence/update system
89
- */
90
- $this->licence_activation();
91
- }
92
- }
93
-
94
-
95
- /**
96
- * Load YIT core plugin
97
- *
98
- * @since 1.0
99
- * @access public
100
- * @return void
101
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
102
- */
103
- public function plugin_fw_loader() {
104
- if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
105
- require_once( YITH_YWZM_DIR . 'plugin-fw/yit-plugin.php' );
106
- }
107
- }
108
-
109
- /**
110
- * Add a panel under YITH Plugins tab
111
- *
112
- * @return void
113
- * @since 1.0
114
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
115
- * @use /Yit_Plugin_Panel class
116
- * @see plugin-fw/lib/yit-plugin-panel.php
117
- */
118
- public function register_panel() {
119
-
120
- if ( ! empty( $this->_panel ) ) {
121
- return;
122
- }
123
-
124
- $admin_tabs['general'] = __( 'General', 'yith-woocommerce-zoom-magnifier' );
125
-
126
- if ( ! defined( 'YITH_YWZM_PREMIUM' ) ) {
127
- $admin_tabs['premium-landing'] = __( 'Premium Version', 'yith-woocommerce-zoom-magnifier' );
128
- } else {
129
- $admin_tabs['exclusions'] = __( 'Product exclusion list', 'yith-woocommerce-zoom-magnifier' );
130
- }
131
-
132
- $args = array(
133
- 'create_menu_page' => true,
134
- 'parent_slug' => '',
135
- 'page_title' => 'Zoom magnifier',
136
- 'menu_title' => 'Zoom magnifier',
137
- 'capability' => 'manage_options',
138
- 'parent' => '',
139
- 'parent_page' => 'yit_plugin_panel',
140
- 'page' => $this->_panel_page,
141
- 'admin-tabs' => $admin_tabs,
142
- 'options-path' => YITH_YWZM_DIR . '/plugin-options'
143
- );
144
-
145
- /* === Fixed: not updated theme === */
146
- if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
147
-
148
- require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
149
- }
150
-
151
- $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
152
-
153
- /** Add custom types actions and filters */
154
- YITH_YWZM_Custom_Types::get_instance();
155
- }
156
-
157
- /**
158
- * Premium Tab Template
159
- *
160
- * Load the premium tab template on admin page
161
- *
162
- * @return void
163
- * @since 1.0
164
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
165
- * @return void
166
- */
167
- public function premium_tab() {
168
- $premium_tab_template = YITH_YWZM_TEMPLATE_DIR . '/admin/' . $this->_premium;
169
- if ( file_exists( $premium_tab_template ) ) {
170
- include_once( $premium_tab_template );
171
- }
172
- }
173
-
174
- /**
175
- * Action Links
176
- *
177
- * add the action links to plugin admin page
178
- *
179
- * @param $links | links plugin array
180
- *
181
- * @return mixed Array
182
- * @since 1.0
183
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
184
- * @return mixed
185
- * @use plugin_action_links_{$plugin_file_name}
186
- */
187
- public function action_links( $links ) {
188
- $links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
189
-
190
- if ( defined( 'YITH_YWZM_FREE_INIT' ) ) {
191
- $links[] = '<a href="' . $this->_premium_landing . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
192
- }
193
-
194
- return $links;
195
- }
196
-
197
- /**
198
- * plugin_row_meta
199
- *
200
- * add the action links to plugin admin page
201
- *
202
- * @param $plugin_meta
203
- * @param $plugin_file
204
- * @param $plugin_data
205
- * @param $status
206
- *
207
- * @return Array
208
- * @since 1.0
209
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
210
- * @use plugin_row_meta
211
- */
212
- public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
213
- if ( ( defined( 'YITH_YWZM_INIT' ) && ( YITH_YWZM_INIT == $plugin_file ) ) ||
214
- ( defined( 'YITH_YWZM_FREE_INIT' ) && ( YITH_YWZM_FREE_INIT == $plugin_file ) )
215
- ) {
216
- $plugin_meta[] = '<a href="' . $this->_official_documentation . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
217
- }
218
-
219
- return $plugin_meta;
220
- }
221
-
222
- public function register_pointer() {
223
- if ( ! class_exists( 'YIT_Pointers' ) ) {
224
- include_once( 'plugin-fw/lib/yit-pointers.php' );
225
- }
226
-
227
- $premium_message = defined( 'YITH_YWZM_PREMIUM' )
228
- ? ''
229
- : __( 'YITH WooCommerce Zoom Magnifier is available in an outstanding PREMIUM version with many new options, discover it now.', 'yith-woocommerce-zoom-magnifier' ) .
230
- ' <a href="' . $this->_premium_landing . '">' . __( 'Premium version', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
231
-
232
- $args[] = array(
233
- 'screen_id' => 'plugins',
234
- 'pointer_id' => 'yith_woocommerce_zoom-magnifier',
235
- 'target' => '#toplevel_page_yit_plugin_panel',
236
- 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
237
- __( 'YITH WooCommerce Zoom Magnifier', 'yith-woocommerce-zoom-magnifier' ),
238
- __( 'In YIT Plugins tab you can find YITH WooCommerce Zoom Magnifier options.<br> From this menu you can access all settings of the YITH plugins activated.', 'yith-woocommerce-zoom-magnifier' ) . '<br>' . $premium_message
239
- ),
240
- 'position' => array( 'edge' => 'left', 'align' => 'center' ),
241
- 'init' => defined( 'YITH_YWZM_PREMIUM' ) ? YITH_YWZM_INIT : YITH_YWZM_FREE_INIT
242
- );
243
-
244
- YIT_Pointers()->register( $args );
245
- }
246
-
247
- /**
248
- * Get the premium landing uri
249
- *
250
- * @since 1.0.0
251
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
252
- * @return string The premium landing link
253
- */
254
- public function get_premium_landing_uri() {
255
- return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
256
- }
257
-
258
- //region **** licence related methods ****
259
-
260
- /**
261
- * Add actions to manage licence activation and updates
262
- */
263
- public function licence_activation() {
264
- if ( ! defined( 'YITH_YWZM_PREMIUM' ) ) {
265
- return;
266
- }
267
-
268
- add_action( 'wp_loaded', array( $this, 'register_plugin_for_activation' ), 99 );
269
- add_action( 'admin_init', array( $this, 'register_plugin_for_updates' ) );
270
- }
271
-
272
- /**
273
- * Register plugins for activation tab
274
- *
275
- * @return void
276
- * @since 2.0.0
277
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
278
- */
279
- public function register_plugin_for_activation() {
280
- if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
281
- require_once 'plugin-fw/lib/yit-plugin-licence.php';
282
- }
283
- YIT_Plugin_Licence()->register( YITH_YWZM_INIT, YITH_YWZM_SECRET_KEY, YITH_YWZM_SLUG );
284
- }
285
-
286
- /**
287
- * Register plugins for update tab
288
- *
289
- * @return void
290
- * @since 2.0.0
291
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
292
- */
293
- public function register_plugin_for_updates() {
294
- if ( ! class_exists( 'YIT_Upgrade' ) ) {
295
- require_once 'plugin-fw/lib/yit-upgrade.php';
296
- }
297
- YIT_Upgrade()->register( YITH_YWZM_SLUG, YITH_YWZM_INIT );
298
- }
299
- //endregion
300
- }
301
  }
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly
4
+ }
5
+
6
+ if ( ! class_exists( 'YITH_YWZM_Plugin_FW_Loader' ) ) {
7
+
8
+ /**
9
+ * Implements features related to an invoice document
10
+ *
11
+ * @class YITH_YWZM_Plugin_FW_Loader
12
+ * @package Yithemes
13
+ * @since 1.0.0
14
+ * @author Lorenzo Giuffrida
15
+ */
16
+ class YITH_YWZM_Plugin_FW_Loader {
17
+
18
+ /**
19
+ * @var $_panel Panel Object
20
+ */
21
+ protected $_panel;
22
+
23
+ /**
24
+ * @var $_premium string Premium tab template file name
25
+ */
26
+ protected $_premium = 'premium.php';
27
+
28
+ /**
29
+ * @var string Premium version landing link
30
+ */
31
+ protected $_premium_landing = 'http://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/';
32
+
33
+ /**
34
+ * @var string Plugin official documentation
35
+ */
36
+ protected $_official_documentation = 'http://yithemes.com/docs-plugins/yith-woocommerce-zoom-magnifier/';
37
+
38
+ /**
39
+ * @var string Plugin panel page
40
+ */
41
+ protected $_panel_page = 'yith_woocommerce_zoom-magnifier_panel';
42
+
43
+ /**
44
+ * Single instance of the class
45
+ *
46
+ * @since 1.0.0
47
+ */
48
+ protected static $instance;
49
+
50
+ /**
51
+ * Returns single instance of the class
52
+ *
53
+ * @since 1.0.0
54
+ */
55
+ public static function get_instance() {
56
+ if ( is_null( self::$instance ) ) {
57
+ self::$instance = new self();
58
+ }
59
+
60
+ return self::$instance;
61
+ }
62
+
63
+ public function __construct() {
64
+ /**
65
+ * Register actions and filters to be used for creating an entry on YIT Plugin menu
66
+ */
67
+ add_action( 'admin_init', array( $this, 'register_pointer' ) );
68
+
69
+ add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 15 );
70
+
71
+ //Add action links
72
+ add_filter( 'plugin_action_links_' . plugin_basename( YITH_YWZM_DIR . '/' . basename( YITH_YWZM_FILE ) ), array(
73
+ $this,
74
+ 'action_links'
75
+ ) );
76
+
77
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
78
+
79
+ // Add stylesheets and scripts files
80
+ add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
81
+
82
+ if ( ! defined( 'YITH_YWZM_PREMIUM' ) ) {
83
+ // Show plugin premium tab
84
+ add_action( 'yith_zoom_magnifier_premium', array( $this, 'premium_tab' ) );
85
+ } else {
86
+
87
+ /**
88
+ * register plugin to licence/update system
89
+ */
90
+ $this->licence_activation();
91
+ }
92
+ }
93
+
94
+
95
+ /**
96
+ * Load YIT core plugin
97
+ *
98
+ * @since 1.0
99
+ * @access public
100
+ * @return void
101
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
102
+ */
103
+ public function plugin_fw_loader() {
104
+ if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
105
+ require_once( YITH_YWZM_DIR . 'plugin-fw/yit-plugin.php' );
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Add a panel under YITH Plugins tab
111
+ *
112
+ * @return void
113
+ * @since 1.0
114
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
115
+ * @use /Yit_Plugin_Panel class
116
+ * @see plugin-fw/lib/yit-plugin-panel.php
117
+ */
118
+ public function register_panel() {
119
+
120
+ if ( ! empty( $this->_panel ) ) {
121
+ return;
122
+ }
123
+
124
+ $admin_tabs['general'] = __( 'General', 'yith-woocommerce-zoom-magnifier' );
125
+
126
+ if ( ! defined( 'YITH_YWZM_PREMIUM' ) ) {
127
+ $admin_tabs['premium-landing'] = __( 'Premium Version', 'yith-woocommerce-zoom-magnifier' );
128
+ } else {
129
+ $admin_tabs['exclusions'] = __( 'Product exclusion list', 'yith-woocommerce-zoom-magnifier' );
130
+ }
131
+
132
+ $args = array(
133
+ 'create_menu_page' => true,
134
+ 'parent_slug' => '',
135
+ 'page_title' => 'Zoom magnifier',
136
+ 'menu_title' => 'Zoom magnifier',
137
+ 'capability' => 'manage_options',
138
+ 'parent' => '',
139
+ 'parent_page' => 'yit_plugin_panel',
140
+ 'page' => $this->_panel_page,
141
+ 'admin-tabs' => $admin_tabs,
142
+ 'options-path' => YITH_YWZM_DIR . '/plugin-options'
143
+ );
144
+
145
+ /* === Fixed: not updated theme === */
146
+ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
147
+
148
+ require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
149
+ }
150
+
151
+ $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
152
+
153
+ /** Add custom types actions and filters */
154
+ YITH_YWZM_Custom_Types::get_instance();
155
+ }
156
+
157
+ /**
158
+ * Premium Tab Template
159
+ *
160
+ * Load the premium tab template on admin page
161
+ *
162
+ * @return void
163
+ * @since 1.0
164
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
165
+ * @return void
166
+ */
167
+ public function premium_tab() {
168
+ $premium_tab_template = YITH_YWZM_TEMPLATE_DIR . '/admin/' . $this->_premium;
169
+ if ( file_exists( $premium_tab_template ) ) {
170
+ include_once( $premium_tab_template );
171
+ }
172
+ }
173
+
174
+ /**
175
+ * Action Links
176
+ *
177
+ * add the action links to plugin admin page
178
+ *
179
+ * @param $links | links plugin array
180
+ *
181
+ * @return mixed Array
182
+ * @since 1.0
183
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
184
+ * @return mixed
185
+ * @use plugin_action_links_{$plugin_file_name}
186
+ */
187
+ public function action_links( $links ) {
188
+ $links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
189
+
190
+ if ( defined( 'YITH_YWZM_FREE_INIT' ) ) {
191
+ $links[] = '<a href="' . $this->_premium_landing . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
192
+ }
193
+
194
+ return $links;
195
+ }
196
+
197
+ /**
198
+ * plugin_row_meta
199
+ *
200
+ * add the action links to plugin admin page
201
+ *
202
+ * @param $plugin_meta
203
+ * @param $plugin_file
204
+ * @param $plugin_data
205
+ * @param $status
206
+ *
207
+ * @return Array
208
+ * @since 1.0
209
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
210
+ * @use plugin_row_meta
211
+ */
212
+ public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
213
+ if ( ( defined( 'YITH_YWZM_INIT' ) && ( YITH_YWZM_INIT == $plugin_file ) ) ||
214
+ ( defined( 'YITH_YWZM_FREE_INIT' ) && ( YITH_YWZM_FREE_INIT == $plugin_file ) )
215
+ ) {
216
+ $plugin_meta[] = '<a href="' . $this->_official_documentation . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
217
+ }
218
+
219
+ return $plugin_meta;
220
+ }
221
+
222
+ public function register_pointer() {
223
+ if ( ! class_exists( 'YIT_Pointers' ) ) {
224
+ include_once( 'plugin-fw/lib/yit-pointers.php' );
225
+ }
226
+
227
+ $premium_message = defined( 'YITH_YWZM_PREMIUM' )
228
+ ? ''
229
+ : __( 'YITH WooCommerce Zoom Magnifier is available in an outstanding PREMIUM version with many new options, discover it now.', 'yith-woocommerce-zoom-magnifier' ) .
230
+ ' <a href="' . $this->_premium_landing . '">' . __( 'Premium version', 'yith-woocommerce-zoom-magnifier' ) . '</a>';
231
+
232
+ $args[] = array(
233
+ 'screen_id' => 'plugins',
234
+ 'pointer_id' => 'yith_woocommerce_zoom-magnifier',
235
+ 'target' => '#toplevel_page_yit_plugin_panel',
236
+ 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
237
+ __( 'YITH WooCommerce Zoom Magnifier', 'yith-woocommerce-zoom-magnifier' ),
238
+ __( 'In YIT Plugins tab you can find YITH WooCommerce Zoom Magnifier options.<br> From this menu you can access all settings of the YITH plugins activated.', 'yith-woocommerce-zoom-magnifier' ) . '<br>' . $premium_message
239
+ ),
240
+ 'position' => array( 'edge' => 'left', 'align' => 'center' ),
241
+ 'init' => defined( 'YITH_YWZM_PREMIUM' ) ? YITH_YWZM_INIT : YITH_YWZM_FREE_INIT
242
+ );
243
+
244
+ YIT_Pointers()->register( $args );
245
+ }
246
+
247
+ /**
248
+ * Get the premium landing uri
249
+ *
250
+ * @since 1.0.0
251
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
252
+ * @return string The premium landing link
253
+ */
254
+ public function get_premium_landing_uri() {
255
+ return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
256
+ }
257
+
258
+ //region **** licence related methods ****
259
+
260
+ /**
261
+ * Add actions to manage licence activation and updates
262
+ */
263
+ public function licence_activation() {
264
+ if ( ! defined( 'YITH_YWZM_PREMIUM' ) ) {
265
+ return;
266
+ }
267
+
268
+ add_action( 'wp_loaded', array( $this, 'register_plugin_for_activation' ), 99 );
269
+ add_action( 'admin_init', array( $this, 'register_plugin_for_updates' ) );
270
+ }
271
+
272
+ /**
273
+ * Register plugins for activation tab
274
+ *
275
+ * @return void
276
+ * @since 2.0.0
277
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
278
+ */
279
+ public function register_plugin_for_activation() {
280
+ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
281
+ require_once 'plugin-fw/lib/yit-plugin-licence.php';
282
+ }
283
+ YIT_Plugin_Licence()->register( YITH_YWZM_INIT, YITH_YWZM_SECRET_KEY, YITH_YWZM_SLUG );
284
+ }
285
+
286
+ /**
287
+ * Register plugins for update tab
288
+ *
289
+ * @return void
290
+ * @since 2.0.0
291
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
292
+ */
293
+ public function register_plugin_for_updates() {
294
+ if ( ! class_exists( 'YIT_Upgrade' ) ) {
295
+ require_once 'plugin-fw/lib/yit-upgrade.php';
296
+ }
297
+ YIT_Upgrade()->register( YITH_YWZM_SLUG, YITH_YWZM_INIT );
298
+ }
299
+ //endregion
300
+ }
301
  }
plugin-fw/assets/css/colorbox.css ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Colorbox Core Style:
3
+ The following CSS is consistent between example themes and should not be altered.
4
+ */
5
+ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden; -webkit-transform: translate3d(0,0,0);}
6
+ #cboxWrapper {max-width:none;}
7
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
8
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
9
+ #cboxContent{position:relative;}
10
+ #cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
11
+ #cboxTitle{margin:0;}
12
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
13
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
14
+ .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
15
+ .cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
16
+ #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
17
+
18
+ /*
19
+ User Style:
20
+ Change the following styles to modify the appearance of Colorbox. They are
21
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
22
+ */
23
+ #cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);}
24
+ #colorbox{outline:0;}
25
+ #cboxTopLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 0;}
26
+ #cboxTopCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -50px;}
27
+ #cboxTopRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px 0;}
28
+ #cboxBottomLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 -25px;}
29
+ #cboxBottomCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -75px;}
30
+ #cboxBottomRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px -25px;}
31
+ #cboxMiddleLeft{width:25px; background:url(../images/colorbox/border2.png) repeat-y 0 0;}
32
+ #cboxMiddleRight{width:25px; background:url(../images/colorbox/border2.png) repeat-y -25px 0;}
33
+ #cboxContent{background:#fff; overflow:hidden;}
34
+ .cboxIframe{background:#fff;}
35
+ #cboxError{padding:50px; border:1px solid #ccc;}
36
+ #cboxLoadedContent{margin-bottom:20px;}
37
+ #cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;}
38
+ #cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;}
39
+ #cboxLoadingOverlay{background:#fff url(../images/colorbox/loading.gif) no-repeat 5px 5px;}
40
+
41
+ /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
42
+ #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
43
+
44
+ /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
45
+ #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
46
+
47
+ #cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;}
48
+ #cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
49
+ #cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
50
+ #cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}
51
+
52
+ /*
53
+ The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
54
+ when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
55
+ See: http://jacklmoore.com/notes/ie-transparency-problems/
56
+ */
57
+ .cboxIE #cboxTopLeft,
58
+ .cboxIE #cboxTopCenter,
59
+ .cboxIE #cboxTopRight,
60
+ .cboxIE #cboxBottomLeft,
61
+ .cboxIE #cboxBottomCenter,
62
+ .cboxIE #cboxBottomRight,
63
+ .cboxIE #cboxMiddleLeft,
64
+ .cboxIE #cboxMiddleRight {
65
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
66
+ }
plugin-fw/assets/css/metaboxes.css CHANGED
@@ -1,630 +1,664 @@
1
- /* self-clear floats */
2
- .clearfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; overflow:hidden; }
3
- /* ie.css */
4
- * html .clearfix { /* IE6 */
5
- height:1%;
6
- }
7
- *:first-child+html .clearfix { /* IE7 */
8
- min-height:1%;
9
- }
10
-
11
- .clearboth { clear: both }
12
-
13
- /* === TAB STYLE */
14
- .metaboxes-tab { margin:-6px -12px -8px; }
15
- .metaboxes-tab div.tabs-panel { height:auto; overflow:visible; margin-top:0px; padding:0 10px; background:none; border:0; border-top:1px solid #D4D4D4; }
16
- .metaboxes-tab ul.metaboxes-tabs { background:#F5F5F5; margin:0; padding:10px 0 0 5px; }
17
- .metaboxes-tab ul.metaboxes-tabs li { padding:8px 15px; border:1px solid #D4D4D4; float:left; background:#EDEDED; border-bottom-color:#EDEDED; margin:0 0 -1px 5px; box-shadow:1px 1px 1px 0 #FFFFFF inset; }
18
- .metaboxes-tab ul.metaboxes-tabs li a { color:#555; text-decoration:none; }
19
- .metaboxes-tab ul.metaboxes-tabs li.tabs { background:#F6F6F6; border-bottom:1px solid #F6F6F6; }
20
- .metaboxes-tab p.field-row { margin:20px 0; }
21
- .metaboxes-tab div.sep { height:1px; background:#DFDFDF; clear:both; margin-left:-10px; margin-right:-10px; }
22
- .metaboxes-tab label { font-weight:bold; width:160px; float:left; line-height:23px; margin-left:-184px; }
23
- .metaboxes-tab label small { font-weight:normal; line-height:15px; font-style:italic; color:#999; display:block; }
24
- .metaboxes-tab input[type="text"], .metaboxes-tab select, .metaboxes-tab textarea { width:30%; }
25
- .metaboxes-tab input[type="checkbox"] { vertical-align: middle }
26
- .metaboxes-tab select {padding:0;}
27
- .metaboxes-tab input.button-secondary, .metaboxes-tab input.checkbox { width:auto; }
28
- .metaboxes-tab .description { color:#AFAFAF; font-size:90%; font-style:italic; line-height:23px; padding-left:5px; }
29
- .metaboxes-tab p.field-row.textarea .description { vertical-align:top; }
30
- .metaboxes-tab p.field-row.checkbox {background:none;}
31
-
32
- .metaboxes-tab .the-metabox { margin:20px 0; margin-left:184px;}
33
- .metaboxes-tab .the-metabox.no-label { margin:20px 0; margin-left:0;}
34
- .metaboxes-tab hr { height: 0px; border-top: 1px solid #dadada; width: auto; margin-left: -10px; margin-right: -10px; }
35
- .metaboxes-tab .the-metabox p { margin:0;}
36
- .metaboxes-tab .the-metabox:last-child { border-bottom: 0px; }
37
- .metaboxes-tab .the-metabox.checkbox { background:none; }
38
- .metaboxes-tab .the-metabox.slider .ui-slider { margin-right:15px; }
39
-
40
- .metaboxes-tab span.desc { font-size: 11px; color: #AFAFAF; }
41
- .metaboxes-tab span.desc.inline { display: inline-block; vertical-align: top; line-height: 23px; }
42
- .metaboxes-tab .onoff span.desc, .metaboxes-tab .onoff label { padding:6px 0; }
43
- .metaboxes-tab .select span.desc, .metaboxes-tab .select label { padding:2px 0; }
44
- .metaboxes-tab .slider span.desc, .metaboxes-tab .slider label { padding:15px 0; }
45
- .metaboxes-tab .slider span.desc { display:block; padding:20px 0; }
46
-
47
- .metaboxes-tab ul.metaboxes-tabs li {
48
- -webkit-border-top-left-radius: 3px;
49
- -webkit-border-top-right-radius: 3px;
50
- -moz-border-radius-topleft: 3px;
51
- -moz-border-radius-topright: 3px;
52
- border-top-left-radius: 3px;
53
- border-top-right-radius: 3px;
54
- }
55
-
56
- /* image gallery */
57
- .metaboxes-tab .image-gallery ul li{
58
- display: inline-block;
59
- width: 80px;
60
- margin-left: 10px;
61
- position: relative;
62
- }
63
- .metaboxes-tab .image-gallery ul li img{
64
- width: 80px;
65
- border: 1px solid #ccc;
66
- }
67
- .metaboxes-tab .image-gallery ul li ul{
68
- position: absolute;
69
- top: -6px;
70
- right: -1px;
71
- width: 20px;
72
- height: 20px;
73
- }
74
- .metaboxes-tab .image-gallery ul a.delete{
75
- background: url(../images/x.png) no-repeat;
76
- width: 20px;
77
- height: 20px;
78
- display: block;
79
- text-indent: -99999px;
80
- }
81
- /* sidebar layout */
82
- .yit-sidebar-layout input[type="radio"] {
83
- display: none;
84
- width: 0px;
85
- }
86
- .yit-sidebar-layout input[type="radio"]:first-child {
87
- margin-right: -2px;
88
- }
89
-
90
- .yit-sidebar-layout input[type="radio"] + img {
91
- border: 2px solid #fff;
92
- padding: 1px;
93
- }
94
-
95
- .yit-sidebar-layout input[type="radio"] + img:hover {
96
- cursor: pointer;
97
- }
98
-
99
- .yit-sidebar-layout input[checked] + img {
100
- border: 2px solid #f2ad35;
101
- padding: 1px;
102
- }
103
-
104
- .yit-sidebar-layout select {
105
- vertical-align: 12px;
106
- width: inherit !important;
107
- }
108
-
109
- /* wp editor */
110
- .the-metabox.textarea-editor .mceIframeContainer {
111
- background:#fff;
112
- }
113
- .the-metabox.textarea-editor label {
114
- margin-top:24px;
115
- }
116
-
117
- /* categories */
118
- .categories-panel { width:30%; float:left; margin-right:4px; }
119
- .categories-panel .box { height:200px; border:1px solid #DFDFDF; background:#fff; padding:6px 10px; overflow: auto; }
120
- .categories-panel ul { list-style:none; margin:0; }
121
- .categories-panel ul li { line-height: 19px; margin: 0; padding: 0; word-wrap: break-word; }
122
- .categories-panel ul li label { font-weight:normal !important; margin-left:0 !important; }
123
- .categories-panel input.newcategory { width:100%; margin-bottom:3px; }
124
-
125
- /* contact form */
126
- .contactform_item {
127
- border-style: solid;
128
- border-width: 1px;
129
- line-height: 1;
130
- margin-bottom: 20px;
131
- padding: 0;
132
- background-color: #F5F5F5;
133
- background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
134
- border-color: #DFDFDF;
135
- border-radius: 3px 3px 3px 3px;
136
- box-shadow: 0 1px 0 #FFFFFF inset;
137
- min-width: 255px;
138
- position: relative;
139
- }
140
- .contactform_item .handlediv { position:relative; top: -4px; }
141
- .contactform_item h3 { min-height: 21px }
142
- .contactform_item .inside { padding: 10px !important; }
143
- .contactform_item .deps { display: none; }
144
- .contactform_item .addoptions p.option { margin: 5px 0 5px 200px }
145
- .contactform_item .addoptions p label { width: 80px !important; }
146
- .contactform_item .add-field-option { margin-bottom: 10px !important; }
147
- .remove_item { float: right; }
148
- .metabox-sortable-placeholder { border: 1px dotted #dedede; margin: 10px 0 }
149
-
150
- /* features tab */
151
- .featurestab_item{
152
- border-style: solid;
153
- border-width: 1px;
154
- line-height: 1;
155
- margin-bottom: 20px;
156
- padding: 0;
157
- background-color: #F5F5F5;
158
- background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
159
- border-color: #DFDFDF;
160
- border-radius: 3px 3px 3px 3px;
161
- box-shadow: 0 1px 0 #FFFFFF inset;
162
- min-width: 255px;
163
- position: relative;
164
- }
165
- .featurestab_item .handlediv { position:relative; top: -4px; }
166
- .featurestab_item h3 { min-height: 21px }
167
- .featurestab_item .inside { padding: 10px !important; }
168
- .featurestab_item .deps { display: none; }
169
- .featurestab_item .addoptions p.option { margin: 5px 0 5px 200px }
170
- .featurestab_item .addoptions p label { width: 80px !important; }
171
- .featurestab_item .add-field-option { margin-bottom: 10px !important; }
172
-
173
- /* slider */
174
- .the-metabox.slider { padding-top:20px; }
175
-
176
- /* on off */
177
- .the-metabox .rm_onoff span.onoff { float:left; margin-right:5px; margin-left:-4px; /* image fix */ }
178
-
179
- /* select */
180
- .the-metabox .select_wrapper { width:341px; background-color:#fff; }
181
- .the-metabox .select_wrapper select { width:100%; }
182
- .the-metabox .icon_type{ width:30%; float: left; margin-right: 40px }
183
- .the-metabox .icon_type select, .the-metabox div.option .select_wrapper select{ width: 100% }
184
-
185
- #post-type-settings .category-list label { width: 187px; }
186
- .remove_cat { float: right; text-align:center; display: block; width: 20px; height: 20px; border-radius: 20px; font-weight: bold; font-size: 10px; background: #efefef; text-decoration: none; }
187
-
188
- .the-metabox .select_wrapper {
189
- background: url("../images/select.png") no-repeat scroll right center #FAFAFA;
190
- border-color: #CCCCCC #EEEEEE #EEEEEE #CCCCCC;
191
- border-radius: 4px 4px 4px 4px;
192
- border-style: solid;
193
- border-width: 1px;
194
- color: #555555;
195
- display: block;
196
- float: left;
197
- font-family: sans-serif;
198
- font-size: 12px;
199
- min-height: 26px;
200
- margin-bottom: 9px !important;
201
- margin-left: 0;
202
- margin-right: 5px;
203
- margin-top: 0;
204
- width: 400px;
205
- position: relative;
206
- }
207
-
208
- /*chosen*/
209
-
210
- .chosen .select_wrapper {
211
- background: none;
212
- border: none;
213
- }
214
- .chosen .select_wrapper .chosen-container{
215
- width: 338px!important;
216
- }
217
- .chosen .select_wrapper .chosen-container .search-field input{
218
- height: 27px!important;
219
- color: #333;
220
- }
221
- .chosen .select_wrapper .chosen-container .chosen-choices{
222
- border: 1px solid #ddd;
223
- box-shadow: none;
224
- }
225
- .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice{
226
- height: 15px!important;
227
- min-width: 105px;
228
- }
229
- .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice span{
230
- line-height: 15px;
231
- height: 15px;
232
- padding-top: 2px;
233
- }
234
- .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice a.search-choice-close{
235
- top: 5px;
236
- }
237
- .chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
238
- width: 100%!important;
239
- }
240
- .select_wrapper span {
241
- height: 26px;
242
- line-height: 26px;
243
- padding-left: 6px;
244
- position: absolute;
245
- z-index: 2;
246
- overflow: hidden;
247
- }
248
-
249
- .the-metabox .select_wrapper select {
250
- cursor: pointer;
251
- height: 28px;
252
- margin: 0;
253
- opacity: 0;
254
- padding: 0;
255
- position: relative;
256
- width: inherit;
257
- z-index: 4;
258
- background-color: #FAFAFA;
259
- }
260
-
261
-
262
- /* typography */
263
- .the-metabox.typography .select_wrapper.font-family { width:200px; }
264
- .the-metabox.typography .spinner_container { float:left; margin-right:10px; }
265
- .the-metabox.typography .spinner_container input.number {
266
- width:50px !important;
267
- -webkit-border-top-right-radius: 0px;
268
- -webkit-border-bottom-right-radius: 0px;
269
- -moz-border-radius-topright: 0px;
270
- -moz-border-radius-bottomright: 0px;
271
- border-top-right-radius: 0px;
272
- border-bottom-right-radius: 0px;
273
- }
274
-
275
- /* number */
276
- .the-metabox.number input.number { width:50px !important; }
277
- /* number */
278
- .rm_number .number {
279
- width: 70px;
280
- text-align: right;
281
- -webkit-border-top-right-radius: 0px;
282
- -webkit-border-bottom-right-radius: 0px;
283
- -moz-border-radius-topright: 0px;
284
- -moz-border-radius-bottomright: 0px;
285
- border-top-right-radius: 0px;
286
- border-bottom-right-radius: 0px;
287
- }
288
-
289
- .spinner-wrapper { position: relative; height: 23px; overflow: hidden; }
290
- .spinner-wrapper input.number { float: left; }
291
- .spinner-wrapper .spinner-button { cursor:pointer; float: left; position: absolute; left: 69px; width: 15px; height: 12px; border: 1px solid #DFDFDF; background: #fff; margin: 0; padding: 0; line-height: 9999px; overflow: hidden; background: url('../images/spinner.png') no-repeat center -11px }
292
- .spinner-wrapper .spinner-button.button-plus { top: 0; -webkit-border-top-right-radius: 3px !important; -moz-border-radius-topright: 3px !important; border-top-right-radius: 3px !important; }
293
- .spinner-wrapper .spinner-button.button-minus { bottom: 0; background-position: center -30px; -webkit-border-bottom-right-radius: 3px !important; -moz-border-radius-bottomright: 3px !important; border-bottom-right-radius: 3px !important; }
294
-
295
-
296
- .spinner-wrapper .spinner-button.button-plus:active { background-position: center 0px; }
297
- .spinner-wrapper .spinner-button.button-minus:active { background-position: center -20px; }
298
-
299
-
300
- .rm_typography .spinner_container { float: left; margin-right: 10px; }
301
- .rm_typography .spinner-wrapper { height: 28px; }
302
- .rm_typography .spinner-wrapper input.number { height: 28px; }
303
- .rm_typography .spinner-wrapper .spinner-button.button-plus { height: 15px; background-position: center -10px; }
304
- .rm_typography .spinner-wrapper .spinner-button.button-minus { height: 14px; }
305
-
306
- .the-metabox .spinner-wrapper .spinner-button { left: 49px; }
307
- .the-metabox.typography .spinner-wrapper .spinner-button { left: 35px; }
308
-
309
- /* colorpicker */
310
- .the-metabox.colorpicker { display:block; width: auto; height: auto; overflow: visible; background-image: none; position: static; font-family: inherit;}
311
- .the-metabox.colorpicker input { background-color: transparent; border: 1px solid #DFDFDF; position: static; font-size: inherit; font-family: inherit; color: inherit; text-align: center; margin: 0 5px 0px; padding: 0; outline: none; width: auto; }
312
-
313
- /* images */
314
- .the-metabox.images, .the-metabox.images label { margin-left:0; display:block; }
315
- .the-metabox.images .slides-wrapper { clear:both; }
316
- .the-metabox.images .slides-wrapper li { position:relative; }
317
- .the-metabox.images a.delete { display:block; margin-left:4px; text-decoration:none; font-weight:bold; color:red; position:absolute; top:0; right:0; width:10px; height:18px; z-index:10; cursor:pointer !important; }
318
-
319
- /* wp editor */
320
- .wp_themeSkin iframe { background: #fff !important; }
321
-
322
- /* custom tabs */
323
- .customtab_item {
324
- border-style: solid;
325
- border-width: 1px;
326
- line-height: 1;
327
- margin-bottom: 20px;
328
- padding: 0;
329
- background-color: #F5F5F5;
330
- background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
331
- border-color: #DFDFDF;
332
- border-radius: 3px 3px 3px 3px;
333
- box-shadow: 0 1px 0 #FFFFFF inset;
334
- min-width: 255px;
335
- position: relative;
336
- }
337
- .customtab_item .handlediv { position:relative; top: -4px; }
338
- .customtab_item h3 { min-height: 21px }
339
- .customtab_item .inside { padding: 10px !important; }
340
- .customtab_item .deps { display: none; }
341
- .customtab_item .addoptions p.option { margin: 5px 0 5px 200px }
342
- .customtab_item .addoptions p label { width: 80px !important; }
343
- .customtab_item .add-field-option { margin-bottom: 10px !important; }
344
- .customtab_item .remove_item { float: right; }
345
- .metabox-sortable-placeholder { border: 1px dotted #dedede; margin: 10px 0 }
346
-
347
- .the-metabox.customtabs {
348
- margin-left: 0;
349
- }
350
-
351
- #customtab_item_sample {
352
- display: none;
353
- }
354
-
355
- .the-metabox.customtabs .field-row {
356
- margin-bottom: 10px;
357
- }
358
-
359
- #yit_custom_tabs label {
360
- font-weight: normal;
361
- width: auto;
362
- float: none;
363
- line-height: auto;
364
- margin-left: 0;
365
- }
366
-
367
-
368
- .wp-admin p label input[type=radio]{
369
- width: 16px;
370
- margin-right: 10px;
371
- margin-top: 3px;
372
- }
373
- .wp-admin .form-field._preset_onsale_icon_field label input[type=radio]{
374
- margin-top: 0;
375
- }
376
-
377
- .the-metabox .spinner {
378
- margin-top: 5px;
379
- float: none;
380
- }
381
-
382
- /* slider */
383
- /*numbers*/
384
- .ui-slider .maxCaption, .ui-slider .minCaption {
385
- margin-bottom: 5px;
386
- }
387
- .ui-slider .feedback {
388
- background: url(../images/slider/tooltip.png) no-repeat center top;
389
- position: absolute;
390
- top: -25px;
391
- width: 35px;
392
- height: 43px;
393
- text-align: center;
394
- width: 100%;
395
- display: block;
396
- }
397
- .ui-slider .feedback strong {
398
- display: inline-block;
399
- padding-top: 4px;
400
- top: -30px;
401
- }
402
- /*handle*/
403
- .ui-slider-horizontal .ui-slider-handle{
404
- background: transparent url(../images/slider/handle.png) no-repeat left top !important;
405
- border: 0px !important;
406
- top: -.35em !important;
407
- width: 18px !important;
408
- height: 19px !important;
409
- }
410
-
411
- /*bg on the left:grey*/
412
- .ui-slider.ui-widget-content {
413
- background: url(../images/slider/grey.gif) repeat-x left center !important;
414
- border-color: #c1c1c0 !important;
415
- height: 10px !important;
416
- }
417
-
418
- .iris-slider-offset.ui-slider.ui-widget-content {
419
- background: transparent!important;
420
- height: auto!important;
421
- }
422
-
423
- /*bg on the right:orange*/
424
- .ui-slider.ui-widget-content .ui-widget-header {
425
- background: url(../images/slider/orange.gif) repeat-x left center !important;
426
- left: 2px !important;
427
- -webkit-border-radius: 15px;
428
- -moz-border-radius: 15px;
429
- -khtml-border-radius: 15px;
430
- border-radius: 15px;
431
- }
432
-
433
-
434
- /*sidebars*/
435
-
436
- #choose-sidebars.choose{
437
- margin-left: 0px;
438
- }
439
-
440
-
441
- #_active_page_options-container label, #_active_page_options-container p{
442
- display: inline-block;
443
- margin: 0px;
444
- }
445
- #_active_page_options-container label{
446
- margin-right: 10px;
447
- margin-top: 3px;
448
- }
449
- #_active_page_options-container {
450
- float: right;
451
- margin-right: 20px;
452
- margin-top: 5px;
453
- }
454
-
455
- /* sortable table posts */
456
-
457
- #the-list.ui-sortable tr:hover {
458
- cursor: move;
459
- }
460
-
461
-
462
- /*datepicker*/
463
- /*! jQuery UI - v1.11.2 - 2015-01-21
464
- * http://jqueryui.com
465
- * Includes: core.css, datepicker.css, theme.css
466
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=0px&bgColorHeader=%23dddddd&bgTextureHeader=flat&bgImgOpacityHeader=60&borderColorHeader=%23aaaaaa&fcHeader=%23222222&iconColorHeader=%23222222&bgColorContent=%23ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=%23aaaaaa&fcContent=%23222222&iconColorContent=%23222222&bgColorDefault=%23e9e9e9&bgTextureDefault=flat&bgImgOpacityDefault=75&borderColorDefault=%23d3d3d3&fcDefault=%23555555&iconColorDefault=%23888888&bgColorHover=%23dadada&bgTextureHover=flat&bgImgOpacityHover=75&borderColorHover=%23999999&fcHover=%23212121&iconColorHover=%23454545&bgColorActive=%23ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=%23aaaaaa&fcActive=%23212121&iconColorActive=%23454545&bgColorHighlight=%23fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=%2389b17e&fcHighlight=%23363636&iconColorHighlight=%232e83ff&bgColorError=%23fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=%23cd0a0a&fcError=%23cd0a0a&iconColorError=%23cd0a0a&bgColorOverlay=%23aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=%23aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
467
- * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
468
-
469
- /* Layout helpers
470
- ----------------------------------*/
471
- .ui-helper-hidden {
472
- display: none;
473
- }
474
- .ui-helper-hidden-accessible {
475
- border: 0;
476
- clip: rect(0 0 0 0);
477
- height: 1px;
478
- margin: -1px;
479
- overflow: hidden;
480
- padding: 0;
481
- position: absolute;
482
- width: 1px;
483
- }
484
- .ui-helper-reset {
485
- margin: 0;
486
- padding: 0;
487
- border: 0;
488
- outline: 0;
489
- line-height: 1.3;
490
- text-decoration: none;
491
- font-size: 100%;
492
- list-style: none;
493
- }
494
- .ui-helper-clearfix:before,
495
- .ui-helper-clearfix:after {
496
- content: "";
497
- display: table;
498
- border-collapse: collapse;
499
- }
500
- .ui-helper-clearfix:after {
501
- clear: both;
502
- }
503
- .ui-helper-clearfix {
504
- min-height: 0; /* support: IE7 */
505
- }
506
- .ui-helper-zfix {
507
- width: 100%;
508
- height: 100%;
509
- top: 0;
510
- left: 0;
511
- position: absolute;
512
- opacity: 0;
513
- filter:Alpha(Opacity=0); /* support: IE8 */
514
- }
515
-
516
- .ui-front {
517
- z-index: 100;
518
- }
519
-
520
-
521
- /* Interaction Cues
522
- ----------------------------------*/
523
- .ui-state-disabled {
524
- cursor: default !important;
525
- }
526
-
527
-
528
- /* Icons
529
- ----------------------------------*/
530
-
531
- /* states and images */
532
- .ui-icon {
533
- display: block;
534
- text-indent: -99999px;
535
- overflow: hidden;
536
- background-repeat: no-repeat;
537
- }
538
-
539
-
540
- /* DATE PICKER
541
- ----------------------------------*/
542
-
543
- .ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}
544
- .ui-datepicker{width:17em;padding:.2em .2em 0;display:none;z-index:100!important;}
545
- .ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}
546
- .ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}
547
- .ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}
548
- .ui-datepicker .ui-datepicker-prev{left:2px}
549
- .ui-datepicker .ui-datepicker-next{right:2px}
550
- .ui-datepicker .ui-datepicker-prev-hover{left:1px}
551
- .ui-datepicker .ui-datepicker-next-hover{right:1px}
552
- .ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}
553
- .ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}
554
- .ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}
555
- .ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}
556
- .ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}
557
- .ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:700;border:0}
558
- .ui-datepicker td{border:0;padding:1px}
559
- .ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}
560
- .ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}
561
- .ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em;width:auto;overflow:visible}
562
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}
563
- .ui-datepicker.ui-datepicker-multi{width:auto}
564
- .ui-datepicker-multi .ui-datepicker-group{float:left}
565
- .ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}
566
- .ui-datepicker-multi-2 .ui-datepicker-group{width:50%}
567
- .ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}
568
- .ui-datepicker-multi-4 .ui-datepicker-group{width:25%}
569
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}
570
- .ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}
571
- .ui-datepicker-row-break{clear:both;width:100%;font-size:0}
572
- .ui-datepicker-rtl{direction:rtl}
573
- .ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}
574
- .ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}
575
- .ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}
576
- .ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}
577
- .ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}
578
- .ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}
579
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}
580
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}
581
- .ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}
582
- .ui-widget .ui-widget{font-size:1em}
583
- .ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}
584
- .ui-widget-content{border:1px solid #aaa;background:#fff 50% 50% repeat-x;color:#222}
585
- .ui-widget-content a{color:#222}
586
- .ui-widget-header{border:1px solid #aaa;background:#ddd 50% 50% repeat-x;color:#222;font-weight:700}
587
- .ui-widget-header a{color:#222}
588
- .ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:0 solid #d3d3d3;background:#e9e9e9 50% 50% repeat-x;font-weight:400;color:#555}
589
- .ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}
590
- .ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:0 solid #999;background:#dadada 50% 50% repeat-x;font-weight:400;color:#212121}
591
- .ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}
592
- .ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:0 solid #aaa;background:#fff 50% 50% repeat-x;font-weight:400;color:#212121}
593
- .ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}
594
- .ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:0 solid #89b17e;background:#fbf9ee 50% 50% repeat-x;color:#363636}
595
- .ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}
596
- .ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:0 solid #cd0a0a;background:#fef1ec 50% 50% repeat-x;color:#cd0a0a}
597
- .ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}
598
- .ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}
599
- .ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}
600
- .ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}
601
- .ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}
602
- .ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}
603
- .ui-icon{width:16px;height:16px}
604
- .ui-icon,.ui-widget-content .ui-icon{background-image:url(../images/ui-icons_222222_256x240.png)}
605
- .ui-widget-header .ui-icon{background-image:url(../images/ui-icons_222222_256x240.png)}
606
- .ui-state-default .ui-icon{background-image:url(../images/ui-icons_888888_256x240.png)}
607
- .ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui-icons_454545_256x240.png)}
608
- .ui-state-active .ui-icon{background-image:url(../images/ui-icons_454545_256x240.png)}
609
- .ui-state-highlight .ui-icon{background-image:url(../images/ui-icons_2e83ff_256x240.png)}
610
- .ui-icon-circle-triangle-e{background-position:-48px -192px}
611
- .ui-icon-circle-triangle-s{background-position:-64px -192px}
612
- .ui-icon-circle-triangle-w{background-position:-80px -192px}
613
- .ui-icon-circle-triangle-n{background-position:-96px -192px}
614
- .ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:0}
615
- .ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:0}
616
- .ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:0}
617
- .ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:0}
618
- .ui-widget-overlay{background:#aaa 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}
619
- .ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
620
-
621
-
622
- .the-metabox.preview{
623
- float: none;
624
- }
625
- .metaboxes-tab .the-metabox.no-label.preview{
626
- margin-left: 184px;
627
- }
628
- .metaboxes-tab .the-metabox.no-label.preview img{
629
- box-shadow: 0 1px 8px rgba(0,0,0,0.2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
  }
1
+ /* self-clear floats */
2
+ .clearfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; overflow:hidden; }
3
+ /* ie.css */
4
+ * html .clearfix { /* IE6 */
5
+ height:1%;
6
+ }
7
+ *:first-child+html .clearfix { /* IE7 */
8
+ min-height:1%;
9
+ }
10
+
11
+ .clearboth { clear: both }
12
+
13
+ /* === TAB STYLE */
14
+ .metaboxes-tab { margin:-6px -12px -8px; }
15
+ .metaboxes-tab div.tabs-panel { height:auto; overflow:visible; margin-top:0px; padding:0 10px; background:none; border:0; border-top:1px solid #D4D4D4; }
16
+ .metaboxes-tab ul.metaboxes-tabs { background:#F5F5F5; margin:0; padding:10px 0 0 5px; }
17
+ .metaboxes-tab ul.metaboxes-tabs li { padding:8px 15px; border:1px solid #D4D4D4; float:left; background:#EDEDED; border-bottom-color:#EDEDED; margin:0 0 -1px 5px; box-shadow:1px 1px 1px 0 #FFFFFF inset; }
18
+ .metaboxes-tab ul.metaboxes-tabs li a { color:#555; text-decoration:none; }
19
+ .metaboxes-tab ul.metaboxes-tabs li.tabs { background:#F6F6F6; border-bottom:1px solid #F6F6F6; }
20
+ .metaboxes-tab p.field-row { margin:20px 0; }
21
+ .metaboxes-tab div.sep { height:1px; background:#DFDFDF; clear:both; margin-left:-10px; margin-right:-10px; }
22
+ .metaboxes-tab label { font-weight:bold; width:160px; float:left; line-height:23px; margin-left:-184px; }
23
+ .metaboxes-tab label small { font-weight:normal; line-height:15px; font-style:italic; color:#999; display:block; }
24
+ .metaboxes-tab input[type="text"], .metaboxes-tab select, .metaboxes-tab textarea { width:30%; }
25
+ .metaboxes-tab input[type="checkbox"] { vertical-align: middle }
26
+ .metaboxes-tab select {padding:0;}
27
+ .metaboxes-tab input.button-secondary, .metaboxes-tab input.checkbox { width:auto; }
28
+ .metaboxes-tab .description { color:#AFAFAF; font-size:90%; font-style:italic; line-height:23px; padding-left:5px; }
29
+ .metaboxes-tab p.field-row.textarea .description { vertical-align:top; }
30
+ .metaboxes-tab p.field-row.checkbox {background:none;}
31
+
32
+ .metaboxes-tab .the-metabox { margin:20px 0; margin-left:184px;}
33
+ .metaboxes-tab .the-metabox.no-label { margin:20px 0; margin-left:0;}
34
+ .metaboxes-tab hr { height: 0px; border-top: 1px solid #dadada; width: auto; margin-left: -10px; margin-right: -10px; }
35
+ .metaboxes-tab .the-metabox p { margin:0;}
36
+ .metaboxes-tab .the-metabox:last-child { border-bottom: 0px; }
37
+ .metaboxes-tab .the-metabox.checkbox { background:none; }
38
+ .metaboxes-tab .the-metabox.slider .ui-slider { margin-right:15px; }
39
+
40
+ .metaboxes-tab span.desc { font-size: 11px; color: #AFAFAF; }
41
+ .metaboxes-tab span.desc.inline { display: inline-block; vertical-align: top; line-height: 23px; }
42
+ .metaboxes-tab .onoff span.desc, .metaboxes-tab .onoff label { padding:6px 0; }
43
+ .metaboxes-tab .select span.desc, .metaboxes-tab .select label { padding:2px 0; }
44
+ .metaboxes-tab .slider span.desc, .metaboxes-tab .slider label { padding:15px 0; }
45
+ .metaboxes-tab .slider span.desc { display:block; padding:20px 0; }
46
+
47
+ .metaboxes-tab ul.metaboxes-tabs li {
48
+ -webkit-border-top-left-radius: 3px;
49
+ -webkit-border-top-right-radius: 3px;
50
+ -moz-border-radius-topleft: 3px;
51
+ -moz-border-radius-topright: 3px;
52
+ border-top-left-radius: 3px;
53
+ border-top-right-radius: 3px;
54
+ }
55
+
56
+ /* image gallery */
57
+ .metaboxes-tab .image-gallery ul li{
58
+ display: inline-block;
59
+ width: 80px;
60
+ margin-left: 10px;
61
+ position: relative;
62
+ }
63
+ .metaboxes-tab .image-gallery ul li img{
64
+ width: 80px;
65
+ border: 1px solid #ccc;
66
+ }
67
+ .metaboxes-tab .image-gallery ul li ul{
68
+ position: absolute;
69
+ top: -6px;
70
+ right: -1px;
71
+ width: 20px;
72
+ height: 20px;
73
+ }
74
+ .metaboxes-tab .image-gallery ul a.delete{
75
+ background: url(../images/x.png) no-repeat;
76
+ width: 20px;
77
+ height: 20px;
78
+ display: block;
79
+ text-indent: -99999px;
80
+ }
81
+ /* sidebar layout */
82
+ .yit-sidebar-layout input[type="radio"] {
83
+ display: none;
84
+ width: 0px;
85
+ }
86
+ .yit-sidebar-layout input[type="radio"]:first-child {
87
+ margin-right: -2px;
88
+ }
89
+
90
+ .yit-sidebar-layout input[type="radio"] + img {
91
+ border: 2px solid #fff;
92
+ padding: 1px;
93
+ }
94
+
95
+ .yit-sidebar-layout input[type="radio"] + img:hover {
96
+ cursor: pointer;
97
+ }
98
+
99
+ .yit-sidebar-layout input[checked] + img {
100
+ border: 2px solid #f2ad35;
101
+ padding: 1px;
102
+ }
103
+
104
+ .yit-sidebar-layout select {
105
+ vertical-align: 12px;
106
+ width: inherit !important;
107
+ }
108
+
109
+ /* wp editor */
110
+ .the-metabox.textarea-editor .mceIframeContainer {
111
+ background:#fff;
112
+ }
113
+ .the-metabox.textarea-editor label {
114
+ margin-top:24px;
115
+ }
116
+
117
+ /* categories */
118
+ .categories-panel { width:30%; float:left; margin-right:4px; }
119
+ .categories-panel .box { height:200px; border:1px solid #DFDFDF; background:#fff; padding:6px 10px; overflow: auto; }
120
+ .categories-panel ul { list-style:none; margin:0; }
121
+ .categories-panel ul li { line-height: 19px; margin: 0; padding: 0; word-wrap: break-word; }
122
+ .categories-panel ul li label { font-weight:normal !important; margin-left:0 !important; }
123
+ .categories-panel input.newcategory { width:100%; margin-bottom:3px; }
124
+
125
+ /* contact form */
126
+ .contactform_item {
127
+ border-style: solid;
128
+ border-width: 1px;
129
+ line-height: 1;
130
+ margin-bottom: 20px;
131
+ padding: 0;
132
+ background-color: #F5F5F5;
133
+ background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
134
+ border-color: #DFDFDF;
135
+ border-radius: 3px 3px 3px 3px;
136
+ box-shadow: 0 1px 0 #FFFFFF inset;
137
+ min-width: 255px;
138
+ position: relative;
139
+ }
140
+ .contactform_item .handlediv { position:relative; top: -4px; }
141
+ .contactform_item h3 { min-height: 21px }
142
+ .contactform_item .inside { padding: 10px !important; }
143
+ .contactform_item .deps { display: none; }
144
+ .contactform_item .addoptions p.option { margin: 5px 0 5px 200px }
145
+ .contactform_item .addoptions p label { width: 80px !important; }
146
+ .contactform_item .add-field-option { margin-bottom: 10px !important; }
147
+ .remove_item { float: right; }
148
+ .metabox-sortable-placeholder { border: 1px dotted #dedede; margin: 10px 0 }
149
+
150
+ /* features tab */
151
+ .featurestab_item{
152
+ border-style: solid;
153
+ border-width: 1px;
154
+ line-height: 1;
155
+ margin-bottom: 20px;
156
+ padding: 0;
157
+ background-color: #F5F5F5;
158
+ background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
159
+ border-color: #DFDFDF;
160
+ border-radius: 3px 3px 3px 3px;
161
+ box-shadow: 0 1px 0 #FFFFFF inset;
162
+ min-width: 255px;
163
+ position: relative;
164
+ }
165
+ .featurestab_item .handlediv { position:relative; top: -4px; }
166
+ .featurestab_item h3 { min-height: 21px }
167
+ .featurestab_item .inside { padding: 10px !important; }
168
+ .featurestab_item .deps { display: none; }
169
+ .featurestab_item .addoptions p.option { margin: 5px 0 5px 200px }
170
+ .featurestab_item .addoptions p label { width: 80px !important; }
171
+ .featurestab_item .add-field-option { margin-bottom: 10px !important; }
172
+
173
+ /* slider */
174
+ .the-metabox.slider { padding-top:20px; }
175
+
176
+ /* on off */
177
+ .the-metabox .rm_onoff span.onoff { float:left; margin-right:5px; margin-left:-4px; /* image fix */ }
178
+
179
+ /* onoff */
180
+ .rm_onoff input {
181
+ display: none;
182
+ }
183
+
184
+ .rm_onoff input + span {
185
+ cursor: pointer;
186
+ text-indent: -9999px;
187
+ display: block;
188
+ width: 85px;
189
+ height: 37px;
190
+ background: transparent url(../images/off.png);
191
+ }
192
+
193
+ .rm_onoff input:checked + span {
194
+ background: transparent url(../images/on.png);
195
+ }
196
+
197
+ .rm_onoff input.onoffchecked + span {
198
+ background: transparent url(../images/on.png);
199
+ }
200
+
201
+ .messages-panel.updated {
202
+ margin: 10px 0px 10px !important;
203
+ max-width: 1200px;
204
+ border-radius: 5px;
205
+ -webkit-box-sizing: border-box;
206
+ box-sizing: border-box;
207
+ }
208
+
209
+ .ui-widget-overlay { background-image: none !important; }
210
+
211
+
212
+
213
+ /* select */
214
+ .the-metabox .select_wrapper { width:341px; background-color:#fff; }
215
+ .the-metabox .select_wrapper select { width:100%; }
216
+ .the-metabox .icon_type{ width:30%; float: left; margin-right: 40px }
217
+ .the-metabox .icon_type select, .the-metabox div.option .select_wrapper select{ width: 100% }
218
+
219
+ #post-type-settings .category-list label { width: 187px; }
220
+ .remove_cat { float: right; text-align:center; display: block; width: 20px; height: 20px; border-radius: 20px; font-weight: bold; font-size: 10px; background: #efefef; text-decoration: none; }
221
+
222
+ .the-metabox .select_wrapper {
223
+ background: url("../images/select.png") no-repeat scroll right center #FAFAFA;
224
+ border-color: #CCCCCC #EEEEEE #EEEEEE #CCCCCC;
225
+ border-radius: 4px 4px 4px 4px;
226
+ border-style: solid;
227
+ border-width: 1px;
228
+ color: #555555;
229
+ display: block;
230
+ float: left;
231
+ font-family: sans-serif;
232
+ font-size: 12px;
233
+ min-height: 26px;
234
+ margin-bottom: 9px !important;
235
+ margin-left: 0;
236
+ margin-right: 5px;
237
+ margin-top: 0;
238
+ width: 400px;
239
+ position: relative;
240
+ }
241
+
242
+ /*chosen*/
243
+
244
+ .chosen .select_wrapper {
245
+ background: none;
246
+ border: none;
247
+ }
248
+ .chosen .select_wrapper .chosen-container{
249
+ width: 338px!important;
250
+ }
251
+ .chosen .select_wrapper .chosen-container .search-field input{
252
+ height: 27px!important;
253
+ color: #333;
254
+ }
255
+ .chosen .select_wrapper .chosen-container .chosen-choices{
256
+ border: 1px solid #ddd;
257
+ box-shadow: none;
258
+ }
259
+ .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice{
260
+ height: 15px!important;
261
+ min-width: 105px;
262
+ }
263
+ .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice span{
264
+ line-height: 15px;
265
+ height: 15px;
266
+ padding-top: 2px;
267
+ }
268
+ .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice a.search-choice-close{
269
+ top: 5px;
270
+ }
271
+ .chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
272
+ width: 100%!important;
273
+ }
274
+ .select_wrapper span {
275
+ height: 26px;
276
+ line-height: 26px;
277
+ padding-left: 6px;
278
+ position: absolute;
279
+ z-index: 2;
280
+ overflow: hidden;
281
+ }
282
+
283
+ .the-metabox .select_wrapper select {
284
+ cursor: pointer;
285
+ height: 28px;
286
+ margin: 0;
287
+ opacity: 0;
288
+ padding: 0;
289
+ position: relative;
290
+ width: inherit;
291
+ z-index: 4;
292
+ background-color: #FAFAFA;
293
+ }
294
+
295
+
296
+ /* typography */
297
+ .the-metabox.typography .select_wrapper.font-family { width:200px; }
298
+ .the-metabox.typography .spinner_container { float:left; margin-right:10px; }
299
+ .the-metabox.typography .spinner_container input.number {
300
+ width:50px !important;
301
+ -webkit-border-top-right-radius: 0px;
302
+ -webkit-border-bottom-right-radius: 0px;
303
+ -moz-border-radius-topright: 0px;
304
+ -moz-border-radius-bottomright: 0px;
305
+ border-top-right-radius: 0px;
306
+ border-bottom-right-radius: 0px;
307
+ }
308
+
309
+ /* number */
310
+ .the-metabox.number input.number { width:50px !important; }
311
+ /* number */
312
+ .rm_number .number {
313
+ width: 70px;
314
+ text-align: right;
315
+ -webkit-border-top-right-radius: 0px;
316
+ -webkit-border-bottom-right-radius: 0px;
317
+ -moz-border-radius-topright: 0px;
318
+ -moz-border-radius-bottomright: 0px;
319
+ border-top-right-radius: 0px;
320
+ border-bottom-right-radius: 0px;
321
+ }
322
+
323
+ .spinner-wrapper { position: relative; height: 23px; overflow: hidden; }
324
+ .spinner-wrapper input.number { float: left; }
325
+ .spinner-wrapper .spinner-button { cursor:pointer; float: left; position: absolute; left: 69px; width: 15px; height: 12px; border: 1px solid #DFDFDF; background: #fff; margin: 0; padding: 0; line-height: 9999px; overflow: hidden; background: url('../images/spinner.png') no-repeat center -11px }
326
+ .spinner-wrapper .spinner-button.button-plus { top: 0; -webkit-border-top-right-radius: 3px !important; -moz-border-radius-topright: 3px !important; border-top-right-radius: 3px !important; }
327
+ .spinner-wrapper .spinner-button.button-minus { bottom: 0; background-position: center -30px; -webkit-border-bottom-right-radius: 3px !important; -moz-border-radius-bottomright: 3px !important; border-bottom-right-radius: 3px !important; }
328
+
329
+
330
+ .spinner-wrapper .spinner-button.button-plus:active { background-position: center 0px; }
331
+ .spinner-wrapper .spinner-button.button-minus:active { background-position: center -20px; }
332
+
333
+
334
+ .rm_typography .spinner_container { float: left; margin-right: 10px; }
335
+ .rm_typography .spinner-wrapper { height: 28px; }
336
+ .rm_typography .spinner-wrapper input.number { height: 28px; }
337
+ .rm_typography .spinner-wrapper .spinner-button.button-plus { height: 15px; background-position: center -10px; }
338
+ .rm_typography .spinner-wrapper .spinner-button.button-minus { height: 14px; }
339
+
340
+ .the-metabox .spinner-wrapper .spinner-button { left: 49px; }
341
+ .the-metabox.typography .spinner-wrapper .spinner-button { left: 35px; }
342
+
343
+ /* colorpicker */
344
+ .the-metabox.colorpicker { display:block; width: auto; height: auto; overflow: visible; background-image: none; position: static; font-family: inherit;}
345
+ .the-metabox.colorpicker input { background-color: transparent; border: 1px solid #DFDFDF; position: static; font-size: inherit; font-family: inherit; color: inherit; text-align: center; margin: 0 5px 0px; padding: 0; outline: none; width: auto; }
346
+
347
+ /* images */
348
+ .the-metabox.images, .the-metabox.images label { margin-left:0; display:block; }
349
+ .the-metabox.images .slides-wrapper { clear:both; }
350
+ .the-metabox.images .slides-wrapper li { position:relative; }
351
+ .the-metabox.images a.delete { display:block; margin-left:4px; text-decoration:none; font-weight:bold; color:red; position:absolute; top:0; right:0; width:10px; height:18px; z-index:10; cursor:pointer !important; }
352
+
353
+ /* wp editor */
354
+ .wp_themeSkin iframe { background: #fff !important; }
355
+
356
+ /* custom tabs */
357
+ .customtab_item {
358
+ border-style: solid;
359
+ border-width: 1px;
360
+ line-height: 1;
361
+ margin-bottom: 20px;
362
+ padding: 0;
363
+ background-color: #F5F5F5;
364
+ background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
365
+ border-color: #DFDFDF;
366
+ border-radius: 3px 3px 3px 3px;
367
+ box-shadow: 0 1px 0 #FFFFFF inset;
368
+ min-width: 255px;
369
+ position: relative;
370
+ }
371
+ .customtab_item .handlediv { position:relative; top: -4px; }
372
+ .customtab_item h3 { min-height: 21px }
373
+ .customtab_item .inside { padding: 10px !important; }
374
+ .customtab_item .deps { display: none; }
375
+ .customtab_item .addoptions p.option { margin: 5px 0 5px 200px }
376
+ .customtab_item .addoptions p label { width: 80px !important; }
377
+ .customtab_item .add-field-option { margin-bottom: 10px !important; }
378
+ .customtab_item .remove_item { float: right; }
379
+ .metabox-sortable-placeholder { border: 1px dotted #dedede; margin: 10px 0 }
380
+
381
+ .the-metabox.customtabs {
382
+ margin-left: 0;
383
+ }
384
+
385
+ #customtab_item_sample {
386
+ display: none;
387
+ }
388
+
389
+ .the-metabox.customtabs .field-row {
390
+ margin-bottom: 10px;
391
+ }
392
+
393
+ #yit_custom_tabs label {
394
+ font-weight: normal;
395
+ width: auto;
396
+ float: none;
397
+ line-height: auto;
398
+ margin-left: 0;
399
+ }
400
+
401
+
402
+ .wp-admin p label input[type=radio]{
403
+ width: 16px;
404
+ margin-right: 10px;
405
+ margin-top: 3px;
406
+ }
407
+ .wp-admin .form-field._preset_onsale_icon_field label input[type=radio]{
408
+ margin-top: 0;
409
+ }
410
+
411
+ .the-metabox .spinner {
412
+ margin-top: 5px;
413
+ float: none;
414
+ }
415
+
416
+ /* slider */
417
+ /*numbers*/
418
+ .ui-slider .maxCaption, .ui-slider .minCaption {
419
+ margin-bottom: 5px;
420
+ }
421
+ .ui-slider .feedback {
422
+ background: url(../images/slider/tooltip.png) no-repeat center top;
423
+ position: absolute;
424
+ top: -25px;
425
+ width: 35px;
426
+ height: 43px;
427
+ text-align: center;
428
+ width: 100%;
429
+ display: block;
430
+ }
431
+ .ui-slider .feedback strong {
432
+ display: inline-block;
433
+ padding-top: 4px;
434
+ top: -30px;
435
+ }
436
+ /*handle*/
437
+ .ui-slider-horizontal .ui-slider-handle{
438
+ background: transparent url(../images/slider/handle.png) no-repeat left top !important;
439
+ border: 0px !important;
440
+ top: -.35em !important;
441
+ width: 18px !important;
442
+ height: 19px !important;
443
+ }
444
+
445
+ /*bg on the left:grey*/
446
+ .ui-slider.ui-widget-content {
447
+ background: url(../images/slider/grey.gif) repeat-x left center !important;
448
+ border-color: #c1c1c0 !important;
449
+ height: 10px !important;
450
+ }
451
+
452
+ .iris-slider-offset.ui-slider.ui-widget-content {
453
+ background: transparent!important;
454
+ height: auto!important;
455
+ }
456
+
457
+ /*bg on the right:orange*/
458
+ .ui-slider.ui-widget-content .ui-widget-header {
459
+ background: url(../images/slider/orange.gif) repeat-x left center !important;
460
+ left: 2px !important;
461
+ -webkit-border-radius: 15px;
462
+ -moz-border-radius: 15px;
463
+ -khtml-border-radius: 15px;
464
+ border-radius: 15px;
465
+ }
466
+
467
+
468
+ /*sidebars*/
469
+
470
+ #choose-sidebars.choose{
471
+ margin-left: 0px;
472
+ }
473
+
474
+
475
+ #_active_page_options-container label, #_active_page_options-container p{
476
+ display: inline-block;
477
+ margin: 0px;
478
+ }
479
+ #_active_page_options-container label{
480
+ margin-right: 10px;
481
+ margin-top: 3px;
482
+ }
483
+ #_active_page_options-container {
484
+ float: right;
485
+ margin-right: 20px;
486
+ margin-top: 5px;
487
+ }
488
+
489
+ /* sortable table posts */
490
+
491
+ #the-list.ui-sortable tr:hover {
492
+ cursor: move;
493
+ }
494
+
495
+
496
+ /*datepicker*/
497
+ /*! jQuery UI - v1.11.2 - 2015-01-21
498
+ * http://jqueryui.com
499
+ * Includes: core.css, datepicker.css, theme.css
500
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=0px&bgColorHeader=%23dddddd&bgTextureHeader=flat&bgImgOpacityHeader=60&borderColorHeader=%23aaaaaa&fcHeader=%23222222&iconColorHeader=%23222222&bgColorContent=%23ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=%23aaaaaa&fcContent=%23222222&iconColorContent=%23222222&bgColorDefault=%23e9e9e9&bgTextureDefault=flat&bgImgOpacityDefault=75&borderColorDefault=%23d3d3d3&fcDefault=%23555555&iconColorDefault=%23888888&bgColorHover=%23dadada&bgTextureHover=flat&bgImgOpacityHover=75&borderColorHover=%23999999&fcHover=%23212121&iconColorHover=%23454545&bgColorActive=%23ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=%23aaaaaa&fcActive=%23212121&iconColorActive=%23454545&bgColorHighlight=%23fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=%2389b17e&fcHighlight=%23363636&iconColorHighlight=%232e83ff&bgColorError=%23fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=%23cd0a0a&fcError=%23cd0a0a&iconColorError=%23cd0a0a&bgColorOverlay=%23aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=%23aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
501
+ * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
502
+
503
+ /* Layout helpers
504
+ ----------------------------------*/
505
+ .ui-helper-hidden {
506
+ display: none;
507
+ }
508
+ .ui-helper-hidden-accessible {
509
+ border: 0;
510
+ clip: rect(0 0 0 0);
511
+ height: 1px;
512
+ margin: -1px;
513
+ overflow: hidden;
514
+ padding: 0;
515
+ position: absolute;
516
+ width: 1px;
517
+ }
518
+ .ui-helper-reset {
519
+ margin: 0;
520
+ padding: 0;
521
+ border: 0;
522
+ outline: 0;
523
+ line-height: 1.3;
524
+ text-decoration: none;
525
+ font-size: 100%;
526
+ list-style: none;
527
+ }
528
+ .ui-helper-clearfix:before,
529
+ .ui-helper-clearfix:after {
530
+ content: "";
531
+ display: table;
532
+ border-collapse: collapse;
533
+ }
534
+ .ui-helper-clearfix:after {
535
+ clear: both;
536
+ }
537
+ .ui-helper-clearfix {
538
+ min-height: 0; /* support: IE7 */
539
+ }
540
+ .ui-helper-zfix {
541
+ width: 100%;
542
+ height: 100%;
543
+ top: 0;
544
+ left: 0;
545
+ position: absolute;
546
+ opacity: 0;
547
+ filter:Alpha(Opacity=0); /* support: IE8 */
548
+ }
549
+
550
+ .ui-front {
551
+ z-index: 100;
552
+ }
553
+
554
+
555
+ /* Interaction Cues
556
+ ----------------------------------*/
557
+ .ui-state-disabled {
558
+ cursor: default !important;
559
+ }
560
+
561
+
562
+ /* Icons
563
+ ----------------------------------*/
564
+
565
+ /* states and images */
566
+ .ui-icon {
567
+ display: block;
568
+ text-indent: -99999px;
569
+ overflow: hidden;
570
+ background-repeat: no-repeat;
571
+ }
572
+
573
+
574
+ /* DATE PICKER
575
+ ----------------------------------*/
576
+
577
+ .ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}
578
+ .ui-datepicker{width:17em;padding:.2em .2em 0;display:none;z-index:100!important;}
579
+ .ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}
580
+ .ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}
581
+ .ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}
582
+ .ui-datepicker .ui-datepicker-prev{left:2px}
583
+ .ui-datepicker .ui-datepicker-next{right:2px}
584
+ .ui-datepicker .ui-datepicker-prev-hover{left:1px}
585
+ .ui-datepicker .ui-datepicker-next-hover{right:1px}
586
+ .ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}
587
+ .ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}
588
+ .ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}
589
+ .ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}
590
+ .ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}
591
+ .ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:700;border:0}
592
+ .ui-datepicker td{border:0;padding:1px}
593
+ .ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}
594
+ .ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}
595
+ .ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em;width:auto;overflow:visible}
596
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}
597
+ .ui-datepicker.ui-datepicker-multi{width:auto}
598
+ .ui-datepicker-multi .ui-datepicker-group{float:left}
599
+ .ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}
600
+ .ui-datepicker-multi-2 .ui-datepicker-group{width:50%}
601
+ .ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}
602
+ .ui-datepicker-multi-4 .ui-datepicker-group{width:25%}
603
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}
604
+ .ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}
605
+ .ui-datepicker-row-break{clear:both;width:100%;font-size:0}
606
+ .ui-datepicker-rtl{direction:rtl}
607
+ .ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}
608
+ .ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}
609
+ .ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}
610
+ .ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}
611
+ .ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}
612
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}
613
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}
614
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}
615
+ .ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}
616
+ .ui-widget .ui-widget{font-size:1em}
617
+ .ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}
618
+ .ui-widget-content{border:1px solid #aaa;background:#fff 50% 50% repeat-x;color:#222}
619
+ .ui-widget-content a{color:#222}
620
+ .ui-widget-header{border:1px solid #aaa;background:#ddd 50% 50% repeat-x;color:#222;font-weight:700}
621
+ .ui-widget-header a{color:#222}
622
+ .ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:0 solid #d3d3d3;background:#e9e9e9 50% 50% repeat-x;font-weight:400;color:#555}
623
+ .ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}
624
+ .ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:0 solid #999;background:#dadada 50% 50% repeat-x;font-weight:400;color:#212121}
625
+ .ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}
626
+ .ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:0 solid #aaa;background:#fff 50% 50% repeat-x;font-weight:400;color:#212121}
627
+ .ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}
628
+ .ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:0 solid #89b17e;background:#fbf9ee 50% 50% repeat-x;color:#363636}
629
+ .ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}
630
+ .ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:0 solid #cd0a0a;background:#fef1ec 50% 50% repeat-x;color:#cd0a0a}
631
+ .ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}
632
+ .ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}
633
+ .ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}
634
+ .ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}
635
+ .ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}
636
+ .ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}
637
+ .ui-icon{width:16px;height:16px}
638
+ .ui-icon,.ui-widget-content .ui-icon{background-image:url(../images/ui-icons_222222_256x240.png)}
639
+ .ui-widget-header .ui-icon{background-image:url(../images/ui-icons_222222_256x240.png)}
640
+ .ui-state-default .ui-icon{background-image:url(../images/ui-icons_888888_256x240.png)}
641
+ .ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui-icons_454545_256x240.png)}
642
+ .ui-state-active .ui-icon{background-image:url(../images/ui-icons_454545_256x240.png)}
643
+ .ui-state-highlight .ui-icon{background-image:url(../images/ui-icons_2e83ff_256x240.png)}
644
+ .ui-icon-circle-triangle-e{background-position:-48px -192px}
645
+ .ui-icon-circle-triangle-s{background-position:-64px -192px}
646
+ .ui-icon-circle-triangle-w{background-position:-80px -192px}
647
+ .ui-icon-circle-triangle-n{background-position:-96px -192px}
648
+ .ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:0}
649
+ .ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:0}
650
+ .ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:0}
651
+ .ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:0}
652
+ .ui-widget-overlay{background:#aaa 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}
653
+ .ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
654
+
655
+
656
+ .the-metabox.preview{
657
+ float: none;
658
+ }
659
+ .metaboxes-tab .the-metabox.no-label.preview{
660
+ margin-left: 184px;
661
+ }
662
+ .metaboxes-tab .the-metabox.no-label.preview img{
663
+ box-shadow: 0 1px 8px rgba(0,0,0,0.2);
664
  }
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_diagonals-thick_18_b81900_40x40.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_flat_10_000000_40x100.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_glass_100_f6f6f6_1x400.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_glass_100_fdf5ce_1x400.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_gloss-wave_35_f6a828_500x100.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_highlight-soft_100_eeeeee_1x100.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-bg_highlight-soft_75_ffe45c_1x100.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_222222_256x240.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_228ef1_256x240.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_ef8c08_256x240.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_ffd27a_256x240.png ADDED
Binary file
plugin-fw/assets/css/overcast/images/jquery_ui/ui-icons_ffffff_256x240.png ADDED
Binary file
plugin-fw/assets/css/overcast/jquery-ui-custom/jquery-ui-1.8.9.custom.css ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI CSS Framework 1.8.13
3
+ *
4
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Theming/API
9
+ */
10
+
11
+ /* Layout helpers
12
+ ----------------------------------*/
13
+ .ui-helper-hidden { display: none; }
14
+ .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
15
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
16
+ .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
17
+ .ui-helper-clearfix { display: inline-block; }
18
+ /* required comment for clearfix to work in Opera \*/
19
+ * html .ui-helper-clearfix { height:1%; }
20
+ .ui-helper-clearfix { display:block; }
21
+ /* end clearfix */
22
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
23
+
24
+
25
+ /* Interaction Cues
26
+ ----------------------------------*/
27
+ .ui-state-disabled { cursor: default !important; }
28
+
29
+
30
+ /* Icons
31
+ ----------------------------------*/
32
+
33
+ /* states and images */
34
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
35
+
36
+
37
+ /* Misc visuals
38
+ ----------------------------------*/
39
+
40
+ /* Overlays */
41
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
42
+
43
+
44
+ /*
45
+ * jQuery UI CSS Framework 1.8.13
46
+ *
47
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
48
+ * Dual licensed under the MIT or GPL Version 2 licenses.
49
+ * http://jquery.org/license
50
+ *
51
+ * http://docs.jquery.com/UI/Theming/API
52
+ *
53
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
54
+ */
55
+
56
+
57
+ /* Component containers
58
+ ----------------------------------*/
59
+ .ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
60
+ .ui-widget .ui-widget { font-size: 1em; }
61
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
62
+ .ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(../images/jquery_ui/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
63
+ .ui-widget-content a { color: #333333; }
64
+ .ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(../images/jquery_ui/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
65
+ .ui-widget-header a { color: #ffffff; }
66
+
67
+ /* Interaction states
68
+ ----------------------------------*/
69
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(../images/jquery_ui/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
70
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
71
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(../images/jquery_ui/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
72
+ .ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
73
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(../images/jquery_ui/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
74
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
75
+ .ui-widget :active { outline: none; }
76
+
77
+ /* Interaction Cues
78
+ ----------------------------------*/
79
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(../images/jquery_ui/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
80
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
81
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(../images/jquery_ui/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
82
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
83
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
84
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
85
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
86
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
87
+
88
+ /* Icons
89
+ ----------------------------------*/
90
+
91
+ /* states and images */
92
+ .ui-icon { width: 16px; height: 16px; background-image: url(../images/jquery_ui/ui-icons_222222_256x240.png); }
93
+ .ui-widget-content .ui-icon {background-image: url(../images/jquery_ui/ui-icons_222222_256x240.png); }
94
+ .ui-widget-header .ui-icon {background-image: url(../images/jquery_ui/ui-icons_ffffff_256x240.png); }
95
+ .ui-state-default .ui-icon { background-image: url(../images/jquery_ui/ui-icons_ef8c08_256x240.png); }
96
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(../images/jquery_ui/ui-icons_ef8c08_256x240.png); }
97
+ .ui-state-active .ui-icon {background-image: url(../images/jquery_ui/ui-icons_ef8c08_256x240.png); }
98
+ .ui-state-highlight .ui-icon {background-image: url(../images/jquery_ui/ui-icons_228ef1_256x240.png); }
99
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(../images/jquery_ui/ui-icons_ffd27a_256x240.png); }
100
+
101
+ /* positioning */
102
+ .ui-icon-carat-1-n { background-position: 0 0; }
103
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
104
+ .ui-icon-carat-1-e { background-position: -32px 0; }
105
+ .ui-icon-carat-1-se { background-position: -48px 0; }
106
+ .ui-icon-carat-1-s { background-position: -64px 0; }
107
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
108
+ .ui-icon-carat-1-w { background-position: -96px 0; }
109
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
110
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
111
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
112
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
113
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
114
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
115
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
116
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
117
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
118
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
119
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
120
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
121
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
122
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
123
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
124
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
125
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
126
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
127
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
128
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
129
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
130
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
131
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
132
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
133
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
134
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
135
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
136
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
137
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
138
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
139
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
140
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
141
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
142
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
143
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
144
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
145
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
146
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
147
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
148
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
149
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
150
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
151
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
152
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
153
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
154
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
155
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
156
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
157
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
158
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
159
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
160
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
161
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
162
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
163
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
164
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
165
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
166
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
167
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
168
+ .ui-icon-extlink { background-position: -32px -80px; }
169
+ .ui-icon-newwin { background-position: -48px -80px; }
170
+ .ui-icon-refresh { background-position: -64px -80px; }
171
+ .ui-icon-shuffle { background-position: -80px -80px; }
172
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
173
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
174
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
175
+ .ui-icon-folder-open { background-position: -16px -96px; }
176
+ .ui-icon-document { background-position: -32px -96px; }
177
+ .ui-icon-document-b { background-position: -48px -96px; }
178
+ .ui-icon-note { background-position: -64px -96px; }
179
+ .ui-icon-mail-closed { background-position: -80px -96px; }
180
+ .ui-icon-mail-open { background-position: -96px -96px; }
181
+ .ui-icon-suitcase { background-position: -112px -96px; }
182
+ .ui-icon-comment { background-position: -128px -96px; }
183
+ .ui-icon-person { background-position: -144px -96px; }
184
+ .ui-icon-print { background-position: -160px -96px; }
185
+ .ui-icon-trash { background-position: -176px -96px; }
186
+ .ui-icon-locked { background-position: -192px -96px; }
187
+ .ui-icon-unlocked { background-position: -208px -96px; }
188
+ .ui-icon-bookmark { background-position: -224px -96px; }
189
+ .ui-icon-tag { background-position: -240px -96px; }
190
+ .ui-icon-home { background-position: 0 -112px; }
191
+ .ui-icon-flag { background-position: -16px -112px; }
192
+ .ui-icon-calendar { background-position: -32px -112px; }
193
+ .ui-icon-cart { background-position: -48px -112px; }
194
+ .ui-icon-pencil { background-position: -64px -112px; }
195
+ .ui-icon-clock { background-position: -80px -112px; }
196
+ .ui-icon-disk { background-position: -96px -112px; }
197
+ .ui-icon-calculator { background-position: -112px -112px; }
198
+ .ui-icon-zoomin { background-position: -128px -112px; }
199
+ .ui-icon-zoomout { background-position: -144px -112px; }
200
+ .ui-icon-search { background-position: -160px -112px; }
201
+ .ui-icon-wrench { background-position: -176px -112px; }
202
+ .ui-icon-gear { background-position: -192px -112px; }
203
+ .ui-icon-heart { background-position: -208px -112px; }
204
+ .ui-icon-star { background-position: -224px -112px; }
205
+ .ui-icon-link { background-position: -240px -112px; }
206
+ .ui-icon-cancel { background-position: 0 -128px; }
207
+ .ui-icon-plus { background-position: -16px -128px; }
208
+ .ui-icon-plusthick { background-position: -32px -128px; }
209
+ .ui-icon-minus { background-position: -48px -128px; }
210
+ .ui-icon-minusthick { background-position: -64px -128px; }
211
+ .ui-icon-close { background-position: -80px -128px; }
212
+ .ui-icon-closethick { background-position: -96px -128px; }
213
+ .ui-icon-key { background-position: -112px -128px; }
214
+ .ui-icon-lightbulb { background-position: -128px -128px; }
215
+ .ui-icon-scissors { background-position: -144px -128px; }
216
+ .ui-icon-clipboard { background-position: -160px -128px; }
217
+ .ui-icon-copy { background-position: -176px -128px; }
218
+ .ui-icon-contact { background-position: -192px -128px; }
219
+ .ui-icon-image { background-position: -208px -128px; }
220
+ .ui-icon-video { background-position: -224px -128px; }
221
+ .ui-icon-script { background-position: -240px -128px; }
222
+ .ui-icon-alert { background-position: 0 -144px; }
223
+ .ui-icon-info { background-position: -16px -144px; }
224
+ .ui-icon-notice { background-position: -32px -144px; }
225
+ .ui-icon-help { background-position: -48px -144px; }
226
+ .ui-icon-check { background-position: -64px -144px; }
227
+ .ui-icon-bullet { background-position: -80px -144px; }
228
+ .ui-icon-radio-off { background-position: -96px -144px; }
229
+ .ui-icon-radio-on { background-position: -112px -144px; }
230
+ .ui-icon-pin-w { background-position: -128px -144px; }
231
+ .ui-icon-pin-s { background-position: -144px -144px; }
232
+ .ui-icon-play { background-position: 0 -160px; }
233
+ .ui-icon-pause { background-position: -16px -160px; }
234
+ .ui-icon-seek-next { background-position: -32px -160px; }
235
+ .ui-icon-seek-prev { background-position: -48px -160px; }
236
+ .ui-icon-seek-end { background-position: -64px -160px; }
237
+ .ui-icon-seek-start { background-position: -80px -160px; }
238
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
239
+ .ui-icon-seek-first { background-position: -80px -160px; }
240
+ .ui-icon-stop { background-position: -96px -160px; }
241
+ .ui-icon-eject { background-position: -112px -160px; }
242
+ .ui-icon-volume-off { background-position: -128px -160px; }
243
+ .ui-icon-volume-on { background-position: -144px -160px; }
244
+ .ui-icon-power { background-position: 0 -176px; }
245
+ .ui-icon-signal-diag { background-position: -16px -176px; }
246
+ .ui-icon-signal { background-position: -32px -176px; }
247
+ .ui-icon-battery-0 { background-position: -48px -176px; }
248
+ .ui-icon-battery-1 { background-position: -64px -176px; }
249
+ .ui-icon-battery-2 { background-position: -80px -176px; }
250
+ .ui-icon-battery-3 { background-position: -96px -176px; }
251
+ .ui-icon-circle-plus { background-position: 0 -192px; }
252
+ .ui-icon-circle-minus { background-position: -16px -192px; }
253
+ .ui-icon-circle-close { background-position: -32px -192px; }
254
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
255
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
256
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
257
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
258
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
259
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
260
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
261
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
262
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
263
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
264
+ .ui-icon-circle-check { background-position: -208px -192px; }
265
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
266
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
267
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
268
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
269
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
270
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
271
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
272
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
273
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
274
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
275
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
276
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
277
+
278
+
279
+ /* Misc visuals
280
+ ----------------------------------*/
281
+
282
+ /* Corner radius */
283
+ .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
284
+ .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
285
+ .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
286
+ .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
287
+ .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
288
+ .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
289
+ .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
290
+ .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
291
+ .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
292
+
293
+ /* Overlays */
294
+ .ui-widget-overlay { background: #666666 url(../images/jquery_ui/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
295
+ .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(../images/jquery_ui/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
296
+ * jQuery UI Resizable 1.8.13
297
+ *
298
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
299
+ * Dual licensed under the MIT or GPL Version 2 licenses.
300
+ * http://jquery.org/license
301
+ *
302
+ * http://docs.jquery.com/UI/Resizable#theming
303
+ */
304
+ .ui-resizable { position: relative;}
305
+ .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;
306
+ /* http://bugs.jqueryui.com/ticket/7233
307
+ - Resizable: resizable handles fail to work in IE if transparent and content overlaps
308
+ */
309
+ background-image:url(data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=);
310
+ }
311
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
312
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
313
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
314
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
315
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
316
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
317
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
318
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
319
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
320
+ * jQuery UI Selectable 1.8.13
321
+ *
322
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
323
+ * Dual licensed under the MIT or GPL Version 2 licenses.
324
+ * http://jquery.org/license
325
+ *
326
+ * http://docs.jquery.com/UI/Selectable#theming
327
+ */
328
+ .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
329
+ /*
330
+ * jQuery UI Accordion 1.8.13
331
+ *
332
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
333
+ * Dual licensed under the MIT or GPL Version 2 licenses.
334
+ * http://jquery.org/license
335
+ *
336
+ * http://docs.jquery.com/UI/Accordion#theming
337
+ */
338
+ /* IE/Win - Fix animation bug - #4615 */
339
+ .ui-accordion { width: 100%; }
340
+ .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
341
+ .ui-accordion .ui-accordion-li-fix { display: inline; }
342
+ .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
343
+ .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
344
+ .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
345
+ .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
346
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
347
+ .ui-accordion .ui-accordion-content-active { display: block; }
348
+ /*
349
+ * jQuery UI Autocomplete 1.8.13
350
+ *
351
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
352
+ * Dual licensed under the MIT or GPL Version 2 licenses.
353
+ * http://jquery.org/license
354
+ *
355
+ * http://docs.jquery.com/UI/Autocomplete#theming
356
+ */
357
+ .ui-autocomplete { position: absolute; cursor: default; }
358
+
359
+ /* workarounds */
360
+ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
361
+
362
+ /*
363
+ * jQuery UI Menu 1.8.13
364
+ *
365
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
366
+ * Dual licensed under the MIT or GPL Version 2 licenses.
367
+ * http://jquery.org/license
368
+ *
369
+ * http://docs.jquery.com/UI/Menu#theming
370
+ */
371
+ .ui-menu {
372
+ list-style:none;
373
+ padding: 2px;
374
+ margin: 0;
375
+ display:block;
376
+ float: left;
377
+ }
378
+ .ui-menu .ui-menu {
379
+ margin-top: -3px;
380
+ }
381
+ .ui-menu .ui-menu-item {
382
+ margin:0;
383
+ padding: 0;
384
+ zoom: 1;
385
+ float: left;
386
+ clear: left;
387
+ width: 100%;
388
+ }
389
+ .ui-menu .ui-menu-item a {
390
+ text-decoration:none;
391
+ display:block;
392
+ padding:.2em .4em;
393
+ line-height:1.5;
394
+ zoom:1;
395
+ }
396
+ .ui-menu .ui-menu-item a.ui-state-hover,
397
+ .ui-menu .ui-menu-item a.ui-state-active {
398
+ font-weight: normal;
399
+ margin: -1px;
400
+ }
401
+ /*
402
+ * jQuery UI Button 1.8.13
403
+ *
404
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
405
+ * Dual licensed under the MIT or GPL Version 2 licenses.
406
+ * http://jquery.org/license
407
+ *
408
+ * http://docs.jquery.com/UI/Button#theming
409
+ */
410
+ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
411
+ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
412
+ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
413
+ .ui-button-icons-only { width: 3.4em; }
414
+ button.ui-button-icons-only { width: 3.7em; }
415
+
416
+ /*button text element */
417
+ .ui-button .ui-button-text { display: block; line-height: 1.4; }
418
+ .ui-button-text-only .ui-button-text { padding: .4em 1em; }
419
+ .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
420
+ .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
421
+ .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
422
+ .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
423
+ /* no icon support for input elements, provide padding by default */
424
+ input.ui-button { padding: .4em 1em; }
425
+
426
+ /*button icon element(s) */
427
+ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
428
+ .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
429
+ .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
430
+ .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
431
+ .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
432
+
433
+ /*button sets*/
434
+ .ui-buttonset { margin-right: 7px; }
435
+ .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
436
+
437
+ /* workarounds */
438
+ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
439
+ /*
440
+ * jQuery UI Dialog 1.8.13
441
+ *
442
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
443
+ * Dual licensed under the MIT or GPL Version 2 licenses.
444
+ * http://jquery.org/license
445
+ *
446
+ * http://docs.jquery.com/UI/Dialog#theming
447
+ */
448
+ .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
449
+ .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
450
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
451
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
452
+ .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
453
+ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
454
+ .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
455
+ .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
456
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
457
+ .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
458
+ .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
459
+ .ui-draggable .ui-dialog-titlebar { cursor: move; }
460
+ /*
461
+ * jQuery UI Slider 1.8.13
462
+ *
463
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
464
+ * Dual licensed under the MIT or GPL Version 2 licenses.
465
+ * http://jquery.org/license
466
+ *
467
+ * http://docs.jquery.com/UI/Slider#theming
468
+ */
469
+ .ui-slider { position: relative; text-align: left; }
470
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
471
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
472
+
473
+ .ui-slider-horizontal { height: .8em; }
474
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
475
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
476
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
477
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
478
+
479
+ .ui-slider-vertical { width: .8em; height: 100px; }
480
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
481
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
482
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
483
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
484
+ * jQuery UI Tabs 1.8.13
485
+ *
486
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
487
+ * Dual licensed under the MIT or GPL Version 2 licenses.
488
+ * http://jquery.org/license
489
+ *
490
+ * http://docs.jquery.com/UI/Tabs#theming
491
+ */
492
+ .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
493
+ .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
494
+ .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
495
+ .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
496
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
497
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
498
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
499
+ .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
500
+ .ui-tabs .ui-tabs-hide { display: none !important; }
501
+ /*
502
+ * jQuery UI Datepicker 1.8.13
503
+ *
504
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
505
+ * Dual licensed under the MIT or GPL Version 2 licenses.
506
+ * http://jquery.org/license
507
+ *
508
+ * http://docs.jquery.com/UI/Datepicker#theming
509
+ */
510
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
511
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
512
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
513
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
514
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
515
+ .ui-datepicker .ui-datepicker-next { right:2px; }
516
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
517
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
518
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
519
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
520
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
521
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
522
+ .ui-datepicker select.ui-datepicker-month,
523
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
524
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
525
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
526
+ .ui-datepicker td { border: 0; padding: 1px; }
527
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
528
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
529
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
530
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
531
+
532
+ /* with multiple calendars */
533
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
534
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
535
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
536
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
537
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
538
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
539
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
540
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
541
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
542
+ .ui-datepicker-row-break { clear:both; width:100%; }
543
+
544
+ /* RTL support */
545
+ .ui-datepicker-rtl { direction: rtl; }
546
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
547
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
548
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
549
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
550
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
551
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
552
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
553
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
554
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
555
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
556
+
557
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
558
+ .ui-datepicker-cover {
559
+ display: none; /*sorry for IE5*/
560
+ display/**/: block; /*sorry for IE5*/
561
+ position: absolute; /*must have*/
562
+ z-index: -1; /*must have*/
563
+ filter: mask(); /*must have*/
564
+ top: -4px; /*must have*/
565
+ left: -4px; /*must have*/
566
+ width: 200px; /*must have*/
567
+ height: 200px; /*must have*/
568
+ }/*
569
+ * jQuery UI Progressbar 1.8.13
570
+ *
571
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
572
+ * Dual licensed under the MIT or GPL Version 2 licenses.
573
+ * http://jquery.org/license
574
+ *
575
+ * http://docs.jquery.com/UI/Progressbar#theming
576
+ */
577
+ .ui-progressbar { height:2em; text-align: left; }
578
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
plugin-fw/assets/css/yit-plugin-panel-sidebar.css ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file belongs to the YIT Plugin Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+
10
+ /* === Panel Sidebar === */
11
+ #yit-panel-sidebar {
12
+ width : 275px;
13
+ float : right;
14
+ margin : 10px 0 0 10px;
15
+ }
16
+
17
+ #yit-panel-sidebar.yith-panel-sidebar-hidden {
18
+ position : absolute;
19
+ top : 0;
20
+ right : 0;
21
+ }
22
+
23
+ #yit-panel-sidebar.yith-panel-sidebar-hidden #yit-panel-sidebar-widgets-container{
24
+ display: none;
25
+ }
26
+
27
+ .yit-panel-sidebar-widget-wrapper {
28
+ position : relative;
29
+ margin : 10px 0 30px 0;
30
+ }
31
+
32
+ .yit-panel-sidebar-widget-container {
33
+ border-radius : 5px;
34
+ border : 1px solid #ddd;
35
+ background : #fff;
36
+ box-shadow : 0 2px 1px -1px #ccc;
37
+ overflow : hidden;
38
+ }
39
+
40
+ .yit-panel-sidebar-widget-container a {
41
+ text-decoration : none;
42
+ }
43
+
44
+ .yit-panel-sidebar-widget-container img.yit-panel-sidebar-widget-image {
45
+ width : 100%;
46
+ position : relative;
47
+ bottom : -5px;
48
+ }
49
+
50
+ .yit-panel-sidebar-widget-title {
51
+ padding : 12px 10px;
52
+ background : #f4f4f4;
53
+ font-size : 10px;
54
+ text-transform : uppercase;
55
+ font-weight : 700;
56
+ }
57
+
58
+ .yit-panel-sidebar-widget-title.dashicons {
59
+ width : auto !important;
60
+ height : auto !important;
61
+ display : block;
62
+ font-family : "Open Sans", sans-serif;
63
+ text-align : left;
64
+ }
65
+
66
+ .yit-panel-sidebar-widget-title.dashicons::before {
67
+ font-family : "Dashicons";
68
+ font-size : 18px;
69
+ display : inline-block;
70
+ vertical-align : middle;
71
+ margin-right : 10px;
72
+ font-weight : normal;
73
+ }
74
+
75
+ .yit-panel-sidebar-widget-title.orange {
76
+ background : #ff643e;
77
+ color : #fff;
78
+ }
79
+
80
+ .yit-panel-sidebar-widget-title.green {
81
+ background : #a3c401;
82
+ color : #fff;
83
+ }
84
+
85
+ .yit-panel-sidebar-widget-title.red {
86
+ background : #e4313c;
87
+ color : #fff;
88
+ }
89
+
90
+ .yit-panel-sidebar-widget-title.yellow {
91
+ background : #ffc400;
92
+ color : #333;
93
+ }
94
+
95
+ .yit-panel-sidebar-widget-title.center {
96
+ text-align : center;
97
+ }
98
+
99
+ .yit-panel-sidebar-widget-title.right {
100
+ text-align : right;
101
+ }
102
+
103
+ .yit-panel-sidebar-widget-content {
104
+ padding : 15px;
105
+ }
106
+
107
+ .yit-panel-sidebar-widget-content p {
108
+ font-size : 11px;
109
+ line-height : 18px;
110
+ margin : 0;
111
+ text-align : justify;
112
+ }
113
+
114
+ .yit-panel-sidebar-widget-badge.gift-tape {
115
+ color : #000;
116
+ font-family : "Open Sans", sans-serif;
117
+ box-sizing : border-box;
118
+ position : absolute;
119
+ background-color : transparent;
120
+ width : 70px;
121
+ height : 70px;
122
+ overflow : hidden;
123
+ top : 0;
124
+ right : 0;
125
+ }
126
+
127
+ .yit-panel-sidebar-widget-badge.gift-tape div.yit-panel-sidebar-widget-badge-text {
128
+ background : #ffd600;
129
+ background : -webkit-linear-gradient(left, #fe8502, #ffe400); /* For Safari 5.1 to 6.0 */
130
+ background : -o-linear-gradient(right, #fe8502, #ffe400); /* For Opera 11.1 to 12.0 */
131
+ background : -moz-linear-gradient(right, #fe8502, #ffe400); /* For Firefox 3.6 to 15 */
132
+ background : linear-gradient(to right, #fe8502, #ffe400); /* Standard syntax */
133
+ font-size : 10px;
134
+ font-weight : bold;
135
+ line-height : 24px;
136
+ position : absolute;
137
+ text-align : center;
138
+ z-index : 100;
139
+ -webkit-transform : rotate(45deg);
140
+ -ms-transform : rotate(45deg);
141
+ transform : rotate(45deg);
142
+ top : 15px;
143
+ left : -6px;
144
+ width : 100px;
145
+ text-shadow : 1px 1px 1px #fff;
146
+ }
147
+
148
+ img.yit-panel-sidebar-widget-despacho-image {
149
+ background : #ffffff;
150
+ background : -webkit-linear-gradient(#ffffff, #a5b7c5); /* For Safari 5.1 to 6.0 */
151
+ background : -o-linear-gradient(#ffffff, #a5b7c5); /* For Opera 11.1 to 12.0 */
152
+ background : -moz-linear-gradient(#ffffff, #a5b7c5); /* For Firefox 3.6 to 15 */
153
+ background : linear-gradient(#ffffff, #a5b7c5); /* Standard syntax */
154
+ }
155
+
156
+ /* ==== Buttons ==== */
157
+ #yit-panel-sidebar .button {
158
+ color : #ffffff;
159
+ border : none;
160
+ background : #666666;
161
+ -webkit-box-shadow : none;
162
+ box-shadow : none;
163
+ vertical-align : middle;
164
+ text-transform : uppercase;
165
+ font-size : 11px;
166
+ font-weight : 700;
167
+ height : 32px;
168
+ line-height : 32px;
169
+ padding : 0 18px 1px;
170
+ }
171
+
172
+ #yit-panel-sidebar .button.orange {
173
+ background : #ff6340;
174
+ }
175
+
176
+ #yit-panel-sidebar .button.green {
177
+ background : #a3c401;
178
+ }
179
+
180
+ #yit-panel-sidebar .button.red {
181
+ background : #e4313c;
182
+ }
183
+
184
+ #yit-panel-sidebar .button.yellow {
185
+ background : #ffc400;
186
+ }
187
+
188
+ /* === Title Icons === */
189
+ #yit-panel-sidebar .yit-panel-sidebar-widget-icon:before {
190
+ content : " ";
191
+ width : 16px;
192
+ height : 16px;
193
+ display : inline-block;
194
+ vertical-align : middle;
195
+ margin-right : 10px;
196
+ }
197
+
198
+ #yit-panel-sidebar .yit-panel-sidebar-widget-icon.link-icon:before {
199
+ background : transparent url('../images/widgets/link-icon.png') no-repeat;
200
+ background-size : contain;
201
+ }
202
+
203
+ #yit-panel-sidebar .yit-panel-sidebar-widget-icon.info-icon:before {
204
+ background : transparent url('../images/widgets/info-icon.png') no-repeat;
205
+ background-size : contain;
206
+ }
207
+
208
+ #yit-panel-sidebar .yit-panel-sidebar-widget-icon.box-icon:before {
209
+ background : transparent url('../images/widgets/box-icon.png') no-repeat;
210
+ background-size : contain;
211
+ }
212
+
213
+ #yit-panel-sidebar .yit-panel-sidebar-widget-icon.box-white-icon:before {
214
+ background : transparent url('../images/widgets/box-white-icon.png') no-repeat;
215
+ background-size : contain;
216
+ }
217
+
218
+ /* ==== Membership Widget ==== */
219
+ #yit-panel-sidebar-membership-widget {
220
+
221
+ }
222
+
223
+ #yit-panel-sidebar-membership-widget .yit-panel-sidebar-widget-title {
224
+ text-align : center;
225
+ }
226
+
227
+ #yit-panel-sidebar-membership-widget .yit-panel-sidebar-widget-content {
228
+ background : transparent url('../images/widgets/membership-bg.png') no-repeat;
229
+ background-position : 100% 180%;
230
+ background-size : 50%;
231
+ }
232
+
233
+ #yit-panel-sidebar-membership-widget .membership-total-price {
234
+ font-size : 25px;
235
+ font-weight : 700;
236
+ display : inline-block;
237
+
238
+ }
239
+
240
+ #yit-panel-sidebar-membership-widget .membership-offer-text {
241
+ display : inline-block;
242
+ font-size : 10px;
243
+ text-transform : uppercase;
244
+ width : 130px;
245
+ line-height : 14px;
246
+ }
247
+
248
+ #yit-panel-sidebar-membership-widget .membership-offer-text2 {
249
+ display : inline-block;
250
+ font-size : 10px;
251
+ text-transform : uppercase;
252
+ width : 36%;
253
+ text-align : right;
254
+ vertical-align : middle;
255
+ margin : 17px 0;
256
+ }
257
+
258
+ #yit-panel-sidebar-membership-widget .membership-offer-sale-text {
259
+ display : inline-block;
260
+ font-size : 24px;
261
+ color : #ff6340;
262
+ text-transform : uppercase;
263
+ width : 55%;
264
+ text-align : left;
265
+ vertical-align : middle;
266
+ margin : 17px 0;
267
+ font-weight : 700;
268
+ }
269
+
270
+ #yit-panel-sidebar-membership-widget .membership-buttons {
271
+ text-align : center;
272
+ margin-bottom : 10px;
273
+ }
274
+
275
+ /* ==== Important Links Widget ==== */
276
+ #yit-panel-sidebar-links-widget .yit-panel-sidebar-widget-content {
277
+ background : transparent url('../images/widgets/link-bg.png') no-repeat;
278
+ background-position : 110% 120%;
279
+ background-size : 50%;
280
+ }
281
+
282
+ ul.yit-panel-sidebar-links-list {
283
+ margin : 0;
284
+ }
285
+
286
+ ul.yit-panel-sidebar-links-list li {
287
+ margin : 0 0 10px 0;
288
+ }
289
+
290
+ ul.yit-panel-sidebar-links-list li:before {
291
+ content : " ";
292
+ width : 15px;
293
+ height : 13px;
294
+ display : inline-block;
295
+ background : transparent url('../images/ui-icons_454545_256x240.png') no-repeat -64px -144px;
296
+ margin-right : 7px;
297
+ }
298
+
299
+ /* === Sidebar Actions ===*/
300
+ #yit-panel-sidebar-actions {
301
+ text-align : right;
302
+ }
303
+
304
+ .yit-panel-sidebar-action-title {
305
+ margin-right : 5px;
306
+ text-transform : uppercase;
307
+ font-size : 11px;
308
+ }
309
+
310
+ #yit-panel-sidebar-action-hide {
311
+ text-align : right;
312
+ cursor : pointer;
313
+ }
314
+
315
+ .yit-panel-sidebar-action-hide-icon {
316
+ color : #f4f4f4;
317
+ background : #565656;
318
+ border-radius : 50%;
319
+ }
320
+
321
+ #yit-panel-sidebar-action-hide:hover .yit-panel-sidebar-action-title{
322
+ color: #000;
323
+ }
324
+
325
+ #yit-panel-sidebar-action-hide:hover .yit-panel-sidebar-action-hide-icon{
326
+ background: #000;
327
+ }
328
+
329
+ .hide-on-click .yit-panel-sidebar-action-hide-icon:before {
330
+ content : "\f139" !important;
331
+ }
332
+
333
+ /* === Responsive === */
334
+
335
+ @media (min-width : 767px) {
336
+ #wpbody-content #yit-panel-sidebar {
337
+ margin-right : 15px;
338
+ }
339
+ }
340
+
341
+ @media (max-width : 767px) {
342
+ #yit-panel-sidebar {
343
+ width : 275px;
344
+ margin : 20px auto 0 auto;
345
+ float : none;
346
+ display : block;
347
+ }
348
+
349
+ #yit-panel-sidebar.yith-panel-sidebar-hidden {
350
+ position : static;
351
+ }
352
+
353
+ #yit-panel-sidebar-actions {
354
+ text-align : center;
355
+ }
356
+
357
+ #yit-panel-sidebar-action-hide {
358
+ text-align : center;
359
+ }
360
+ }
361
+
362
+ @media (max-width : 480px) {
363
+
364
+ }
365
+
366
+ @media (min-width : 768px) and (max-width : 992px) {
367
+ }
368
+
369
+ @media (min-width : 980px) and (max-width : 1199px) {
370
+ }
371
+
372
+ @media (min-width : 1200px) {
373
+
374
+ }
375
+
376
+ @media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (-o-min-device-pixel-ratio : 3/2), only screen and (min--moz-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) {
377
+ }
plugin-fw/assets/css/yit-plugin-panel.css CHANGED
@@ -1,664 +1,713 @@
1
- /*
2
- * This file belongs to the YIT Plugin Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
-
10
- /* onoff */
11
- .rm_onoff input {
12
- display: none;
13
- }
14
-
15
- .rm_onoff input + span {
16
- cursor: pointer;
17
- text-indent: -9999px;
18
- display: block;
19
- width: 85px;
20
- height: 37px;
21
- background: transparent url(../images/off.png);
22
- }
23
-
24
- .rm_onoff input:checked + span {
25
- background: transparent url(../images/on.png);
26
- }
27
-
28
- .rm_onoff input.onoffchecked + span {
29
- background: transparent url(../images/on.png);
30
- }
31
-
32
- /* slider */
33
- /*numbers*/
34
- .ui-slider .maxCaption, .ui-slider .minCaption {
35
- margin-bottom: 5px;
36
- }
37
- .ui-slider .feedback {
38
- background: url(../images/slider/tooltip.png) no-repeat center top;
39
- position: absolute;
40
- top: -25px;
41
- width: 35px;
42
- height: 43px;
43
- text-align: center;
44
- width: 100%;
45
- display: block;
46
- }
47
- .ui-slider .feedback strong {
48
- display: inline-block;
49
- padding-top: 4px;
50
- top: -30px;
51
- }
52
- /*handle*/
53
- .yit-options .ui-slider-horizontal .ui-slider-handle,
54
- .yit_options .ui-slider-horizontal .ui-slider-handle {
55
- background: transparent url(../images/slider/handle.png) no-repeat left top !important;
56
- border: 0px !important;
57
- top: -.35em !important;
58
- width: 18px !important;
59
- height: 19px !important;
60
- }
61
-
62
- /*bg on the left:grey*/
63
- .yit-options .ui-slider.ui-widget-content,
64
- .yit_options .ui-slider.ui-widget-content {
65
- background: url(../images/slider/grey.gif) repeat-x left center !important;
66
- border-color: #c1c1c0 !important;
67
- height: 10px !important;
68
- }
69
-
70
- .iris-slider-offset.ui-slider.ui-widget-content {
71
- background: transparent!important;
72
- height: auto!important;
73
- }
74
-
75
- /*bg on the right:orange*/
76
- .ui-slider.ui-widget-content .ui-widget-header {
77
- background: url(../images/slider/orange.gif) repeat-x left center !important;
78
- left: 2px !important;
79
- -webkit-border-radius: 15px;
80
- -moz-border-radius: 15px;
81
- -khtml-border-radius: 15px;
82
- border-radius: 15px;
83
- }
84
-
85
- .plugin-option tr{
86
- border-bottom: 1px solid #ccc;
87
- }
88
- .plugin-option .yit_options,
89
- .plugin-option .yit-options{
90
- border-bottom: 0px;
91
- }
92
- .plugin-option .yit-options .option,
93
- .plugin-option .yit_options .option {
94
- width: 600px;
95
- float: left;
96
- }
97
-
98
- .plugin-option .form-table td{
99
- padding: 25px 10px;
100
- }
101
-
102
- .yit_options .select_wrapper,
103
- .yit-options .select_wrapper {
104
- background: url("../images/select.png") no-repeat scroll right center #FAFAFA;
105
- border-color: #CCCCCC #EEEEEE #EEEEEE #CCCCCC;
106
- border-radius: 4px 4px 4px 4px;
107
- border-style: solid;
108
- border-width: 1px;
109
- color: #555555;
110
- display: block;
111
- float: left;
112
- font-family: sans-serif;
113
- font-size: 12px;
114
- height: 26px;
115
- margin-bottom: 9px !important;
116
- margin-left: 0;
117
- margin-right: 5px;
118
- margin-top: 0;
119
- width: 400px;
120
- }
121
- .chosen .select_wrapper {
122
- background: none;
123
- border: none;
124
- }
125
- .chosen .select_wrapper .chosen-container{
126
- width: 338px!important;
127
- }
128
- .chosen .select_wrapper .chosen-container .search-field input{
129
- height: 27px!important;
130
- color: #333;
131
- }
132
- .chosen .select_wrapper .chosen-container .chosen-choices{
133
- border: 1px solid #ddd;
134
- box-shadow: none;
135
- }
136
- .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice{
137
- height: 15px!important;
138
- min-width: 105px;
139
- }
140
- .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice span{
141
- line-height: 15px;
142
- height: 15px;
143
- padding-top: 2px;
144
- }
145
- .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice a.search-choice-close{
146
- top: 5px;
147
- }
148
- .chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
149
- width: 100%!important;
150
- }
151
-
152
- /* === Multiple Chosen Customizzation === */
153
-
154
- .yith-choosen .chosen-choices {
155
- line-height: 27px;
156
- min-height: 27px;
157
- border: 1px solid #ddd;
158
- }
159
-
160
- .yith-choosen .chosen-container-active .chosen-choices{
161
- border: 1px solid #5b9dd9;
162
- -webkit-box-shadow: 0 0 2px rgba(30,140,190,.8);
163
- box-shadow: 0 0 2px rgba(30,140,190,.8);
164
- }
165
-
166
- .select_wrapper span {
167
- height: 26px;
168
- line-height: 26px;
169
- padding-left: 6px;
170
- position: absolute;
171
- z-index: 2;
172
- overflow: hidden;
173
- }
174
- .ie8 .yit_options select,
175
- .ie8 .yit-options select {
176
- height: 26px;
177
- }
178
- .yit_options select, .yit-options select, .the-metabox .select_wrapper select {
179
- cursor: pointer;
180
- height: 28px;
181
- margin: 0;
182
- opacity: 0;
183
- padding: 0;
184
- position: relative;
185
- width: inherit;
186
- z-index: 4;
187
- background-color: #FAFAFA;
188
- }
189
-
190
- /* === Single Chosen Customizzation === */
191
-
192
- .yith-choosen .chosen-container-single .chosen-default {
193
- background: transparent;
194
- border-color: #ddd;
195
- }
196
-
197
- .yith-choosen .chosen-search > input[type=text]{
198
- width: 100% !important;
199
- }
200
-
201
- .yith-choosen .chosen-container-single .chosen-single {
202
- background: transparent;
203
- border-color: #ddd;
204
- }
205
-
206
-
207
- /* Style to woocommerce panel*/
208
-
209
- #plugin-fw-wc{
210
- padding-top: 20px;
211
- }
212
- #plugin-fw-wc table.form-table{
213
- background-color: #fff;
214
- margin-bottom: 20px;
215
- }
216
- #plugin-fw-wc table.form-table th {
217
- padding: 20px;
218
- }
219
- #plugin-fw-wc h3{
220
- padding:0px 10px 10px ;
221
- border-bottom: 1px solid #eee;
222
- }
223
-
224
- /* === VIDEO BOX === */
225
-
226
- .yith-videobox-wrapper {
227
- padding-top: 20px;
228
- }
229
- .yith-videobox-wrapper h3{
230
- padding:0px 10px 10px ;
231
- border-bottom: 1px solid #eee;
232
- }
233
-
234
- .yith-videobox-wrapper .postbox {
235
- display: inline-block;
236
- }
237
- .yith-videobox-wrapper .yith_videobox .column {
238
- width: 45%;
239
- float: left;
240
- padding-right: 2.5%;
241
- border-right: 1px solid #ebebeb;
242
- padding-bottom: 2em;
243
- }
244
- .yith-videobox-wrapper .yith_videobox .column.two {
245
- margin-right: 0;
246
- padding-right: 0;
247
- padding-left: 2.5%;
248
- border: 0;
249
- max-width: 49%;
250
- }
251
- .yith-videobox-wrapper .yith_videobox h2{
252
- font-size: 16px;
253
- margin-bottom: 20px;
254
- }
255
- .yith-videobox-wrapper .yith-video-link {
256
- width: 100%;
257
- max-width: 200px;
258
- float: left;
259
- margin: 0 1.5em 1.5em 0;
260
- }
261
- .yith-videobox-wrapper .yith-video-link {
262
- width: 100%;
263
- max-width: 200px;
264
- float: left;
265
- margin: 0 1.5em 1.5em 0;
266
- }
267
- .yith-videobox-wrapper .yith-image-frame img {
268
- max-width: 100%;
269
- height: auto;
270
- }
271
- .yith-videobox-wrapper .yith-video-link img {
272
- max-width: 100%;
273
- height: auto;
274
- }
275
- .yith-videobox-wrapper .yith-video-iframe {
276
- display: none;
277
-
278
- }
279
-
280
- /* === Plugins Upgrader === */
281
-
282
- .yit-plugin-changelog-wrapper {
283
- display: none;
284
- }
285
-
286
- .yit-plugin-changelog-title {
287
- text-transform: uppercase;
288
- }
289
-
290
- .yit-plugin-changelog {
291
- background: #fcfcfc;
292
- height: 97%;
293
- z-index: 999;
294
- overflow: auto;
295
- }
296
-
297
- /* === Plugins Licence Activation === */
298
-
299
- .yit-container.plugin-licence-activation {
300
- font-family: 'Raleway', sans-serif;
301
- }
302
-
303
- .yit-container.plugin-licence-activation .to-active-wrapper {
304
- margin-bottom: 60px;
305
- }
306
-
307
- .yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form {
308
- position: relative;
309
- border-color: #e1e1e1;
310
- border-style: solid;
311
- border-width: 0;
312
- }
313
-
314
- .yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:first-child {
315
- border-top-width: 1px;
316
- }
317
-
318
- .yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:last-child {
319
- border-bottom-width: 1px;
320
- }
321
-
322
- .yit-container.plugin-licence-activation .to-active-wrapper table.to-active-table {
323
- border-width: 0;
324
- border-spacing: 0;
325
- width: 100%;
326
- }
327
-
328
- .yit-container.plugin-licence-activation .message {
329
- display: none;
330
- line-height: normal;
331
- background: #ffffff url(../images/licence-error.png) 15px center no-repeat;
332
- padding-left: 65px;
333
- padding-right: 15px;
334
- width: 150px;
335
- }
336
-
337
- .yit-container.plugin-licence-activation .message-wrapper {
338
- height: 75px;
339
- display: none;
340
- position: absolute;
341
- top: 0;
342
- right: -250px;
343
- border: 1px solid #ff3838;
344
- }
345
-
346
- .yit-container.plugin-licence-activation .message-wrapper.visible {
347
- display: table;
348
- }
349
-
350
- .yit-container.plugin-licence-activation .message {
351
- display: table-cell;
352
- vertical-align: middle;
353
- }
354
-
355
- .yit-container.plugin-licence-activation .arrow-left:after,
356
- .yit-container.plugin-licence-activation .arrow-left:before {
357
- content: "";
358
- display: block;
359
- width: 0;
360
- height: 0;
361
- position: absolute;
362
- }
363
-
364
- .yit-container.plugin-licence-activation .arrow-left:before {
365
- border-top: 9px solid transparent;
366
- border-bottom: 9px solid transparent;
367
- border-right: 9px solid #ff3838;
368
- top: 26px;
369
- left: -9px;
370
- }
371
-
372
- .yit-container.plugin-licence-activation .arrow-left:after {
373
- border-top: 8px solid transparent;
374
- border-bottom: 8px solid transparent;
375
- border-right: 8px solid #fff;
376
- left: -8px;
377
- top: 27px;
378
- }
379
-
380
- .yit-container.plugin-licence-activation h2,
381
- .yit-container.plugin-licence-activation h3 {
382
- text-transform: uppercase;
383
- font-weight: 800;
384
- margin-bottom: 30px;
385
- }
386
-
387
- .yit-container.plugin-licence-activation h2 {
388
- color: #808a97;
389
- font-size: 25px;
390
- }
391
- .yit-container.plugin-licence-activation h3 {
392
- color: #313131;
393
- font-size: 15px;
394
- height: 20px;
395
- }
396
-
397
- .yit-container.plugin-licence-activation h3.to-active {
398
- height: 20px;
399
- position: relative;
400
- vertical-align: top;
401
- }
402
-
403
- .yit-container.plugin-licence-activation .spinner.show{
404
- display: inline-block;
405
- vertical-align: middle;
406
- float: none;
407
- }
408
-
409
- .yit-container.plugin-licence-activation h3.to-active > .spinner.show {
410
- display: inline-block;
411
- float: none;
412
- top: -3px;
413
- position: relative;
414
- }
415
-
416
- .yit-container.plugin-licence-activation .licence-check-section{
417
- margin-bottom: 60px;
418
- }
419
-
420
- .yit-container.plugin-licence-activation span.licence-label {
421
- font-weight: 500;
422
- color: #606060;
423
- margin-bottom: 30px;
424
- }
425
-
426
- .yit-container.plugin-licence-activation .button-licence {
427
- border: 0;
428
- font-size: 13px;
429
- text-transform: uppercase;
430
- background-color: #808a97;
431
- color: #fff;
432
- font-weight: 700;
433
- border-radius: 3px;
434
- cursor: pointer;
435
- text-decoration: none;
436
- padding: 5px 7px;
437
- -webkit-transition: background-color 0.3s ease;
438
- -moz-transition: background-color 0.3s ease;
439
- -ms-transition: background-color 0.3s ease;
440
- -o-transition: background-color 0.3s ease;
441
- transition: background-color 0.3s ease;
442
- }
443
-
444
- .yit-container.plugin-licence-activation .button-licence:hover {
445
- background-color: #4d5c6f;
446
- }
447
-
448
- .yit-container.plugin-licence-activation .button-licence.clicked {
449
- cursor: not-allowed;
450
- background-color: #e2e2e2 !important;
451
- }
452
-
453
- .yit-container.plugin-licence-activation .button-licence.licence-check {
454
- font-weight: 400;
455
- padding: 12px 19px;
456
- }
457
-
458
- .yit-container.plugin-licence-activation .button-licence.licence-renew {
459
- text-decoration: none;
460
- padding: 7px 12px;
461
- font-size: 9px;
462
- }
463
-
464
- .yit-container.plugin-licence-activation .button-licence.licence-renew:focus {
465
- box-shadow: none;
466
- }
467
-
468
- .yit-container.plugin-licence-activation table:not(.to-active-table) {
469
- width: 100%;
470
- border: 1px solid #dcdcdc;
471
- border-spacing: 0;
472
- border-radius: 5px;
473
- border-collapse: separate;
474
- overflow: hidden;
475
- }
476
-
477
- .yit-container.plugin-licence-activation table:not(.to-active-table) th {
478
- border-bottom: 1px solid #dcdcdc;
479
- }
480
-
481
- .yit-container.plugin-licence-activation table:not(.to-active-table) td,
482
- .yit-container.plugin-licence-activation table:not(.to-active-table) th {
483
- border-right: 1px solid #dcdcdc;
484
- }
485
- .yit-container.plugin-licence-activation table td:last-child,
486
- .yit-container.plugin-licence-activation table th:last-child {
487
- border-right: 0;
488
- }
489
-
490
- .yit-container.plugin-licence-activation table thead tr {
491
- background-color: #f6f4f4;
492
- }
493
-
494
- .yit-container.plugin-licence-activation table tbody tr {
495
- background-color: #ffffff;
496
- }
497
-
498
- .yit-container.plugin-licence-activation table thead tr th {
499
- font-size: 13px;
500
- color: #313131;
501
- text-transform: uppercase;
502
- font-weight: bold;
503
- }
504
-
505
- .yit-container.plugin-licence-activation table thead tr,
506
- .yit-container.plugin-licence-activation table tbody tr {
507
- line-height: 60px;
508
- }
509
-
510
- .yit-container.plugin-licence-activation table tbody tr td{
511
- text-align: center;
512
- line-height: 20px;
513
- padding: 10px 5px;
514
- }
515
-
516
- .yit-container.plugin-licence-activation .button-licence.licence-activation {
517
- padding: 12px 18px;
518
- }
519
-
520
- .yit-container.plugin-licence-activation .to-active-table tr {
521
- line-height: 75px;
522
- }
523
-
524
- .yit-container.plugin-licence-activation .to-active-table tr.plugin-row {
525
- background-color: transparent;
526
- -webkit-transition: all 0.3s ease;
527
- -moz-transition: all 0.3s ease;
528
- -ms-transition: all 0.3s ease;
529
- -o-transition: all 0.3s ease;
530
- transition: all 0.3s ease;
531
- }
532
-
533
- .yit-container.plugin-licence-activation .to-active-table tr.plugin-row.error {
534
- background-color: #ffdcdc;
535
- }
536
-
537
- .yit-container.plugin-licence-activation .to-active-table td {
538
- padding-right: 12px;
539
- width: 33%;
540
- }
541
-
542
-
543
- .yit-container.plugin-licence-activation .to-active-table td.plugin-name {
544
- color: #808a97;
545
- font-size: 12px;
546
- text-transform: uppercase;
547
- font-weight: bold;
548
- line-height: 20px;
549
- width: 20%;
550
- padding-left: 20px;
551
- }
552
-
553
- .yit-container.plugin-licence-activation .to-active-table td.activate-button {
554
- width: 15%;
555
- position: relative;
556
- }
557
-
558
- .yit-container.plugin-licence-activation input[type=text],
559
- .yit-container.plugin-licence-activation input[type=email]{
560
- -webkit-transition: all 0.3s ease;
561
- -moz-transition: all 0.3s ease;
562
- -ms-transition: all 0.3s ease;
563
- -o-transition: all 0.3s ease;
564
- transition: all 0.3s ease;
565
-
566
- border: 1px solid #dcdcdc;
567
- padding: 0 15px;
568
- border-radius: 3px;
569
- height: 41px;
570
- width: 100%;
571
- }
572
-
573
- .yit-container.plugin-licence-activation input[type=text].require,
574
- .yit-container.plugin-licence-activation input[type=email].require {
575
- border: 1px solid #ff3838;
576
- }
577
-
578
- .yit-container.plugin-licence-activation input[type=text]:focus,
579
- .yit-container.plugin-licence-activation input[type=email]:focus{
580
- webkit-box-shadow: 0 0 1px rgba(30,140,190,.8);
581
- box-shadow: 0 0 1px rgba(30,140,190,.8);
582
- }
583
-
584
- .yit-container.plugin-licence-activation input[type=text]{
585
- text-transform: uppercase;
586
- text-align: center;
587
- }
588
-
589
- .yit-container.plugin-licence-activation input[type=email] {
590
- text-align: left;
591
- }
592
-
593
- .yit-container.plugin-licence-activation input[type=submit]:focus{
594
- outline: 0;
595
- }
596
-
597
- /* === Woocommerce panel === */
598
- #plugin-fw-wc .yit_options{
599
- padding: 0;
600
- border: 0;
601
- }
602
- #plugin-fw-wc .yit_options input.upload_button, .yit_options input.button{
603
- background: none;
604
- border: 1px solid #ccc;
605
- }
606
-
607
- /* === WP Pointers === */
608
-
609
- #adminmenu li.menu-top.yit-pointer-selected-row,
610
- #adminmenu li.menu-top.yit-pointer-selected-row:hover,
611
- #adminmenu li.yit-pointer-selected-row a.menu-top {
612
- background-color: #acc327;
613
- color: #000;
614
- }
615
-
616
- #adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer{
617
- color: #000;
618
- }
619
-
620
- #adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer:hover,
621
- #adminmenu .wp-submenu a.yit-pointer-selected-row {
622
- color: #fff;
623
- }
624
-
625
- #adminmenu .wp-submenu a.yit-pointer-selected-row:hover {
626
- color: #45bbe6;
627
- }
628
-
629
- /* WooCommerce 2.4 Support */
630
- .woocommerce table.form-table .colorpick{
631
- width: 6em;
632
- }
633
-
634
- #wpwrap h2.nav-tab-wrapper , #wpbody-content h2.nav-tab-wrapper {
635
- border-bottom: 1px solid #ccc;
636
- }
637
-
638
- /* === YIT FRAMEWORK === */
639
- .plugin-card .plugin-icon img {
640
- max-width: 100%;
641
- width: auto;
642
- height: auto;
643
- }
644
-
645
- /* === Responsive === */
646
-
647
- @media (max-width: 767px) {}
648
-
649
- @media (max-width: 480px) {}
650
-
651
- @media (min-width: 768px) and (max-width: 992px) {}
652
-
653
- @media (min-width: 980px) and (max-width: 1199px) {}
654
-
655
- @media (min-width: 1200px) {
656
- .yit-container.plugin-licence-activation{
657
- width: 900px;
658
- }
659
- }
660
-
661
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
662
- only screen and (-o-min-device-pixel-ratio: 3/2),
663
- only screen and (min--moz-device-pixel-ratio: 1.5),
664
- only screen and (min-device-pixel-ratio: 1.5) {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file belongs to the YIT Plugin Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+
10
+ /* onoff */
11
+ .rm_onoff input {
12
+ display : none;
13
+ }
14
+
15
+ .rm_onoff input + span {
16
+ cursor : pointer;
17
+ text-indent : -9999px;
18
+ display : block;
19
+ width : 85px;
20
+ height : 37px;
21
+ background : transparent url(../images/off.png);
22
+ }
23
+
24
+ .rm_onoff input:checked + span {
25
+ background : transparent url(../images/on.png);
26
+ }
27
+
28
+ .rm_onoff input.onoffchecked + span {
29
+ background : transparent url(../images/on.png);
30
+ }
31
+
32
+ /* slider */
33
+ /*numbers*/
34
+ .ui-slider .maxCaption, .ui-slider .minCaption {
35
+ margin-bottom : 5px;
36
+ }
37
+
38
+ .ui-slider .feedback {
39
+ background : url(../images/slider/tooltip.png) no-repeat center top;
40
+ position : absolute;
41
+ top : -25px;
42
+ width : 35px;
43
+ height : 43px;
44
+ text-align : center;
45
+ width : 100%;
46
+ display : block;
47
+ }
48
+
49
+ .ui-slider .feedback strong {
50
+ display : inline-block;
51
+ padding-top : 4px;
52
+ top : -30px;
53
+ }
54
+
55
+ /*handle*/
56
+ .yit-options .ui-slider-horizontal .ui-slider-handle,
57
+ .yit_options .ui-slider-horizontal .ui-slider-handle {
58
+ background : transparent url(../images/slider/handle.png) no-repeat left top !important;
59
+ border : 0px !important;
60
+ top : -.35em !important;
61
+ width : 18px !important;
62
+ height : 19px !important;
63
+ }
64
+
65
+ /*bg on the left:grey*/
66
+ .yit-options .ui-slider.ui-widget-content,
67
+ .yit_options .ui-slider.ui-widget-content {
68
+ background : url(../images/slider/grey.gif) repeat-x left center !important;
69
+ border-color : #c1c1c0 !important;
70
+ height : 10px !important;
71
+ }
72
+
73
+ .iris-slider-offset.ui-slider.ui-widget-content {
74
+ background : transparent !important;
75
+ height : auto !important;
76
+ }
77
+
78
+ /*bg on the right:orange*/
79
+ .ui-slider.ui-widget-content .ui-widget-header {
80
+ background : url(../images/slider/orange.gif) repeat-x left center !important;
81
+ left : 2px !important;
82
+ -webkit-border-radius : 15px;
83
+ -moz-border-radius : 15px;
84
+ -khtml-border-radius : 15px;
85
+ border-radius : 15px;
86
+ }
87
+
88
+ .plugin-option tr {
89
+ border-bottom : 1px solid #ccc;
90
+ }
91
+
92
+ .plugin-option .yit_options,
93
+ .plugin-option .yit-options {
94
+ border-bottom : 0px;
95
+ }
96
+
97
+ .plugin-option .yit-options .option,
98
+ .plugin-option .yit_options .option {
99
+ width : 600px;
100
+ float : left;
101
+ }
102
+
103
+ .plugin-option .form-table td {
104
+ padding : 25px 10px;
105
+ }
106
+
107
+ .yit_options .select_wrapper,
108
+ .yit-options .select_wrapper {
109
+ background : url("../images/select.png") no-repeat scroll right center #FAFAFA;
110
+ border-color : #CCCCCC #EEEEEE #EEEEEE #CCCCCC;
111
+ border-radius : 4px 4px 4px 4px;
112
+ border-style : solid;
113
+ border-width : 1px;
114
+ color : #555555;
115
+ display : block;
116
+ float : left;
117
+ font-family : sans-serif;
118
+ font-size : 12px;
119
+ height : 26px;
120
+ margin-bottom : 9px !important;
121
+ margin-left : 0;
122
+ margin-right : 5px;
123
+ margin-top : 0;
124
+ width : 400px;
125
+ }
126
+
127
+ .chosen .select_wrapper {
128
+ background : none;
129
+ border : none;
130
+ }
131
+
132
+ .chosen .select_wrapper .chosen-container {
133
+ width : 338px !important;
134
+ }
135
+
136
+ .chosen .select_wrapper .chosen-container .search-field input {
137
+ height : 27px !important;
138
+ color : #333;
139
+ }
140
+
141
+ .chosen .select_wrapper .chosen-container .chosen-choices {
142
+ border : 1px solid #ddd;
143
+ box-shadow : none;
144
+ }
145
+
146
+ .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice {
147
+ height : 15px !important;
148
+ min-width : 105px;
149
+ }
150
+
151
+ .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice span {
152
+ line-height : 15px;
153
+ height : 15px;
154
+ padding-top : 2px;
155
+ }
156
+
157
+ .chosen .select_wrapper .chosen-container .chosen-choices li.search-choice a.search-choice-close {
158
+ top : 5px;
159
+ }
160
+
161
+ .chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input {
162
+ width : 100% !important;
163
+ }
164
+
165
+ /* === Multiple Chosen Customizzation === */
166
+
167
+ .yith-choosen .chosen-choices {
168
+ line-height : 27px;
169
+ min-height : 27px;
170
+ border : 1px solid #ddd;
171
+ }
172
+
173
+ .yith-choosen .chosen-container-active .chosen-choices {
174
+ border : 1px solid #5b9dd9;
175
+ -webkit-box-shadow : 0 0 2px rgba(30, 140, 190, .8);
176
+ box-shadow : 0 0 2px rgba(30, 140, 190, .8);
177
+ }
178
+
179
+ .select_wrapper span {
180
+ height : 26px;
181
+ line-height : 26px;
182
+ padding-left : 6px;
183
+ position : absolute;
184
+ z-index : 2;
185
+ overflow : hidden;
186
+ }
187
+
188
+ .ie8 .yit_options select,
189
+ .ie8 .yit-options select {
190
+ height : 26px;
191
+ }
192
+
193
+ .yit_options select, .yit-options select, .the-metabox .select_wrapper select {
194
+ cursor : pointer;
195
+ height : 28px;
196
+ margin : 0;
197
+ opacity : 0;
198
+ padding : 0;
199
+ position : relative;
200
+ width : inherit;
201
+ z-index : 4;
202
+ background-color : #FAFAFA;
203
+ }
204
+
205
+ /* === Single Chosen Customizzation === */
206
+
207
+ .yith-choosen .chosen-container-single .chosen-default {
208
+ background : transparent;
209
+ border-color : #ddd;
210
+ }
211
+
212
+ .yith-choosen .chosen-search > input[type=text] {
213
+ width : 100% !important;
214
+ }
215
+
216
+ .yith-choosen .chosen-container-single .chosen-single {
217
+ background : transparent;
218
+ border-color : #ddd;
219
+ }
220
+
221
+ /* Style to woocommerce panel*/
222
+
223
+ #plugin-fw-wc {
224
+ padding-top : 20px;
225
+ }
226
+
227
+ #plugin-fw-wc table.form-table {
228
+ background-color : #fff;
229
+ margin-bottom : 20px;
230
+ }
231
+
232
+ #plugin-fw-wc table.form-table th {
233
+ padding : 20px;
234
+ }
235
+
236
+ #plugin-fw-wc h3 {
237
+ padding : 0px 10px 10px;
238
+ border-bottom : 1px solid #eee;
239
+ }
240
+
241
+ /* === VIDEO BOX === */
242
+
243
+ .yith-videobox-wrapper {
244
+ padding-top : 20px;
245
+ }
246
+
247
+ .yith-videobox-wrapper h3 {
248
+ padding : 0px 10px 10px;
249
+ border-bottom : 1px solid #eee;
250
+ }
251
+
252
+ .yith-videobox-wrapper .postbox {
253
+ display : inline-block;
254
+ }
255
+
256
+ .yith-videobox-wrapper .yith_videobox .column {
257
+ width : 45%;
258
+ float : left;
259
+ padding-right : 2.5%;
260
+ border-right : 1px solid #ebebeb;
261
+ padding-bottom : 2em;
262
+ }
263
+
264
+ .yith-videobox-wrapper .yith_videobox .column.two {
265
+ margin-right : 0;
266
+ padding-right : 0;
267
+ padding-left : 2.5%;
268
+ border : 0;
269
+ max-width : 49%;
270
+ }
271
+
272
+ .yith-videobox-wrapper .yith_videobox h2 {
273
+ font-size : 16px;
274
+ margin-bottom : 20px;
275
+ }
276
+
277
+ .yith-videobox-wrapper .yith-video-link {
278
+ width : 100%;
279
+ max-width : 200px;
280
+ float : left;
281
+ margin : 0 1.5em 1.5em 0;
282
+ }
283
+
284
+ .yith-videobox-wrapper .yith-video-link {
285
+ width : 100%;
286
+ max-width : 200px;
287
+ float : left;
288
+ margin : 0 1.5em 1.5em 0;
289
+ }
290
+
291
+ .yith-videobox-wrapper .yith-image-frame img {
292
+ max-width : 100%;
293
+ height : auto;
294
+ }
295
+
296
+ .yith-videobox-wrapper .yith-video-link img {
297
+ max-width : 100%;
298
+ height : auto;
299
+ }
300
+
301
+ .yith-videobox-wrapper .yith-video-iframe {
302
+ display : none;
303
+
304
+ }
305
+
306
+ /* === Plugins Upgrader === */
307
+
308
+ .yit-plugin-changelog-wrapper {
309
+ display : none;
310
+ }
311
+
312
+ .yit-plugin-changelog-title {
313
+ text-transform : uppercase;
314
+ }
315
+
316
+ .yit-plugin-changelog {
317
+ background : #fcfcfc;
318
+ height : 97%;
319
+ z-index : 999;
320
+ overflow : auto;
321
+ }
322
+
323
+ /* === Plugins Licence Activation === */
324
+
325
+ .yit-container.plugin-licence-activation {
326
+ font-family : 'Raleway', sans-serif;
327
+ }
328
+
329
+ .yit-container.plugin-licence-activation .to-active-wrapper {
330
+ margin-bottom : 60px;
331
+ }
332
+
333
+ .yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form {
334
+ position : relative;
335
+ border-color : #e1e1e1;
336
+ border-style : solid;
337
+ border-width : 0;
338
+ }
339
+
340
+ .yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:first-child {
341
+ border-top-width : 1px;
342
+ }
343
+
344
+ .yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:last-child {
345
+ border-bottom-width : 1px;
346
+ }
347
+
348
+ .yit-container.plugin-licence-activation .to-active-wrapper table.to-active-table {
349
+ border-width : 0;
350
+ border-spacing : 0;
351
+ width : 100%;
352
+ }
353
+
354
+ .yit-container.plugin-licence-activation .message {
355
+ display : none;
356
+ line-height : normal;
357
+ background : #ffffff url(../images/licence-error.png) 15px center no-repeat;
358
+ padding-left : 65px;
359
+ padding-right : 15px;
360
+ width : 150px;
361
+ }
362
+
363
+ .yit-container.plugin-licence-activation .message-wrapper {
364
+ height : 75px;
365
+ display : none;
366
+ position : absolute;
367
+ top : 0;
368
+ right : -250px;
369
+ border : 1px solid #ff3838;
370
+ }
371
+
372
+ .yit-container.plugin-licence-activation .message-wrapper.visible {
373
+ display : table;
374
+ }
375
+
376
+ .yit-container.plugin-licence-activation .message {
377
+ display : table-cell;
378
+ vertical-align : middle;
379
+ }
380
+
381
+ .yit-container.plugin-licence-activation .arrow-left:after,
382
+ .yit-container.plugin-licence-activation .arrow-left:before {
383
+ content : "";
384
+ display : block;
385
+ width : 0;
386
+ height : 0;
387
+ position : absolute;
388
+ }
389
+
390
+ .yit-container.plugin-licence-activation .arrow-left:before {
391
+ border-top : 9px solid transparent;
392
+ border-bottom : 9px solid transparent;
393
+ border-right : 9px solid #ff3838;
394
+ top : 26px;
395
+ left : -9px;
396
+ }
397
+
398
+ .yit-container.plugin-licence-activation .arrow-left:after {
399
+ border-top : 8px solid transparent;
400
+ border-bottom : 8px solid transparent;
401
+ border-right : 8px solid #fff;
402
+ left : -8px;
403
+ top : 27px;
404
+ }
405
+
406
+ .yit-container.plugin-licence-activation h2,
407
+ .yit-container.plugin-licence-activation h3 {
408
+ text-transform : uppercase;
409
+ font-weight : 800;
410
+ margin-bottom : 30px;
411
+ }
412
+
413
+ .yit-container.plugin-licence-activation h2 {
414
+ color : #808a97;
415
+ font-size : 25px;
416
+ }
417
+
418
+ .yit-container.plugin-licence-activation h3 {
419
+ color : #313131;
420
+ font-size : 15px;
421
+ height : 20px;
422
+ }
423
+
424
+ .yit-container.plugin-licence-activation h3.to-active {
425
+ height : 20px;
426
+ position : relative;
427
+ vertical-align : top;
428
+ }
429
+
430
+ .yit-container.plugin-licence-activation .spinner.show {
431
+ display : inline-block;
432
+ vertical-align : middle;
433
+ float : none;
434
+ }
435
+
436
+ .yit-container.plugin-licence-activation h3.to-active > .spinner.show {
437
+ display : inline-block;
438
+ float : none;
439
+ top : -3px;
440
+ position : relative;
441
+ }
442
+
443
+ .yit-container.plugin-licence-activation .licence-check-section {
444
+ margin-bottom : 60px;
445
+ }
446
+
447
+ .yit-container.plugin-licence-activation span.licence-label {
448
+ font-weight : 500;
449
+ color : #606060;
450
+ margin-bottom : 30px;
451
+ }
452
+
453
+ .yit-container.plugin-licence-activation .button-licence {
454
+ border : 0;
455
+ font-size : 13px;
456
+ text-transform : uppercase;
457
+ background-color : #808a97;
458
+ color : #fff;
459
+ font-weight : 700;
460
+ border-radius : 3px;
461
+ cursor : pointer;
462
+ text-decoration : none;
463
+ padding : 5px 7px;
464
+ -webkit-transition : background-color 0.3s ease;
465
+ -moz-transition : background-color 0.3s ease;
466
+ -ms-transition : background-color 0.3s ease;
467
+ -o-transition : background-color 0.3s ease;
468
+ transition : background-color 0.3s ease;
469
+ }
470
+
471
+ .yit-container.plugin-licence-activation .button-licence:hover {
472
+ background-color : #4d5c6f;
473
+ }
474
+
475
+ .yit-container.plugin-licence-activation .button-licence.clicked {
476
+ cursor : not-allowed;
477
+ background-color : #e2e2e2 !important;
478
+ }
479
+
480
+ .yit-container.plugin-licence-activation .button-licence.licence-check {
481
+ font-weight : 400;
482
+ padding : 12px 19px;
483
+ }
484
+
485
+ .yit-container.plugin-licence-activation .button-licence.licence-renew {
486
+ text-decoration : none;
487
+ padding : 7px 12px;
488
+ font-size : 9px;
489
+ }
490
+
491
+ .yit-container.plugin-licence-activation .button-licence.licence-renew:focus {
492
+ box-shadow : none;
493
+ }
494
+
495
+ .yit-container.plugin-licence-activation table:not(.to-active-table) {
496
+ width : 100%;
497
+ border : 1px solid #dcdcdc;
498
+ border-spacing : 0;
499
+ border-radius : 5px;
500
+ border-collapse : separate;
501
+ overflow : hidden;
502
+ }
503
+
504
+ .yit-container.plugin-licence-activation table:not(.to-active-table) th {
505
+ border-bottom : 1px solid #dcdcdc;
506
+ }
507
+
508
+ .yit-container.plugin-licence-activation table:not(.to-active-table) td,
509
+ .yit-container.plugin-licence-activation table:not(.to-active-table) th {
510
+ border-right : 1px solid #dcdcdc;
511
+ }
512
+
513
+ .yit-container.plugin-licence-activation table td:last-child,
514
+ .yit-container.plugin-licence-activation table th:last-child {
515
+ border-right : 0;
516
+ }
517
+
518
+ .yit-container.plugin-licence-activation table thead tr {
519
+ background-color : #f6f4f4;
520
+ }
521
+
522
+ .yit-container.plugin-licence-activation table tbody tr {
523
+ background-color : #ffffff;
524
+ }
525
+
526
+ .yit-container.plugin-licence-activation table thead tr th {
527
+ font-size : 13px;
528
+ color : #313131;
529
+ text-transform : uppercase;
530
+ font-weight : bold;
531
+ }
532
+
533
+ .yit-container.plugin-licence-activation table thead tr,
534
+ .yit-container.plugin-licence-activation table tbody tr {
535
+ line-height : 60px;
536
+ }
537
+
538
+ .yit-container.plugin-licence-activation table tbody tr td {
539
+ text-align : center;
540
+ line-height : 20px;
541
+ padding : 10px 5px;
542
+ }
543
+
544
+ .yit-container.plugin-licence-activation .button-licence.licence-activation {
545
+ padding : 12px 18px;
546
+ }
547
+
548
+ .yit-container.plugin-licence-activation .to-active-table tr {
549
+ line-height : 75px;
550
+ }
551
+
552
+ .yit-container.plugin-licence-activation .to-active-table tr.plugin-row {
553
+ background-color : transparent;
554
+ -webkit-transition : all 0.3s ease;
555
+ -moz-transition : all 0.3s ease;
556
+ -ms-transition : all 0.3s ease;
557
+ -o-transition : all 0.3s ease;
558
+ transition : all 0.3s ease;
559
+ }
560
+
561
+ .yit-container.plugin-licence-activation .to-active-table tr.plugin-row.error {
562
+ background-color : #ffdcdc;
563
+ }
564
+
565
+ .yit-container.plugin-licence-activation .to-active-table td {
566
+ padding-right : 12px;
567
+ width : 33%;
568
+ }
569
+
570
+ .yit-container.plugin-licence-activation .to-active-table td.plugin-name {
571
+ color : #808a97;
572
+ font-size : 12px;
573
+ text-transform : uppercase;
574
+ font-weight : bold;
575
+ line-height : 20px;
576
+ width : 20%;
577
+ padding-left : 20px;
578
+ }
579
+
580
+ .yit-container.plugin-licence-activation .to-active-table td.activate-button {
581
+ width : 15%;
582
+ position : relative;
583
+ }
584
+
585
+ .yit-container.plugin-licence-activation input[type=text],
586
+ .yit-container.plugin-licence-activation input[type=email] {
587
+ -webkit-transition : all 0.3s ease;
588
+ -moz-transition : all 0.3s ease;
589
+ -ms-transition : all 0.3s ease;
590
+ -o-transition : all 0.3s ease;
591
+ transition : all 0.3s ease;
592
+
593
+ border : 1px solid #dcdcdc;
594
+ padding : 0 15px;
595
+ border-radius : 3px;
596
+ height : 41px;
597
+ width : 100%;
598
+ }
599
+
600
+ .yit-container.plugin-licence-activation input[type=text].require,
601
+ .yit-container.plugin-licence-activation input[type=email].require {
602
+ border : 1px solid #ff3838;
603
+ }
604
+
605
+ .yit-container.plugin-licence-activation input[type=text]:focus,
606
+ .yit-container.plugin-licence-activation input[type=email]:focus {
607
+ webkit-box-shadow : 0 0 1px rgba(30, 140, 190, .8);
608
+ box-shadow : 0 0 1px rgba(30, 140, 190, .8);
609
+ }
610
+
611
+ .yit-container.plugin-licence-activation input[type=text] {
612
+ text-transform : uppercase;
613
+ text-align : center;
614
+ }
615
+
616
+ .yit-container.plugin-licence-activation input[type=email] {
617
+ text-align : left;
618
+ }
619
+
620
+ .yit-container.plugin-licence-activation input[type=submit]:focus {
621
+ outline : 0;
622
+ }
623
+
624
+ /* === Woocommerce panel === */
625
+ #plugin-fw-wc .yit_options {
626
+ padding : 0;
627
+ border : 0;
628
+ }
629
+
630
+ #plugin-fw-wc .yit_options input.upload_button, .yit_options input.button {
631
+ background : none;
632
+ border : 1px solid #ccc;
633
+ }
634
+
635
+ /* === WP Pointers === */
636
+
637
+ #adminmenu li.menu-top.yit-pointer-selected-row,
638
+ #adminmenu li.menu-top.yit-pointer-selected-row:hover,
639
+ #adminmenu li.yit-pointer-selected-row a.menu-top {
640
+ background-color : #acc327;
641
+ color : #000;
642
+ }
643
+
644
+ #adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer {
645
+ color : #000;
646
+ }
647
+
648
+ #adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer:hover,
649
+ #adminmenu .wp-submenu a.yit-pointer-selected-row {
650
+ color : #fff;
651
+ }
652
+
653
+ #adminmenu .wp-submenu a.yit-pointer-selected-row:hover {
654
+ color : #45bbe6;
655
+ }
656
+
657
+ /* WooCommerce 2.4 Support */
658
+ .woocommerce table.form-table .colorpick {
659
+ width : 6em;
660
+ }
661
+
662
+ #wpwrap h2.nav-tab-wrapper , #wpbody-content h2.nav-tab-wrapper {
663
+ border-bottom: 1px solid #ccc;
664
+ }
665
+
666
+ /* === YIT FRAMEWORK === */
667
+ .plugin-card .plugin-icon img {
668
+ max-width : 100%;
669
+ width : auto;
670
+ height : auto;
671
+ }
672
+
673
+ /* === Panel Content and Container === */
674
+ .yit-admin-panel-container{
675
+ position:relative;
676
+ }
677
+ .yit-admin-panel-content-wrap {
678
+ width : calc(100% - 300px);
679
+ display : inline-block;
680
+ }
681
+
682
+ .yit-admin-panel-content-wrap.yit-admin-panel-content-wrap-full {
683
+ width : 100%;
684
+ display : block;
685
+ }
686
+
687
+ /* === Responsive === */
688
+
689
+ @media (max-width : 767px) {
690
+ .yit-admin-panel-content-wrap {
691
+ width : 100%;
692
+ display : block;
693
+ }
694
+ }
695
+
696
+ @media (max-width : 480px) {
697
+
698
+ }
699
+
700
+ @media (min-width : 768px) and (max-width : 992px) {
701
+ }
702
+
703
+ @media (min-width : 980px) and (max-width : 1199px) {
704
+ }
705
+
706
+ @media (min-width : 1200px) {
707
+ .yit-container.plugin-licence-activation {
708
+ width : 900px;
709
+ }
710
+ }
711
+
712
+ @media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (-o-min-device-pixel-ratio : 3/2), only screen and (min--moz-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) {
713
+ }
plugin-fw/assets/css/yit-upgrade-to-pro.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* === Upgrade to Premium Landing page === */
2
+
3
+ #upgrade-to-premium{
4
+ width: 900px;
5
+ }
6
+ #upgrade-to-premium h1{
7
+ font-family: 'Raleway',san-serif;
8
+ text-transform: uppercase;
9
+ font-size: 30px;
10
+ font-weight: 700;
11
+ color: #808a97;
12
+ }
13
+
14
+ #upgrade-to-premium h3{
15
+ font-family: 'Raleway',san-serif;
16
+ font-size: 20px;
17
+ line-height: 29px;
18
+ font-weight: 700;
19
+ color: #808a97;
20
+ }
21
+
22
+ #upgrade-to-premium p{
23
+ font-family: 'Open Sans',san-serif;
24
+ font-size: 15px;
25
+ line-height: 29px;
26
+ font-weight: 400;
27
+ color: #6a6a6b;
28
+ }
29
+ #upgrade-to-premium p.highlighted{
30
+ font-family: 'Raleway',san-serif;
31
+ font-size: 20px;
32
+ line-height: 27px;
33
+ color: #808a97;
34
+ font-weight: 400;
35
+ }
36
+ #upgrade-to-premium ol{
37
+ counter-reset: item;
38
+ list-style-type: none;
39
+ margin-left: 0;
40
+ }
41
+ #upgrade-to-premium li.step{
42
+ font-family: 'open sans',san-serif;
43
+ font-size: 15px;
44
+ color: #6a6a6b;
45
+ font-weight: 400;
46
+ position: relative;
47
+ padding-left: 50px;
48
+ line-height: 25px;
49
+ margin-bottom: 25px;
50
+ }
51
+ #upgrade-to-premium li.step:before{
52
+ content: counters(item, ".") " ";
53
+ counter-increment: item;
54
+ position: absolute;
55
+ left: 0;
56
+ top: 0;
57
+ border: 1px solid #808a97;
58
+ width: 30px;
59
+ height: 30px;
60
+ border-radius: 16px;
61
+ background-color: #808a97;
62
+ color: #ffffff;
63
+ font-weight: 700;
64
+ font-size: 18px;
65
+ text-align: center;
66
+ line-height: 27px;
67
+ }
68
+ #upgrade-to-premium li.step img{
69
+ border: 1px solid #b8b8b8;
70
+ width: 600px;
71
+ display: block;
72
+ margin: 15px 0 25px 0;
73
+ }
74
+
75
+ #cboxLoadedContent {
76
+ margin-bottom: 60px!important;
77
+ }
plugin-fw/assets/css/yit-upgrader.css CHANGED
@@ -1,14 +1,14 @@
1
- /* === Plugins Upgrader === */
2
-
3
- .yit-plugin-changelog-wrapper {
4
- display: none;
5
- }
6
-
7
- .yit-plugin-changelog-title {
8
- text-transform: uppercase;
9
- }
10
-
11
- .yit-plugin-changelog {
12
- background: #fcfcfc;
13
- height: 97%;
14
  }
1
+ /* === Plugins Upgrader === */
2
+
3
+ .yit-plugin-changelog-wrapper {
4
+ display: none;
5
+ }
6
+
7
+ .yit-plugin-changelog-title {
8
+ text-transform: uppercase;
9
+ }
10
+
11
+ .yit-plugin-changelog {
12
+ background: #fcfcfc;
13
+ height: 97%;
14
  }
plugin-fw/assets/images/colorbox/border1.png ADDED
Binary file
plugin-fw/assets/images/colorbox/border2.png ADDED
Binary file
plugin-fw/assets/images/colorbox/loading.gif ADDED
Binary file
plugin-fw/assets/images/upgrade-page/01.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/02.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/03.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/04.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/05.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/06.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/07.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/08.jpg ADDED
Binary file
plugin-fw/assets/images/upgrade-page/09.jpg ADDED
Binary file
plugin-fw/assets/images/widgets/box-icon.png ADDED
Binary file
plugin-fw/assets/images/widgets/box-white-icon.png ADDED
Binary file
plugin-fw/assets/images/widgets/despacho.png ADDED
Binary file
plugin-fw/assets/images/widgets/info-icon.png ADDED
Binary file
plugin-fw/assets/images/widgets/link-bg.png ADDED
Binary file
plugin-fw/assets/images/widgets/link-bg2.png ADDED
Binary file
plugin-fw/assets/images/widgets/link-icon.png ADDED
Binary file
plugin-fw/assets/images/widgets/membership-bg.png ADDED
Binary file
plugin-fw/assets/js/jquery.colorbox.js ADDED
@@ -0,0 +1,1105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Colorbox 1.6.3
3
+ license: MIT
4
+ http://www.jacklmoore.com/colorbox
5
+ */
6
+ (function ($, document, window) {
7
+ var
8
+ // Default settings object.
9
+ // See http://jacklmoore.com/colorbox for details.
10
+ defaults = {
11
+ // data sources
12
+ html: false,
13
+ photo: false,
14
+ iframe: false,
15
+ inline: false,
16
+
17
+ // behavior and appearance
18
+ transition: "elastic",
19
+ speed: 300,
20
+ fadeOut: 300,
21
+ width: false,
22
+ initialWidth: "600",
23
+ innerWidth: false,
24
+ maxWidth: false,
25
+ height: false,
26
+ initialHeight: "450",
27
+ innerHeight: false,
28
+ maxHeight: false,
29
+ scalePhotos: true,
30
+ scrolling: true,
31
+ opacity: 0.9,
32
+ preloading: true,
33
+ className: false,
34
+ overlayClose: true,
35
+ escKey: true,
36
+ arrowKey: true,
37
+ top: false,
38
+ bottom: false,
39
+ left: false,
40
+ right: false,
41
+ fixed: false,
42
+ data: undefined,
43
+ closeButton: true,
44
+ fastIframe: true,
45
+ open: false,
46
+ reposition: true,
47
+ loop: true,
48
+ slideshow: false,
49
+ slideshowAuto: true,
50
+ slideshowSpeed: 2500,
51
+ slideshowStart: "start slideshow",
52
+ slideshowStop: "stop slideshow",
53
+ photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
54
+
55
+ // alternate image paths for high-res displays
56
+ retinaImage: false,
57
+ retinaUrl: false,
58
+ retinaSuffix: '@2x.$1',
59
+
60
+ // internationalization
61
+ current: "image {current} of {total}",
62
+ previous: "previous",
63
+ next: "next",
64
+ close: "close",
65
+ xhrError: "This content failed to load.",
66
+ imgError: "This image failed to load.",
67
+
68
+ // accessbility
69
+ returnFocus: true,
70
+ trapFocus: true,
71
+
72
+ // callbacks
73
+ onOpen: false,
74
+ onLoad: false,
75
+ onComplete: false,
76
+ onCleanup: false,
77
+ onClosed: false,
78
+
79
+ rel: function() {
80
+ return this.rel;
81
+ },
82
+ href: function() {
83
+ // using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
84
+ return $(this).attr('href');
85
+ },
86
+ title: function() {
87
+ return this.title;
88
+ },
89
+ createImg: function() {
90
+ var img = new Image();
91
+ var attrs = $(this).data('cbox-img-attrs');
92
+
93
+ if (typeof attrs === 'object') {
94
+ $.each(attrs, function(key, val){
95
+ img[key] = val;
96
+ });
97
+ }
98
+
99
+ return img;
100
+ },
101
+ createIframe: function() {
102
+ var iframe = document.createElement('iframe');
103
+ var attrs = $(this).data('cbox-iframe-attrs');
104
+
105
+ if (typeof attrs === 'object') {
106
+ $.each(attrs, function(key, val){
107
+ iframe[key] = val;
108
+ });
109
+ }
110
+
111
+ if ('frameBorder' in iframe) {
112
+ iframe.frameBorder = 0;
113
+ }
114
+ if ('allowTransparency' in iframe) {
115
+ iframe.allowTransparency = "true";
116
+ }
117
+ iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching
118
+ iframe.allowFullscreen = true;
119
+
120
+ return iframe;
121
+ }
122
+ },
123
+
124
+ // Abstracting the HTML and event identifiers for easy rebranding
125
+ colorbox = 'colorbox',
126
+ prefix = 'cbox',
127
+ boxElement = prefix + 'Element',
128
+
129
+ // Events
130
+ event_open = prefix + '_open',
131
+ event_load = prefix + '_load',
132
+ event_complete = prefix + '_complete',
133
+ event_cleanup = prefix + '_cleanup',
134
+ event_closed = prefix + '_closed',
135
+ event_purge = prefix + '_purge',
136
+
137
+ // Cached jQuery Object Variables
138
+ $overlay,
139
+ $box,
140
+ $wrap,
141
+ $content,
142
+ $topBorder,
143
+ $leftBorder,
144
+ $rightBorder,
145
+ $bottomBorder,
146
+ $related,
147
+ $window,
148
+ $loaded,
149
+ $loadingBay,
150
+ $loadingOverlay,
151
+ $title,
152
+ $current,
153
+ $slideshow,
154
+ $next,
155
+ $prev,
156
+ $close,
157
+ $groupControls,
158
+ $events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
159
+
160
+ // Variables for cached values or use across multiple functions
161
+ settings,
162
+ interfaceHeight,
163
+ interfaceWidth,
164
+ loadedHeight,
165
+ loadedWidth,
166
+ index,
167
+ photo,
168
+ open,
169
+ active,
170
+ closing,
171
+ loadingTimer,
172
+ publicMethod,
173
+ div = "div",
174
+ requests = 0,
175
+ previousCSS = {},
176
+ init;
177
+
178
+ // ****************
179
+ // HELPER FUNCTIONS
180
+ // ****************
181
+
182
+ // Convenience function for creating new jQuery objects
183
+ function $tag(tag, id, css) {
184
+ var element = document.createElement(tag);
185
+
186
+ if (id) {
187
+ element.id = prefix + id;
188
+ }
189
+
190
+ if (css) {
191
+ element.style.cssText = css;
192
+ }
193
+
194
+ return $(element);
195
+ }
196
+
197
+ // Get the window height using innerHeight when available to avoid an issue with iOS
198
+ // http://bugs.jquery.com/ticket/6724
199
+ function winheight() {
200
+ return window.innerHeight ? window.innerHeight : $(window).height();
201
+ }
202
+
203
+ function Settings(element, options) {
204
+ if (options !== Object(options)) {
205
+ options = {};
206
+ }
207
+
208
+ this.cache = {};
209
+ this.el = element;
210
+
211
+ this.value = function(key) {
212
+ var dataAttr;
213
+
214
+ if (this.cache[key] === undefined) {
215
+ dataAttr = $(this.el).attr('data-cbox-'+key);
216
+
217
+ if (dataAttr !== undefined) {
218
+ this.cache[key] = dataAttr;
219
+ } else if (options[key] !== undefined) {
220
+ this.cache[key] = options[key];
221
+ } else if (defaults[key] !== undefined) {
222
+ this.cache[key] = defaults[key];
223
+ }
224
+ }
225
+
226
+ return this.cache[key];
227
+ };
228
+
229
+ this.get = function(key) {
230
+ var value = this.value(key);
231
+ return $.isFunction(value) ? value.call(this.el, this) : value;
232
+ };
233
+ }
234
+
235
+ // Determine the next and previous members in a group.
236
+ function getIndex(increment) {
237
+ var
238
+ max = $related.length,
239
+ newIndex = (index + increment) % max;
240
+
241
+ return (newIndex < 0) ? max + newIndex : newIndex;
242
+ }
243
+
244
+ // Convert '%' and 'px' values to integers
245
+ function setSize(size, dimension) {
246
+ return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
247
+ }
248
+
249
+ // Checks an href to see if it is a photo.
250
+ // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
251
+ function isImage(settings, url) {
252
+ return settings.get('photo') || settings.get('photoRegex').test(url);
253
+ }
254
+
255
+ function retinaUrl(settings, url) {
256
+ return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
257
+ }
258
+
259
+ function trapFocus(e) {
260
+ if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
261
+ e.stopPropagation();
262
+ $box.focus();
263
+ }
264
+ }
265
+
266
+ function setClass(str) {
267
+ if (setClass.str !== str) {
268
+ $box.add($overlay).removeClass(setClass.str).addClass(str);
269
+ setClass.str = str;
270
+ }
271
+ }
272
+
273
+ function getRelated(rel) {
274
+ index = 0;
275
+
276
+ if (rel && rel !== false && rel !== 'nofollow') {
277
+ $related = $('.' + boxElement).filter(function () {
278
+ var options = $.data(this, colorbox);
279
+ var settings = new Settings(this, options);
280
+ return (settings.get('rel') === rel);
281
+ });
282
+ index = $related.index(settings.el);
283
+
284
+ // Check direct calls to Colorbox.
285
+ if (index === -1) {
286
+ $related = $related.add(settings.el);
287
+ index = $related.length - 1;
288
+ }
289
+ } else {
290
+ $related = $(settings.el);
291
+ }
292
+ }
293
+
294
+ function trigger(event) {
295
+ // for external use
296
+ $(document).trigger(event);
297
+ // for internal use
298
+ $events.triggerHandler(event);
299
+ }
300
+
301
+ var slideshow = (function(){
302
+ var active,
303
+ className = prefix + "Slideshow_",
304
+ click = "click." + prefix,
305
+ timeOut;
306
+
307
+ function clear () {
308
+ clearTimeout(timeOut);
309
+ }
310
+
311
+ function set() {
312
+ if (settings.get('loop') || $related[index + 1]) {
313
+ clear();
314
+ timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
315
+ }
316
+ }
317
+
318
+ function start() {
319
+ $slideshow
320
+ .html(settings.get('slideshowStop'))
321
+ .unbind(click)
322
+ .one(click, stop);
323
+
324
+ $events
325
+ .bind(event_complete, set)
326
+ .bind(event_load, clear);
327
+
328
+ $box.removeClass(className + "off").addClass(className + "on");
329
+ }
330
+
331
+ function stop() {
332
+ clear();
333
+
334
+ $events
335
+ .unbind(event_complete, set)
336
+ .unbind(event_load, clear);
337
+
338
+ $slideshow
339
+ .html(settings.get('slideshowStart'))
340
+ .unbind(click)
341
+ .one(click, function () {
342
+ publicMethod.next();
343
+ start();
344
+ });
345
+
346
+ $box.removeClass(className + "on").addClass(className + "off");
347
+ }
348
+
349
+ function reset() {
350
+ active = false;
351
+ $slideshow.hide();
352
+ clear();
353
+ $events
354
+ .unbind(event_complete, set)
355
+ .unbind(event_load, clear);
356
+ $box.removeClass(className + "off " + className + "on");
357
+ }
358
+
359
+ return function(){
360
+ if (active) {
361
+ if (!settings.get('slideshow')) {
362
+ $events.unbind(event_cleanup, reset);
363
+ reset();
364
+ }
365
+ } else {
366
+ if (settings.get('slideshow') && $related[1]) {
367
+ active = true;
368
+ $events.one(event_cleanup, reset);
369
+ if (settings.get('slideshowAuto')) {
370
+ start();
371
+ } else {
372
+ stop();
373
+ }
374
+ $slideshow.show();
375
+ }
376
+ }
377
+ };
378
+
379
+ }());
380
+
381
+
382
+ function launch(element) {
383
+ var options;
384
+
385
+ if (!closing) {
386
+
387
+ options = $(element).data(colorbox);
388
+
389
+ settings = new Settings(element, options);
390
+
391
+ getRelated(settings.get('rel'));
392
+
393
+ if (!open) {
394
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
395
+
396
+ setClass(settings.get('className'));
397
+
398
+ // Show colorbox so the sizes can be calculated in older versions of jQuery
399
+ $box.css({visibility:'hidden', display:'block', opacity:''});
400
+
401
+ $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
402
+ $content.css({width:'', height:''}).append($loaded);
403
+
404
+ // Cache values needed for size calculations
405
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
406
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
407
+ loadedHeight = $loaded.outerHeight(true);
408
+ loadedWidth = $loaded.outerWidth(true);
409
+
410
+ // Opens inital empty Colorbox prior to content being loaded.
411
+ var initialWidth = setSize(settings.get('initialWidth'), 'x');
412
+ var initialHeight = setSize(settings.get('initialHeight'), 'y');
413
+ var maxWidth = settings.get('maxWidth');
414
+ var maxHeight = settings.get('maxHeight');
415
+
416
+ settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
417
+ settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
418
+
419
+ $loaded.css({width:'', height:settings.h});
420
+ publicMethod.position();
421
+
422
+ trigger(event_open);
423
+ settings.get('onOpen');
424
+
425
+ $groupControls.add($title).hide();
426
+
427
+ $box.focus();
428
+
429
+ if (settings.get('trapFocus')) {
430
+ // Confine focus to the modal
431
+ // Uses event capturing that is not supported in IE8-
432
+ if (document.addEventListener) {
433
+
434
+ document.addEventListener('focus', trapFocus, true);
435
+
436
+ $events.one(event_closed, function () {
437
+ document.removeEventListener('focus', trapFocus, true);
438
+ });
439
+ }
440
+ }
441
+
442
+ // Return focus on closing
443
+ if (settings.get('returnFocus')) {
444
+ $events.one(event_closed, function () {
445
+ $(settings.el).focus();
446
+ });
447
+ }
448
+ }
449
+
450
+ var opacity = parseFloat(settings.get('opacity'));
451
+ $overlay.css({
452
+ opacity: opacity === opacity ? opacity : '',
453
+ cursor: settings.get('overlayClose') ? 'pointer' : '',
454
+ visibility: 'visible'
455
+ }).show();
456
+
457
+ if (settings.get('closeButton')) {
458
+ $close.html(settings.get('close')).appendTo($content);
459
+ } else {
460
+ $close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
461
+ }
462
+
463
+ load();
464
+ }
465
+ }
466
+
467
+ // Colorbox's markup needs to be added to the DOM prior to being called
468
+ // so that the browser will go ahead and load the CSS background images.
469
+ function appendHTML() {
470
+ if (!$box) {
471
+ init = false;
472
+ $window = $(window);
473
+ $box = $tag(div).attr({
474
+ id: colorbox,
475
+ 'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
476
+ role: 'dialog',
477
+ tabindex: '-1'
478
+ }).hide();
479
+ $overlay = $tag(div, "Overlay").hide();
480
+ $loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
481
+ $wrap = $tag(div, "Wrapper");
482
+ $content = $tag(div, "Content").append(
483
+ $title = $tag(div, "Title"),
484
+ $current = $tag(div, "Current"),
485
+ $prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
486
+ $next = $('<button type="button"/>').attr({id:prefix+'Next'}),
487
+ $slideshow = $tag('button', "Slideshow"),
488
+ $loadingOverlay
489
+ );
490
+
491
+ $close = $('<button type="button"/>').attr({id:prefix+'Close'});
492
+
493
+ $wrap.append( // The 3x3 Grid that makes up Colorbox
494
+ $tag(div).append(
495
+ $tag(div, "TopLeft"),
496
+ $topBorder = $tag(div, "TopCenter"),
497
+ $tag(div, "TopRight")
498
+ ),
499
+ $tag(div, false, 'clear:left').append(
500
+ $leftBorder = $tag(div, "MiddleLeft"),
501
+ $content,
502
+ $rightBorder = $tag(div, "MiddleRight")
503
+ ),
504
+ $tag(div, false, 'clear:left').append(
505
+ $tag(div, "BottomLeft"),
506
+ $bottomBorder = $tag(div, "BottomCenter"),
507
+ $tag(div, "BottomRight")
508
+ )
509
+ ).find('div div').css({'float': 'left'});
510
+
511
+ $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
512
+
513
+ $groupControls = $next.add($prev).add($current).add($slideshow);
514
+ }
515
+ if (document.body && !$box.parent().length) {
516
+ $(document.body).append($overlay, $box.append($wrap, $loadingBay));
517
+ }
518
+ }
519
+
520
+ // Add Colorbox's event bindings
521
+ function addBindings() {
522
+ function clickHandler(e) {
523
+ // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
524
+ // See: http://jacklmoore.com/notes/click-events/
525
+ if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
526
+ e.preventDefault();
527
+ launch(this);
528
+ }
529
+ }
530
+
531
+ if ($box) {
532
+ if (!init) {
533
+ init = true;
534
+
535
+ // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
536
+ $next.click(function () {
537
+ publicMethod.next();
538
+ });
539
+ $prev.click(function () {
540
+ publicMethod.prev();
541
+ });
542
+ $close.click(function () {
543
+ publicMethod.close();
544
+ });
545
+ $overlay.click(function () {
546
+ if (settings.get('overlayClose')) {
547
+ publicMethod.close();
548
+ }
549
+ });
550
+
551
+ // Key Bindings
552
+ $(document).bind('keydown.' + prefix, function (e) {
553
+ var key = e.keyCode;
554
+ if (open && settings.get('escKey') && key === 27) {
555
+ e.preventDefault();
556
+ publicMethod.close();
557
+ }
558
+ if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
559
+ if (key === 37) {
560
+ e.preventDefault();
561
+ $prev.click();
562
+ } else if (key === 39) {
563
+ e.preventDefault();
564
+ $next.click();
565
+ }
566
+ }
567
+ });
568
+
569
+ if ($.isFunction($.fn.on)) {
570
+ // For jQuery 1.7+
571
+ $(document).on('click.'+prefix, '.'+boxElement, clickHandler);
572
+ } else {
573
+ // For jQuery 1.3.x -> 1.6.x
574
+ // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
575
+ // This is not here for jQuery 1.9, it's here for legacy users.
576
+ $('.'+boxElement).live('click.'+prefix, clickHandler);
577
+ }
578
+ }
579
+ return true;
580
+ }
581
+ return false;
582
+ }
583
+
584
+ // Don't do anything if Colorbox already exists.
585
+ if ($[colorbox]) {
586
+ return;
587
+ }
588
+
589
+ // Append the HTML when the DOM loads
590
+ $(appendHTML);
591
+
592
+
593
+ // ****************
594
+ // PUBLIC FUNCTIONS
595
+ // Usage format: $.colorbox.close();
596
+ // Usage from within an iframe: parent.jQuery.colorbox.close();
597
+ // ****************
598
+
599
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
600
+ var settings;
601
+ var $obj = this;
602
+
603
+ options = options || {};
604
+
605
+ if ($.isFunction($obj)) { // assume a call to $.colorbox
606
+ $obj = $('<a/>');
607
+ options.open = true;
608
+ }
609
+
610
+ if (!$obj[0]) { // colorbox being applied to empty collection
611
+ return $obj;
612
+ }
613
+
614
+ appendHTML();
615
+
616
+ if (addBindings()) {
617
+
618
+ if (callback) {
619
+ options.onComplete = callback;
620
+ }
621
+
622
+ $obj.each(function () {
623
+ var old = $.data(this, colorbox) || {};
624
+ $.data(this, colorbox, $.extend(old, options));
625
+ }).addClass(boxElement);
626
+
627
+ settings = new Settings($obj[0], options);
628
+
629
+ if (settings.get('open')) {
630
+ launch($obj[0]);
631
+ }
632
+ }
633
+
634
+ return $obj;
635
+ };
636
+
637
+ publicMethod.position = function (speed, loadedCallback) {
638
+ var
639
+ css,
640
+ top = 0,
641
+ left = 0,
642
+ offset = $box.offset(),
643
+ scrollTop,
644
+ scrollLeft;
645
+
646
+ $window.unbind('resize.' + prefix);
647
+
648
+ // remove the modal so that it doesn't influence the document width/height
649
+ $box.css({top: -9e4, left: -9e4});
650
+
651
+ scrollTop = $window.scrollTop();
652
+ scrollLeft = $window.scrollLeft();
653
+
654
+ if (settings.get('fixed')) {
655
+ offset.top -= scrollTop;
656
+ offset.left -= scrollLeft;
657
+ $box.css({position: 'fixed'});
658
+ } else {
659
+ top = scrollTop;
660
+ left = scrollLeft;
661
+ $box.css({position: 'absolute'});
662
+ }
663
+
664
+ // keeps the top and left positions within the browser's viewport.
665
+ if (settings.get('right') !== false) {
666
+ left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
667
+ } else if (settings.get('left') !== false) {
668
+ left += setSize(settings.get('left'), 'x');
669
+ } else {
670
+ left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
671
+ }
672
+
673
+ if (settings.get('bottom') !== false) {
674
+ top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
675
+ } else if (settings.get('top') !== false) {
676
+ top += setSize(settings.get('top'), 'y');
677
+ } else {
678
+ top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
679
+ }
680
+
681
+ $box.css({top: offset.top, left: offset.left, visibility:'visible'});
682
+
683
+ // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
684
+ // but it has to be shrank down around the size of div#colorbox when it's done. If not,
685
+ // it can invoke an obscure IE bug when using iframes.
686
+ $wrap[0].style.width = $wrap[0].style.height = "9999px";
687
+
688
+ function modalDimensions() {
689
+ $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
690
+ $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
691
+ }
692
+
693
+ css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
694
+
695
+ // setting the speed to 0 if the content hasn't changed size or position
696
+ if (speed) {
697
+ var tempSpeed = 0;
698
+ $.each(css, function(i){
699
+ if (css[i] !== previousCSS[i]) {
700
+ tempSpeed = speed;
701
+ return;
702
+ }
703
+ });
704
+ speed = tempSpeed;
705
+ }
706
+
707
+ previousCSS = css;
708
+
709
+ if (!speed) {
710
+ $box.css(css);
711
+ }
712
+
713
+ $box.dequeue().animate(css, {
714
+ duration: speed || 0,
715
+ complete: function () {
716
+ modalDimensions();
717
+
718
+ active = false;
719
+
720
+ // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
721
+ $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
722
+ $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
723
+
724
+ if (settings.get('reposition')) {
725
+ setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
726
+ $window.bind('resize.' + prefix, publicMethod.position);
727
+ }, 1);
728
+ }
729
+
730
+ if ($.isFunction(loadedCallback)) {
731
+ loadedCallback();
732
+ }
733
+ },
734
+ step: modalDimensions
735
+ });
736
+ };
737
+
738
+ publicMethod.resize = function (options) {
739
+ var scrolltop;
740
+
741
+ if (open) {
742
+ options = options || {};
743
+
744
+ if (options.width) {
745
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
746
+ }
747
+
748
+ if (options.innerWidth) {
749
+ settings.w = setSize(options.innerWidth, 'x');
750
+ }
751
+
752
+ $loaded.css({width: settings.w});
753
+
754
+ if (options.height) {
755
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
756
+ }
757
+
758
+ if (options.innerHeight) {
759
+ settings.h = setSize(options.innerHeight, 'y');
760
+ }
761
+
762
+ if (!options.innerHeight && !options.height) {
763
+ scrolltop = $loaded.scrollTop();
764
+ $loaded.css({height: "auto"});
765
+ settings.h = $loaded.height();
766
+ }
767
+
768
+ $loaded.css({height: settings.h});
769
+
770
+ if(scrolltop) {
771
+ $loaded.scrollTop(scrolltop);
772
+ }
773
+
774
+ publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
775
+ }
776
+ };
777
+
778
+ publicMethod.prep = function (object) {
779
+ if (!open) {
780
+ return;
781
+ }
782
+
783
+ var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
784
+
785
+ $loaded.remove();
786
+
787
+ $loaded = $tag(div, 'LoadedContent').append(object);
788
+
789
+ function getWidth() {
790
+ settings.w = settings.w || $loaded.width();
791
+ settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
792
+ return settings.w;
793
+ }
794
+ function getHeight() {
795
+ settings.h = settings.h || $loaded.height();
796
+ settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
797
+ return settings.h;
798
+ }
799
+
800
+ $loaded.hide()
801
+ .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
802
+ .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
803
+ .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
804
+ .prependTo($content);
805
+
806
+ $loadingBay.hide();
807
+
808
+ // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
809
+
810
+ $(photo).css({'float': 'none'});
811
+
812
+ setClass(settings.get('className'));
813
+
814
+ callback = function () {
815
+ var total = $related.length,
816
+ iframe,
817
+ complete;
818
+
819
+ if (!open) {
820
+ return;
821
+ }
822
+
823
+ function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
824
+ if ($.support.opacity === false) {
825
+ $box[0].style.removeAttribute('filter');
826
+ }
827
+ }
828
+
829
+ complete = function () {
830
+ clearTimeout(loadingTimer);
831
+ $loadingOverlay.hide();
832
+ trigger(event_complete);
833
+ settings.get('onComplete');
834
+ };
835
+
836
+
837
+ $title.html(settings.get('title')).show();
838
+ $loaded.show();
839
+
840
+ if (total > 1) { // handle grouping
841
+ if (typeof settings.get('current') === "string") {
842
+ $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
843
+ }
844
+
845
+ $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
846
+ $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
847
+
848
+ slideshow();
849
+
850
+ // Preloads images within a rel group
851
+ if (settings.get('preloading')) {
852
+ $.each([getIndex(-1), getIndex(1)], function(){
853
+ var img,
854
+ i = $related[this],
855
+ settings = new Settings(i, $.data(i, colorbox)),
856
+ src = settings.get('href');
857
+
858
+ if (src && isImage(settings, src)) {
859
+ src = retinaUrl(settings, src);
860
+ img = document.createElement('img');
861
+ img.src = src;
862
+ }
863
+ });
864
+ }
865
+ } else {
866
+ $groupControls.hide();
867
+ }
868
+
869
+ if (settings.get('iframe')) {
870
+
871
+ iframe = settings.get('createIframe');
872
+
873
+ if (!settings.get('scrolling')) {
874
+ iframe.scrolling = "no";
875
+ }
876
+
877
+ $(iframe)
878
+ .attr({
879
+ src: settings.get('href'),
880
+ 'class': prefix + 'Iframe'
881
+ })
882
+ .one('load', complete)
883
+ .appendTo($loaded);
884
+
885
+ $events.one(event_purge, function () {
886
+ iframe.src = "//about:blank";
887
+ });
888
+
889
+ if (settings.get('fastIframe')) {
890
+ $(iframe).trigger('load');
891
+ }
892
+ } else {
893
+ complete();
894
+ }
895
+
896
+ if (settings.get('transition') === 'fade') {
897
+ $box.fadeTo(speed, 1, removeFilter);
898
+ } else {
899
+ removeFilter();
900
+ }
901
+ };
902
+
903
+ if (settings.get('transition') === 'fade') {
904
+ $box.fadeTo(speed, 0, function () {
905
+ publicMethod.position(0, callback);
906
+ });
907
+ } else {
908
+ publicMethod.position(speed, callback);
909
+ }
910
+ };
911
+
912
+ function load () {
913
+ var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
914
+
915
+ active = true;
916
+
917
+ photo = false;
918
+
919
+ trigger(event_purge);
920
+ trigger(event_load);
921
+ settings.get('onLoad');
922
+
923
+ settings.h = settings.get('height') ?
924
+ setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
925
+ settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
926
+
927
+ settings.w = settings.get('width') ?
928
+ setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
929
+ settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
930
+
931
+ // Sets the minimum dimensions for use in image scaling
932
+ settings.mw = settings.w;
933
+ settings.mh = settings.h;
934
+
935
+ // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
936
+ // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
937
+ if (settings.get('maxWidth')) {
938
+ settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
939
+ settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
940
+ }
941
+ if (settings.get('maxHeight')) {
942
+ settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
943
+ settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
944
+ }
945
+
946
+ href = settings.get('href');
947
+
948
+ loadingTimer = setTimeout(function () {
949
+ $loadingOverlay.show();
950
+ }, 100);
951
+
952
+ if (settings.get('inline')) {
953
+ var $target = $(href);
954
+ // Inserts an empty placeholder where inline content is being pulled from.
955
+ // An event is bound to put inline content back when Colorbox closes or loads new content.
956
+ $inline = $('<div>').hide().insertBefore($target);
957
+
958
+ $events.one(event_purge, function () {
959
+ $inline.replaceWith($target);
960
+ });
961
+
962
+ prep($target);
963
+ } else if (settings.get('iframe')) {
964
+ // IFrame element won't be added to the DOM until it is ready to be displayed,
965
+ // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
966
+ prep(" ");
967
+ } else if (settings.get('html')) {
968
+ prep(settings.get('html'));
969
+ } else if (isImage(settings, href)) {
970
+
971
+ href = retinaUrl(settings, href);
972
+
973
+ photo = settings.get('createImg');
974
+
975
+ $(photo)
976
+ .addClass(prefix + 'Photo')
977
+ .bind('error.'+prefix,function () {
978
+ prep($tag(div, 'Error').html(settings.get('imgError')));
979
+ })
980
+ .one('load', function () {
981
+ if (request !== requests) {
982
+ return;
983
+ }
984
+
985
+ // A small pause because some browsers will occassionaly report a
986
+ // img.width and img.height of zero immediately after the img.onload fires
987
+ setTimeout(function(){
988
+ var percent;
989
+
990
+ if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
991
+ photo.height = photo.height / window.devicePixelRatio;
992
+ photo.width = photo.width / window.devicePixelRatio;
993
+ }
994
+
995
+ if (settings.get('scalePhotos')) {
996
+ setResize = function () {
997
+ photo.height -= photo.height * percent;
998
+ photo.width -= photo.width * percent;
999
+ };
1000
+ if (settings.mw && photo.width > settings.mw) {
1001
+ percent = (photo.width - settings.mw) / photo.width;
1002
+ setResize();
1003
+ }
1004
+ if (settings.mh && photo.height > settings.mh) {
1005
+ percent = (photo.height - settings.mh) / photo.height;
1006
+ setResize();
1007
+ }
1008
+ }
1009
+
1010
+ if (settings.h) {
1011
+ photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
1012
+ }
1013
+
1014
+ if ($related[1] && (settings.get('loop') || $related[index + 1])) {
1015
+ photo.style.cursor = 'pointer';
1016
+
1017
+ $(photo).bind('click.'+prefix, function () {
1018
+ publicMethod.next();
1019
+ });
1020
+ }
1021
+
1022
+ photo.style.width = photo.width + 'px';
1023
+ photo.style.height = photo.height + 'px';
1024
+ prep(photo);
1025
+ }, 1);
1026
+ });
1027
+
1028
+ photo.src = href;
1029
+
1030
+ } else if (href) {
1031
+ $loadingBay.load(href, settings.get('data'), function (data, status) {
1032
+ if (request === requests) {
1033
+ prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
1034
+ }
1035
+ });
1036
+ }
1037
+ }
1038
+
1039
+ // Navigates to the next page/image in a set.
1040
+ publicMethod.next = function () {
1041
+ if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
1042
+ index = getIndex(1);
1043
+ launch($related[index]);
1044
+ }
1045
+ };
1046
+
1047
+ publicMethod.prev = function () {
1048
+ if (!active && $related[1] && (settings.get('loop') || index)) {
1049
+ index = getIndex(-1);
1050
+ launch($related[index]);
1051
+ }
1052
+ };
1053
+
1054
+ // Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1055
+ publicMethod.close = function () {
1056
+ if (open && !closing) {
1057
+
1058
+ closing = true;
1059
+ open = false;
1060
+ trigger(event_cleanup);
1061
+ settings.get('onCleanup');
1062
+ $window.unbind('.' + prefix);
1063
+ $overlay.fadeTo(settings.get('fadeOut') || 0, 0);
1064
+
1065
+ $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
1066
+ $box.hide();
1067
+ $overlay.hide();
1068
+ trigger(event_purge);
1069
+ $loaded.remove();
1070
+
1071
+ setTimeout(function () {
1072
+ closing = false;
1073
+ trigger(event_closed);
1074
+ settings.get('onClosed');
1075
+ }, 1);
1076
+ });
1077
+ }
1078
+ };
1079
+
1080
+ // Removes changes Colorbox made to the document, but does not remove the plugin.
1081
+ publicMethod.remove = function () {
1082
+ if (!$box) { return; }
1083
+
1084
+ $box.stop();
1085
+ $[colorbox].close();
1086
+ $box.stop(false, true).remove();
1087
+ $overlay.remove();
1088
+ closing = false;
1089
+ $box = null;
1090
+ $('.' + boxElement)
1091
+ .removeData(colorbox)
1092
+ .removeClass(boxElement);
1093
+
1094
+ $(document).unbind('click.'+prefix).unbind('keydown.'+prefix);
1095
+ };
1096
+
1097
+ // A method for fetching the current element Colorbox is referencing.
1098
+ // returns a jQuery object.
1099
+ publicMethod.element = function () {
1100
+ return $(settings.el);
1101
+ };
1102
+
1103
+ publicMethod.settings = defaults;
1104
+
1105
+ }(jQuery, document, window));
plugin-fw/assets/js/metabox.js CHANGED
@@ -1,354 +1,355 @@
1
- /**
2
- * This file belongs to the YIT Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
- (function ($) {
10
-
11
- $('.metaboxes-tab').each(function () {
12
- $('.tabs-panel', this).hide();
13
-
14
- var active_tab = wpCookies.get('active_metabox_tab');
15
- if (active_tab == null) {
16
- active_tab = $('ul.metaboxes-tabs li:first-child a', this).attr('href');
17
- } else {
18
- active_tab = '#' + active_tab;
19
- }
20
-
21
- $(active_tab).show();
22
-
23
- $('.metaboxes-tabs a', this).click(function (e) {
24
- if ($(this).parent().hasClass('tabs')) {
25
- e.preventDefault();
26
- return;
27
- }
28
-
29
- var t = $(this).attr('href');
30
- $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
31
- $(this).closest('.metaboxes-tab').find('.tabs-panel').slideUp('fast');
32
- $(t).delay(350).slideDown('fast');
33
-
34
- return false;
35
- });
36
- });
37
-
38
- //upload
39
- var _custom_media = true,
40
- _orig_send_attachment = wp.media.editor.send.attachment;
41
-
42
- $(document).on('click', '.metaboxes-tab .upload_button', function(e) {
43
- var send_attachment_bkp = wp.media.editor.send.attachment;
44
- var button = $(this);
45
- if( typeof button.attr('id') != 'undefined' ) {
46
-
47
- var id = button.attr('id').replace('-button', '');
48
- _custom_media = true;
49
- wp.media.editor.send.attachment = function(props, attachment){
50
- if ( _custom_media ) {
51
- if( $("#"+id).is('input[type=text]') ) {
52
- $("#"+id).val(attachment.url);
53
- } else {
54
- $("#"+id + '_custom').val(attachment.url);
55
- }
56
- } else {
57
- return _orig_send_attachment.apply( this, [props, attachment] );
58
- };
59
- }
60
-
61
- wp.media.editor.open(button);
62
- return false;
63
- }
64
-
65
- });
66
-
67
- $('.metaboxes-tab .add_media').on('click', function(){
68
- _custom_media = false;
69
- });
70
-
71
- //colorpicker
72
- $('.metaboxes-tab .panel-colorpicker').wpColorPicker({
73
- onInit: function(){ console.log('test');},
74
- change: function(event, ui){
75
- },
76
- clear: function(){
77
- var input = $(this);
78
- input.val(input.data('default-color'));
79
- input.change();
80
- }
81
- });
82
-
83
-
84
- $('.metaboxes-tab .panel-colorpicker').each( function() {
85
- var select_label = $(this).data('variations-label');
86
- $(this).parent().parent().find('a.wp-color-result').attr('title', select_label);
87
- });
88
-
89
- //datepicker
90
- $('.metaboxes-tab .panel-datepicker').each( function() {
91
- $(this).datepicker();
92
- });
93
-
94
-
95
- // select
96
- var select_value = function() {
97
- var value = '';
98
-
99
- if( $(this).attr('multiple')){
100
- $(this).children("option:selected").each(function(i,v){
101
- if( i != 0)
102
- value += ', ';
103
-
104
- value += $(v).text();
105
- });
106
-
107
- if( value == '' ){
108
- $(this).children().children("option:selected").each(function(i,v){
109
- if( i != 0)
110
- value += ', ';
111
-
112
- value += $(v).text();
113
- });
114
- }
115
- }
116
- else{
117
- value = $(this).children("option:selected").text();
118
-
119
- if( value == '' )
120
- value = $(this).children().children("option:selected").text();
121
- }
122
-
123
-
124
- if ( $(this).parent().find('span').length <= 0 ) {
125
- $(this).before('<span></span>');
126
- }
127
-
128
- $(this).parent().children('span').replaceWith('<span>'+value +'</span>');
129
- };
130
- $('.metaboxes-tab .select_wrapper select').not('.chosen').each(select_value).change(select_value);
131
-
132
- //Open select multiple
133
- $('.metaboxes-tab .select_wrapper').click( function(e){
134
- e.stopPropagation();
135
- $(this).find('select[multiple]').not('.chosen').toggle();
136
- });
137
- //Stops click propagation on select, to prevent select hide
138
- $('.metaboxes-tab .select_wrapper select[multiple]').not('.chosen').click( function(e){
139
- e.stopPropagation();
140
- });
141
- //Hides select on window click
142
- $(window).click(function(){
143
- $('.metaboxes-tab .select_wrapper select[multiple]').not('.chosen').hide();
144
- })
145
-
146
- //on-off
147
- $('.metaboxes-tab .onoff_container span').on('click', function(){
148
-
149
- var input = $( this ).prev( 'input' );
150
- var checked = input.prop( 'checked' );
151
-
152
- if( checked ) {
153
- input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass('onoffchecked');
154
- } else {
155
- input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass('onoffchecked');
156
- }
157
-
158
- input.change();
159
- });
160
-
161
- //chosen
162
- $('.metaboxes-tab .chosen .select_wrapper select').chosen();
163
-
164
-
165
- $('.metaboxes-tab .slider_container .ui-slider-horizontal').each(function(){
166
- var val = $(this).data('val');
167
- var minValue = $(this).data('min');
168
- var maxValue = $(this).data('max');
169
- var step = $(this).data('step');
170
- var labels = $(this).data('labels');
171
-
172
- $(this).slider({
173
- value: val,
174
- min: minValue,
175
- max: maxValue,
176
- range: 'min',
177
- step: step,
178
-
179
- slide: function( event, ui ) {
180
- $(this).find('input').val( ui.value );
181
- $(this).siblings('.feedback').find('strong' ).text( ui.value + labels );
182
- }
183
- });
184
- });
185
-
186
-
187
- var act_page_option = $('#_active_page_options-container').parent().html();
188
- $('#_active_page_options-container').parent().remove();
189
- $(act_page_option).insertAfter('#yit-post-setting .handlediv');
190
- $(act_page_option).insertAfter('#yit-page-setting .handlediv');
191
-
192
-
193
- $('#_active_page_options-container').on('click', function(){
194
- if( $('#_active_page_options').is(":checked") ){
195
- $('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 1 , 'pointer-events' : 'auto' } );
196
- }else{
197
- $('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 0.5 , 'pointer-events' : 'none' } );
198
- }
199
- }).click();
200
-
201
-
202
- //dependencies handler
203
- $('.metaboxes-tab [data-field]').each(function(){
204
- var t = $(this);
205
-
206
- var field = '#' + t.data('field'),
207
- dep = '#' + t.data('dep'),
208
- value = t.data('value');
209
-
210
-
211
- dependencies_handler( field, dep, value.toString() );
212
-
213
- $(dep).on('change', function(){
214
- dependencies_handler( field, dep, value.toString() );
215
- }).change();
216
- });
217
-
218
- //Handle dependencies.
219
- function dependencies_handler ( id, deps, values ) {
220
- var result = true;
221
-
222
-
223
- //Single dependency
224
- if( typeof( deps ) == 'string' ) {
225
- if( deps.substr( 0, 6 ) == ':radio' )
226
- {deps = deps + ':checked'; }
227
-
228
- var val = $( deps ).val();
229
-
230
- if( $(deps).attr('type') == 'checkbox'){
231
- var thisCheck = $(deps);
232
- if ( thisCheck.is ( ':checked' ) ) {
233
- val = 'yes';
234
- }
235
- else {
236
- val = 'no';
237
- }
238
- }
239
-
240
- var values = values.split( ',' );
241
-
242
- for( var i = 0; i < values.length; i++ ) {
243
- if( val != values[i] )
244
- { result = false; }
245
- else
246
- { result = true; break; }
247
- }
248
- }
249
-
250
- if( !result ) {
251
- $( id + '-container' ).parent().hide();
252
- } else {
253
- $( id + '-container' ).parent().show();
254
- }
255
- };
256
-
257
- // Image gallery
258
- $(document).on('click', '.image-gallery-button', function (e) {
259
- var $t = $(this),
260
- $container = $t.closest('.image-gallery'),
261
- $image_gallery_ids = $container.find('.image_gallery_ids'),
262
- attachment_ids = $image_gallery_ids.val(),
263
- $gallery_images_wrapper = $container.find('ul.slides-wrapper');
264
-
265
-
266
- // Create the media frame.
267
- var image_gallery_frame = wp.media.frames.image_gallery = wp.media({
268
- // Set the title of the modal.
269
- title : $t.data('choose'),
270
- button: {
271
- text: $t.data('update')
272
- },
273
- states: [
274
- new wp.media.controller.Library({
275
- title : $t.data('choose'),
276
- filterable: 'all',
277
- multiple : true
278
- })
279
- ]
280
- });
281
-
282
- // When an image is selected, run a callback.
283
- image_gallery_frame.on('select', function () {
284
- var selection = image_gallery_frame.state().get('selection');
285
- selection.map(function (attachment) {
286
- attachment = attachment.toJSON();
287
-
288
- if (attachment.id) {
289
- attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
290
- $gallery_images_wrapper.append('<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data('delete') + '">x</a></li></ul></li>');
291
- }
292
- });
293
-
294
- $image_gallery_ids.val(attachment_ids);
295
- });
296
-
297
- image_gallery_frame.open();
298
-
299
- });
300
-
301
- // Image ordering
302
- $('.image-gallery ul.slides-wrapper').each(function(){
303
- var $t = $(this);
304
- $t.sortable({
305
- items : 'li.image',
306
- cursor : 'move',
307
- scrollSensitivity : 40,
308
- forcePlaceholderSize: true,
309
- forceHelperSize : false,
310
- helper : 'clone',
311
- opacity : 0.65,
312
- start : function (event, ui) {
313
- ui.item.css('background-color', '#f6f6f6');
314
- },
315
- stop : function (event, ui) {
316
- ui.item.removeAttr('style');
317
- },
318
- update : function (event, ui) {
319
- var attachment_ids = '';
320
-
321
- $t.find('li.image').css('cursor', 'default').each(function () {
322
- var attachment_id = $(this).attr('data-attachment_id');
323
- attachment_ids = attachment_ids + attachment_id + ',';
324
- });
325
-
326
- $t.closest('.image-gallery').find('.image_gallery_ids').val(attachment_ids);
327
- }
328
- });
329
- });
330
-
331
- // Remove images
332
- $('.image-gallery ul.slides-wrapper').on( 'click', 'a.delete', function() {
333
-
334
- var $wrapper = $(this).closest('.image-gallery'),
335
- $gallery = $(this).closest('.image-gallery ul.slides-wrapper'),
336
- $image_gallery_ids = $wrapper.find('.image_gallery_ids'),
337
- attachment_ids = '';
338
-
339
- $(this).closest('li.image').remove();
340
-
341
- $gallery.find('li.image').css('cursor','default').each(function() {
342
- var attachment_id = $(this).attr( 'data-attachment_id' );
343
- attachment_ids = attachment_ids + attachment_id + ',';
344
- });
345
-
346
- $image_gallery_ids.val( attachment_ids );
347
-
348
- return false;
349
- });
350
-
351
-
352
-
353
-
 
354
  })(jQuery);
1
+ /**
2
+ * This file belongs to the YIT Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+ (function ($) {
10
+
11
+ $('.metaboxes-tab').each(function () {
12
+ $('.tabs-panel', this).hide();
13
+
14
+ var active_tab = wpCookies.get('active_metabox_tab');
15
+ if (active_tab == null) {
16
+ active_tab = $('ul.metaboxes-tabs li:first-child a', this).attr('href');
17
+ } else {
18
+ active_tab = '#' + active_tab;
19
+ }
20
+
21
+ $(active_tab).show();
22
+
23
+ $('.metaboxes-tabs a', this).click(function (e) {
24
+ if ($(this).parent().hasClass('tabs')) {
25
+ e.preventDefault();
26
+ return;
27
+ }
28
+
29
+ var t = $(this).attr('href');
30
+ $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
31
+ $(this).closest('.metaboxes-tab').find('.tabs-panel').slideUp('fast');
32
+ $(t).delay(350).slideDown('fast');
33
+
34
+ return false;
35
+ });
36
+ });
37
+
38
+ //upload
39
+ var _custom_media = true,
40
+ _orig_send_attachment = wp.media.editor.send.attachment;
41
+
42
+ $(document).on('click', '.metaboxes-tab .upload_button', function(e) {
43
+ var send_attachment_bkp = wp.media.editor.send.attachment;
44
+ var button = $(this);
45
+ if( typeof button.attr('id') != 'undefined' ) {
46
+
47
+ var id = button.attr('id').replace('-button', '');
48
+ _custom_media = true;
49
+ wp.media.editor.send.attachment = function(props, attachment){
50
+ if ( _custom_media ) {
51
+ if( $("#"+id).is('input[type=text]') ) {
52
+ $("#"+id).val(attachment.url);
53
+ } else {
54
+ $("#"+id + '_custom').val(attachment.url);
55
+ }
56
+ } else {
57
+ return _orig_send_attachment.apply( this, [props, attachment] );
58
+ };
59
+ }
60
+
61
+ wp.media.editor.open(button);
62
+ return false;
63
+ }
64
+
65
+ });
66
+
67
+ $('.metaboxes-tab .add_media').on('click', function(){
68
+ _custom_media = false;
69
+ });
70
+
71
+ //colorpicker
72
+ $('.metaboxes-tab .panel-colorpicker').wpColorPicker({
73
+ onInit: function(){ console.log('test');},
74
+ change: function(event, ui){
75
+ },
76
+ clear: function(){
77
+ var input = $(this);
78
+ input.val(input.data('default-color'));
79
+ input.change();
80
+ }
81
+ });
82
+
83
+
84
+ $('.metaboxes-tab .panel-colorpicker').each( function() {
85
+ var select_label = $(this).data('variations-label');
86
+ $(this).parent().parent().find('a.wp-color-result').attr('title', select_label);
87
+ });
88
+
89
+ //datepicker
90
+ $('.metaboxes-tab .panel-datepicker').each( function() {
91
+ $(this).datepicker();
92
+ });
93
+
94
+
95
+ // select
96
+ var select_value = function() {
97
+ var value = '';
98
+
99
+ if( $(this).attr('multiple')){
100
+ $(this).children("option:selected").each(function(i,v){
101
+ if( i != 0)
102
+ value += ', ';
103
+
104
+ value += $(v).text();
105
+ });
106
+
107
+ if( value == '' ){
108
+ $(this).children().children("option:selected").each(function(i,v){
109
+ if( i != 0)
110
+ value += ', ';
111
+
112
+ value += $(v).text();
113
+ });
114
+ }
115
+ }
116
+ else{
117
+ value = $(this).children("option:selected").text();
118
+
119
+ if( value == '' )
120
+ value = $(this).children().children("option:selected").text();
121
+ }
122
+
123
+
124
+ if ( $(this).parent().find('span').length <= 0 ) {
125
+ $(this).before('<span></span>');
126
+ }
127
+
128
+ $(this).parent().children('span').replaceWith('<span>'+value +'</span>');
129
+ };
130
+ $('.metaboxes-tab .select_wrapper select').not('.chosen').each(select_value).change(select_value);
131
+
132
+ //Open select multiple
133
+ $('.metaboxes-tab .select_wrapper').click( function(e){
134
+ e.stopPropagation();
135
+ $(this).find('select[multiple]').not('.chosen').toggle();
136
+ });
137
+ //Stops click propagation on select, to prevent select hide
138
+ $('.metaboxes-tab .select_wrapper select[multiple]').not('.chosen').click( function(e){
139
+ e.stopPropagation();
140
+ });
141
+ //Hides select on window click
142
+ $(window).click(function(){
143
+ $('.metaboxes-tab .select_wrapper select[multiple]').not('.chosen').hide();
144
+ })
145
+
146
+ //chosen
147
+ $('.metaboxes-tab .chosen .select_wrapper select').chosen();
148
+
149
+
150
+ $('.metaboxes-tab .slider_container .ui-slider-horizontal').each(function(){
151
+ var val = $(this).data('val');
152
+ var minValue = $(this).data('min');
153
+ var maxValue = $(this).data('max');
154
+ var step = $(this).data('step');
155
+ var labels = $(this).data('labels');
156
+
157
+ $(this).slider({
158
+ value: val,
159
+ min: minValue,
160
+ max: maxValue,
161
+ range: 'min',
162
+ step: step,
163
+
164
+ slide: function( event, ui ) {
165
+ $(this).find('input').val( ui.value );
166
+ $(this).siblings('.feedback').find('strong' ).text( ui.value + labels );
167
+ }
168
+ });
169
+ });
170
+
171
+
172
+ var act_page_option = $('#_active_page_options-container').parent().html();
173
+ $('#_active_page_options-container').parent().remove();
174
+ $(act_page_option).insertAfter('#yit-post-setting .handlediv');
175
+ $(act_page_option).insertAfter('#yit-page-setting .handlediv');
176
+
177
+
178
+ $('#_active_page_options-container').on('click', function(){
179
+ if( $('#_active_page_options').is(":checked") ){
180
+ $('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 1 , 'pointer-events' : 'auto' } );
181
+ }else{
182
+ $('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 0.5 , 'pointer-events' : 'none' } );
183
+ }
184
+ }).click();
185
+
186
+
187
+ //dependencies handler
188
+ $('.metaboxes-tab [data-field]').each(function(){
189
+ var t = $(this);
190
+
191
+ var field = '#' + t.data('field'),
192
+ dep = '#' + t.data('dep'),
193
+ value = t.data('value');
194
+
195
+
196
+ dependencies_handler( field, dep, value.toString() );
197
+
198
+ $(dep).on('change', function(){
199
+ dependencies_handler( field, dep, value.toString() );
200
+ }).change();
201
+ });
202
+
203
+ //Handle dependencies.
204
+ function dependencies_handler ( id, deps, values ) {
205
+ var result = true;
206
+
207
+
208
+ //Single dependency
209
+ if( typeof( deps ) == 'string' ) {
210
+ if( deps.substr( 0, 6 ) == ':radio' )
211
+ {deps = deps + ':checked'; }
212
+
213
+ var val = $( deps ).val();
214
+
215
+ if( $(deps).attr('type') == 'checkbox'){
216
+ var thisCheck = $(deps);
217
+ if ( thisCheck.is ( ':checked' ) ) {
218
+ val = 'yes';
219
+ }
220
+ else {
221
+ val = 'no';
222
+ }
223
+ }
224
+
225
+ var values = values.split( ',' );
226
+
227
+ for( var i = 0; i < values.length; i++ ) {
228
+ if( val != values[i] )
229
+ { result = false; }
230
+ else
231
+ { result = true; break; }
232
+ }
233
+ }
234
+
235
+ if( !result ) {
236
+ $( id + '-container' ).parent().hide();
237
+ } else {
238
+ $( id + '-container' ).parent().show();
239
+ }
240
+ };
241
+
242
+ // Image gallery
243
+ $(document).on('click', '.image-gallery-button', function (e) {
244
+ var $t = $(this),
245
+ $container = $t.closest('.image-gallery'),
246
+ $image_gallery_ids = $container.find('.image_gallery_ids'),
247
+ attachment_ids = $image_gallery_ids.val(),
248
+ $gallery_images_wrapper = $container.find('ul.slides-wrapper');
249
+
250
+
251
+ // Create the media frame.
252
+ var image_gallery_frame = wp.media.frames.image_gallery = wp.media({
253
+ // Set the title of the modal.
254
+ title : $t.data('choose'),
255
+ button: {
256
+ text: $t.data('update')
257
+ },
258
+ states: [
259
+ new wp.media.controller.Library({
260
+ title : $t.data('choose'),
261
+ filterable: 'all',
262
+ multiple : true
263
+ })
264
+ ]
265
+ });
266
+
267
+ // When an image is selected, run a callback.
268
+ image_gallery_frame.on('select', function () {
269
+ var selection = image_gallery_frame.state().get('selection');
270
+ selection.map(function (attachment) {
271
+ attachment = attachment.toJSON();
272
+
273
+ if (attachment.id) {
274
+ attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
275
+ $gallery_images_wrapper.append('<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data('delete') + '">x</a></li></ul></li>');
276
+ }
277
+ });
278
+
279
+ $image_gallery_ids.val(attachment_ids);
280
+ });
281
+
282
+ image_gallery_frame.open();
283
+
284
+ });
285
+
286
+ // Image ordering
287
+ $('.image-gallery ul.slides-wrapper').each(function(){
288
+ var $t = $(this);
289
+ $t.sortable({
290
+ items : 'li.image',
291
+ cursor : 'move',
292
+ scrollSensitivity : 40,
293
+ forcePlaceholderSize: true,
294
+ forceHelperSize : false,
295
+ helper : 'clone',
296
+ opacity : 0.65,
297
+ start : function (event, ui) {
298
+ ui.item.css('background-color', '#f6f6f6');
299
+ },
300
+ stop : function (event, ui) {
301
+ ui.item.removeAttr('style');
302
+ },
303
+ update : function (event, ui) {
304
+ var attachment_ids = '';
305
+
306
+ $t.find('li.image').css('cursor', 'default').each(function () {
307
+ var attachment_id = $(this).attr('data-attachment_id');
308
+ attachment_ids = attachment_ids + attachment_id + ',';
309
+ });
310
+
311
+ $t.closest('.image-gallery').find('.image_gallery_ids').val(attachment_ids);
312
+ }
313
+ });
314
+ });
315
+
316
+ // Remove images
317
+ $('.image-gallery ul.slides-wrapper').on( 'click', 'a.delete', function() {
318
+
319
+ var $wrapper = $(this).closest('.image-gallery'),
320
+ $gallery = $(this).closest('.image-gallery ul.slides-wrapper'),
321
+ $image_gallery_ids = $wrapper.find('.image_gallery_ids'),
322
+ attachment_ids = '';
323
+
324
+ $(this).closest('li.image').remove();
325
+
326
+ $gallery.find('li.image').css('cursor','default').each(function() {
327
+ var attachment_id = $(this).attr( 'data-attachment_id' );
328
+ attachment_ids = attachment_ids + attachment_id + ',';
329
+ });
330
+
331
+ $image_gallery_ids.val( attachment_ids );
332
+
333
+ return false;
334
+ });
335
+
336
+
337
+ //on-off
338
+ $('.the-metabox .rm_onoff.onoff_container span').on('click', function(ev){
339
+
340
+ var input = $( this ).prev( 'input' );
341
+ var checked = input.prop( 'checked' );
342
+
343
+ if( checked ) {
344
+ input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass('onoffchecked');
345
+ } else {
346
+ input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass('onoffchecked');
347
+ }
348
+
349
+ input.change();
350
+ });
351
+
352
+
353
+
354
+
355
  })(jQuery);
plugin-fw/assets/js/metabox.min.js CHANGED
@@ -1,11 +1,11 @@
1
  (function(a){function k(b,c,d){var e=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var g=a(c).val();"checkbox"==a(c).attr("type")&&(g=a(c).is(":checked")?"yes":"no");d=d.split(",");for(c=0;c<d.length;c++)if(g!=d[c])e=!1;else{e=!0;break}}e?a(b+"-container").parent().show():a(b+"-container").parent().hide()}a(".metaboxes-tab").each(function(){a(".tabs-panel",this).hide();var b=wpCookies.get("active_metabox_tab"),b=null==b?a("ul.metaboxes-tabs li:first-child a",this).attr("href"):
2
- "#"+b;a(b).show();a(".metaboxes-tabs a",this).click(function(b){if(a(this).parent().hasClass("tabs"))b.preventDefault();else return b=a(this).attr("href"),a(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),a(this).closest(".metaboxes-tab").find(".tabs-panel").slideUp("fast"),a(b).delay(350).slideDown("fast"),!1})});var h=!0,l=wp.media.editor.send.attachment;a(document).on("click",".metaboxes-tab .upload_button",function(b){b=a(this);var c=b.attr("id").replace("-button","");h=!0;
3
- wp.media.editor.send.attachment=function(b,e){if(h)a("#"+c).is("input[type=text]")?a("#"+c).val(e.url):a("#"+c+"_custom").val(e.url);else return l.apply(this,[b,e])};wp.media.editor.open(b);return!1});a(".metaboxes-tab .add_media").on("click",function(){h=!1});a(".metaboxes-tab .panel-colorpicker").wpColorPicker({onInit:function(){console.log("test")},change:function(a,c){},clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});a(".metaboxes-tab .panel-colorpicker").each(function(){var b=
4
  a(this).data("variations-label");a(this).parent().parent().find("a.wp-color-result").attr("title",b)});a(".metaboxes-tab .panel-datepicker").each(function(){a(this).datepicker()});var f=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));
5
  0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+"</span>")};a(".metaboxes-tab .select_wrapper select").not(".chosen").each(f).change(f);a(".metaboxes-tab .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".metaboxes-tab .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".metaboxes-tab .select_wrapper select[multiple]").not(".chosen").hide()});
6
- a(".metaboxes-tab .onoff_container span").on("click",function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a(".metaboxes-tab .chosen .select_wrapper select").chosen();a(".metaboxes-tab .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),g=a(this).data("labels");
7
- a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);a(this).siblings(".feedback").find("strong").text(c.value+g)}})});f=a("#_active_page_options-container").parent().html();a("#_active_page_options-container").parent().remove();a(f).insertAfter("#yit-post-setting .handlediv");a(f).insertAfter("#yit-page-setting .handlediv");a("#_active_page_options-container").on("click",function(){a("#_active_page_options").is(":checked")?a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:1,
8
- "pointer-events":"auto"}):a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:.5,"pointer-events":"none"})}).click();a(".metaboxes-tab [data-field]").each(function(){var b=a(this),c="#"+b.data("field"),d="#"+b.data("dep"),e=b.data("value");k(c,d,e.toString());a(d).on("change",function(){k(c,d,e.toString())}).change()});a(document).on("click",".image-gallery-button",function(b){var c=a(this);b=c.closest(".image-gallery");var d=b.find(".image_gallery_ids"),
9
- e=d.val(),g=b.find("ul.slides-wrapper"),f=wp.media.frames.image_gallery=wp.media({title:c.data("choose"),button:{text:c.data("update")},states:[new wp.media.controller.Library({title:c.data("choose"),filterable:"all",multiple:!0})]});f.on("select",function(){f.state().get("selection").map(function(a){a=a.toJSON();a.id&&(e=e?e+","+a.id:a.id,g.append('<li class="image" data-attachment_id="'+a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+c.data("delete")+
10
- '">x</a></li></ul></li>'))});d.val(e)});f.open()});a(".image-gallery ul.slides-wrapper").each(function(){var b=a(this);b.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(c,d){var e="";b.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");e=e+b+","});
11
- b.closest(".image-gallery").find(".image_gallery_ids").val(e)}})});a(".image-gallery ul.slides-wrapper").on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),c=a(this).closest(".image-gallery ul.slides-wrapper"),b=b.find(".image_gallery_ids"),d="";a(this).closest("li.image").remove();c.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");d=d+b+","});b.val(d);return!1})})(jQuery);
1
  (function(a){function k(b,c,d){var e=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var g=a(c).val();"checkbox"==a(c).attr("type")&&(g=a(c).is(":checked")?"yes":"no");d=d.split(",");for(c=0;c<d.length;c++)if(g!=d[c])e=!1;else{e=!0;break}}e?a(b+"-container").parent().show():a(b+"-container").parent().hide()}a(".metaboxes-tab").each(function(){a(".tabs-panel",this).hide();var b=wpCookies.get("active_metabox_tab"),b=null==b?a("ul.metaboxes-tabs li:first-child a",this).attr("href"):
2
+ "#"+b;a(b).show();a(".metaboxes-tabs a",this).click(function(b){if(a(this).parent().hasClass("tabs"))b.preventDefault();else return b=a(this).attr("href"),a(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),a(this).closest(".metaboxes-tab").find(".tabs-panel").slideUp("fast"),a(b).delay(350).slideDown("fast"),!1})});var h=!0,l=wp.media.editor.send.attachment;a(document).on("click",".metaboxes-tab .upload_button",function(b){b=a(this);if("undefined"!=typeof b.attr("id")){var c=b.attr("id").replace("-button",
3
+ "");h=!0;wp.media.editor.send.attachment=function(b,e){if(h)a("#"+c).is("input[type=text]")?a("#"+c).val(e.url):a("#"+c+"_custom").val(e.url);else return l.apply(this,[b,e])};wp.media.editor.open(b);return!1}});a(".metaboxes-tab .add_media").on("click",function(){h=!1});a(".metaboxes-tab .panel-colorpicker").wpColorPicker({onInit:function(){console.log("test")},change:function(a,c){},clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});a(".metaboxes-tab .panel-colorpicker").each(function(){var b=
4
  a(this).data("variations-label");a(this).parent().parent().find("a.wp-color-result").attr("title",b)});a(".metaboxes-tab .panel-datepicker").each(function(){a(this).datepicker()});var f=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));
5
  0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+"</span>")};a(".metaboxes-tab .select_wrapper select").not(".chosen").each(f).change(f);a(".metaboxes-tab .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".metaboxes-tab .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".metaboxes-tab .select_wrapper select[multiple]").not(".chosen").hide()});
6
+ a(".metaboxes-tab .chosen .select_wrapper select").chosen();a(".metaboxes-tab .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),g=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);a(this).siblings(".feedback").find("strong").text(c.value+g)}})});f=a("#_active_page_options-container").parent().html();a("#_active_page_options-container").parent().remove();
7
+ a(f).insertAfter("#yit-post-setting .handlediv");a(f).insertAfter("#yit-page-setting .handlediv");a("#_active_page_options-container").on("click",function(){a("#_active_page_options").is(":checked")?a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:1,"pointer-events":"auto"}):a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:.5,"pointer-events":"none"})}).click();a(".metaboxes-tab [data-field]").each(function(){var b=
8
+ a(this),c="#"+b.data("field"),d="#"+b.data("dep"),e=b.data("value");k(c,d,e.toString());a(d).on("change",function(){k(c,d,e.toString())}).change()});a(document).on("click",".image-gallery-button",function(b){var c=a(this);b=c.closest(".image-gallery");var d=b.find(".image_gallery_ids"),e=d.val(),g=b.find("ul.slides-wrapper"),f=wp.media.frames.image_gallery=wp.media({title:c.data("choose"),button:{text:c.data("update")},states:[new wp.media.controller.Library({title:c.data("choose"),filterable:"all",
9
+ multiple:!0})]});f.on("select",function(){f.state().get("selection").map(function(a){a=a.toJSON();a.id&&(e=e?e+","+a.id:a.id,g.append('<li class="image" data-attachment_id="'+a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+c.data("delete")+'">x</a></li></ul></li>'))});d.val(e)});f.open()});a(".image-gallery ul.slides-wrapper").each(function(){var b=a(this);b.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,
10
+ forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(c,d){var e="";b.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");e=e+b+","});b.closest(".image-gallery").find(".image_gallery_ids").val(e)}})});a(".image-gallery ul.slides-wrapper").on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),c=a(this).closest(".image-gallery ul.slides-wrapper"),
11
+ b=b.find(".image_gallery_ids"),d="";a(this).closest("li.image").remove();c.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");d=d+b+","});b.val(d);return!1});a(".the-metabox .rm_onoff.onoff_container span").on("click",function(b){b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()})})(jQuery);
plugin-fw/assets/js/multisite-updater.js CHANGED
@@ -1,216 +1,216 @@
1
- /**
2
- * This file belongs to the YIT Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
- (function ($) {
10
-
11
- var plugins_menu_item = $( '#menu-plugins' ),
12
- update = plugins_menu_item.find('.update-plugins'),
13
- count = update.find(".update-count").text(),
14
- registered = plugins.registered,
15
- activated = plugins.activated;
16
-
17
- if( count == 0 || count == ''){
18
- var update_row = '<span class="update-plugins"><span class="plugin-count"></span></span>';
19
- count = 0;
20
- plugins_menu_item.find( '.wp-menu-name').append( update_row );
21
- }
22
-
23
- /**
24
- * Add the plugin update rows for old plugins
25
- */
26
- update_plugins_row( registered, activated, count, plugins );
27
-
28
- /**
29
- *
30
- * Add the update plugin rows for old plugin
31
- *
32
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
33
- *
34
- * @param registered Registred plugins
35
- * @param activated Activated plugins
36
- * @param count Number of old plugins
37
- * @param localize Localize strings array
38
- *
39
- * @return void
40
- */
41
- function update_plugins_row( registered, activated, count, localize ){
42
- for( var init in registered ){
43
- var plugin = registered[init];
44
- for( var headers in plugin ){
45
-
46
- if( headers == 'slug' || version_compare( plugin[headers].Version, plugin[headers].Latest, '>=' ) ) {
47
- continue;
48
- }
49
-
50
- count = parseInt(count) + 1;
51
- $(".plugin-count").empty().html(count);
52
-
53
- var regex = new RegExp(' ', 'g'),
54
- info = plugin[headers],
55
- name = '' + info.Name,
56
- id = name.replace(regex, '-').trim(),
57
- row = '#' + id.toLowerCase();
58
-
59
- $(row).addClass("update");
60
-
61
- var html = '<tr class="plugin-update-tr">' +
62
- '<td colspan="3" class="plugin-update colspanchange">' +
63
- '<div class="update-message">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
64
- '<a class="thickbox" href="' + localize.details_url[init] + '">' + localize.strings.latest.replace( '%latest%', plugin[headers].Latest ) + '</a>';
65
-
66
- if( typeof activated[init] == "undefined" ) {
67
-
68
- html = html +
69
- ' <em>' + localize.strings.unavailable + '</em>' +
70
- localize.strings.activate.replace( '%activate_link%', localize.licence_activation_url ).replace( '%plugin_name%', name );
71
- } else {
72
- html = html +
73
- '. <a href="' + localize.update_url[init] + '">' + localize.strings.update_now + '</a>';
74
- }
75
-
76
- if( typeof localize.changelogs[init] != 'undefined' ){
77
- html = html + localize.changelogs[init];
78
- }
79
-
80
- html = html +
81
- '</div>' +
82
- '</td>' +
83
- '</tr>';
84
-
85
- $(html).insertAfter(row);
86
- }
87
- }
88
- }
89
-
90
- /**
91
- *
92
- * @param v1 Version 1
93
- * @param v2 Version 2
94
- * @param operator Compare type
95
- * @returns bool
96
- *
97
- * @see php.js library http://phpjs.org/
98
- */
99
- function version_compare(v1, v2, operator) {
100
- // discuss at: http://phpjs.org/functions/version_compare/
101
- // original by: Philippe Jausions (http://pear.php.net/user/jausions)
102
- // original by: Aidan Lister (http://aidanlister.com/)
103
- // reimplemented by: Kankrelune (http://www.webfaktory.info/)
104
- // improved by: Brett Zamir (http://brett-zamir.me)
105
- // improved by: Scott Baker
106
- // improved by: Theriault
107
- // example 1: version_compare('8.2.5rc', '8.2.5a');
108
- // returns 1: 1
109
- // example 2: version_compare('8.2.50', '8.2.52', '<');
110
- // returns 2: true
111
- // example 3: version_compare('5.3.0-dev', '5.3.0');
112
- // returns 3: -1
113
- // example 4: version_compare('4.1.0.52','4.01.0.51');
114
- // returns 4: 1
115
-
116
- this.php_js = this.php_js || {};
117
- this.php_js.ENV = this.php_js.ENV || {};
118
- // END REDUNDANT
119
- // Important: compare must be initialized at 0.
120
- var i = 0,
121
- x = 0,
122
- compare = 0,
123
- // vm maps textual PHP versions to negatives so they're less than 0.
124
- // PHP currently defines these as CASE-SENSITIVE. It is important to
125
- // leave these as negatives so that they can come before numerical versions
126
- // and as if no letters were there to begin with.
127
- // (1alpha is < 1 and < 1.1 but > 1dev1)
128
- // If a non-numerical value can't be mapped to this table, it receives
129
- // -7 as its value.
130
- vm = {
131
- 'dev' : -6,
132
- 'alpha': -5,
133
- 'a' : -5,
134
- 'beta' : -4,
135
- 'b' : -4,
136
- 'RC' : -3,
137
- 'rc' : -3,
138
- '#' : -2,
139
- 'p' : 1,
140
- 'pl' : 1
141
- },
142
- // This function will be called to prepare each version argument.
143
- // It replaces every _, -, and + with a dot.
144
- // It surrounds any nonsequence of numbers/dots with dots.
145
- // It replaces sequences of dots with a single dot.
146
- // version_compare('4..0', '4.0') == 0
147
- // Important: A string of 0 length needs to be converted into a value
148
- // even less than an unexisting value in vm (-7), hence [-8].
149
- // It's also important to not strip spaces because of this.
150
- // version_compare('', ' ') == 1
151
- prepVersion = function (v) {
152
- v = ('' + v)
153
- .replace(/[_\-+]/g, '.');
154
- v = v.replace(/([^.\d]+)/g, '.$1.')
155
- .replace(/\.{2,}/g, '.');
156
- return (!v.length ? [-8] : v.split('.'));
157
- };
158
- // This converts a version component to a number.
159
- // Empty component becomes 0.
160
- // Non-numerical component becomes a negative number.
161
- // Numerical component becomes itself as an integer.
162
- numVersion = function (v) {
163
- return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
164
- };
165
- v1 = prepVersion(v1);
166
- v2 = prepVersion(v2);
167
- x = Math.max(v1.length, v2.length);
168
- for (i = 0; i < x; i++) {
169
- if (v1[i] == v2[i]) {
170
- continue;
171
- }
172
- v1[i] = numVersion(v1[i]);
173
- v2[i] = numVersion(v2[i]);
174
- if (v1[i] < v2[i]) {
175
- compare = -1;
176
- break;
177
- } else if (v1[i] > v2[i]) {
178
- compare = 1;
179
- break;
180
- }
181
- }
182
- if (!operator) {
183
- return compare;
184
- }
185
-
186
- // Important: operator is CASE-SENSITIVE.
187
- // "No operator" seems to be treated as "<."
188
- // Any other values seem to make the function return null.
189
- switch (operator) {
190
- case '>':
191
- case 'gt':
192
- return (compare > 0);
193
- case '>=':
194
- case 'ge':
195
- return (compare >= 0);
196
- case '<=':
197
- case 'le':
198
- return (compare <= 0);
199
- case '==':
200
- case '=':
201
- case 'eq':
202
- return (compare === 0);
203
- case '<>':
204
- case '!=':
205
- case 'ne':
206
- return (compare !== 0);
207
- case '':
208
- case '<':
209
- case 'lt':
210
- return (compare < 0);
211
- default:
212
- return null;
213
- }
214
- }
215
-
216
- })(jQuery);
1
+ /**
2
+ * This file belongs to the YIT Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+ (function ($) {
10
+
11
+ var plugins_menu_item = $( '#menu-plugins' ),
12
+ update = plugins_menu_item.find('.update-plugins'),
13
+ count = update.find(".update-count").text(),
14
+ registered = plugins.registered,
15
+ activated = plugins.activated;
16
+
17
+ if( count == 0 || count == ''){
18
+ var update_row = '<span class="update-plugins"><span class="plugin-count"></span></span>';
19
+ count = 0;
20
+ plugins_menu_item.find( '.wp-menu-name').append( update_row );
21
+ }
22
+
23
+ /**
24
+ * Add the plugin update rows for old plugins
25
+ */
26
+ update_plugins_row( registered, activated, count, plugins );
27
+
28
+ /**
29
+ *
30
+ * Add the update plugin rows for old plugin
31
+ *
32
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
33
+ *
34
+ * @param registered Registred plugins
35
+ * @param activated Activated plugins
36
+ * @param count Number of old plugins
37
+ * @param localize Localize strings array
38
+ *
39
+ * @return void
40
+ */
41
+ function update_plugins_row( registered, activated, count, localize ){
42
+ for( var init in registered ){
43
+ var plugin = registered[init];
44
+ for( var headers in plugin ){
45
+
46
+ if( headers == 'slug' || version_compare( plugin[headers].Version, plugin[headers].Latest, '>=' ) ) {
47
+ continue;
48
+ }
49
+
50
+ count = parseInt(count) + 1;
51
+ $(".plugin-count").empty().html(count);
52
+
53
+ var regex = new RegExp(' ', 'g'),
54
+ info = plugin[headers],
55
+ name = '' + info.Name,
56
+ id = name.replace(regex, '-').trim(),
57
+ row = '#' + id.toLowerCase();
58
+
59
+ $(row).addClass("update");
60
+
61
+ var html = '<tr class="plugin-update-tr">' +
62
+ '<td colspan="3" class="plugin-update colspanchange">' +
63
+ '<div class="update-message">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
64
+ '<a class="thickbox" href="' + localize.details_url[init] + '">' + localize.strings.latest.replace( '%latest%', plugin[headers].Latest ) + '</a>';
65
+
66
+ if( typeof activated[init] == "undefined" ) {
67
+
68
+ html = html +
69
+ ' <em>' + localize.strings.unavailable + '</em>' +
70
+ localize.strings.activate.replace( '%activate_link%', localize.licence_activation_url ).replace( '%plugin_name%', name );
71
+ } else {
72
+ html = html +
73
+ '. <a href="' + localize.update_url[init] + '">' + localize.strings.update_now + '</a>';
74
+ }
75
+
76
+ if( typeof localize.changelogs[init] != 'undefined' ){
77
+ html = html + localize.changelogs[init];
78
+ }
79
+
80
+ html = html +
81
+ '</div>' +
82
+ '</td>' +
83
+ '</tr>';
84
+
85
+ $(html).insertAfter(row);
86
+ }
87
+ }
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @param v1 Version 1
93
+ * @param v2 Version 2
94
+ * @param operator Compare type
95
+ * @returns bool
96
+ *
97
+ * @see php.js library http://phpjs.org/
98
+ */
99
+ function version_compare(v1, v2, operator) {
100
+ // discuss at: http://phpjs.org/functions/version_compare/
101
+ // original by: Philippe Jausions (http://pear.php.net/user/jausions)
102
+ // original by: Aidan Lister (http://aidanlister.com/)
103
+ // reimplemented by: Kankrelune (http://www.webfaktory.info/)
104
+ // improved by: Brett Zamir (http://brett-zamir.me)
105
+ // improved by: Scott Baker
106
+ // improved by: Theriault
107
+ // example 1: version_compare('8.2.5rc', '8.2.5a');
108
+ // returns 1: 1
109
+ // example 2: version_compare('8.2.50', '8.2.52', '<');
110
+ // returns 2: true
111
+ // example 3: version_compare('5.3.0-dev', '5.3.0');
112
+ // returns 3: -1
113
+ // example 4: version_compare('4.1.0.52','4.01.0.51');
114
+ // returns 4: 1
115
+
116
+ this.php_js = this.php_js || {};
117
+ this.php_js.ENV = this.php_js.ENV || {};
118
+ // END REDUNDANT
119
+ // Important: compare must be initialized at 0.
120
+ var i = 0,
121
+ x = 0,
122
+ compare = 0,
123
+ // vm maps textual PHP versions to negatives so they're less than 0.
124
+ // PHP currently defines these as CASE-SENSITIVE. It is important to
125
+ // leave these as negatives so that they can come before numerical versions
126
+ // and as if no letters were there to begin with.
127
+ // (1alpha is < 1 and < 1.1 but > 1dev1)
128
+ // If a non-numerical value can't be mapped to this table, it receives
129
+ // -7 as its value.
130
+ vm = {
131
+ 'dev' : -6,
132
+ 'alpha': -5,
133
+ 'a' : -5,
134
+ 'beta' : -4,
135
+ 'b' : -4,
136
+ 'RC' : -3,
137
+ 'rc' : -3,
138
+ '#' : -2,
139
+ 'p' : 1,
140
+ 'pl' : 1
141
+ },
142
+ // This function will be called to prepare each version argument.
143
+ // It replaces every _, -, and + with a dot.
144
+ // It surrounds any nonsequence of numbers/dots with dots.
145
+ // It replaces sequences of dots with a single dot.
146
+ // version_compare('4..0', '4.0') == 0
147
+ // Important: A string of 0 length needs to be converted into a value
148
+ // even less than an unexisting value in vm (-7), hence [-8].
149
+ // It's also important to not strip spaces because of this.
150
+ // version_compare('', ' ') == 1
151
+ prepVersion = function (v) {
152
+ v = ('' + v)
153
+ .replace(/[_\-+]/g, '.');
154
+ v = v.replace(/([^.\d]+)/g, '.$1.')
155
+ .replace(/\.{2,}/g, '.');
156
+ return (!v.length ? [-8] : v.split('.'));
157
+ };
158
+ // This converts a version component to a number.
159
+ // Empty component becomes 0.
160
+ // Non-numerical component becomes a negative number.
161
+ // Numerical component becomes itself as an integer.
162
+ numVersion = function (v) {
163
+ return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
164
+ };
165
+ v1 = prepVersion(v1);
166
+ v2 = prepVersion(v2);
167
+ x = Math.max(v1.length, v2.length);
168
+ for (i = 0; i < x; i++) {
169
+ if (v1[i] == v2[i]) {
170
+ continue;
171
+ }
172
+ v1[i] = numVersion(v1[i]);
173
+ v2[i] = numVersion(v2[i]);
174
+ if (v1[i] < v2[i]) {
175
+ compare = -1;
176
+ break;
177
+ } else if (v1[i] > v2[i]) {
178
+ compare = 1;
179
+ break;
180
+ }
181
+ }
182
+ if (!operator) {
183
+ return compare;
184
+ }
185
+
186
+ // Important: operator is CASE-SENSITIVE.
187
+ // "No operator" seems to be treated as "<."
188
+ // Any other values seem to make the function return null.
189
+ switch (operator) {
190
+ case '>':
191
+ case 'gt':
192
+ return (compare > 0);
193
+ case '>=':
194
+ case 'ge':
195
+ return (compare >= 0);
196
+ case '<=':
197
+ case 'le':
198
+ return (compare <= 0);
199
+ case '==':
200
+ case '=':
201
+ case 'eq':
202
+ return (compare === 0);
203
+ case '<>':
204
+ case '!=':
205
+ case 'ne':
206
+ return (compare !== 0);
207
+ case '':
208
+ case '<':
209
+ case 'lt':
210
+ return (compare < 0);
211
+ default:
212
+ return null;
213
+ }
214
+ }
215
+
216
+ })(jQuery);
plugin-fw/assets/js/multisite-updater.min.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(m){function n(c,d,k){this.php_js=this.php_js||{};this.php_js.ENV=this.php_js.ENV||{};var a=0,e=0,b=0,f={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},a=function(a){a=(""+a).replace(/[_\-+]/g,".");a=a.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,".");return a.length?a.split("."):[-8]};numVersion=function(a){return a?isNaN(a)?f[a]||-7:parseInt(a,10):0};c=a(c);d=a(d);e=Math.max(c.length,d.length);for(a=0;a<e;a++)if(c[a]!=d[a])if(c[a]=numVersion(c[a]),d[a]=numVersion(d[a]),
2
- c[a]<d[a]){b=-1;break}else if(c[a]>d[a]){b=1;break}if(!k)return b;switch(k){case ">":case "gt":return 0<b;case ">=":case "ge":return 0<=b;case "<=":case "le":return 0>=b;case "==":case "=":case "eq":return 0===b;case "<>":case "!=":case "ne":return 0!==b;case "":case "<":case "lt":return 0>b;default:return null}}var l=m("#menu-plugins"),g=l.find(".update-plugins").find(".update-count").text(),p=plugins.registered,q=plugins.activated;if(0==g||""==g)g=0,l.find(".wp-menu-name").append('<span class="update-plugins"><span class="plugin-count"></span></span>');
3
- (function(c,d,k,a){for(var e in c){var b=c[e],f;for(f in b)if("slug"!=f&&!n(b[f].Version,b[f].Latest,">=")){k=parseInt(k)+1;m(".plugin-count").empty().html(k);var g=""+b[f].Name,l="#"+g.replace(RegExp(" ","g"),"-").trim().toLowerCase();m(l).addClass("update");var h='<tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">'+a.strings.new_version.replace("%plugin_name%",g)+'<a class="thickbox" href="'+a.details_url[e]+'">'+a.strings.latest.replace("%latest%",
4
  b[f].Latest)+"</a>",h="undefined"==typeof d[e]?h+" <em>"+a.strings.unavailable+"</em>"+a.strings.activate.replace("%activate_link%",a.licence_activation_url).replace("%plugin_name%",g):h+'. <a href="'+a.update_url[e]+'">'+a.strings.update_now+"</a>";"undefined"!=typeof a.changelogs[e]&&(h+=a.changelogs[e]);h+="</div></td></tr>";m(h).insertAfter(l)}}})(p,q,g,plugins)})(jQuery);
1
+ (function(m){function n(c,d,k){this.php_js=this.php_js||{};this.php_js.ENV=this.php_js.ENV||{};var a=0,e=0,b=0,f={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},a=function(a){a=(""+a).replace(/[_\-+]/g,".");a=a.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,".");return a.length?a.split("."):[-8]};numVersion=function(a){return a?isNaN(a)?f[a]||-7:parseInt(a,10):0};c=a(c);d=a(d);e=Math.max(c.length,d.length);for(a=0;a<e;a++)if(c[a]!=d[a])if(c[a]=numVersion(c[a]),d[a]=numVersion(d[a]),
2
+ c[a]<d[a]){b=-1;break}else if(c[a]>d[a]){b=1;break}if(!k)return b;switch(k){case ">":case "gt":return 0<b;case ">=":case "ge":return 0<=b;case "<=":case "le":return 0>=b;case "==":case "=":case "eq":return 0===b;case "<>":case "!=":case "ne":return 0!==b;case "":case "<":case "lt":return 0>b;default:return null}}var l=m("#menu-plugins"),g=l.find(".update-plugins").find(".update-count").text(),p=plugins.registered,q=plugins.activated;if(0==g||""==g)g=0,l.find(".wp-menu-name").append('<span class="update-plugins"><span class="plugin-count"></span></span>');
3
+ (function(c,d,k,a){for(var e in c){var b=c[e],f;for(f in b)if("slug"!=f&&!n(b[f].Version,b[f].Latest,">=")){k=parseInt(k)+1;m(".plugin-count").empty().html(k);var g=""+b[f].Name,l="#"+g.replace(RegExp(" ","g"),"-").trim().toLowerCase();m(l).addClass("update");var h='<tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">'+a.strings.new_version.replace("%plugin_name%",g)+'<a class="thickbox" href="'+a.details_url[e]+'">'+a.strings.latest.replace("%latest%",
4
  b[f].Latest)+"</a>",h="undefined"==typeof d[e]?h+" <em>"+a.strings.unavailable+"</em>"+a.strings.activate.replace("%activate_link%",a.licence_activation_url).replace("%plugin_name%",g):h+'. <a href="'+a.update_url[e]+'">'+a.strings.update_now+"</a>";"undefined"!=typeof a.changelogs[e]&&(h+=a.changelogs[e]);h+="</div></td></tr>";m(h).insertAfter(l)}}})(p,q,g,plugins)})(jQuery);
plugin-fw/assets/js/yit-cpt-unlimited.js CHANGED
@@ -1,79 +1,79 @@
1
- /**
2
- * This file belongs to the YIT Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
-
10
- (function($) {
11
- "use strict";
12
- // Author code here
13
-
14
- // open media box
15
- $('.wrap h1, .wrap h2').on( 'click', 'a.multi-uploader', function(event){
16
- event.preventDefault();
17
-
18
- var file_frame,
19
- button = $(this),
20
- selected = false;
21
-
22
- // spinner
23
- button.next('span.spinner').css( 'display', 'inline-block' );
24
-
25
- // If the media frame already exists, reopen it.
26
- if ( file_frame ) {
27
- file_frame.open();
28
- return;
29
- }
30
-
31
- // Create the media frame.
32
- file_frame = wp.media.frames.file_frame = wp.media({
33
- title: button.data( 'uploader_title' ),
34
- button: {
35
- text: button.data( 'uploader_button_text' )
36
- },
37
- library: {
38
- type: 'image'
39
- },
40
- multiple: true // Set to true to allow multiple files to be selected
41
- });
42
-
43
- // When an image is selected, run a callback.
44
- file_frame.on( 'select', function() {
45
- var selection = file_frame.state().get('selection'),
46
- images = [];
47
-
48
- selection.map( function( attachment ) {
49
- attachment = attachment.toJSON();
50
-
51
- // Do something with attachment.id and/or attachment.url here
52
- images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
53
- });
54
-
55
- // make AJAX request
56
- $.post( ajaxurl, {
57
- images: images,
58
- post_type: typenow,
59
- action: 'yit_cptu_multiuploader'
60
- }, function( data ){
61
- location.reload();
62
- });
63
-
64
- button.next('span.spinner').css( 'display', 'inline-block' );
65
-
66
- // flag
67
- selected = true;
68
- });
69
-
70
- // when close
71
- file_frame.on( 'close', function() {
72
- if ( ! selected ) button.next('span.spinner').hide();
73
- });
74
-
75
- // Finally, open the modal
76
- file_frame.open();
77
- });
78
-
79
  })(jQuery);
1
+ /**
2
+ * This file belongs to the YIT Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+
10
+ (function($) {
11
+ "use strict";
12
+ // Author code here
13
+
14
+ // open media box
15
+ $('.wrap h1, .wrap h2').on( 'click', 'a.multi-uploader', function(event){
16
+ event.preventDefault();
17
+
18
+ var file_frame,
19
+ button = $(this),
20
+ selected = false;
21
+
22
+ // spinner
23
+ button.next('span.spinner').css( 'display', 'inline-block' );
24
+
25
+ // If the media frame already exists, reopen it.
26
+ if ( file_frame ) {
27
+ file_frame.open();
28
+ return;
29
+ }
30
+
31
+ // Create the media frame.
32
+ file_frame = wp.media.frames.file_frame = wp.media({
33
+ title: button.data( 'uploader_title' ),
34
+ button: {
35
+ text: button.data( 'uploader_button_text' )
36
+ },
37
+ library: {
38
+ type: 'image'
39
+ },
40
+ multiple: true // Set to true to allow multiple files to be selected
41
+ });
42
+
43
+ // When an image is selected, run a callback.
44
+ file_frame.on( 'select', function() {
45
+ var selection = file_frame.state().get('selection'),
46
+ images = [];
47
+
48
+ selection.map( function( attachment ) {
49
+ attachment = attachment.toJSON();
50
+
51
+ // Do something with attachment.id and/or attachment.url here
52
+ images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
53
+ });
54
+
55
+ // make AJAX request
56
+ $.post( ajaxurl, {
57
+ images: images,
58
+ post_type: typenow,
59
+ action: 'yit_cptu_multiuploader'
60
+ }, function( data ){
61
+ location.reload();
62
+ });
63
+
64
+ button.next('span.spinner').css( 'display', 'inline-block' );
65
+
66
+ // flag
67
+ selected = true;
68
+ });
69
+
70
+ // when close
71
+ file_frame.on( 'close', function() {
72
+ if ( ! selected ) button.next('span.spinner').hide();
73
+ });
74
+
75
+ // Finally, open the modal
76
+ file_frame.open();
77
+ });
78
+
79
  })(jQuery);
plugin-fw/assets/js/yit-cptu-sortable-posts.js CHANGED
@@ -1,32 +1,32 @@
1
- /**
2
- * This file belongs to the YIT Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
-
10
- (function($) {
11
- "use strict";
12
- // Author code here
13
-
14
- $("#the-list").sortable({
15
- items : 'tr',
16
- axis : 'y',
17
- helper : function(e, ui) {
18
- ui.children().children().each(function() {
19
- $(this).width( $(this).width() );
20
- });
21
- return ui;
22
- },
23
- update : function(e, ui) {
24
- $.post( ajaxurl, {
25
- action: 'cpt_sort_posts',
26
- order: $("#the-list").sortable("serialize"),
27
- post_type: typenow
28
- });
29
- }
30
- });
31
-
32
  })(jQuery);
1
+ /**
2
+ * This file belongs to the YIT Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+
10
+ (function($) {
11
+ "use strict";
12
+ // Author code here
13
+
14
+ $("#the-list").sortable({
15
+ items : 'tr',
16
+ axis : 'y',
17
+ helper : function(e, ui) {
18
+ ui.children().children().each(function() {
19
+ $(this).width( $(this).width() );
20
+ });
21
+ return ui;
22
+ },
23
+ update : function(e, ui) {
24
+ $.post( ajaxurl, {
25
+ action: 'cpt_sort_posts',
26
+ order: $("#the-list").sortable("serialize"),
27
+ post_type: typenow
28
+ });
29
+ }
30
+ });
31
+
32
  })(jQuery);
plugin-fw/assets/js/yit-plugin-panel-sidebar.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * This file belongs to the YIT Plugin Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+
10
+
11
+ (function ( $ ) {
12
+ var hide_sidebar_btn = $( '#yit-panel-sidebar-action-hide' ),
13
+ hide_sidebar_text = hide_sidebar_btn.find( '.yit-panel-sidebar-action-title' ),
14
+ sidebar = $( '#yit-panel-sidebar' ),
15
+ panel_wrapper = $( '.' + sidebar_labels.wrapper_class ),
16
+ ajax_hide_option_save_call,
17
+ ajax_hide_option_save = function ( option ) {
18
+ if ( ajax_hide_option_save_call ) {
19
+ ajax_hide_option_save_call.abort();
20
+ }
21
+
22
+ var post_data = {
23
+ option: option,
24
+ action: 'yith_plugin_panel_sidebar_set_collapse_option'
25
+ };
26
+
27
+ ajax_hide_option_save_call = $.ajax( {
28
+ type: "POST",
29
+ data: post_data,
30
+ url: ajaxurl
31
+ } );
32
+ },
33
+ hide_sidebar = function () {
34
+ hide_sidebar_btn.removeClass( 'hide-on-click' );
35
+ hide_sidebar_text.html( sidebar_labels.show_sidebar );
36
+ sidebar.addClass( 'yith-panel-sidebar-hidden' );
37
+ panel_wrapper.addClass( 'yit-admin-panel-content-wrap-full' );
38
+ ajax_hide_option_save( 'yes' );
39
+ },
40
+ show_sidebar = function () {
41
+ hide_sidebar_btn.addClass( 'hide-on-click' );
42
+ hide_sidebar_text.html( sidebar_labels.hide_sidebar );
43
+ sidebar.removeClass( 'yith-panel-sidebar-hidden' );
44
+ panel_wrapper.removeClass( 'yit-admin-panel-content-wrap-full' );
45
+ ajax_hide_option_save( 'no' );
46
+ };
47
+
48
+ hide_sidebar_btn.on( 'click', function () {
49
+ if ( $( this ).is( '.hide-on-click' ) ) {
50
+ hide_sidebar();
51
+ } else {
52
+ show_sidebar();
53
+ }
54
+ } );
55
+
56
+ })( jQuery );
plugin-fw/assets/js/yit-plugin-panel-sidebar.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){var i,e=a("#yit-panel-sidebar-action-hide"),n=e.find(".yit-panel-sidebar-action-title"),l=a("#yit-panel-sidebar"),s=a("."+sidebar_labels.wrapper_class),t=function(e){i&&i.abort();var n={option:e,action:"yith_plugin_panel_sidebar_set_collapse_option"};i=a.ajax({type:"POST",data:n,url:ajaxurl})},d=function(){e.removeClass("hide-on-click"),n.html(sidebar_labels.show_sidebar),l.addClass("yith-panel-sidebar-hidden"),s.addClass("yit-admin-panel-content-wrap-full"),t("yes")},o=function(){e.addClass("hide-on-click"),n.html(sidebar_labels.hide_sidebar),l.removeClass("yith-panel-sidebar-hidden"),s.removeClass("yit-admin-panel-content-wrap-full"),t("no")};e.on("click",function(){a(this).is(".hide-on-click")?d():o()})}(jQuery);
plugin-fw/assets/js/yit-plugin-panel.js CHANGED
@@ -1,329 +1,329 @@
1
- /**
2
- * This file belongs to the YIT Plugin Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
-
10
-
11
- (function ($) {
12
-
13
- // select
14
- var select_value = function () {
15
-
16
- var value = '';
17
-
18
- if ($(this).attr('multiple')) {
19
- $(this).children("option:selected").each(function (i, v) {
20
- if (i != 0)
21
- value += ', ';
22
-
23
- value += $(v).text();
24
- });
25
-
26
- if (value == '') {
27
- $(this).children().children("option:selected").each(function (i, v) {
28
- if (i != 0)
29
- value += ', ';
30
-
31
- value += $(v).text();
32
- });
33
- }
34
- }
35
- else {
36
- value = $(this).children("option:selected").text();
37
-
38
- if (value == '')
39
- value = $(this).children().children("option:selected").text();
40
- }
41
-
42
-
43
- if ($(this).parent().find('span').length <= 0) {
44
- $(this).before('<span></span>');
45
- }
46
-
47
- $(this).parent().children('span').replaceWith('<span>' + value + '</span>');
48
- };
49
- $('.plugin-option .select_wrapper select').not('.chosen').each(select_value).change(select_value);
50
-
51
- //Open select multiple
52
- $('.plugin-option .select_wrapper').click(function (e) {
53
- e.stopPropagation();
54
- $(this).find('select[multiple]').not('.chosen').toggle();
55
- });
56
- //Stops click propagation on select, to prevent select hide
57
- $('.plugin-option .select_wrapper select[multiple]').not('.chosen').click(function (e) {
58
- e.stopPropagation();
59
- });
60
- //Hides select on window click
61
- $(window).click(function () {
62
- $('.plugin-option .select_wrapper select[multiple]').not('.chosen').hide();
63
- })
64
- //chosen
65
- $('.plugin-option .chosen .select_wrapper select').chosen();
66
-
67
- // on-off
68
- $('.plugin-option .on_off_container span').on('click', function () {
69
- var input = $(this).prev('input');
70
- var checked = input.prop('checked');
71
-
72
- if (checked) {
73
- input.prop('checked', false).attr('value', 'no').removeClass('onoffchecked');
74
- } else {
75
- input.prop('checked', true).attr('value', 'yes').addClass('onoffchecked');
76
- }
77
-
78
- input.change();
79
- });
80
-
81
-
82
- //slider
83
- $('.plugin-option .slider_container .ui-slider-horizontal').each(function () {
84
- var val = $(this).data('val');
85
- var minValue = $(this).data('min');
86
- var maxValue = $(this).data('max');
87
- var step = $(this).data('step');
88
- var labels = $(this).data('labels');
89
-
90
- $(this).slider({
91
- value: val,
92
- min : minValue,
93
- max : maxValue,
94
- range: 'min',
95
- step : step,
96
-
97
- slide: function (event, ui) {
98
- $(this).find('input').val(ui.value);
99
- $(this).siblings('.feedback').find('strong').text(ui.value + labels);
100
- }
101
- });
102
- });
103
-
104
-
105
- if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
106
-
107
- //upload
108
- var _custom_media = true,
109
- _orig_send_attachment = wp.media.editor.send.attachment;
110
-
111
- // preview
112
- $('.plugin-option .upload_img_url').change(function () {
113
- var url = $(this).val();
114
- var re = new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)");
115
-
116
- var preview = $(this).parents().siblings('.upload_img_preview');
117
- if (re.test(url)) {
118
- preview.html('<img src="' + url + '" style="max-width:600px; max-height:300px;" />');
119
- } else {
120
- preview.html('');
121
- }
122
- }).trigger( 'change' );
123
-
124
- $( document ).on( 'click', '.plugin-option .upload_button', function(e) {
125
- e.preventDefault();
126
-
127
- var t = $(this),
128
- custom_uploader,
129
- id = t.attr('id').replace(/-button$/, '');
130
-
131
- //If the uploader object has already been created, reopen the dialog
132
- if (custom_uploader) {
133
- custom_uploader.open();
134
- return;
135
- }
136
-
137
- var custom_uploader_states = [
138
- // Main states.
139
- new wp.media.controller.Library({
140
- library: wp.media.query(),
141
- multiple: false,
142
- title: 'Choose Image',
143
- priority: 20,
144
- filterable: 'uploaded'
145
- })
146
- ];
147
-
148
- // Create the media frame.
149
- custom_uploader = wp.media.frames.downloadable_file = wp.media({
150
- // Set the title of the modal.
151
- title: 'Choose Image',
152
- library: {
153
- type: ''
154
- },
155
- button: {
156
- text: 'Choose Image'
157
- },
158
- multiple: false,
159
- states: custom_uploader_states
160
- });
161
-
162
-
163
- //When a file is selected, grab the URL and set it as the text field's value
164
- custom_uploader.on( 'select' , function() {
165
- var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
166
-
167
- $("#" + id).val( attachment.url );
168
- // Save the id of the selected element to an element which name is the same with
169
- // a suffix "-yith-attachment-id"
170
- if ($("#" + id + "-yith-attachment-id")) {
171
- $("#" + id + "-yith-attachment-id").val(attachment.id);
172
- }
173
-
174
- $('.plugin-option .upload_img_url').trigger('change');
175
- });
176
-
177
- //Open the uploader dialog
178
- custom_uploader.open();
179
- });
180
-
181
- $( document).on( 'click', '.plugin-option .upload_button_reset', function(e){
182
- var t = $(this),
183
- id = t.attr('id'),
184
- input_id = t.attr('id').replace(/-button_reset$/, ''),
185
- default_value = $('#' + id).data('default');
186
-
187
- $("#" + input_id).val( default_value );
188
- $('.plugin-option .upload_img_url').trigger('change');
189
- } );
190
- }
191
-
192
- $('.plugin-option .add_media').on('click', function () {
193
- _custom_media = false;
194
- });
195
-
196
- //dependencies handler
197
- $('[data-field]').each(function () {
198
- var t = $(this);
199
-
200
- var field = '#' + t.data('field'),
201
- dep = '#' + t.data('dep'),
202
- value = t.data('value');
203
-
204
- $(dep).on('change',function () {
205
- dependencies_handler(field, dep, value.toString());
206
- }).change();
207
- });
208
-
209
- //Handle dependencies.
210
- function dependencies_handler(id, deps, values) {
211
- var result = true;
212
-
213
- //Single dependency
214
- if (typeof( deps ) == 'string') {
215
- if (deps.substr(0, 6) == ':radio') {
216
- deps = deps + ':checked';
217
- }
218
-
219
- var values = values.split(',');
220
-
221
- for (var i = 0; i < values.length; i++) {
222
-
223
- if ($(deps).val() != values[i]) {
224
- result = false;
225
- }
226
- else {
227
- result = true;
228
- break;
229
- }
230
- }
231
- }
232
-
233
- if (!result) {
234
- $(id + '-container').closest('tr').hide();
235
- } else {
236
- $(id + '-container').closest('tr').show();
237
- }
238
- };
239
-
240
- //connected list
241
- $('.rm_connectedlist').each(function () {
242
- var ul = $(this).find('ul');
243
- var input = $(this).find(':hidden');
244
- var sortable = ul.sortable({
245
- connectWith: ul,
246
- update : function (event, ui) {
247
- var value = {};
248
-
249
- ul.each(function () {
250
- var options = {};
251
-
252
- $(this).children().each(function () {
253
- options[ $(this).data('option') ] = $(this).text();
254
- });
255
-
256
- value[ $(this).data('list') ] = options;
257
- });
258
-
259
- input.val((JSON.stringify(value)).replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'));
260
- }
261
- }).disableSelection();
262
- });
263
-
264
- $(document).ready(function () {
265
-
266
- $('.yith-video-link').click(function (event) {
267
- event.preventDefault();
268
- var target = $(this).data('video-id');
269
-
270
- $('.' + target).dialog({
271
- dialogClass : 'wp-dialog yit-dialog yit-video-dialog',
272
- modal : true,
273
- closeOnEscape: true,
274
- width : 'auto',
275
- resizable : false,
276
- draggable : false,
277
- create : function (event, ui) {
278
- $(this).css("maxWidth", "853px");
279
- },
280
- open : function (event, ui) {
281
-
282
- $('.ui-widget-overlay').bind('click', function () {
283
- $(this).siblings('.ui-dialog').find('.ui-dialog-content').dialog('close');
284
- });
285
-
286
- }
287
-
288
- });
289
-
290
- $('.ui-dialog :button').blur();
291
-
292
- });
293
- });
294
-
295
- //codemirror
296
- $(document).ready(function () {
297
- $('.codemirror').each(function (i, v) {
298
- var editor = CodeMirror.fromTextArea(v, {
299
- lineNumbers : 1,
300
- mode : 'javascript',
301
- showCursorWhenSelecting: true
302
- })
303
-
304
- $(v).data('codemirrorInstance', editor);
305
- })
306
- })
307
-
308
- //google analytics generation
309
- $(document).ready(function () {
310
- $('.google-analytic-generate').click(function () {
311
- var editor = $('#' + $(this).data('textarea')).data('codemirrorInstance');
312
- var gatc = $('#' + $(this).data('input')).val();
313
- var basename = $(this).data('basename');
314
-
315
- var text = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";
316
- text += "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n";
317
- text += "m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
318
- text += "})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";
319
- text += "ga('create', '" + gatc + "', '" + basename + "');\n";
320
- text += "ga('send', 'pageview');\n";
321
- editor.replaceRange(
322
- text,
323
- editor.getCursor('start'),
324
- editor.getCursor('end')
325
- )
326
- })
327
- })
328
-
329
  })(jQuery);
1
+ /**
2
+ * This file belongs to the YIT Plugin Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+
10
+
11
+ (function ($) {
12
+
13
+ // select
14
+ var select_value = function () {
15
+
16
+ var value = '';
17
+
18
+ if ($(this).attr('multiple')) {
19
+ $(this).children("option:selected").each(function (i, v) {
20
+ if (i != 0)
21
+ value += ', ';
22
+
23
+ value += $(v).text();
24
+ });
25
+
26
+ if (value == '') {
27
+ $(this).children().children("option:selected").each(function (i, v) {
28
+ if (i != 0)
29
+ value += ', ';
30
+
31
+ value += $(v).text();
32
+ });
33
+ }
34
+ }
35
+ else {
36
+ value = $(this).children("option:selected").text();
37
+
38
+ if (value == '')
39
+ value = $(this).children().children("option:selected").text();
40
+ }
41
+
42
+
43
+ if ($(this).parent().find('span').length <= 0) {
44
+ $(this).before('<span></span>');
45
+ }
46
+
47
+ $(this).parent().children('span').replaceWith('<span>' + value + '</span>');
48
+ };
49
+ $('.plugin-option .select_wrapper select').not('.chosen').each(select_value).change(select_value);
50
+
51
+ //Open select multiple
52
+ $('.plugin-option .select_wrapper').click(function (e) {
53
+ e.stopPropagation();
54
+ $(this).find('select[multiple]').not('.chosen').toggle();
55
+ });
56
+ //Stops click propagation on select, to prevent select hide
57
+ $('.plugin-option .select_wrapper select[multiple]').not('.chosen').click(function (e) {
58
+ e.stopPropagation();
59
+ });
60
+ //Hides select on window click
61
+ $(window).click(function () {
62
+ $('.plugin-option .select_wrapper select[multiple]').not('.chosen').hide();
63
+ })
64
+ //chosen
65
+ $('.plugin-option .chosen .select_wrapper select').chosen();
66
+
67
+ // on-off
68
+ $('.plugin-option .onoff_container span').on('click', function () {
69
+ var input = $(this).prev('input');
70
+ var checked = input.prop('checked');
71
+
72
+ if (checked) {
73
+ input.prop('checked', false).attr('value', 'no').removeClass('onoffchecked');
74
+ } else {
75
+ input.prop('checked', true).attr('value', 'yes').addClass('onoffchecked');
76
+ }
77
+
78
+ input.change();
79
+ });
80
+
81
+
82
+ //slider
83
+ $('.plugin-option .slider_container .ui-slider-horizontal').each(function () {
84
+ var val = $(this).data('val');
85
+ var minValue = $(this).data('min');
86
+ var maxValue = $(this).data('max');
87
+ var step = $(this).data('step');
88
+ var labels = $(this).data('labels');
89
+
90
+ $(this).slider({
91
+ value: val,
92
+ min : minValue,
93
+ max : maxValue,
94
+ range: 'min',
95
+ step : step,
96
+
97
+ slide: function (event, ui) {
98
+ $(this).find('input').val(ui.value);
99
+ $(this).siblings('.feedback').find('strong').text(ui.value + labels);
100
+ }
101
+ });
102
+ });
103
+
104
+
105
+ if (typeof wp !== 'undefined' && typeof wp.media !== 'undefined') {
106
+
107
+ //upload
108
+ var _custom_media = true,
109
+ _orig_send_attachment = wp.media.editor.send.attachment;
110
+
111
+ // preview
112
+ $('.plugin-option .upload_img_url').change(function () {
113
+ var url = $(this).val();
114
+ var re = new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)");
115
+
116
+ var preview = $(this).parents().siblings('.upload_img_preview');
117
+ if (re.test(url)) {
118
+ preview.html('<img src="' + url + '" style="max-width:600px; max-height:300px;" />');
119
+ } else {
120
+ preview.html('');
121
+ }
122
+ }).trigger( 'change' );
123
+
124
+ $( document ).on( 'click', '.plugin-option .upload_button', function(e) {
125
+ e.preventDefault();
126
+
127
+ var t = $(this),
128
+ custom_uploader,
129
+ id = t.attr('id').replace(/-button$/, '');
130
+
131
+ //If the uploader object has already been created, reopen the dialog
132
+ if (custom_uploader) {
133
+ custom_uploader.open();
134
+ return;
135
+ }
136
+
137
+ var custom_uploader_states = [
138
+ // Main states.
139
+ new wp.media.controller.Library({
140
+ library: wp.media.query(),
141
+ multiple: false,
142
+ title: 'Choose Image',
143
+ priority: 20,
144
+ filterable: 'uploaded'
145
+ })
146
+ ];
147
+
148
+ // Create the media frame.
149
+ custom_uploader = wp.media.frames.downloadable_file = wp.media({
150
+ // Set the title of the modal.
151
+ title: 'Choose Image',
152
+ library: {
153
+ type: ''
154
+ },
155
+ button: {
156
+ text: 'Choose Image'
157
+ },
158
+ multiple: false,
159
+ states: custom_uploader_states
160
+ });
161
+
162
+
163
+ //When a file is selected, grab the URL and set it as the text field's value
164
+ custom_uploader.on( 'select' , function() {
165
+ var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
166
+
167
+ $("#" + id).val( attachment.url );
168
+ // Save the id of the selected element to an element which name is the same with
169
+ // a suffix "-yith-attachment-id"
170
+ if ($("#" + id + "-yith-attachment-id")) {
171
+ $("#" + id + "-yith-attachment-id").val(attachment.id);
172
+ }
173
+
174
+ $('.plugin-option .upload_img_url').trigger('change');
175
+ });
176
+
177
+ //Open the uploader dialog
178
+ custom_uploader.open();
179
+ });
180
+
181
+ $( document).on( 'click', '.plugin-option .upload_button_reset', function(e){
182
+ var t = $(this),
183
+ id = t.attr('id'),
184
+ input_id = t.attr('id').replace(/-button_reset$/, ''),
185
+ default_value = $('#' + id).data('default');
186
+
187
+ $("#" + input_id).val( default_value );
188
+ $('.plugin-option .upload_img_url').trigger('change');
189
+ } );
190
+ }
191
+
192
+ $('.plugin-option .add_media').on('click', function () {
193
+ _custom_media = false;
194
+ });
195
+
196
+ //dependencies handler
197
+ $('[data-field]').each(function () {
198
+ var t = $(this);
199
+
200
+ var field = '#' + t.data('field'),
201
+ dep = '#' + t.data('dep'),
202
+ value = t.data('value');
203
+
204
+ $(dep).on('change',function () {
205
+ dependencies_handler(field, dep, value.toString());
206
+ }).change();
207
+ });
208
+
209
+ //Handle dependencies.
210
+ function dependencies_handler(id, deps, values) {
211
+ var result = true;
212
+
213
+ //Single dependency
214
+ if (typeof( deps ) == 'string') {
215
+ if (deps.substr(0, 6) == ':radio') {
216
+ deps = deps + ':checked';
217
+ }
218
+
219
+ var values = values.split(',');
220
+
221
+ for (var i = 0; i < values.length; i++) {
222
+
223
+ if ($(deps).val() != values[i]) {
224
+ result = false;
225
+ }
226
+ else {
227
+ result = true;
228
+ break;
229
+ }
230
+ }
231
+ }
232
+
233
+ if (!result) {
234
+ $(id + '-container').closest('tr').hide();
235
+ } else {
236
+ $(id + '-container').closest('tr').show();
237
+ }
238
+ };
239
+
240
+ //connected list
241
+ $('.rm_connectedlist').each(function () {
242
+ var ul = $(this).find('ul');
243
+ var input = $(this).find(':hidden');
244
+ var sortable = ul.sortable({
245
+ connectWith: ul,
246
+ update : function (event, ui) {
247
+ var value = {};
248
+
249
+ ul.each(function () {
250
+ var options = {};
251
+
252
+ $(this).children().each(function () {
253
+ options[ $(this).data('option') ] = $(this).text();
254
+ });
255
+
256
+ value[ $(this).data('list') ] = options;
257
+ });
258
+
259
+ input.val((JSON.stringify(value)).replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'));
260
+ }
261
+ }).disableSelection();
262
+ });
263
+
264
+ $(document).ready(function () {
265
+
266
+ $('.yith-video-link').click(function (event) {
267
+ event.preventDefault();
268
+ var target = $(this).data('video-id');
269
+
270
+ $('.' + target).dialog({
271
+ dialogClass : 'wp-dialog yit-dialog yit-video-dialog',
272
+ modal : true,
273
+ closeOnEscape: true,
274
+ width : 'auto',
275
+ resizable : false,
276
+ draggable : false,
277
+ create : function (event, ui) {
278
+ $(this).css("maxWidth", "853px");
279
+ },
280
+ open : function (event, ui) {
281
+
282
+ $('.ui-widget-overlay').bind('click', function () {
283
+ $(this).siblings('.ui-dialog').find('.ui-dialog-content').dialog('close');
284
+ });
285
+
286
+ }
287
+
288
+ });
289
+
290
+ $('.ui-dialog :button').blur();
291
+
292
+ });
293
+ });
294
+
295
+ //codemirror
296
+ $(document).ready(function () {
297
+ $('.codemirror').each(function (i, v) {
298
+ var editor = CodeMirror.fromTextArea(v, {
299
+ lineNumbers : 1,
300
+ mode : 'javascript',
301
+ showCursorWhenSelecting: true
302
+ })
303
+
304
+ $(v).data('codemirrorInstance', editor);
305
+ })
306
+ })
307
+
308
+ //google analytics generation
309
+ $(document).ready(function () {
310
+ $('.google-analytic-generate').click(function () {
311
+ var editor = $('#' + $(this).data('textarea')).data('codemirrorInstance');
312
+ var gatc = $('#' + $(this).data('input')).val();
313
+ var basename = $(this).data('basename');
314
+
315
+ var text = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";
316
+ text += "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n";
317
+ text += "m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
318
+ text += "})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";
319
+ text += "ga('create', '" + gatc + "', '" + basename + "');\n";
320
+ text += "ga('send', 'pageview');\n";
321
+ editor.replaceRange(
322
+ text,
323
+ editor.getCursor('start'),
324
+ editor.getCursor('end')
325
+ )
326
+ })
327
+ })
328
+
329
  })(jQuery);
plugin-fw/assets/js/yit-plugin-panel.min.js CHANGED
@@ -1,5 +1,5 @@
1
  (function(a){var l=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+
2
- "</span>")};a(".plugin-option .select_wrapper select").not(".chosen").each(l).change(l);a(".plugin-option .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()});a(".plugin-option .chosen .select_wrapper select").chosen();a(".plugin-option .on_off_container span").on("click",
3
  function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);
4
  a(this).siblings(".feedback").find("strong").text(c.value+f)}})});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(".plugin-option .upload_img_url").change(function(){var b=a(this).val(),c=a(this).parents().siblings(".upload_img_preview");/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?c.html('<img src="'+b+'" style="max-width:600px; max-height:300px;" />'):c.html("")}).trigger("change"),a(document).on("click",".plugin-option .upload_button",function(b){b.preventDefault();
5
  var c,d=a(this).attr("id").replace(/-button$/,"");c||(b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})],c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b}),c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+d).val(b.url);a("#"+d+"-yith-attachment-id")&&a("#"+d+"-yith-attachment-id").val(b.id);a(".plugin-option .upload_img_url").trigger("change")}));
@@ -7,4 +7,4 @@ c.open()}),a(document).on("click",".plugin-option .upload_button_reset",function
7
  b.substr(0,6)&&(b+=":checked");for(var g=g.split(","),k=0;k<g.length;k++)if(a(b).val()!=g[k])h=!1;else{h=!0;break}}h?a(c+"-container").closest("tr").show():a(c+"-container").closest("tr").hide()}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,
8
  "\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(b,d){a(this).css("maxWidth","853px")},open:function(b,d){a(".ui-widget-overlay").bind("click",function(){a(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}});
9
  a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".codemirror").each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)})});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename"),e;e="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
10
- e+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";e+="ga('create', '"+c+"', '"+d+"');\n";e+="ga('send', 'pageview');\n";b.replaceRange(e,b.getCursor("start"),b.getCursor("end"))})})})(jQuery);
1
  (function(a){var l=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+
2
+ "</span>")};a(".plugin-option .select_wrapper select").not(".chosen").each(l).change(l);a(".plugin-option .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()});a(".plugin-option .chosen .select_wrapper select").chosen();a(".plugin-option .onoff_container span").on("click",
3
  function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);
4
  a(this).siblings(".feedback").find("strong").text(c.value+f)}})});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(".plugin-option .upload_img_url").change(function(){var b=a(this).val(),c=a(this).parents().siblings(".upload_img_preview");/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?c.html('<img src="'+b+'" style="max-width:600px; max-height:300px;" />'):c.html("")}).trigger("change"),a(document).on("click",".plugin-option .upload_button",function(b){b.preventDefault();
5
  var c,d=a(this).attr("id").replace(/-button$/,"");c||(b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})],c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b}),c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+d).val(b.url);a("#"+d+"-yith-attachment-id")&&a("#"+d+"-yith-attachment-id").val(b.id);a(".plugin-option .upload_img_url").trigger("change")}));
7
  b.substr(0,6)&&(b+=":checked");for(var g=g.split(","),k=0;k<g.length;k++)if(a(b).val()!=g[k])h=!1;else{h=!0;break}}h?a(c+"-container").closest("tr").show():a(c+"-container").closest("tr").hide()}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,
8
  "\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(b,d){a(this).css("maxWidth","853px")},open:function(b,d){a(".ui-widget-overlay").bind("click",function(){a(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}});
9
  a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".codemirror").each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)})});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename"),e;e="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
10
+ e+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";e+="ga('create', '"+c+"', '"+d+"');\n";e+="ga('send', 'pageview');\n";b.replaceRange(e,b.getCursor("start"),b.getCursor("end"))})})})(jQuery);
plugin-fw/assets/js/yit-wp-pointer.js CHANGED
@@ -1,84 +1,84 @@
1
- jQuery(document).ready( function($) {
2
-
3
- var pointers = custom_pointer.pointers[0],
4
- options = pointers.options,
5
- target = $(pointers.target),
6
- pointer_id = pointers.pointer_id;
7
-
8
- $(target).find('.wp-submenu li a').each(function () {
9
-
10
- var t = $(this),
11
- href = t.attr('href');
12
-
13
- href = href.replace('admin.php?page=', '');
14
-
15
- if( href == pointer_id ){
16
-
17
- var selected_plugin_row = t.add( target ),
18
- top_level_menu = target.find( pointers.target.replace( '#', '.' ) );
19
-
20
- target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
21
-
22
- t.pointer({
23
- pointerClass: 'yit-wp-pointer',
24
- content : options.content,
25
- position: options.position,
26
- open : function () {
27
- selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
28
- top_level_menu.addClass( 'yit-pointer' );
29
- },
30
-
31
-
32
- close : function () {
33
- target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
34
- selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
35
- top_level_menu.removeClass( 'yit-pointer' );
36
-
37
- $.ajax({
38
- type : 'POST',
39
- url : ajaxurl,
40
- data : {
41
- "action" : "dismiss-wp-pointer",
42
- "pointer": pointer_id
43
- },
44
- success: function (response) {
45
- }
46
- });
47
-
48
- }
49
- }).pointer('open');
50
- } else if( 'yith_default_pointer' == pointer_id ) {
51
-
52
- var selected_plugin_row = t.add( target ),
53
- top_level_menu = target.find( pointers.target.replace( '#', '.' )),
54
- yit_plugins = $( pointers.target );
55
-
56
- yit_plugins.addClass('wp-has-current-submenu');
57
-
58
- top_level_menu.pointer({
59
- pointerClass: 'yit-wp-pointer',
60
- content : options.content,
61
- position: options.position,
62
-
63
- open : function () {
64
- yit_plugins.addClass( 'yit-pointer-selected-row' );
65
- },
66
-
67
- close : function () {
68
- yit_plugins.removeClass( 'yit-pointer-selected-row wp-has-current-submenu' );
69
-
70
- $.ajax({
71
- type : 'POST',
72
- url : ajaxurl,
73
- data : {
74
- "action" : "dismiss-wp-pointer",
75
- "pointer": pointer_id
76
- },
77
- success: function (response) {
78
- }
79
- });
80
- }
81
- }).pointer('open');
82
- }
83
- });
84
  });
1
+ jQuery(document).ready( function($) {
2
+
3
+ var pointers = custom_pointer.pointers[0],
4
+ options = pointers.options,
5
+ target = $(pointers.target),
6
+ pointer_id = pointers.pointer_id;
7
+
8
+ $(target).find('.wp-submenu li a').each(function () {
9
+
10
+ var t = $(this),
11
+ href = t.attr('href');
12
+
13
+ href = href.replace('admin.php?page=', '');
14
+
15
+ if( href == pointer_id ){
16
+
17
+ var selected_plugin_row = t.add( target ),
18
+ top_level_menu = target.find( pointers.target.replace( '#', '.' ) );
19
+
20
+ target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
21
+
22
+ t.pointer({
23
+ pointerClass: 'yit-wp-pointer',
24
+ content : options.content,
25
+ position: options.position,
26
+ open : function () {
27
+ selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
28
+ top_level_menu.addClass( 'yit-pointer' );
29
+ },
30
+
31
+
32
+ close : function () {
33
+ target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
34
+ selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
35
+ top_level_menu.removeClass( 'yit-pointer' );
36
+
37
+ $.ajax({
38
+ type : 'POST',
39
+ url : ajaxurl,
40
+ data : {
41
+ "action" : "dismiss-wp-pointer",
42
+ "pointer": pointer_id
43
+ },
44
+ success: function (response) {
45
+ }
46
+ });
47
+
48
+ }
49
+ }).pointer('open');
50
+ } else if( 'yith_default_pointer' == pointer_id ) {
51
+
52
+ var selected_plugin_row = t.add( target ),
53
+ top_level_menu = target.find( pointers.target.replace( '#', '.' )),
54
+ yit_plugins = $( pointers.target );
55
+
56
+ yit_plugins.addClass('wp-has-current-submenu');
57
+
58
+ top_level_menu.pointer({
59
+ pointerClass: 'yit-wp-pointer',
60
+ content : options.content,
61
+ position: options.position,
62
+
63
+ open : function () {
64
+ yit_plugins.addClass( 'yit-pointer-selected-row' );
65
+ },
66
+
67
+ close : function () {
68
+ yit_plugins.removeClass( 'yit-pointer-selected-row wp-has-current-submenu' );
69
+
70
+ $.ajax({
71
+ type : 'POST',
72
+ url : ajaxurl,
73
+ data : {
74
+ "action" : "dismiss-wp-pointer",
75
+ "pointer": pointer_id
76
+ },
77
+ success: function (response) {
78
+ }
79
+ });
80
+ }
81
+ }).pointer('open');
82
+ }
83
+ });
84
  });
plugin-fw/assets/js/yit-wp-pointer.min.js CHANGED
@@ -1,3 +1,3 @@
1
- jQuery(document).ready(function(b){var c=custom_pointer.pointers[0],d=c.options,a=b(c.target),e=c.pointer_id;b(a).find(".wp-submenu li a").each(function(){var f=b(this),h=f.attr("href"),h=h.replace("admin.php?page=","");if(h==e){var k=f.add(a),g=a.find(c.target.replace("#","."));a.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");f.pointer({pointerClass:"yit-wp-pointer",content:d.content,position:d.position,open:function(){console.log("here");k.toggleClass("yit-pointer-selected-row");
2
- g.addClass("yit-pointer")},close:function(){a.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");k.toggleClass("yit-pointer-selected-row");g.removeClass("yit-pointer");b.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}else if("yith_default_pointer"==e){var k=f.add(a),g=a.find(c.target.replace("#",".")),l=b(c.target);l.addClass("wp-has-current-submenu");g.pointer({pointerClass:"yit-wp-pointer",content:d.content,
3
  position:d.position,open:function(){l.addClass("yit-pointer-selected-row")},close:function(){l.removeClass("yit-pointer-selected-row wp-has-current-submenu");b.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}})});
1
+ jQuery(document).ready(function(b){var c=custom_pointer.pointers[0],d=c.options,a=b(c.target),e=c.pointer_id;b(a).find(".wp-submenu li a").each(function(){var f=b(this),h=f.attr("href"),h=h.replace("admin.php?page=","");if(h==e){var k=f.add(a),g=a.find(c.target.replace("#","."));a.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");f.pointer({pointerClass:"yit-wp-pointer",content:d.content,position:d.position,open:function(){console.log("here");k.toggleClass("yit-pointer-selected-row");
2
+ g.addClass("yit-pointer")},close:function(){a.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");k.toggleClass("yit-pointer-selected-row");g.removeClass("yit-pointer");b.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}else if("yith_default_pointer"==e){var k=f.add(a),g=a.find(c.target.replace("#",".")),l=b(c.target);l.addClass("wp-has-current-submenu");g.pointer({pointerClass:"yit-wp-pointer",content:d.content,
3
  position:d.position,open:function(){l.addClass("yit-pointer-selected-row")},close:function(){l.removeClass("yit-pointer-selected-row wp-has-current-submenu");b.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}})});
plugin-fw/init.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
- /**
3
- * Framework Name: YIT Plugin Framework
4
- * Version: 2.9.10
5
- * Author: Yithemes
6
- * Text Domain: yith-plugin-fw
7
- * Domain Path: /languages/
8
- *
9
- * @author Your Inspiration Themes
10
- * @package YITH WooCommerce Ajax Navigation
11
- * @version 2.0
12
- */
13
- /**
14
- * This file belongs to the YIT Plugin Framework.
15
- *
16
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
17
- * that is bundled with this package in the file LICENSE.txt.
18
- * It is also available through the world-wide-web at this URL:
19
- * http://www.gnu.org/licenses/gpl-3.0.txt
20
- */
21
-
22
-
23
- if ( ! defined ( 'ABSPATH' ) ) {
24
- exit;
25
- } // Exit if accessed directly
26
-
27
- if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
28
- /**
29
- * YITH WooCommerce Ajax Navigation
30
- *
31
- * @since 1.0.0
32
- */
33
- function yit_maybe_plugin_fw_loader ( $plugin_path ) {
34
- global $plugin_fw_data;
35
-
36
- $default_headers = array (
37
- 'Name' => 'Framework Name',
38
- 'Version' => 'Version',
39
- 'Author' => 'Author',
40
- 'TextDomain' => 'Text Domain',
41
- 'DomainPath' => 'Domain Path',
42
- );
43
-
44
- $framework_data = get_file_data ( trailingslashit ( $plugin_path ) . 'plugin-fw/init.php', $default_headers );
45
- $plugin_fw_main_file = trailingslashit ( $plugin_path ) . 'plugin-fw/yit-plugin.php';
46
-
47
- if ( ! empty( $plugin_fw_data ) ) {
48
- foreach ( $plugin_fw_data as $version => $path ) {
49
- if ( version_compare ( $version, $framework_data[ 'Version' ], '<' ) ) {
50
- $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
51
- }
52
- }
53
- } else {
54
- $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
55
- }
56
- }
57
  }
1
+ <?php
2
+ /**
3
+ * Framework Name: YIT Plugin Framework
4
+ * Version: 2.9.22
5
+ * Author: Yithemes
6
+ * Text Domain: yith-plugin-fw
7
+ * Domain Path: /languages/
8
+ *
9
+ * @author Your Inspiration Themes
10
+ * @package YITH WooCommerce Ajax Navigation
11
+ * @version 2.0
12
+ */
13
+ /**
14
+ * This file belongs to the YIT Plugin Framework.
15
+ *
16
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
17
+ * that is bundled with this package in the file LICENSE.txt.
18
+ * It is also available through the world-wide-web at this URL:
19
+ * http://www.gnu.org/licenses/gpl-3.0.txt
20
+ */
21
+
22
+
23
+ if ( ! defined ( 'ABSPATH' ) ) {
24
+ exit;
25
+ } // Exit if accessed directly
26
+
27
+ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
28
+ /**
29
+ * YITH WooCommerce Ajax Navigation
30
+ *
31
+ * @since 1.0.0
32
+ */
33
+ function yit_maybe_plugin_fw_loader ( $plugin_path ) {
34
+ global $plugin_fw_data;
35
+
36
+ $default_headers = array (
37
+ 'Name' => 'Framework Name',
38
+ 'Version' => 'Version',
39
+ 'Author' => 'Author',
40
+ 'TextDomain' => 'Text Domain',
41
+ 'DomainPath' => 'Domain Path',
42
+ );
43
+
44
+ $framework_data = get_file_data ( trailingslashit ( $plugin_path ) . 'plugin-fw/init.php', $default_headers );
45
+ $plugin_fw_main_file = trailingslashit ( $plugin_path ) . 'plugin-fw/yit-plugin.php';
46
+
47
+ if ( ! empty( $plugin_fw_data ) ) {
48
+ foreach ( $plugin_fw_data as $version => $path ) {
49
+ if ( version_compare ( $version, $framework_data[ 'Version' ], '<' ) ) {
50
+ $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
51
+ }
52
+ }
53
+ } else {
54
+ $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
55
+ }
56
+ }
57
  }
plugin-fw/languages/yith-plugin-fw-it_IT.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-it_IT.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
- "POT-Creation-Date: 2015-11-16 12:23+0100\n"
8
- "PO-Revision-Date: 2015-11-16 12:24+0100\n"
9
  "Last-Translator: \n"
10
  "Language-Team: YIThemes <plugins@yithemes.com>\n"
11
  "Language: it_IT\n"
@@ -224,7 +224,7 @@ msgstr "Aggiungi %s dalla immagini"
224
  msgid "Upload multiple files"
225
  msgstr ""
226
 
227
- #: lib/yit-plugin-panel-wc.php:336
228
  msgid "The changes you have made will be lost if you leave this page."
229
  msgstr "Perderai tutti i cambiamenti effettuati se lasci questa pagina."
230
 
@@ -232,71 +232,75 @@ msgstr "Perderai tutti i cambiamenti effettuati se lasci questa pagina."
232
  msgid "Plugin Settings"
233
  msgstr "Impostazioni plugin"
234
 
235
- #: lib/yit-plugin-panel.php:96 lib/yit-plugin-subpanel.php:101
236
- msgid "YIT Plugins"
237
- msgstr "YIT Plugins"
238
 
239
- #: lib/yit-plugin-panel.php:288 lib/yit-plugin-subpanel.php:143
 
 
 
 
240
  #: templates/panel/woocommerce/woocommerce-form.php:5
241
  msgid "Save Changes"
242
  msgstr "Salva modifiche"
243
 
244
- #: lib/yit-plugin-panel.php:291 templates/panel/woocommerce/woocommerce-form.php:8
245
  msgid "If you continue with this action, you will reset all options in this page."
246
  msgstr ""
247
  "Se prosegui con questa azione, tutte le opzioni di questa pagina saranno "
248
  "reimpostate."
249
 
250
- #: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
251
  msgid "Reset to default"
252
  msgstr ""
253
 
254
- #: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
255
  #: templates/panel/woocommerce/woocommerce-form.php:11
256
  msgid "Are you sure?"
257
  msgstr "Sei sicuro?"
258
 
259
- #: lib/yit-plugin-panel.php:427
260
  msgid "The element you have entered already exists. Please, enter another name."
261
  msgstr "L'elemento inserito esiste già. Per favore, inserisci un altro nome."
262
 
263
- #: lib/yit-plugin-panel.php:428
264
  msgid "Settings saved"
265
  msgstr "Impostazioni salvate"
266
 
267
- #: lib/yit-plugin-panel.php:429
268
  msgid "Settings reset"
269
  msgstr "Impostazioni azzerate"
270
 
271
- #: lib/yit-plugin-panel.php:430
272
  msgid "Element deleted correctly."
273
  msgstr "Elemento rimosso correttamente."
274
 
275
- #: lib/yit-plugin-panel.php:431 lib/yit-plugin-panel.php:432
276
  msgid "Element updated correctly."
277
  msgstr "Elemento aggiornato correttamente."
278
 
279
- #: lib/yit-plugin-panel.php:433
280
  msgid "Database imported correctly."
281
  msgstr "Database importato correttamente."
282
 
283
- #: lib/yit-plugin-panel.php:434
284
  msgid "An error has occurred during import. Please try again."
285
  msgstr "Si è verificato un errore durante l'importazione. Prova di nuovo."
286
 
287
- #: lib/yit-plugin-panel.php:435
288
  msgid "The added file is not valid."
289
  msgstr "Il file aggiunto non è valido."
290
 
291
- #: lib/yit-plugin-panel.php:436
292
  msgid "Sorry, import is disabled."
293
  msgstr "Ci dispiace, l'importazione è disabilitata."
294
 
295
- #: lib/yit-plugin-panel.php:437
296
  msgid "Sorting successful."
297
  msgstr "Ordinamento effettuato con successo."
298
 
299
- #: lib/yit-plugin-subpanel.php:146
300
  msgid ""
301
  "If you continue with this action, you will reset all the options in this page."
302
  msgstr ""
@@ -347,40 +351,40 @@ msgstr ""
347
  "di YITH WooCommerce Wishlist, YITH WooCommerce Ajax Search etc.)\n"
348
  "saranno trasferite nella scheda Plugin YIT."
349
 
350
- #: lib/yit-upgrade.php:123
351
  msgid "There is a new version of %plugin_name% available."
352
  msgstr "Una nuova versione di %plugin_name% è disponibile."
353
 
354
- #: lib/yit-upgrade.php:124
355
  msgid "View version %latest% details."
356
  msgstr "Visualizza i dettagli della versione %latest%."
357
 
358
- #: lib/yit-upgrade.php:125
359
  msgid "Automatic update is unavailable for this plugin,"
360
  msgstr "L'aggiornamento automatico non è disponibile per questo plugin,"
361
 
362
- #: lib/yit-upgrade.php:126
363
  msgid "please <a href=\"%activate_link%\">activate</a> your copy of %plugin_name%."
364
  msgstr ""
365
  "per favore, <a href=\"%activate_link%\">attiva</a> la tua copia di %plugin_name%."
366
 
367
- #: lib/yit-upgrade.php:127
368
  msgid "Update now."
369
  msgstr "Aggiorna adesso."
370
 
371
- #: lib/yit-upgrade.php:250
372
- msgid "Yithemes Repository"
373
- msgstr "Repository YIThemes"
374
 
375
- #: lib/yit-upgrade.php:284
376
  msgid "Invalid URL Provided."
377
  msgstr "L'URL inserito non è valido."
378
 
379
- #: lib/yit-upgrade.php:297
380
  msgid "Could not create Temporary file."
381
  msgstr "Non è stato possibile creare il file temporaneo."
382
 
383
- #: lib/yit-upgrade.php:439
384
  #, php-format
385
  msgid ""
386
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
@@ -389,7 +393,7 @@ msgstr ""
389
  "È disponibile una nuova versione di %1$s. <a href=\"%2$s\" class=\"thickbox yit-"
390
  "changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a>."
391
 
392
- #: lib/yit-upgrade.php:441
393
  #, php-format
394
  msgid ""
395
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
@@ -402,7 +406,7 @@ msgstr ""
402
  "<em>Per poter usufruire degli aggiornamenti automatici è necessario attivare il "
403
  "plugin su un solo sito.</em>"
404
 
405
- #: lib/yit-upgrade.php:443
406
  #, php-format
407
  msgid ""
408
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
@@ -411,7 +415,7 @@ msgid ""
411
  "activation\">activate</a> your copy of %6s.</em>"
412
  msgstr ""
413
 
414
- #: lib/yit-upgrade.php:445
415
  #, php-format
416
  msgid ""
417
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
@@ -422,111 +426,115 @@ msgstr ""
422
  "changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a> "
423
  "oppure <a href=\"%5$s\">aggiorna adesso</a>."
424
 
425
- #: lib/yit-upgrade.php:518
426
  msgid "You can't update the plugins for this site."
427
  msgstr "Non è possibile aggiornare i plugin per questo sito."
428
 
429
- #: lib/yit-upgrade.php:522
430
  msgid "You do not have sufficient permissions to update the plugins for this site."
431
  msgstr ""
432
  "Non sei in possesso delle autorizzazioni necessarie per aggiornare i plugin in "
433
  "questo sito."
434
 
435
- #: lib/yit-upgrade.php:529
436
  msgid "Update Plugin"
437
  msgstr "Aggiorna plugin"
438
 
439
- #: licence/lib/yit-licence.php:170
440
  #, php-format
441
  msgctxt "%s = field name"
442
  msgid "%s field cannot be empty"
443
  msgstr "Il campo %s non può essere vuoto"
444
 
445
- #: licence/lib/yit-licence.php:171
446
  #, php-format
447
  msgid "%s and %s fields cannot be empty"
448
  msgstr "I campi %s e %s non possono essere vuoti"
449
 
450
- #: licence/lib/yit-licence.php:172
451
  msgid "Unable to contact the remote server, please try again later. Thanks!"
452
  msgstr "Impossibile contattare il server remoto, prova più tardi. Grazie!"
453
 
454
- #: licence/lib/yit-licence.php:173
455
- #: licence/templates/panel/activation/activation-panel.php:89
456
- #: licence/templates/panel/activation/activation-panel.php:164
457
- #: licence/templates/panel/activation/activation-panel.php:195
458
  #: templates/metaboxes/types/contactform.php:148
459
  #: templates/metaboxes/types/contactform.php:340
460
  msgid "Email"
461
  msgstr "Email"
462
 
463
- #: licence/lib/yit-licence.php:174
464
- #: licence/templates/panel/activation/activation-panel.php:90
465
- #: licence/templates/panel/activation/activation-panel.php:165
466
- #: licence/templates/panel/activation/activation-panel.php:196
467
  msgid "License Key"
468
  msgstr ""
469
 
470
- #: licence/lib/yit-licence.php:175
471
  msgid "Are you sure you want to deactivate the license for current site?"
472
  msgstr ""
473
 
474
- #: licence/lib/yit-licence.php:638
475
  msgid "Invalid Request"
476
  msgstr "Richiesta non valida"
477
 
478
- #: licence/lib/yit-licence.php:639
479
  msgid "Invalid license key"
480
  msgstr ""
481
 
482
- #: licence/lib/yit-licence.php:640
483
  msgid "Software has been deactivated"
484
  msgstr "Il software è stato disattivato"
485
 
486
- #: licence/lib/yit-licence.php:641
487
  msgid "Maximum number of activations exceeded"
488
  msgstr "Hai raggiunto il numero massimo di attivazioni"
489
 
490
- #: licence/lib/yit-licence.php:642
491
  msgid "Invalid instance ID"
492
  msgstr "Istanza ID non valida"
493
 
494
- #: licence/lib/yit-licence.php:643
495
  msgid "Invalid security key"
496
  msgstr "Chiave di sicurezza non valida"
497
 
498
- #: licence/lib/yit-licence.php:644
499
  msgid "License key has expired"
500
  msgstr ""
501
 
502
- #: licence/lib/yit-licence.php:645
503
  msgid "License key has been banned"
504
  msgstr ""
505
 
506
- #: licence/lib/yit-licence.php:646
 
 
 
 
507
  msgid "Great"
508
  msgstr ""
509
 
510
- #: licence/lib/yit-licence.php:646
511
  msgid "License successfully activated"
512
  msgstr ""
513
 
514
- #: licence/lib/yit-licence.php:647
515
  msgid "License key deactivated for website"
516
  msgstr ""
517
 
518
- #: licence/lib/yit-plugin-licence.php:68 licence/lib/yit-plugin-licence.php:69
519
- #: licence/lib/yit-theme-licence.php:70 licence/lib/yit-theme-licence.php:71
520
- #: licence/lib/yit-theme-licence.php:110 licence/lib/yit-theme-licence.php:111
521
  msgid "License Activation"
522
  msgstr ""
523
 
524
- #: licence/lib/yit-theme-licence.php:118 licence/lib/yit-theme-licence.php:119
525
  #, php-format
526
  msgid "%s"
527
  msgstr "%s"
528
 
529
- #: licence/lib/yit-theme-licence.php:160
530
  msgid ""
531
  "I cannot find the license key for activating the theme I have bought some time "
532
  "ago. Where can I find it?"
@@ -548,11 +556,11 @@ msgid ""
548
  "in section \"My licenses\"."
549
  msgstr ""
550
 
551
- #: licence/templates/panel/activation/activation-panel.php:22
552
  msgid "Yithemes License Activation"
553
  msgstr ""
554
 
555
- #: licence/templates/panel/activation/activation-panel.php:28
556
  msgid ""
557
  "Have you updated your licenses? Have you asked for an extension? Update "
558
  "information concerning your products."
@@ -560,73 +568,75 @@ msgstr ""
560
  "Hai aggiornato la tua licenza? Hai richiesto un'estensione? Aggiorna le "
561
  "informazioni dei tuoi prodotti."
562
 
563
- #: licence/templates/panel/activation/activation-panel.php:30
564
  msgid "Update license information"
565
  msgstr ""
566
 
567
- #: licence/templates/panel/activation/activation-panel.php:43
568
  msgid "Product to activate"
569
  msgid_plural "Products to activate"
570
  msgstr[0] ""
571
  msgstr[1] ""
572
 
573
- #: licence/templates/panel/activation/activation-panel.php:62
574
  msgid "Activate"
575
  msgstr "Attiva"
576
 
577
- #: licence/templates/panel/activation/activation-panel.php:81
578
  msgid "Activated"
579
  msgstr "Attivato"
580
 
581
- #: licence/templates/panel/activation/activation-panel.php:87
582
- #: licence/templates/panel/activation/activation-panel.php:162
583
- #: licence/templates/panel/activation/activation-panel.php:192
584
  msgid "Product Name"
585
  msgstr "Nome prodotto"
586
 
587
- #: licence/templates/panel/activation/activation-panel.php:93
588
- #: licence/templates/panel/activation/activation-panel.php:199
589
  msgid "Expires"
590
  msgstr "Scadenza"
591
 
592
- #: licence/templates/panel/activation/activation-panel.php:96
593
  msgid "Remaining"
594
  msgstr "Tempo rimanente"
595
 
596
  #: licence/templates/panel/activation/activation-panel.php:97
597
- #: licence/templates/panel/activation/activation-panel.php:223
598
  msgid "Membership"
599
  msgstr ""
600
 
601
- #: licence/templates/panel/activation/activation-panel.php:100
602
  msgid "License Actions"
603
  msgstr ""
604
 
605
- #: licence/templates/panel/activation/activation-panel.php:125
606
  #, php-format
607
  msgid "%1s out of %2s"
608
  msgstr "%1s di %2s"
609
 
610
- #: licence/templates/panel/activation/activation-panel.php:140
611
  msgid "Deactivate"
612
  msgstr ""
613
 
614
- #: licence/templates/panel/activation/activation-panel.php:145
615
- #: licence/templates/panel/activation/activation-panel.php:202
616
- #: licence/templates/panel/activation/activation-panel.php:223
617
  msgid "Renew"
618
  msgstr "Rinnova"
619
 
620
- #: licence/templates/panel/activation/activation-panel.php:158
621
  msgid "Banned"
622
  msgstr "Bloccato"
623
 
624
- #: licence/templates/panel/activation/activation-panel.php:188
625
  msgid "Expired"
626
  msgstr "Non più valido"
627
 
628
- #: licence/templates/panel/activation/activation-panel.php:223
629
- msgid "License"
 
 
 
 
630
  msgstr ""
631
 
632
  #: templates/metaboxes/types/ajax-products.php:23
@@ -993,10 +1003,146 @@ msgstr "Corsivo"
993
  msgid "Italic bold"
994
  msgstr "Grassetto corsivo"
995
 
 
 
 
 
996
  #: templates/panel/woocommerce/woocommerce-form.php:11
997
  msgid "Reset Defaults"
998
  msgstr "Ripristina impostazioni iniziali"
999
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1000
  #~ msgid "Layout for this "
1001
  #~ msgstr "Layout per questo"
1002
 
4
  msgstr ""
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
+ "POT-Creation-Date: 2016-03-18 15:29+0100\n"
8
+ "PO-Revision-Date: 2016-03-18 15:34+0100\n"
9
  "Last-Translator: \n"
10
  "Language-Team: YIThemes <plugins@yithemes.com>\n"
11
  "Language: it_IT\n"
224
  msgid "Upload multiple files"
225
  msgstr ""
226
 
227
+ #: lib/yit-plugin-panel-wc.php:345
228
  msgid "The changes you have made will be lost if you leave this page."
229
  msgstr "Perderai tutti i cambiamenti effettuati se lasci questa pagina."
230
 
232
  msgid "Plugin Settings"
233
  msgstr "Impostazioni plugin"
234
 
235
+ #: lib/yit-plugin-panel.php:99 lib/yit-plugin-subpanel.php:103
236
+ msgid "YITH Plugins"
237
+ msgstr "YITH Plugins"
238
 
239
+ #: lib/yit-plugin-panel.php:276
240
+ msgid "Premium version upgrade"
241
+ msgstr ""
242
+
243
+ #: lib/yit-plugin-panel.php:322 lib/yit-plugin-subpanel.php:146
244
  #: templates/panel/woocommerce/woocommerce-form.php:5
245
  msgid "Save Changes"
246
  msgstr "Salva modifiche"
247
 
248
+ #: lib/yit-plugin-panel.php:325 templates/panel/woocommerce/woocommerce-form.php:8
249
  msgid "If you continue with this action, you will reset all options in this page."
250
  msgstr ""
251
  "Se prosegui con questa azione, tutte le opzioni di questa pagina saranno "
252
  "reimpostate."
253
 
254
+ #: lib/yit-plugin-panel.php:327 lib/yit-plugin-subpanel.php:151
255
  msgid "Reset to default"
256
  msgstr ""
257
 
258
+ #: lib/yit-plugin-panel.php:327 lib/yit-plugin-subpanel.php:151
259
  #: templates/panel/woocommerce/woocommerce-form.php:11
260
  msgid "Are you sure?"
261
  msgstr "Sei sicuro?"
262
 
263
+ #: lib/yit-plugin-panel.php:461
264
  msgid "The element you have entered already exists. Please, enter another name."
265
  msgstr "L'elemento inserito esiste già. Per favore, inserisci un altro nome."
266
 
267
+ #: lib/yit-plugin-panel.php:462
268
  msgid "Settings saved"
269
  msgstr "Impostazioni salvate"
270
 
271
+ #: lib/yit-plugin-panel.php:463
272
  msgid "Settings reset"
273
  msgstr "Impostazioni azzerate"
274
 
275
+ #: lib/yit-plugin-panel.php:464
276
  msgid "Element deleted correctly."
277
  msgstr "Elemento rimosso correttamente."
278
 
279
+ #: lib/yit-plugin-panel.php:465 lib/yit-plugin-panel.php:466
280
  msgid "Element updated correctly."
281
  msgstr "Elemento aggiornato correttamente."
282
 
283
+ #: lib/yit-plugin-panel.php:467
284
  msgid "Database imported correctly."
285
  msgstr "Database importato correttamente."
286
 
287
+ #: lib/yit-plugin-panel.php:468
288
  msgid "An error has occurred during import. Please try again."
289
  msgstr "Si è verificato un errore durante l'importazione. Prova di nuovo."
290
 
291
+ #: lib/yit-plugin-panel.php:469
292
  msgid "The added file is not valid."
293
  msgstr "Il file aggiunto non è valido."
294
 
295
+ #: lib/yit-plugin-panel.php:470
296
  msgid "Sorry, import is disabled."
297
  msgstr "Ci dispiace, l'importazione è disabilitata."
298
 
299
+ #: lib/yit-plugin-panel.php:471
300
  msgid "Sorting successful."
301
  msgstr "Ordinamento effettuato con successo."
302
 
303
+ #: lib/yit-plugin-subpanel.php:149
304
  msgid ""
305
  "If you continue with this action, you will reset all the options in this page."
306
  msgstr ""
351
  "di YITH WooCommerce Wishlist, YITH WooCommerce Ajax Search etc.)\n"
352
  "saranno trasferite nella scheda Plugin YIT."
353
 
354
+ #: lib/yit-upgrade.php:136
355
  msgid "There is a new version of %plugin_name% available."
356
  msgstr "Una nuova versione di %plugin_name% è disponibile."
357
 
358
+ #: lib/yit-upgrade.php:137
359
  msgid "View version %latest% details."
360
  msgstr "Visualizza i dettagli della versione %latest%."
361
 
362
+ #: lib/yit-upgrade.php:138
363
  msgid "Automatic update is unavailable for this plugin,"
364
  msgstr "L'aggiornamento automatico non è disponibile per questo plugin,"
365
 
366
+ #: lib/yit-upgrade.php:139
367
  msgid "please <a href=\"%activate_link%\">activate</a> your copy of %plugin_name%."
368
  msgstr ""
369
  "per favore, <a href=\"%activate_link%\">attiva</a> la tua copia di %plugin_name%."
370
 
371
+ #: lib/yit-upgrade.php:140
372
  msgid "Update now."
373
  msgstr "Aggiorna adesso."
374
 
375
+ #: lib/yit-upgrade.php:243
376
+ msgid "YIThemes Repository"
377
+ msgstr ""
378
 
379
+ #: lib/yit-upgrade.php:277
380
  msgid "Invalid URL Provided."
381
  msgstr "L'URL inserito non è valido."
382
 
383
+ #: lib/yit-upgrade.php:290
384
  msgid "Could not create Temporary file."
385
  msgstr "Non è stato possibile creare il file temporaneo."
386
 
387
+ #: lib/yit-upgrade.php:432
388
  #, php-format
389
  msgid ""
390
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
393
  "È disponibile una nuova versione di %1$s. <a href=\"%2$s\" class=\"thickbox yit-"
394
  "changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a>."
395
 
396
+ #: lib/yit-upgrade.php:434
397
  #, php-format
398
  msgid ""
399
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
406
  "<em>Per poter usufruire degli aggiornamenti automatici è necessario attivare il "
407
  "plugin su un solo sito.</em>"
408
 
409
+ #: lib/yit-upgrade.php:436
410
  #, php-format
411
  msgid ""
412
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
415
  "activation\">activate</a> your copy of %6s.</em>"
416
  msgstr ""
417
 
418
+ #: lib/yit-upgrade.php:438
419
  #, php-format
420
  msgid ""
421
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
426
  "changelog-button\" title=\"%3$s\">Visualizza i dettagli della versione %4$s</a> "
427
  "oppure <a href=\"%5$s\">aggiorna adesso</a>."
428
 
429
+ #: lib/yit-upgrade.php:511
430
  msgid "You can't update the plugins for this site."
431
  msgstr "Non è possibile aggiornare i plugin per questo sito."
432
 
433
+ #: lib/yit-upgrade.php:515
434
  msgid "You do not have sufficient permissions to update the plugins for this site."
435
  msgstr ""
436
  "Non sei in possesso delle autorizzazioni necessarie per aggiornare i plugin in "
437
  "questo sito."
438
 
439
+ #: lib/yit-upgrade.php:522
440
  msgid "Update Plugin"
441
  msgstr "Aggiorna plugin"
442
 
443
+ #: licence/lib/yit-licence.php:182
444
  #, php-format
445
  msgctxt "%s = field name"
446
  msgid "%s field cannot be empty"
447
  msgstr "Il campo %s non può essere vuoto"
448
 
449
+ #: licence/lib/yit-licence.php:183
450
  #, php-format
451
  msgid "%s and %s fields cannot be empty"
452
  msgstr "I campi %s e %s non possono essere vuoti"
453
 
454
+ #: licence/lib/yit-licence.php:184
455
  msgid "Unable to contact the remote server, please try again later. Thanks!"
456
  msgstr "Impossibile contattare il server remoto, prova più tardi. Grazie!"
457
 
458
+ #: licence/lib/yit-licence.php:185
459
+ #: licence/templates/panel/activation/activation-panel.php:88
460
+ #: licence/templates/panel/activation/activation-panel.php:166
461
+ #: licence/templates/panel/activation/activation-panel.php:197
462
  #: templates/metaboxes/types/contactform.php:148
463
  #: templates/metaboxes/types/contactform.php:340
464
  msgid "Email"
465
  msgstr "Email"
466
 
467
+ #: licence/lib/yit-licence.php:186
468
+ #: licence/templates/panel/activation/activation-panel.php:89
469
+ #: licence/templates/panel/activation/activation-panel.php:167
470
+ #: licence/templates/panel/activation/activation-panel.php:198
471
  msgid "License Key"
472
  msgstr ""
473
 
474
+ #: licence/lib/yit-licence.php:187
475
  msgid "Are you sure you want to deactivate the license for current site?"
476
  msgstr ""
477
 
478
+ #: licence/lib/yit-licence.php:667
479
  msgid "Invalid Request"
480
  msgstr "Richiesta non valida"
481
 
482
+ #: licence/lib/yit-licence.php:668
483
  msgid "Invalid license key"
484
  msgstr ""
485
 
486
+ #: licence/lib/yit-licence.php:669
487
  msgid "Software has been deactivated"
488
  msgstr "Il software è stato disattivato"
489
 
490
+ #: licence/lib/yit-licence.php:670
491
  msgid "Maximum number of activations exceeded"
492
  msgstr "Hai raggiunto il numero massimo di attivazioni"
493
 
494
+ #: licence/lib/yit-licence.php:671
495
  msgid "Invalid instance ID"
496
  msgstr "Istanza ID non valida"
497
 
498
+ #: licence/lib/yit-licence.php:672
499
  msgid "Invalid security key"
500
  msgstr "Chiave di sicurezza non valida"
501
 
502
+ #: licence/lib/yit-licence.php:673
503
  msgid "License key has expired"
504
  msgstr ""
505
 
506
+ #: licence/lib/yit-licence.php:674
507
  msgid "License key has been banned"
508
  msgstr ""
509
 
510
+ #: licence/lib/yit-licence.php:675
511
+ msgid "Current product is not included with your membership key"
512
+ msgstr ""
513
+
514
+ #: licence/lib/yit-licence.php:676
515
  msgid "Great"
516
  msgstr ""
517
 
518
+ #: licence/lib/yit-licence.php:676
519
  msgid "License successfully activated"
520
  msgstr ""
521
 
522
+ #: licence/lib/yit-licence.php:677
523
  msgid "License key deactivated for website"
524
  msgstr ""
525
 
526
+ #: licence/lib/yit-plugin-licence.php:67 licence/lib/yit-plugin-licence.php:68
527
+ #: licence/lib/yit-theme-licence.php:69 licence/lib/yit-theme-licence.php:70
528
+ #: licence/lib/yit-theme-licence.php:109 licence/lib/yit-theme-licence.php:110
529
  msgid "License Activation"
530
  msgstr ""
531
 
532
+ #: licence/lib/yit-theme-licence.php:117 licence/lib/yit-theme-licence.php:118
533
  #, php-format
534
  msgid "%s"
535
  msgstr "%s"
536
 
537
+ #: licence/lib/yit-theme-licence.php:159
538
  msgid ""
539
  "I cannot find the license key for activating the theme I have bought some time "
540
  "ago. Where can I find it?"
556
  "in section \"My licenses\"."
557
  msgstr ""
558
 
559
+ #: licence/templates/panel/activation/activation-panel.php:23
560
  msgid "Yithemes License Activation"
561
  msgstr ""
562
 
563
+ #: licence/templates/panel/activation/activation-panel.php:27
564
  msgid ""
565
  "Have you updated your licenses? Have you asked for an extension? Update "
566
  "information concerning your products."
568
  "Hai aggiornato la tua licenza? Hai richiesto un'estensione? Aggiorna le "
569
  "informazioni dei tuoi prodotti."
570
 
571
+ #: licence/templates/panel/activation/activation-panel.php:29
572
  msgid "Update license information"
573
  msgstr ""
574
 
575
+ #: licence/templates/panel/activation/activation-panel.php:42
576
  msgid "Product to activate"
577
  msgid_plural "Products to activate"
578
  msgstr[0] ""
579
  msgstr[1] ""
580
 
581
+ #: licence/templates/panel/activation/activation-panel.php:61
582
  msgid "Activate"
583
  msgstr "Attiva"
584
 
585
+ #: licence/templates/panel/activation/activation-panel.php:80
586
  msgid "Activated"
587
  msgstr "Attivato"
588
 
589
+ #: licence/templates/panel/activation/activation-panel.php:86
590
+ #: licence/templates/panel/activation/activation-panel.php:164
591
+ #: licence/templates/panel/activation/activation-panel.php:194
592
  msgid "Product Name"
593
  msgstr "Nome prodotto"
594
 
595
+ #: licence/templates/panel/activation/activation-panel.php:92
596
+ #: licence/templates/panel/activation/activation-panel.php:201
597
  msgid "Expires"
598
  msgstr "Scadenza"
599
 
600
+ #: licence/templates/panel/activation/activation-panel.php:95
601
  msgid "Remaining"
602
  msgstr "Tempo rimanente"
603
 
604
  #: licence/templates/panel/activation/activation-panel.php:97
 
605
  msgid "Membership"
606
  msgstr ""
607
 
608
+ #: licence/templates/panel/activation/activation-panel.php:101
609
  msgid "License Actions"
610
  msgstr ""
611
 
612
+ #: licence/templates/panel/activation/activation-panel.php:126
613
  #, php-format
614
  msgid "%1s out of %2s"
615
  msgstr "%1s di %2s"
616
 
617
+ #: licence/templates/panel/activation/activation-panel.php:142
618
  msgid "Deactivate"
619
  msgstr ""
620
 
621
+ #: licence/templates/panel/activation/activation-panel.php:147
622
+ #: licence/templates/panel/activation/activation-panel.php:204
 
623
  msgid "Renew"
624
  msgstr "Rinnova"
625
 
626
+ #: licence/templates/panel/activation/activation-panel.php:160
627
  msgid "Banned"
628
  msgstr "Bloccato"
629
 
630
+ #: licence/templates/panel/activation/activation-panel.php:190
631
  msgid "Expired"
632
  msgstr "Non più valido"
633
 
634
+ #: licence/templates/panel/activation/activation-panel.php:226
635
+ msgid "Order again"
636
+ msgstr ""
637
+
638
+ #: licence/templates/panel/activation/activation-panel.php:228
639
+ msgid "Renew license"
640
  msgstr ""
641
 
642
  #: templates/metaboxes/types/ajax-products.php:23
1003
  msgid "Italic bold"
1004
  msgstr "Grassetto corsivo"
1005
 
1006
+ #: templates/panel/types/upload.php:32
1007
+ msgid "Reset"
1008
+ msgstr ""
1009
+
1010
  #: templates/panel/woocommerce/woocommerce-form.php:11
1011
  msgid "Reset Defaults"
1012
  msgstr "Ripristina impostazioni iniziali"
1013
 
1014
+ #: templates/upgrade/upgrade-to-pro-version.php:2
1015
+ msgid "Upgrade to Premium Version"
1016
+ msgstr ""
1017
+
1018
+ #: templates/upgrade/upgrade-to-pro-version.php:3
1019
+ msgid ""
1020
+ "Have you purchased the premium version of a plugin? Don't you know how to activate "
1021
+ "the license after the purchase?"
1022
+ msgstr ""
1023
+ "Hai comprato la versione premium di un plugin ? Dopo l'acquisto non trovi dove "
1024
+ "attivare la licenza del tuo plugin premium ? "
1025
+
1026
+ #: templates/upgrade/upgrade-to-pro-version.php:5
1027
+ msgid ""
1028
+ "To upgrade from a FREE to a PREMIUM plugin is not suffice to insert the license "
1029
+ "key provided after the purchase.\n"
1030
+ " The reason is that they are two distinct products, with significant "
1031
+ "differences both for available options and for number of files included in the "
1032
+ "plugin package.\n"
1033
+ " To start to use the PREMIUM version of the plugin, you simply need to "
1034
+ "download the PREMIUM packet and install it on your site."
1035
+ msgstr ""
1036
+ "Per passare da un plugin FREE ad uno PREMIUM non basta semplicemnete inserire la "
1037
+ "chiave di licenza che ti è stata fornita dopo aver completato l'acquisto. Questo "
1038
+ "perchè fisicamente si tratta di due prodotti diversi, con differenze sostanziali "
1039
+ "sia nelle opzioni disponibili sia sul numero di file presenti all'interno del "
1040
+ "pacchetto del plugin stesso. \n"
1041
+ "Per iniziare ad usare il plugin PREMIUM che hai appena acquistato devi "
1042
+ "semplicemente scaricare il pacchetto PREMIUM ed installarlo sul tuo sito."
1043
+
1044
+ #: templates/upgrade/upgrade-to-pro-version.php:9
1045
+ #, php-format
1046
+ msgid ""
1047
+ "%1$sDo you need to know how to do it?%2$s Easy! %1$sFollow this list of steps%2$s "
1048
+ "and in a few minutes the plugin you purchased will be installed on your site"
1049
+ msgstr ""
1050
+ "%1$sNon sai come fare ?%2$s Non è un problema%1$s, segui i passi elencati qui sotto"
1051
+ "%2$s ed in pochi minuti avrai il plugin acquistato correttamente installato sul "
1052
+ "tuo sito."
1053
+
1054
+ #: templates/upgrade/upgrade-to-pro-version.php:12
1055
+ msgid "Go to yithemes.com and login to \"My Account\" page"
1056
+ msgstr "Vai su yithemes.com ed effettua il login alla sezione \"My Account \""
1057
+
1058
+ #: templates/upgrade/upgrade-to-pro-version.php:18
1059
+ msgid ""
1060
+ "From the menu on the left, click on \"My Downloads\", look for the plugin you want "
1061
+ "to install among the available downloads and click on \"Download\" button"
1062
+ msgstr ""
1063
+ "Dal menù di sinistra clicca su \"My Downloads\" e cerca tra i download disponibili "
1064
+ "il plugin che vuoi installare, e clicca su \"Download\""
1065
+
1066
+ #: templates/upgrade/upgrade-to-pro-version.php:24
1067
+ msgid ""
1068
+ "After downloading the packet, go to your website and login to WordPress "
1069
+ "administration area."
1070
+ msgstr ""
1071
+ "Non appena il download del pacchetto sarà completato recati sul tuo sito web ed "
1072
+ "effettua il login all'area amministrazione di WordPress."
1073
+
1074
+ #: templates/upgrade/upgrade-to-pro-version.php:30
1075
+ msgid ""
1076
+ "From the menu on the left, click on \"Plugins\". You will be redirected to the "
1077
+ "page where you will find the complete list of all the plugins available on your "
1078
+ "site. Click on \"Add New\" button that you find above on the left to add a new "
1079
+ "plugin"
1080
+ msgstr ""
1081
+ "Dal menù di sinistra clicca sulla voce Plugins. Verrai indirizzato su una pagina "
1082
+ "con la lista dei plugin disponibili sul tuo sito. Clicca sul pulsante \"Add New\" "
1083
+ "che trovi in alto a sinistra vicino al titolo della pagina."
1084
+
1085
+ #: templates/upgrade/upgrade-to-pro-version.php:36
1086
+ msgid ""
1087
+ "You will be redirected to a new page where you will find, above on the left next "
1088
+ "to the page title, the \"Upload Plugin\" button."
1089
+ msgstr ""
1090
+ "Verrai indirizzato su una nuova pagina dove trovi, in alto a sinistra vicino al "
1091
+ "titolo della pagina, il pulsante \"Upload Plugin\"."
1092
+
1093
+ #: templates/upgrade/upgrade-to-pro-version.php:42
1094
+ msgid ""
1095
+ "Click on \"Upload Plugins\" button to start the upload of the PREMIUM version of "
1096
+ "the plugin previously downloaded. Click on \"Select File\", search for the "
1097
+ "download folder related to the plugin and upload the package. Now you only need to "
1098
+ "wait a few minutes for the upload and the installation on your site. (We used YITH "
1099
+ "Live Chat plugin by way of example)"
1100
+ msgstr ""
1101
+ "Cliccando su \"Upload Plugins\", ti troverai in una pagina dove poter effettuare "
1102
+ "l'upload del pacchetto del plugin PREMIUM da te precedentemente scaricato. Clicca "
1103
+ "quindi su \"Scegli File\", cerca la cartella di download dove hai scaricato il "
1104
+ "plugin ed effettua il caricamento del pacchetto. A questo punto ti basta attendere "
1105
+ "qualche minuto che il pacchetto venga caricato ed installato sul tuo sito. "
1106
+ "(Abbiamo usato YITH Live Chat come esempio) "
1107
+
1108
+ #: templates/upgrade/upgrade-to-pro-version.php:48
1109
+ msgid "After completing the installation, click on \"Activate plugin\""
1110
+ msgstr "Al termine della procedura di installazione clicca su \"Attiva\""
1111
+
1112
+ #: templates/upgrade/upgrade-to-pro-version.php:52
1113
+ msgid ""
1114
+ "If everything worked allright, your plugin is now correctly installed on your "
1115
+ "website. Enjoy it :-)"
1116
+ msgstr ""
1117
+ "Se tutto è andato per il meglio il tuo plugin è correttamente installato sul tuo "
1118
+ "sito web. Enjoy it :-)"
1119
+
1120
+ #: templates/upgrade/upgrade-to-pro-version.php:55
1121
+ msgid ""
1122
+ "The last step is the activation of the plugin through its license key you received "
1123
+ "after the purchase. Click on \"License Activation\" that you find in \"YITH Plugins"
1124
+ "\" and insert the license key and the email address you used during the purchas."
1125
+ msgstr ""
1126
+ "Ultimo step è attivare il plugin con la chiave di licenza che hai ricevuto dopo "
1127
+ "l'acquisto. Clicca quindi sul link \"License Activation\" che trovi sotto \"YITH "
1128
+ "Plugins\" ed inserisci la license key in tuo possesso ed email utilizzata in fase "
1129
+ "di acquisto."
1130
+
1131
+ #: templates/upgrade/upgrade-to-pro-version.php:61
1132
+ msgid ""
1133
+ "In case you had difficulty to recover the license key we sent you by email, you "
1134
+ "can easily find it in \"My Licenses\" section of your account on yithemes.com"
1135
+ msgstr ""
1136
+ "Se non trovi l'email che ti abbiamo inviato contenete la license key puoi "
1137
+ "facilmente recuperarla dalla sezione \"My Licenses\" all'interno della sezione My "
1138
+ "Account del nostro sito yithemes.com."
1139
+
1140
+ #~ msgid "YIT Plugins"
1141
+ #~ msgstr "YIT Plugins"
1142
+
1143
+ #~ msgid "Yithemes Repository"
1144
+ #~ msgstr "Repository YIThemes"
1145
+
1146
  #~ msgid "Layout for this "
1147
  #~ msgstr "Layout per questo"
1148
 
plugin-fw/languages/yith-plugin-fw.pot CHANGED
@@ -5,7 +5,7 @@ msgid ""
5
  msgstr ""
6
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
7
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
8
- "POT-Creation-Date: 2015-11-16 12:23+0100\n"
9
  "PO-Revision-Date: 2015-05-05 10:38+0100\n"
10
  "Last-Translator: \n"
11
  "Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
@@ -220,7 +220,7 @@ msgstr ""
220
  msgid "Upload multiple files"
221
  msgstr ""
222
 
223
- #: lib/yit-plugin-panel-wc.php:336
224
  msgid "The changes you have made will be lost if you leave this page."
225
  msgstr ""
226
 
@@ -228,69 +228,69 @@ msgstr ""
228
  msgid "Plugin Settings"
229
  msgstr ""
230
 
231
- #: lib/yit-plugin-panel.php:96 lib/yit-plugin-subpanel.php:101
232
- msgid "YIT Plugins"
233
  msgstr ""
234
 
235
- #: lib/yit-plugin-panel.php:288 lib/yit-plugin-subpanel.php:143
236
  #: templates/panel/woocommerce/woocommerce-form.php:5
237
  msgid "Save Changes"
238
  msgstr ""
239
 
240
- #: lib/yit-plugin-panel.php:291 templates/panel/woocommerce/woocommerce-form.php:8
241
  msgid "If you continue with this action, you will reset all options in this page."
242
  msgstr ""
243
 
244
- #: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
245
  msgid "Reset to default"
246
  msgstr ""
247
 
248
- #: lib/yit-plugin-panel.php:293 lib/yit-plugin-subpanel.php:148
249
  #: templates/panel/woocommerce/woocommerce-form.php:11
250
  msgid "Are you sure?"
251
  msgstr ""
252
 
253
- #: lib/yit-plugin-panel.php:427
254
  msgid "The element you have entered already exists. Please, enter another name."
255
  msgstr ""
256
 
257
- #: lib/yit-plugin-panel.php:428
258
  msgid "Settings saved"
259
  msgstr ""
260
 
261
- #: lib/yit-plugin-panel.php:429
262
  msgid "Settings reset"
263
  msgstr ""
264
 
265
- #: lib/yit-plugin-panel.php:430
266
  msgid "Element deleted correctly."
267
  msgstr ""
268
 
269
- #: lib/yit-plugin-panel.php:431 lib/yit-plugin-panel.php:432
270
  msgid "Element updated correctly."
271
  msgstr ""
272
 
273
- #: lib/yit-plugin-panel.php:433
274
  msgid "Database imported correctly."
275
  msgstr ""
276
 
277
- #: lib/yit-plugin-panel.php:434
278
  msgid "An error has occurred during import. Please try again."
279
  msgstr ""
280
 
281
- #: lib/yit-plugin-panel.php:435
282
  msgid "The added file is not valid."
283
  msgstr ""
284
 
285
- #: lib/yit-plugin-panel.php:436
286
  msgid "Sorry, import is disabled."
287
  msgstr ""
288
 
289
- #: lib/yit-plugin-panel.php:437
290
  msgid "Sorting successful."
291
  msgstr ""
292
 
293
- #: lib/yit-plugin-subpanel.php:146
294
  msgid ""
295
  "If you continue with this action, you will reset all the options in this page."
296
  msgstr ""
@@ -329,46 +329,46 @@ msgid ""
329
  "Plugin tab."
330
  msgstr ""
331
 
332
- #: lib/yit-upgrade.php:123
333
  msgid "There is a new version of %plugin_name% available."
334
  msgstr ""
335
 
336
- #: lib/yit-upgrade.php:124
337
  msgid "View version %latest% details."
338
  msgstr ""
339
 
340
- #: lib/yit-upgrade.php:125
341
  msgid "Automatic update is unavailable for this plugin,"
342
  msgstr ""
343
 
344
- #: lib/yit-upgrade.php:126
345
  msgid "please <a href=\"%activate_link%\">activate</a> your copy of %plugin_name%."
346
  msgstr ""
347
 
348
- #: lib/yit-upgrade.php:127
349
  msgid "Update now."
350
  msgstr ""
351
 
352
- #: lib/yit-upgrade.php:250
353
- msgid "Yithemes Repository"
354
  msgstr ""
355
 
356
- #: lib/yit-upgrade.php:284
357
  msgid "Invalid URL Provided."
358
  msgstr ""
359
 
360
- #: lib/yit-upgrade.php:297
361
  msgid "Could not create Temporary file."
362
  msgstr ""
363
 
364
- #: lib/yit-upgrade.php:439
365
  #, php-format
366
  msgid ""
367
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
368
  "changelog-button\" title=\"%3$s\">View version %4$s details</a>."
369
  msgstr ""
370
 
371
- #: lib/yit-upgrade.php:441
372
  #, php-format
373
  msgid ""
374
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
@@ -377,7 +377,7 @@ msgid ""
377
  "updates.</em>"
378
  msgstr ""
379
 
380
- #: lib/yit-upgrade.php:443
381
  #, php-format
382
  msgid ""
383
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
@@ -386,7 +386,7 @@ msgid ""
386
  "activation\">activate</a> your copy of %6s.</em>"
387
  msgstr ""
388
 
389
- #: lib/yit-upgrade.php:445
390
  #, php-format
391
  msgid ""
392
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
@@ -394,109 +394,113 @@ msgid ""
394
  "\">update now</a>."
395
  msgstr ""
396
 
397
- #: lib/yit-upgrade.php:518
398
  msgid "You can't update the plugins for this site."
399
  msgstr ""
400
 
401
- #: lib/yit-upgrade.php:522
402
  msgid "You do not have sufficient permissions to update the plugins for this site."
403
  msgstr ""
404
 
405
- #: lib/yit-upgrade.php:529
406
  msgid "Update Plugin"
407
  msgstr ""
408
 
409
- #: licence/lib/yit-licence.php:170
410
  #, php-format
411
  msgctxt "%s = field name"
412
  msgid "%s field cannot be empty"
413
  msgstr ""
414
 
415
- #: licence/lib/yit-licence.php:171
416
  #, php-format
417
  msgid "%s and %s fields cannot be empty"
418
  msgstr ""
419
 
420
- #: licence/lib/yit-licence.php:172
421
  msgid "Unable to contact the remote server, please try again later. Thanks!"
422
  msgstr ""
423
 
424
- #: licence/lib/yit-licence.php:173
425
- #: licence/templates/panel/activation/activation-panel.php:89
426
- #: licence/templates/panel/activation/activation-panel.php:164
427
- #: licence/templates/panel/activation/activation-panel.php:195
428
  #: templates/metaboxes/types/contactform.php:148
429
  #: templates/metaboxes/types/contactform.php:340
430
  msgid "Email"
431
  msgstr ""
432
 
433
- #: licence/lib/yit-licence.php:174
434
- #: licence/templates/panel/activation/activation-panel.php:90
435
- #: licence/templates/panel/activation/activation-panel.php:165
436
- #: licence/templates/panel/activation/activation-panel.php:196
437
  msgid "License Key"
438
  msgstr ""
439
 
440
- #: licence/lib/yit-licence.php:175
441
  msgid "Are you sure you want to deactivate the license for current site?"
442
  msgstr ""
443
 
444
- #: licence/lib/yit-licence.php:638
445
  msgid "Invalid Request"
446
  msgstr ""
447
 
448
- #: licence/lib/yit-licence.php:639
449
  msgid "Invalid license key"
450
  msgstr ""
451
 
452
- #: licence/lib/yit-licence.php:640
453
  msgid "Software has been deactivated"
454
  msgstr ""
455
 
456
- #: licence/lib/yit-licence.php:641
457
  msgid "Maximum number of activations exceeded"
458
  msgstr ""
459
 
460
- #: licence/lib/yit-licence.php:642
461
  msgid "Invalid instance ID"
462
  msgstr ""
463
 
464
- #: licence/lib/yit-licence.php:643
465
  msgid "Invalid security key"
466
  msgstr ""
467
 
468
- #: licence/lib/yit-licence.php:644
469
  msgid "License key has expired"
470
  msgstr ""
471
 
472
- #: licence/lib/yit-licence.php:645
473
  msgid "License key has been banned"
474
  msgstr ""
475
 
476
- #: licence/lib/yit-licence.php:646
 
 
 
 
477
  msgid "Great"
478
  msgstr ""
479
 
480
- #: licence/lib/yit-licence.php:646
481
  msgid "License successfully activated"
482
  msgstr ""
483
 
484
- #: licence/lib/yit-licence.php:647
485
  msgid "License key deactivated for website"
486
  msgstr ""
487
 
488
- #: licence/lib/yit-plugin-licence.php:68 licence/lib/yit-plugin-licence.php:69
489
- #: licence/lib/yit-theme-licence.php:70 licence/lib/yit-theme-licence.php:71
490
- #: licence/lib/yit-theme-licence.php:110 licence/lib/yit-theme-licence.php:111
491
  msgid "License Activation"
492
  msgstr ""
493
 
494
- #: licence/lib/yit-theme-licence.php:118 licence/lib/yit-theme-licence.php:119
495
  #, php-format
496
  msgid "%s"
497
  msgstr ""
498
 
499
- #: licence/lib/yit-theme-licence.php:160
500
  msgid ""
501
  "I cannot find the license key for activating the theme I have bought some time "
502
  "ago. Where can I find it?"
@@ -516,83 +520,85 @@ msgid ""
516
  "in section \"My licenses\"."
517
  msgstr ""
518
 
519
- #: licence/templates/panel/activation/activation-panel.php:22
520
  msgid "Yithemes License Activation"
521
  msgstr ""
522
 
523
- #: licence/templates/panel/activation/activation-panel.php:28
524
  msgid ""
525
  "Have you updated your licenses? Have you asked for an extension? Update "
526
  "information concerning your products."
527
  msgstr ""
528
 
529
- #: licence/templates/panel/activation/activation-panel.php:30
530
  msgid "Update license information"
531
  msgstr ""
532
 
533
- #: licence/templates/panel/activation/activation-panel.php:43
534
  msgid "Product to activate"
535
  msgid_plural "Products to activate"
536
  msgstr[0] ""
537
  msgstr[1] ""
538
 
539
- #: licence/templates/panel/activation/activation-panel.php:62
540
  msgid "Activate"
541
  msgstr ""
542
 
543
- #: licence/templates/panel/activation/activation-panel.php:81
544
  msgid "Activated"
545
  msgstr ""
546
 
547
- #: licence/templates/panel/activation/activation-panel.php:87
548
- #: licence/templates/panel/activation/activation-panel.php:162
549
- #: licence/templates/panel/activation/activation-panel.php:192
550
  msgid "Product Name"
551
  msgstr ""
552
 
553
- #: licence/templates/panel/activation/activation-panel.php:93
554
- #: licence/templates/panel/activation/activation-panel.php:199
555
  msgid "Expires"
556
  msgstr ""
557
 
558
- #: licence/templates/panel/activation/activation-panel.php:96
559
  msgid "Remaining"
560
  msgstr ""
561
 
562
  #: licence/templates/panel/activation/activation-panel.php:97
563
- #: licence/templates/panel/activation/activation-panel.php:223
564
  msgid "Membership"
565
  msgstr ""
566
 
567
- #: licence/templates/panel/activation/activation-panel.php:100
568
  msgid "License Actions"
569
  msgstr ""
570
 
571
- #: licence/templates/panel/activation/activation-panel.php:125
572
  #, php-format
573
  msgid "%1s out of %2s"
574
  msgstr ""
575
 
576
- #: licence/templates/panel/activation/activation-panel.php:140
577
  msgid "Deactivate"
578
  msgstr ""
579
 
580
- #: licence/templates/panel/activation/activation-panel.php:145
581
- #: licence/templates/panel/activation/activation-panel.php:202
582
- #: licence/templates/panel/activation/activation-panel.php:223
583
  msgid "Renew"
584
  msgstr ""
585
 
586
- #: licence/templates/panel/activation/activation-panel.php:158
587
  msgid "Banned"
588
  msgstr ""
589
 
590
- #: licence/templates/panel/activation/activation-panel.php:188
591
  msgid "Expired"
592
  msgstr ""
593
 
594
- #: licence/templates/panel/activation/activation-panel.php:223
595
- msgid "License"
 
 
 
 
596
  msgstr ""
597
 
598
  #: templates/metaboxes/types/ajax-products.php:23
@@ -955,6 +961,10 @@ msgstr ""
955
  msgid "Italic bold"
956
  msgstr ""
957
 
 
 
 
 
958
  #: templates/panel/woocommerce/woocommerce-form.php:11
959
  msgid "Reset Defaults"
960
  msgstr ""
5
  msgstr ""
6
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
7
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
8
+ "POT-Creation-Date: 2016-03-07 15:11+0100\n"
9
  "PO-Revision-Date: 2015-05-05 10:38+0100\n"
10
  "Last-Translator: \n"
11
  "Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
220
  msgid "Upload multiple files"
221
  msgstr ""
222
 
223
+ #: lib/yit-plugin-panel-wc.php:341
224
  msgid "The changes you have made will be lost if you leave this page."
225
  msgstr ""
226
 
228
  msgid "Plugin Settings"
229
  msgstr ""
230
 
231
+ #: lib/yit-plugin-panel.php:99 lib/yit-plugin-subpanel.php:103
232
+ msgid "YITH Plugins"
233
  msgstr ""
234
 
235
+ #: lib/yit-plugin-panel.php:297 lib/yit-plugin-subpanel.php:146
236
  #: templates/panel/woocommerce/woocommerce-form.php:5
237
  msgid "Save Changes"
238
  msgstr ""
239
 
240
+ #: lib/yit-plugin-panel.php:300 templates/panel/woocommerce/woocommerce-form.php:8
241
  msgid "If you continue with this action, you will reset all options in this page."
242
  msgstr ""
243
 
244
+ #: lib/yit-plugin-panel.php:302 lib/yit-plugin-subpanel.php:151
245
  msgid "Reset to default"
246
  msgstr ""
247
 
248
+ #: lib/yit-plugin-panel.php:302 lib/yit-plugin-subpanel.php:151
249
  #: templates/panel/woocommerce/woocommerce-form.php:11
250
  msgid "Are you sure?"
251
  msgstr ""
252
 
253
+ #: lib/yit-plugin-panel.php:436
254
  msgid "The element you have entered already exists. Please, enter another name."
255
  msgstr ""
256
 
257
+ #: lib/yit-plugin-panel.php:437
258
  msgid "Settings saved"
259
  msgstr ""
260
 
261
+ #: lib/yit-plugin-panel.php:438
262
  msgid "Settings reset"
263
  msgstr ""
264
 
265
+ #: lib/yit-plugin-panel.php:439
266
  msgid "Element deleted correctly."
267
  msgstr ""
268
 
269
+ #: lib/yit-plugin-panel.php:440 lib/yit-plugin-panel.php:441
270
  msgid "Element updated correctly."
271
  msgstr ""
272
 
273
+ #: lib/yit-plugin-panel.php:442
274
  msgid "Database imported correctly."
275
  msgstr ""
276
 
277
+ #: lib/yit-plugin-panel.php:443
278
  msgid "An error has occurred during import. Please try again."
279
  msgstr ""
280
 
281
+ #: lib/yit-plugin-panel.php:444
282
  msgid "The added file is not valid."
283
  msgstr ""
284
 
285
+ #: lib/yit-plugin-panel.php:445
286
  msgid "Sorry, import is disabled."
287
  msgstr ""
288
 
289
+ #: lib/yit-plugin-panel.php:446
290
  msgid "Sorting successful."
291
  msgstr ""
292
 
293
+ #: lib/yit-plugin-subpanel.php:149
294
  msgid ""
295
  "If you continue with this action, you will reset all the options in this page."
296
  msgstr ""
329
  "Plugin tab."
330
  msgstr ""
331
 
332
+ #: lib/yit-upgrade.php:136
333
  msgid "There is a new version of %plugin_name% available."
334
  msgstr ""
335
 
336
+ #: lib/yit-upgrade.php:137
337
  msgid "View version %latest% details."
338
  msgstr ""
339
 
340
+ #: lib/yit-upgrade.php:138
341
  msgid "Automatic update is unavailable for this plugin,"
342
  msgstr ""
343
 
344
+ #: lib/yit-upgrade.php:139
345
  msgid "please <a href=\"%activate_link%\">activate</a> your copy of %plugin_name%."
346
  msgstr ""
347
 
348
+ #: lib/yit-upgrade.php:140
349
  msgid "Update now."
350
  msgstr ""
351
 
352
+ #: lib/yit-upgrade.php:243
353
+ msgid "YIThemes Repository"
354
  msgstr ""
355
 
356
+ #: lib/yit-upgrade.php:277
357
  msgid "Invalid URL Provided."
358
  msgstr ""
359
 
360
+ #: lib/yit-upgrade.php:290
361
  msgid "Could not create Temporary file."
362
  msgstr ""
363
 
364
+ #: lib/yit-upgrade.php:432
365
  #, php-format
366
  msgid ""
367
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
368
  "changelog-button\" title=\"%3$s\">View version %4$s details</a>."
369
  msgstr ""
370
 
371
+ #: lib/yit-upgrade.php:434
372
  #, php-format
373
  msgid ""
374
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
377
  "updates.</em>"
378
  msgstr ""
379
 
380
+ #: lib/yit-upgrade.php:436
381
  #, php-format
382
  msgid ""
383
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
386
  "activation\">activate</a> your copy of %6s.</em>"
387
  msgstr ""
388
 
389
+ #: lib/yit-upgrade.php:438
390
  #, php-format
391
  msgid ""
392
  "There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox yit-"
394
  "\">update now</a>."
395
  msgstr ""
396
 
397
+ #: lib/yit-upgrade.php:511
398
  msgid "You can't update the plugins for this site."
399
  msgstr ""
400
 
401
+ #: lib/yit-upgrade.php:515
402
  msgid "You do not have sufficient permissions to update the plugins for this site."
403
  msgstr ""
404
 
405
+ #: lib/yit-upgrade.php:522
406
  msgid "Update Plugin"
407
  msgstr ""
408
 
409
+ #: licence/lib/yit-licence.php:182
410
  #, php-format
411
  msgctxt "%s = field name"
412
  msgid "%s field cannot be empty"
413
  msgstr ""
414
 
415
+ #: licence/lib/yit-licence.php:183
416
  #, php-format
417
  msgid "%s and %s fields cannot be empty"
418
  msgstr ""
419
 
420
+ #: licence/lib/yit-licence.php:184
421
  msgid "Unable to contact the remote server, please try again later. Thanks!"
422
  msgstr ""
423
 
424
+ #: licence/lib/yit-licence.php:185
425
+ #: licence/templates/panel/activation/activation-panel.php:88
426
+ #: licence/templates/panel/activation/activation-panel.php:166
427
+ #: licence/templates/panel/activation/activation-panel.php:197
428
  #: templates/metaboxes/types/contactform.php:148
429
  #: templates/metaboxes/types/contactform.php:340
430
  msgid "Email"
431
  msgstr ""
432
 
433
+ #: licence/lib/yit-licence.php:186
434
+ #: licence/templates/panel/activation/activation-panel.php:89
435
+ #: licence/templates/panel/activation/activation-panel.php:167
436
+ #: licence/templates/panel/activation/activation-panel.php:198
437
  msgid "License Key"
438
  msgstr ""
439
 
440
+ #: licence/lib/yit-licence.php:187
441
  msgid "Are you sure you want to deactivate the license for current site?"
442
  msgstr ""
443
 
444
+ #: licence/lib/yit-licence.php:667
445
  msgid "Invalid Request"
446
  msgstr ""
447
 
448
+ #: licence/lib/yit-licence.php:668
449
  msgid "Invalid license key"
450
  msgstr ""
451
 
452
+ #: licence/lib/yit-licence.php:669
453
  msgid "Software has been deactivated"
454
  msgstr ""
455
 
456
+ #: licence/lib/yit-licence.php:670
457
  msgid "Maximum number of activations exceeded"
458
  msgstr ""
459
 
460
+ #: licence/lib/yit-licence.php:671
461
  msgid "Invalid instance ID"
462
  msgstr ""
463
 
464
+ #: licence/lib/yit-licence.php:672
465
  msgid "Invalid security key"
466
  msgstr ""
467
 
468
+ #: licence/lib/yit-licence.php:673
469
  msgid "License key has expired"
470
  msgstr ""
471
 
472
+ #: licence/lib/yit-licence.php:674
473
  msgid "License key has been banned"
474
  msgstr ""
475
 
476
+ #: licence/lib/yit-licence.php:675
477
+ msgid "Current product is not included with your membership key"
478
+ msgstr ""
479
+
480
+ #: licence/lib/yit-licence.php:676
481
  msgid "Great"
482
  msgstr ""
483
 
484
+ #: licence/lib/yit-licence.php:676
485
  msgid "License successfully activated"
486
  msgstr ""
487
 
488
+ #: licence/lib/yit-licence.php:677
489
  msgid "License key deactivated for website"
490
  msgstr ""
491
 
492
+ #: licence/lib/yit-plugin-licence.php:67 licence/lib/yit-plugin-licence.php:68
493
+ #: licence/lib/yit-theme-licence.php:69 licence/lib/yit-theme-licence.php:70
494
+ #: licence/lib/yit-theme-licence.php:109 licence/lib/yit-theme-licence.php:110
495
  msgid "License Activation"
496
  msgstr ""
497
 
498
+ #: licence/lib/yit-theme-licence.php:117 licence/lib/yit-theme-licence.php:118
499
  #, php-format
500
  msgid "%s"
501
  msgstr ""
502
 
503
+ #: licence/lib/yit-theme-licence.php:159
504
  msgid ""
505
  "I cannot find the license key for activating the theme I have bought some time "
506
  "ago. Where can I find it?"
520
  "in section \"My licenses\"."
521
  msgstr ""
522
 
523
+ #: licence/templates/panel/activation/activation-panel.php:23
524
  msgid "Yithemes License Activation"
525
  msgstr ""
526
 
527
+ #: licence/templates/panel/activation/activation-panel.php:27
528
  msgid ""
529
  "Have you updated your licenses? Have you asked for an extension? Update "
530
  "information concerning your products."
531
  msgstr ""
532
 
533
+ #: licence/templates/panel/activation/activation-panel.php:29
534
  msgid "Update license information"
535
  msgstr ""
536
 
537
+ #: licence/templates/panel/activation/activation-panel.php:42
538
  msgid "Product to activate"
539
  msgid_plural "Products to activate"
540
  msgstr[0] ""
541
  msgstr[1] ""
542
 
543
+ #: licence/templates/panel/activation/activation-panel.php:61
544
  msgid "Activate"
545
  msgstr ""
546
 
547
+ #: licence/templates/panel/activation/activation-panel.php:80
548
  msgid "Activated"
549
  msgstr ""
550
 
551
+ #: licence/templates/panel/activation/activation-panel.php:86
552
+ #: licence/templates/panel/activation/activation-panel.php:164
553
+ #: licence/templates/panel/activation/activation-panel.php:194
554
  msgid "Product Name"
555
  msgstr ""
556
 
557
+ #: licence/templates/panel/activation/activation-panel.php:92
558
+ #: licence/templates/panel/activation/activation-panel.php:201
559
  msgid "Expires"
560
  msgstr ""
561
 
562
+ #: licence/templates/panel/activation/activation-panel.php:95
563
  msgid "Remaining"
564
  msgstr ""
565
 
566
  #: licence/templates/panel/activation/activation-panel.php:97
 
567
  msgid "Membership"
568
  msgstr ""
569
 
570
+ #: licence/templates/panel/activation/activation-panel.php:101
571
  msgid "License Actions"
572
  msgstr ""
573
 
574
+ #: licence/templates/panel/activation/activation-panel.php:126
575
  #, php-format
576
  msgid "%1s out of %2s"
577
  msgstr ""
578
 
579
+ #: licence/templates/panel/activation/activation-panel.php:142
580
  msgid "Deactivate"
581
  msgstr ""
582
 
583
+ #: licence/templates/panel/activation/activation-panel.php:147
584
+ #: licence/templates/panel/activation/activation-panel.php:204
 
585
  msgid "Renew"
586
  msgstr ""
587
 
588
+ #: licence/templates/panel/activation/activation-panel.php:160
589
  msgid "Banned"
590
  msgstr ""
591
 
592
+ #: licence/templates/panel/activation/activation-panel.php:190
593
  msgid "Expired"
594
  msgstr ""
595
 
596
+ #: licence/templates/panel/activation/activation-panel.php:226
597
+ msgid "Order again"
598
+ msgstr ""
599
+
600
+ #: licence/templates/panel/activation/activation-panel.php:228
601
+ msgid "Renew license"
602
  msgstr ""
603
 
604
  #: templates/metaboxes/types/ajax-products.php:23
961
  msgid "Italic bold"
962
  msgstr ""
963
 
964
+ #: templates/panel/types/upload.php:32
965
+ msgid "Reset"
966
+ msgstr ""
967
+
968
  #: templates/panel/woocommerce/woocommerce-form.php:11
969
  msgid "Reset Defaults"
970
  msgstr ""
plugin-fw/lib/yit-ajax.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( !defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( !class_exists( 'YIT_Ajax' ) ) {
16
+ /**
17
+ * YIT Ajax
18
+ *
19
+ * @class YIT_Ajax
20
+ * @package Yithemes
21
+ * @since 1.0
22
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
23
+ */
24
+ class YIT_Ajax {
25
+ /**
26
+ * @var string version of class
27
+ */
28
+ public $version = '1.0.0';
29
+
30
+ /**
31
+ * @var object The single instance of the class
32
+ * @since 1.0
33
+ */
34
+ protected static $_instance = null;
35
+
36
+ /**
37
+ * Constructor
38
+ *
39
+ * @since 1.0
40
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
41
+ */
42
+ private function __construct() {
43
+ add_action( 'wp_ajax_yith_plugin_panel_sidebar_set_collapse_option', array( $this, 'set_ajax_sidebar_collapse_option' ) );
44
+ }
45
+
46
+ /**
47
+ * get single instance
48
+ *
49
+ * @static
50
+ * @return YIT_Ajax
51
+ *
52
+ * @since 1.0
53
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
54
+ */
55
+ public static function instance() {
56
+ if ( is_null( self::$_instance ) ) {
57
+ self::$_instance = new self();
58
+ }
59
+
60
+ return self::$_instance;
61
+ }
62
+
63
+ /**
64
+ * Set Sidebar collapse option [AJAX]
65
+ */
66
+ public function set_ajax_sidebar_collapse_option() {
67
+ if ( isset( $_REQUEST[ 'option' ] ) ) {
68
+ $option = $_REQUEST[ 'option' ];
69
+ update_option( YIT_Plugin_Panel_Sidebar::$collapse_option, $option );
70
+ }
71
+ die();
72
+ }
73
+ }
74
+ }
75
+
76
+ YIT_Ajax::instance();
plugin-fw/lib/yit-cpt-unlimited.php CHANGED
@@ -1,1775 +1,1775 @@
1
- <?php
2
- /*
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
- if (!defined('ABSPATH')) {exit('Direct access forbidden.');
11
- }
12
-
13
- /**
14
- * Manage the custom post types as Portfolio, Contact Forms and similar (called CPTU)
15
- *
16
- * @class YIT_CPT_Unlimited
17
- * @package Yithemes
18
- * @since 2.0.0
19
- * @author Your Inspiration Themes
20
- *
21
- */
22
-
23
- class YIT_CPT_Unlimited {
24
-
25
- /**
26
- * @var string The name of main post type of CPTU
27
- * @since 1.0
28
- */
29
- protected $_name = '';
30
-
31
- /**
32
- * @var string The prefix of each post type created by the post of main CPTU
33
- * @since 1.0
34
- */
35
- protected $_prefix_cpt = '';
36
-
37
- /**
38
- * @var string The labels defined for the main CPTU
39
- * @since 1.0
40
- */
41
- protected $_labels = '';
42
-
43
- /**
44
- * @var string The configuration arguments of post type
45
- * @since 1.0
46
- */
47
- protected $_args = '';
48
-
49
- /**
50
- * @var array All post types created by the post of main CPTU
51
- * @since 1.0
52
- */
53
- public $post_types = array();
54
-
55
- /**
56
- * @var array $layouts Array with all portfolio layouts available for this site
57
- * @since 1.0
58
- */
59
- public $layouts = array();
60
-
61
- /**
62
- * @var string $template_path The pathname of template folder
63
- * @since 1.0
64
- */
65
- protected $template_path = '';
66
-
67
- /**
68
- * @var string $template_url The URL of template folder
69
- * @since 1.0
70
- */
71
- protected $template_url = '';
72
-
73
- /**
74
- * @var int $_index Unique sequential ID to differentiate same shortcodes in the same page
75
- */
76
- public $index = 0;
77
-
78
- /**
79
- * @var string $_layout Temporary attribute to load automatically the settings for each layout
80
- * @since 1.0
81
- */
82
- private $_layout = '';
83
-
84
-
85
- /**
86
- * Constructor
87
- *
88
- * Accept an array of arguments to define the characteristics of CPTU to register.
89
- *
90
- * @since 1.0
91
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
92
- */
93
- public function __construct( $args = array() ) {
94
-
95
- $defaults = array(
96
- 'name' => '',
97
- 'post_type_prefix' => '',
98
- 'labels' => array(
99
- 'main_name' => '',
100
- 'singular' => '',
101
- 'plural' => '',
102
- 'menu' => ''
103
- ),
104
- 'manage_layouts' => false,
105
- 'add_multiuploader' => false,
106
- 'sortable' => false,
107
- 'has_single' => false,
108
- 'has_taxonomy' => false,
109
- 'label_item_sing' => '',
110
- 'label_item_plur' => '',
111
- 'shortcode_name' => '',
112
- 'shortcode_icon' => '', // URL or icon name from http://melchoyce.github.io/dashicons/
113
- 'layout_option' => '_type' // the option ID of layout metabox
114
- );
115
- $this->_args = wp_parse_args( $args, $defaults );
116
-
117
- // fix labels
118
- if ( empty( $this->_args['labels']['main_name'] ) ) {
119
- $this->_args['labels']['main_name'] = $this->_args['labels']['singular'];
120
- }
121
- if ( empty( $this->_args['labels']['menu'] ) ) {
122
- $this->_args['labels']['menu'] = $this->_args['labels']['singular'];
123
- }
124
-
125
- /* populate */
126
- $this->_name = $this->_args['name'];
127
- $this->_prefix_cpt = $this->_args['post_type_prefix'];
128
- $this->_labels = $this->_args['labels'];
129
-
130
- add_action( 'init', array( $this, 'register_post_type' ) );
131
- add_action( 'init', array( $this, 'register_cptu_post_types' ) );
132
-
133
- add_action( 'save_post', array( $this, 'rewrite_flush') );
134
-
135
- // admin interface
136
- add_action( 'admin_head', array( $this, 'add_cptu_menu_item' ) );
137
- add_action( 'admin_init', array( $this, 'add_quick_links_metaboxes' ) );
138
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) );
139
-
140
- // metaboxes
141
- add_action( 'after_setup_theme', array( $this, 'add_metabox_cptu' ), 2 );
142
- add_action( 'after_setup_theme', array( $this, 'add_metabox_item_fields' ), 2 );
143
-
144
- // multiuploader
145
- if ( $this->_args['add_multiuploader'] ) {
146
- add_action( 'admin_footer', array( $this, 'add_button_multiuploader' ) );
147
- add_action( 'wp_ajax_yit_cptu_multiuploader', array( $this, 'post_multiuploader' ) );
148
- }
149
-
150
- // layouts
151
- if ( $this->_args['manage_layouts'] ) {
152
- // get all layouts available
153
- $this->get_layouts();
154
- }
155
-
156
- // single layout
157
- if ( $this->_args['has_single'] ) {
158
- add_action( 'yit_loop', array( $this, 'single_template' ) );
159
- add_action( 'wp', array( $this, 'single_template_config' ) );
160
-
161
- if ( defined('DOING_AJAX') && DOING_AJAX ) {
162
- add_action( 'init', array( $this, 'single_template_config' ) );
163
- }
164
- }
165
-
166
- // archive template
167
- add_action( 'wp', array( $this, 'archive_template' ) );
168
-
169
- // enqueue the assets of each layout
170
- add_action( 'wp_enqueue_scripts', array( $this, 'frontend_assets' ) );
171
-
172
- // add the shortcode, used to show the frontend
173
- if ( ! empty( $this->_args['shortcode_name'] ) ) {
174
- add_shortcode( $this->_args['shortcode_name'], array( &$this, 'add_shortcode' ) );
175
- add_filter( 'yit_shortcode_' . $this->_args['shortcode_name'] . '_icon', array( $this, 'shortcode_icon') );
176
- add_filter( 'yit-shortcode-plugin-init', array( $this, 'add_shortcode_to_box' ) );
177
- }
178
-
179
- // add sortable feature
180
- if ( $this->_args['sortable'] ) {
181
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_sortable_assets' ) );
182
- add_action( 'wp_ajax_cpt_sort_posts', array( $this, 'sort_posts' ) );
183
- add_action( 'admin_init', array( $this, 'init_menu_order' ) );
184
- add_filter( 'pre_get_posts', array( $this, 'filter_active' ) );
185
- add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
186
- add_filter( 'get_next_post_where', array( $this, 'sorted_next_post_where' ) );
187
- add_filter( 'get_previous_post_where', array( $this, 'sorted_prev_post_where' ) );
188
- add_filter( 'get_next_post_sort', array( $this, 'sorted_next_post_sort' ) );
189
- add_filter( 'get_previous_post_sort', array( $this, 'sorted_prev_post_sort' ) );
190
- }
191
-
192
- // add default columns to post type table list
193
- add_filter( 'manage_edit-' . $this->_name . '_columns', array( $this, 'cptu_define_columns' ) );
194
- add_action( 'manage_' . $this->_name . '_posts_custom_column' , array( $this, 'cptu_change_columns' ), 10, 2 );
195
-
196
- // add required post type for wordpress importer
197
- add_filter( 'wp_import_post_data_raw', array( $this, 'add_importer_required_post_type' ) );
198
- add_filter( 'wp_import_terms', array( $this, 'add_importer_required_taxonomy' ) );
199
- add_action( 'wp_import_set_post_terms', array( $this, 'recount_terms_post' ), 10, 3 );
200
-
201
- }
202
-
203
- /**
204
- * Enqueue the assets for the sortable feature
205
- *
206
- * @return void
207
- * @since 1.0
208
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
209
- */
210
- public function admin_sortable_assets() {
211
- global $post;
212
-
213
- if ( ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
214
- return;
215
- }
216
-
217
- wp_enqueue_script( 'yit-cptu-sortable-posts', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cptu-sortable-posts.js', array( 'jquery', 'jquery-ui-sortable' ), '1.0', true );
218
- }
219
-
220
- public function init_menu_order( $post_types = array() ) {
221
- global $wpdb;
222
-
223
- if ( empty( $post_types ) ) {
224
- $post_types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_type FROM $wpdb->posts WHERE post_type LIKE %s", str_replace( '_', '\_', $this->_prefix_cpt ) . '%' ) );
225
- } elseif ( ! is_array( $post_types ) ) {
226
- $post_types = array( $post_types );
227
- }
228
-
229
- foreach ( $post_types as $post_type ) {
230
- $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = '{$post_type}' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future') AND menu_order = 0" );
231
-
232
- if ( empty( $count ) ) {
233
- continue;
234
- }
235
-
236
- $sql = "SELECT ID
237
- FROM $wpdb->posts
238
- WHERE post_type = '" . $post_type . "'
239
- AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
240
- ORDER BY post_date DESC
241
- ";
242
-
243
- $results = $wpdb->get_results( $sql );
244
-
245
- foreach ( $results as $key => $result ) {
246
- $wpdb->update( $wpdb->posts, array( 'menu_order' => $key + 1 ), array( 'ID' => $result->ID ) );
247
- }
248
- }
249
- }
250
-
251
- /**
252
- * Save the order of posts from sortable feature
253
- *
254
- * @return void
255
- * @since 1.0
256
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
257
- */
258
- public function sort_posts() {
259
- global $wpdb;
260
-
261
- parse_str( $_REQUEST['order'], $data );
262
-
263
- if ( is_array( $data ) ) {
264
- //$this->init_menu_order( $_REQUEST['post_type'] );
265
-
266
- $id_arr = array( );
267
- foreach ( $data as $key => $values ) {
268
- foreach ( $values as $position => $id ) {
269
- $id_arr[] = $id;
270
- }
271
- }
272
-
273
-
274
- $menu_order_arr = array( );
275
- foreach ( $id_arr as $key => $id ) {
276
- $results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = " . $id );
277
- foreach ( $results as $result ) {
278
- $menu_order_arr[] = $result->menu_order;
279
- }
280
- }
281
-
282
- sort( $menu_order_arr );
283
-
284
- foreach ( $data as $key => $values ) {
285
- foreach ( $values as $position => $id ) {
286
- $wpdb->update( $wpdb->posts, array( 'menu_order' => $menu_order_arr[$position] ), array( 'ID' => $id ) );
287
- }
288
- }
289
- }
290
-
291
- die();
292
- }
293
-
294
- public function filter_active( $wp_query ) {
295
- if ( is_admin() && isset( $wp_query->query['suppress_filters'] ) )
296
- $wp_query->query['suppress_filters'] = false;
297
- if ( is_admin() && isset( $wp_query->query_vars['suppress_filters'] ) )
298
- $wp_query->query_vars['suppress_filters'] = false;
299
- return $wp_query;
300
- }
301
-
302
- public function pre_get_posts( $wp_query ) {
303
- if ( is_admin() && !defined( 'DOING_AJAX' ) ) {
304
- if ( isset( $wp_query->query['post_type'] ) ) {
305
- $post_types = (array) $wp_query->query['post_type'];
306
- foreach ( $post_types as $post_type ) {
307
- if ( $this->_is_valid( $post_type ) ) {
308
- $wp_query->set( 'orderby', 'menu_order' );
309
- $wp_query->set( 'order', 'ASC' );
310
- }
311
- }
312
- }
313
-
314
- } else {
315
-
316
- $active = false;
317
-
318
- if ( isset( $wp_query->query['suppress_filters'] ) || isset( $wp_query->query['post_type'] ) ) {
319
- $post_types = (array) $wp_query->query['post_type'];
320
- foreach ( $post_types as $post_type ) {
321
- if ( $this->_is_valid( $post_type ) ) {
322
- $active = true;
323
- }
324
- }
325
- }
326
-
327
- if ( $active ) {
328
- if ( !isset( $wp_query->query['orderby'] ) || $wp_query->query['orderby'] == 'post_date' )
329
- $wp_query->set( 'orderby', 'menu_order' );
330
- if ( !isset( $wp_query->query['order'] ) || $wp_query->query['order'] == 'DESC' )
331
- $wp_query->set( 'order', 'ASC' );
332
- }
333
- }
334
- }
335
-
336
- /**
337
- * Filters where clause for get next post
338
- *
339
- * @param $where
340
- *
341
- * @return string
342
- * @since 1.0
343
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
344
- */
345
- public function sorted_next_post_where( $where ){
346
- global $post;
347
- if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
348
- $post = get_post( intval( $_REQUEST['post_id'] ) );
349
- }
350
- else{
351
- $post = get_post();
352
- }
353
-
354
- if( ! $post || ! $this->_is_valid( $post->post_type ) ){
355
- return $where;
356
- }
357
-
358
- $result = str_replace( "'" . $post->post_date . "'", $post->menu_order, $where );
359
- $result = str_replace( 'p.post_date', 'p.menu_order', $result );
360
-
361
- return $result;
362
- }
363
-
364
- /**
365
- * Filters where clause for get prev post
366
- *
367
- * @param $where
368
- *
369
- * @return string
370
- * @since 1.0
371
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
372
- */
373
- public function sorted_prev_post_where( $where ){
374
- global $post;
375
-
376
- if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
377
- $post = get_post( intval( $_REQUEST['post_id'] ) );
378
- }
379
- else{
380
- $post = get_post();
381
- }
382
-
383
- if( ! $post || ! $this->_is_valid( $post->post_type ) ){
384
- return $where;
385
- }
386
-
387
- $result = str_replace( "'" . $post->post_date . "'", $post->menu_order, $where );
388
- $result = str_replace( 'p.post_date', 'p.menu_order', $result );
389
-
390
- return $result;
391
- }
392
-
393
- /**
394
- * Filters sort clause for get next post
395
- *
396
- * @param $sort
397
- *
398
- * @return string
399
- * @since 1.0
400
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
401
- */
402
- public function sorted_next_post_sort( $sort ){
403
- global $post;
404
-
405
- if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
406
- $post = get_post( intval( $_REQUEST['post_id'] ) );
407
- }
408
- else{
409
- $post = get_post();
410
- }
411
-
412
- if( ! $post || ! $this->_is_valid( $post->post_type ) ){
413
- return $sort;
414
- }
415
-
416
- $result = str_replace( 'p.post_date', 'p.menu_order', $sort );
417
- return $result;
418
- }
419
-
420
- /**
421
- * Filters sort clause for get prev post
422
- *
423
- * @param $sort
424
- *
425
- * @return string
426
- * @since 1.0
427
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
428
- */
429
- public function sorted_prev_post_sort( $sort ){
430
- global $post;
431
-
432
- if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
433
- $post = get_post( intval( $_REQUEST['post_id'] ) );
434
- }
435
- else{
436
- $post = get_post();
437
- }
438
-
439
- if( ! $post || ! $this->_is_valid( $post->post_type ) ){
440
- return $sort;
441
- }
442
-
443
- $result = str_replace( 'p.post_date', 'p.menu_order', $sort );
444
- return $result;
445
- }
446
-
447
- /**
448
- * Register post type
449
- *
450
- * Register the post type for the creation of portfolios
451
- *
452
- * @return void
453
- * @since 1.0
454
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
455
- */
456
- public function register_post_type() {
457
- $labels = array(
458
- 'name' => ucfirst( $this->_labels['main_name'] ),
459
- 'singular_name' => ucfirst( $this->_labels['singular'] ),
460
- 'add_new' => sprintf( __( 'Add %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
461
- 'add_new_item' => sprintf( __( 'Add New %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
462
- 'edit_item' => sprintf( __( 'Edit %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
463
- 'new_item' => sprintf( __( 'New %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
464
- 'all_items' => sprintf( __( 'All %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
465
- 'view_item' => sprintf( __( 'View %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
466
- 'search_items' => sprintf( __( 'Search %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
467
- 'not_found' => sprintf( __( 'No %s found', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
468
- 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
469
- 'parent_item_colon' => '',
470
- 'menu_name' => ucfirst( $this->_labels['menu'] )
471
- );
472
-
473
- $args = array(
474
- 'labels' => apply_filters( 'yit_' . $this->_name . '_labels', $labels ),
475
- 'public' => false,
476
- 'publicly_queryable' => false,
477
- 'show_ui' => true,
478
- 'show_in_menu' => true,
479
- 'query_var' => false,
480
- 'capability_type' => 'post',
481
- 'hierarchical' => false,
482
- 'menu_position' => null,
483
- 'supports' => array( 'title' )
484
- );
485
-
486
- if ( ! empty( $this->_args['menu_icon'] ) ) {
487
- $args['menu_icon'] = $this->_args['menu_icon'];
488
- }
489
-
490
- register_post_type( $this->_name, apply_filters( 'yit_' . $this->_name . '_args', $args ) );
491
- }
492
-
493
- /**
494
- * Retrieve the values configured inside the custom post type
495
- *
496
- * @param $post /WP_Query The post where get the arguments configured in the cpt
497
- *
498
- * @return array
499
- * @since 1.0
500
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
501
- */
502
- protected function _cpt_args( $post ) {
503
- if ( ! isset( $post->ID ) ) {
504
- return;
505
- }
506
-
507
- $args = apply_filters( 'yit_cptu_register_post_type_args', array(
508
- 'layout' => get_post_meta( $post->ID, $this->_args['layout_option'], true ),
509
- 'rewrite' => get_post_meta( $post->ID, '_rewrite', true ),
510
- 'label_singular' => ! empty( $this->_args['label_item_sing'] ) ? $this->_args['label_item_sing'] : get_post_meta( $post->ID, '_label_singular', true ),
511
- 'label_plural' => ! empty( $this->_args['label_item_plur'] ) ? $this->_args['label_item_plur'] : get_post_meta( $post->ID, '_label_plural', true ),
512
- 'taxonomy' => get_post_meta( $post->ID, '_taxonomy', true ),
513
- 'taxonomy_rewrite' => get_post_meta( $post->ID, '_taxonomy_rewrite', true ),
514
- ), $this->_name, $post );
515
-
516
- $title = $post->post_title;
517
-
518
- if ( empty( $args['label_singular'] ) ) {
519
- $args['label_singular'] = $title;
520
- }
521
-
522
- if ( empty( $args['label_plural'] ) ) {
523
- $args['label_plural'] = $title;
524
- }
525
-
526
- return $args;
527
- }
528
-
529
- /**
530
- * Retrieve the post types created for this CPTU
531
- *
532
- * @return array The link changed
533
- * @since 1.0
534
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
535
- */
536
- public function get_post_types() {
537
- if ( ! empty( $this->post_types ) ) {
538
- return $this->post_types;
539
- }
540
-
541
- $args = array(
542
- 'post_type' => $this->_name,
543
- 'posts_per_page' => -1,
544
- 'post_status' => 'publish'
545
- );
546
- $this->post_types = get_posts( $args );
547
-
548
- return $this->post_types;
549
- }
550
-
551
- /**
552
- * Register portfolio post types
553
- *
554
- * Register the post types for each portfolio created by admin
555
- *
556
- * @return void
557
- * @since 1.0
558
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
559
- */
560
- public function register_cptu_post_types() {
561
- $post_types = $this->get_post_types();
562
- $pts = array();
563
-
564
- foreach ( $post_types as $pt ) {
565
-
566
- extract( $this->_cpt_args( $pt ) );
567
-
568
- $name = $pt->post_name;
569
- $title = $pt->post_title;
570
-
571
- $labels = array(
572
- 'name' => $title,
573
- 'singular_name' => $label_singular,
574
- 'add_new' => sprintf( __( 'Add %s', 'yith-plugin-fw' ), $label_singular ),
575
- 'add_new_item' => sprintf( __( 'Add New %s', 'yith-plugin-fw' ), $label_singular ),
576
- 'edit_item' => sprintf( __( 'Edit %s', 'yith-plugin-fw' ), $label_singular ),
577
- 'new_item' => sprintf( __( 'New %s', 'yith-plugin-fw' ), $label_singular ),
578
- 'all_items' => sprintf( __( 'All %s', 'yith-plugin-fw' ), $label_plural ),
579
- 'view_item' => sprintf( __( 'View %s', 'yith-plugin-fw' ), $label_singular ),
580
- 'search_items' => sprintf( __( 'Search %s', 'yith-plugin-fw' ), $label_plural ),
581
- 'not_found' => sprintf( __( 'No %s found', 'yith-plugin-fw' ), $label_plural ),
582
- 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'yith-plugin-fw' ), $label_plural ),
583
- 'parent_item_colon' => '',
584
- 'menu_name' => $title
585
- );
586
-
587
- $args = array(
588
- 'labels' => apply_filters( 'yit_' . $this->_prefix_cpt . $name . '_labels', $labels ),
589
- 'public' => true,
590
- 'publicly_queryable' => true,
591
- 'show_ui' => true,
592
- 'show_in_menu' => false,
593
- 'query_var' => true,
594
- 'capability_type' => 'post',
595
- 'hierarchical' => false,
596
- 'menu_position' => null,
597
- 'supports' => array( 'title', 'editor', 'thumbnail' )
598
- );
599
-
600
- if ( ! $this->_args['has_single'] ) {
601
- $args['public'] = false;
602
- $args['publicly_queryable'] = false;
603
- $args['query_var'] = false;
604
- }
605
-
606
- if ( $this->_args['manage_layouts'] && isset($this->layouts[ $layout ]) && ! $this->layouts[ $layout ]['support']['description'] ) {
607
- unset( $args['supports'][1] ); // remove 'editor'
608
- }
609
-
610
- if ( ! empty( $rewrite ) ) {
611
- $args['rewrite'] = array( 'slug' => $rewrite );
612
- }
613
-
614
- // register post type
615
- $post_type = yit_avoid_duplicate( str_replace( '-', '_', substr( $this->_prefix_cpt . $name, 0, 16) ), $post_types );
616
- register_post_type( $post_type, apply_filters( 'yit_' . $this->_prefix_cpt . $name . '_args', $args, $pt ) ); // save the post type in post meta
617
-
618
- update_post_meta( $pt->ID, '_post_type', $post_type );
619
- $pts[] = $post_type;
620
-
621
- // register taxonomy
622
- if ( $this->_args['has_taxonomy'] && ! empty( $taxonomy ) ) {
623
-
624
- $labels = array(
625
- 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'yith-plugin-fw' ), $label_singular ),
626
- 'singular_name' => _x( 'Category', 'taxonomy singular name', 'yith-plugin-fw' ),
627
- 'search_items' => __( 'Search Categories', 'yith-plugin-fw' ),
628
- 'all_items' => __( 'All Categories', 'yith-plugin-fw' ),
629
- 'parent_item' => __( 'Parent Category', 'yith-plugin-fw' ),
630
- 'parent_item_colon' => __( 'Parent Category:', 'yith-plugin-fw' ),
631
- 'edit_item' => __( 'Edit Category', 'yith-plugin-fw' ),
632
- 'update_item' => __( 'Update Category', 'yith-plugin-fw' ),
633
- 'add_new_item' => __( 'Add New Category', 'yith-plugin-fw' ),
634
- 'new_item_name' => __( 'New Category Name', 'yith-plugin-fw' ),
635
- 'menu_name' => __( 'Category', 'yith-plugin-fw' ),
636
- );
637
-
638
- $args = array(
639
- 'hierarchical' => true,
640
- 'labels' => $labels,
641
- 'show_ui' => true,
642
- 'show_admin_column' => true,
643
- 'query_var' => true,
644
- );
645
-
646
- if ( ! empty( $taxonomy_rewrite ) ) {
647
- $args['rewrite'] = array( 'slug' => $taxonomy_rewrite );
648
- }
649
-
650
- register_taxonomy( substr( $taxonomy, 0, 32 ), $post_type, $args );
651
-
652
- }
653
-
654
- }
655
-
656
- wp_cache_set( 'yit_cptu_post_types', $post_types );
657
- }
658
-
659
- /**
660
- * Flush Rewrite Rules
661
- *
662
- * rewrite rules when a cpt unlimited is saved
663
- *
664
- * @return void
665
- * @since 1.0
666
- * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
667
- */
668
-
669
- public function rewrite_flush( $post ){
670
-
671
- if ( isset( $post ) && $this->_is_valid( get_post_type( intval( $post ) ) ) ) {
672
- flush_rewrite_rules();
673
- }
674
-
675
- }
676
-
677
- /**
678
- * Add the item for each portfolio under "Portfolios"
679
- *
680
- * @return void
681
- * @since 1.0
682
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
683
- */
684
- public function add_cptu_menu_item() {
685
- global $submenu, $post, $parent_file, $pagenow;
686
-
687
- // get current post type
688
- if ( isset( $post->post_type ) ) {
689
- $post_type = $post->post_type;
690
- } else if ( isset( $_REQUEST['post_type'] ) ) {
691
- $post_type = $_REQUEST['post_type'];
692
- } else {
693
- return;
694
- }
695
-
696
- $item = 'edit.php?post_type=' . $this->_name;
697
-
698
- // add new items
699
- if ( strpos( $post_type, $this->_prefix_cpt ) !== false ) {
700
- global $wpdb;
701
- $portfolio = $wpdb->get_row( $wpdb->prepare( "SELECT p.* FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $post_type, $this->_name ) );
702
-
703
- if ( ! isset( $portfolio->ID ) ) {
704
- return;
705
- }
706
-
707
- $label_singular = ! empty( $this->_args['label_item_sing'] ) ? $this->_args['label_item_sing'] : get_post_meta( $portfolio->ID, '_label_singular', true );
708
- $label_plural = ! empty( $this->_args['label_item_plur'] ) ? $this->_args['label_item_plur'] : get_post_meta( $portfolio->ID, '_label_plural', true );
709
-
710
- if ( empty( $label_plural ) ) {
711
- $label_plural = $portfolio->post_title;
712
- }
713
-
714
- if ( empty( $label_singular ) ) {
715
- $label_singular = $portfolio->post_title;
716
- }
717
-
718
- $submenu[ $item ][15] = array( ucfirst( $label_plural ), 'edit_posts', 'edit.php?post_type=' . $post_type );
719
- $submenu[ $item ][20] = array( sprintf( __('Add %s', 'yith-plugin-fw'), ucfirst( $label_singular ) ), 'edit_posts', 'post-new.php?post_type=' . $post_type );
720
-
721
- global $wp_taxonomies;
722
- $taxonomy = get_post_meta( $portfolio->ID, '_taxonomy', true );
723
- if ( isset( $wp_taxonomies[ $taxonomy ] ) ) {
724
- $submenu[ $item ][25] = array( __('Categories', 'yith-plugin-fw'), 'edit_posts', 'edit-tags.php?taxonomy=' . $taxonomy . '&post_type=' . $post_type );
725
- }
726
- }
727
-
728
- // set the parent item inside the single of each post type
729
- if ( $pagenow == 'post.php' && isset( $_GET['post'] ) && $this->_is_valid( get_post_type( intval( $_GET['post'] ) ) ) ) {
730
- $parent_file = 'edit.php?post_type=' . $this->_name;
731
- }
732
- }
733
-
734
- /**
735
- * Locate folder of CPTU templates, if there isn't a layouts management
736
- *
737
- * @return string
738
- * @since 1.0
739
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
740
- */
741
- public function template_path() {
742
- if ( ! empty( $this->template_path ) ) {
743
- return $this->template_path;
744
- }
745
-
746
- // paths
747
- $stylesheet_path_1 = get_stylesheet_directory() . '/theme/templates/' . $this->_name . '/';
748
- $stylesheet_path_2 = get_template_directory() . '/theme/templates/' . $this->_name . '/';
749
- $template_path_1 = get_stylesheet_directory() . '/' . $this->_name . '/';
750
- $template_path_2 = get_template_directory() . '/' . $this->_name . '/';
751
- $plugin_path = $this->_args['plugin_path'] . '/templates/';
752
-
753
- foreach ( array( 'stylesheet_path_1', 'stylesheet_path_2', 'template_path_1', 'template_path_2', 'plugin_path' ) as $var ) {
754
- $path = ${$var};
755
-
756
- if ( file_exists( $path ) ) {
757
- $this->template_path = $path;
758
- }
759
- }
760
-
761
- return $this->template_path;
762
- }
763
-
764
- /**
765
- * Locate folder of CPTU templates, if there isn't a layouts management
766
- *
767
- * @return string
768
- * @since 1.0
769
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
770
- */
771
- public function template_url() {
772
- if ( ! empty( $this->template_url ) ) {
773
- return $this->template_path;
774
- }
775
-
776
- $this->template_url = str_replace( array(
777
- get_stylesheet_directory(),
778
- get_template_directory(),
779
- $this->_args['plugin_path']
780
- ), array(
781
- get_stylesheet_directory_uri(),
782
- get_template_directory_uri(),
783
- $this->_args['plugin_url']
784
- ), $this->template_path() );
785
-
786
- return $this->template_url;
787
- }
788
-
789
- /**
790
- * Retrieve all layouts to manage by custom post type added in the site in this order:
791
- * 1. Child theme (if exists)
792
- * 2. Theme
793
- * 3. Plugin
794
- *
795
- * It also load the config.php file of each layout
796
- *
797
- * @return void
798
- * @since 1.0
799
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
800
- */
801
- public function get_layouts() {
802
-
803
- // paths
804
- $stylesheet_path_1 = get_stylesheet_directory() . '/theme/templates/' . $this->_name . '/';
805
- $stylesheet_path_2 = get_template_directory() . '/theme/templates/' . $this->_name . '/';
806
- $template_path_1 = get_stylesheet_directory() . '/' . $this->_name . '/';
807
- $template_path_2 = get_template_directory() . '/' . $this->_name . '/';
808
- $plugin_path = $this->_args['plugin_path'] . '/templates/';
809
-
810
- foreach ( array( 'stylesheet_path_1', 'stylesheet_path_2', 'template_path_1', 'template_path_2', 'plugin_path' ) as $var ) {
811
- $path = ${$var};
812
-
813
- if ( file_exists( $path ) ) {
814
- foreach ( scandir( $path ) as $scan ) {
815
- if ( ! isset( $this->layouts[$scan] ) && is_dir( $path . $scan ) && ! in_array( $scan, array( '.', '..', '.svn' ) ) && $scan[0] != '_' ) {
816
- $this->layouts[$scan] = array(
817
- 'name' => ucfirst( str_replace( '-', ' ', $scan ) ),
818
- 'path' => $path . $scan,
819
- 'url' => str_replace( array(
820
- get_stylesheet_directory(),
821
- get_template_directory(),
822
- $this->_args['plugin_path']
823
- ), array(
824
- get_stylesheet_directory_uri(),
825
- get_template_directory_uri(),
826
- $this->_args['plugin_url']
827
- ), $path . $scan ),
828
- 'css' => array(),
829
- 'js' => array(),
830
- 'support' => array(
831
- 'description' => true
832
- ),
833
- 'columns' => array()
834
- );
835
-
836
- // set the vars for config.php
837
- $layout = $scan;
838
- $this->_layout = $layout; // temporary attribute to load automatically the configuration inside the config.php, for this layout
839
-
840
- // TODO Fare in modo di caricare il file config.php soltanto quando realmente serve
841
- if ( ! in_array( $scan, array( 'single' ) ) && file_exists( $path . $scan . '/config.php' ) ) {
842
- include_once( $path . $scan . '/config.php' );
843
- }
844
- }
845
- }
846
- }
847
-
848
- }
849
- }
850
-
851
- /**
852
- * Say if you want to set description for the current layout or not. This method must be used only inside the
853
- * config.php file of layout
854
- *
855
- * @param $v string 'yes' or 'no'
856
- *
857
- * @return void
858
- * @since 1.0
859
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
860
- */
861
- public function add_description_field( $v ) {
862
- $this->layouts[ $this->_layout ]['support']['description'] = $v == 'yes' ? true : false;
863
- }
864
-
865
- /**
866
- * Add the extra fields for the specific layout type of portfolio
867
- *
868
- * @param array $fields The fields to add
869
- *
870
- * @return void
871
- * @since 1.0
872
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
873
- */
874
- public function add_layout_fields( $fields = array() ) {
875
- // change the ID
876
- foreach ( $fields as $id => $val ) {
877
- unset( $fields[ $id ] );
878
- $id = $this->_layout . '_' . $id;
879
- $fields[ $id ] = $val;
880
- }
881
-
882
- $this->layouts[ $this->_layout ]['fields'] = $fields;
883
- }
884
-
885
- /**
886
- * Add fields to add to the metabox of each item of each post type created
887
- *
888
- * @param array $fields The fields to add
889
- *
890
- * @return void
891
- * @since 1.0
892
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
893
- */
894
- public function add_item_fields( $fields = array() ) {
895
- // change the ID
896
- foreach ( $fields as $id => $val ) {
897
- unset( $fields[ $id ] );
898
- //$id = $this->_layout . '_' . $id;
899
- $fields[ $id ] = $val;
900
- }
901
- $this->layouts[ $this->_layout ]['item_fields'] = $fields;
902
- }
903
-
904
- /**
905
- * Add columns to the table list
906
- *
907
- * @param array $columns The columns to add in the table list
908
- *
909
- * @return void
910
- * @since 1.0
911
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
912
- */
913
- public function add_table_columns( $columns ) {
914
- $this->layouts[ $this->_layout ]['columns'] = $columns;
915
- }
916
-
917
- /**
918
- * Enqueue the css files of layout
919
- *
920
- * @param string $handle Name of the stylesheet.
921
- * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
922
- * @param array $deps An array of registered style handles this stylesheet depends on. Default empty array.
923
- * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter is used
924
- * to ensure that the correct version is sent to the client regardless of caching, and so
925
- * should be included if a version number is available and makes sense for the stylesheet.
926
- * @param string $media Optional. The media for which this stylesheet has been defined.
927
- * Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
928
- * 'screen', 'tty', or 'tv'.
929
- *
930
- * @return void
931
- * @since 1.0
932
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
933
- */
934
- public function enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
935
- $this->layouts[ $this->_layout ]['css'][] = compact( 'handle', 'src', 'deps', 'ver', 'media' );
936
- }
937
-
938
- /**
939
- * Enqueue the js files of layout
940
- *
941
- * @param string $handle Name of the script.
942
- * @param string|bool $src Path to the script from the root directory of WordPress. Example: '/js/myscript.js'.
943
- * @param array $deps An array of registered handles this script depends on. Default empty array.
944
- * @param string|bool $ver Optional. String specifying the script version number, if it has one. This parameter
945
- * is used to ensure that the correct version is sent to the client regardless of caching,
946
- * and so should be included if a version number is available and makes sense for the script.
947
- * @param bool $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
948
- * Default 'false'. Accepts 'false' or 'true'.
949
- *
950
- * @return void
951
- * @since 1.0
952
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
953
- */
954
- public function enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
955
- $this->layouts[ $this->_layout ]['js'][] = compact( 'handle', 'src', 'deps', 'ver', 'in_footer' );
956
- }
957
-
958
- /**
959
- * Enqueue the assets for the frontend
960
- *
961
- * @return void
962
- * @since 1.0
963
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
964
- */
965
- public function frontend_assets() {
966
- global $post;
967
-
968
- // not single
969
- if ( ! is_single() || ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
970
- $posts = get_posts(array(
971
- 'post_type' => $this->_name,
972
- 'posts_per_page' => -1,
973
- 'post_status' => 'publish',
974
- 'fields' => 'ids'
975
- ));
976
-
977
- $enqueued = array();
978
-
979
- foreach ( $posts as $post_id ) {
980
- $layout = get_post_meta( $post_id, $this->_args['layout_option'], true );
981
-
982
- if ( in_array( $layout, array( $enqueued ) ) || ! isset( $this->layouts[ $layout ]['css'] ) ) {
983
- continue;
984
- }
985
-
986
- foreach ( $this->layouts[ $layout ]['css'] as $asset ) {
987
- if ( empty( $asset ) ) {
988
- continue;
989
- }
990
- yit_enqueue_style( $asset['handle'], empty( $asset['src'] ) ? false : $this->locate_url( $layout ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['media'] );
991
- }
992
-
993
- $enqueued[] = $layout;
994
- }
995
- }
996
-
997
- // load assets of single template
998
- else {
999
- $layout = 'single';
1000
-
1001
- if ( ! isset( $this->layouts[ $layout ]['css'] ) ) {
1002
- return;
1003
- }
1004
-
1005
- foreach ( $this->layouts[ $layout ]['css'] as $asset ) {
1006
- if ( empty( $asset ) ) {
1007
- continue;
1008
- }
1009
- yit_enqueue_style( $asset['handle'], $this->locate_url( $layout ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['media'] );
1010
- }
1011
- }
1012
-
1013
- }
1014
-
1015
- /**
1016
- * Register Metaboxes options
1017
- *
1018
- * Add the metabox for the portfolio settings
1019
- *
1020
- * @return void
1021
- * @since 1.0
1022
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1023
- */
1024
- public function add_metabox_cptu() {
1025
-
1026
- // Reorganize layouts
1027
- if ( $this->_args['manage_layouts'] ) {
1028
- $layouts = array();
1029
- foreach ( $this->layouts as $layout_id => $layout ) {
1030
- if ( 'single' == $layout_id ) {
1031
- continue;
1032
- }
1033
- $layouts[ $layout_id ] = $layout['name'];
1034
- }
1035
-
1036
- $layouts = apply_filters( 'yit_cptu_' . $this->_name . '_layout_values', $layouts );
1037
- }
1038
-
1039
- $single_layouts = apply_filters( 'yit_cptu_' . $this->_name . '_single_layout_values', array() );
1040
-
1041
- $metabox_args = array(
1042
- 'label' => sprintf( __( '%s Settings', 'yith-plugin-fw' ), $this->_labels['singular'] ),
1043
- 'pages' => $this->_name, //or array( 'post-type1', 'post-type2')
1044
- 'context' => 'normal', //('normal', 'advanced', or 'side')
1045
- 'priority' => 'default',
1046
- 'tabs' => array(
1047
- 'settings' => array(
1048
- 'label' => __( 'Settings', 'yith-plugin-fw' ),
1049
- 'fields' => apply_filters( 'yit_cptu_fields', array(
1050
- 'type' => array(
1051
- 'label' => __( 'Type', 'yith-plugin-fw' ),
1052
- 'desc' => sprintf( __( 'Layout for this %s' , 'yith-plugin-fw' ), strtolower( $this->_labels['singular'] ) ),
1053
- 'type' => 'select',
1054
- 'options' => isset( $layouts ) ? $layouts : array(),
1055
- 'std' => '' ),
1056
-
1057
- 'rewrite' => array(
1058
- 'label' => __( 'Rewrite', 'yith-plugin-fw' ),
1059
- 'desc' => __( 'Univocal identification name in the URL for each product (slug from post if empty)', 'yith-plugin-fw' ),
1060
- 'type' => 'text',
1061
- 'std' => '' ),
1062
-
1063
- 'label_singular' => array(
1064
- 'label' => __( 'Label in Singular', 'yith-plugin-fw' ),
1065
- 'desc' => __( 'Set a label in singular (title of portfolio if empty)', 'yith-plugin-fw' ),
1066
- 'type' => 'text',
1067
- 'std' => '' ),
1068
-
1069
- 'label_plural' => array(
1070
- 'label' => __( 'Label in Plural', 'yith-plugin-fw' ),
1071
- 'desc' => __( 'Set a label in plural (title of portfolio if empty)', 'yith-plugin-fw' ),
1072
- 'type' => 'text',
1073
- 'std' => '' ),
1074
-
1075
- 'taxonomy' => array(
1076
- 'label' => __( 'Taxonomy', 'yith-plugin-fw' ),
1077
- 'desc' => __( 'If you want to use categories in the portfolio, set a name for taxonomy. Name should be a slug (must not contain capital letters nor spaces) and must not be more than 32 characters long (database structure restriction).', 'yith-plugin-fw' ),
1078
- 'type' => 'text',
1079
- 'std' => '' ),
1080
-
1081
- 'taxonomy_rewrite' => array(
1082
- 'label' => __( 'Taxonomy Rewrite', 'yith-plugin-fw' ),
1083
- 'desc' => __( 'Set univocal name for each category page URL.', 'yith-plugin-fw' ),
1084
- 'type' => 'text',
1085
- 'std' => '' ),
1086
-
1087
- 'single_layout' => array(
1088
- 'label' => __( 'Single layout', 'yith-plugin-fw' ),
1089
- 'desc' => __( 'Layout for single page of this portfolio', 'yith-plugin-fw' ),
1090
- 'type' => 'select',
1091
- 'options' => $single_layouts,
1092
- 'std' => '' ),
1093
- ) )
1094
- )
1095
- )
1096
-
1097
- );
1098
-
1099
- if ( ! $this->_args['has_single'] ) {
1100
- unset( $metabox_args['tabs']['settings']['fields']['rewrite'] );
1101
- }
1102
-
1103
- if ( ! $this->_args['has_taxonomy'] ) {
1104
- unset( $metabox_args['tabs']['settings']['fields']['taxonomy'] );
1105
- unset( $metabox_args['tabs']['settings']['fields']['taxonomy_rewrite'] );
1106
- }
1107
-
1108
- if ( ! empty( $this->_args['label_item_sing'] ) ) {
1109
- unset( $metabox_args['tabs']['settings']['fields']['label_singular'] );
1110
- }
1111
-
1112
- if ( ! empty( $this->_args['label_item_plur'] ) ) {
1113
- unset( $metabox_args['tabs']['settings']['fields']['label_plural'] );
1114
- }
1115
-
1116
- if ( $this->_args['manage_layouts'] ) {
1117
-
1118
- if ( count( $layouts ) < 1 ) {
1119
- unset( $metabox_args['tabs']['settings']['fields']['type'] );
1120
- }
1121
-
1122
- // Layouts options
1123
- foreach ( $this->layouts as $layout => $args ) {
1124
- if ( ! isset( $args['fields'] ) ) {
1125
- continue;
1126
- }
1127
-
1128
- // Section title
1129
- $metabox_args['tabs']['settings']['fields'][ $layout . '_title' ] = array(
1130
- 'desc' => $args['name'] . ' ' . __( 'layout settings', 'yith-plugin-fw' ),
1131
- 'type' => 'title',
1132
- 'deps' => array(
1133
- 'ids' => '_type',
1134
- 'values' => $layout
1135
- )
1136
- );
1137
-
1138
- // Options
1139
- foreach( $args['fields'] as $field_id => $field ) {
1140
- $metabox_args['tabs']['settings']['fields'][ $field_id ] = $field;
1141
- $metabox_args['tabs']['settings']['fields'][ $field_id ]['deps'] = array(
1142
- 'ids' => '_type',
1143
- 'values' => $layout
1144
- );
1145
- }
1146
- }
1147
- }else {
1148
- unset( $metabox_args['tabs']['settings']['fields']['type'] );
1149
- }
1150
-
1151
- if( count( $single_layouts ) < 1 ){
1152
- unset( $metabox_args['tabs']['settings']['fields']['single_layout'] );
1153
- }
1154
-
1155
- // undo if tab empty
1156
- if ( empty( $metabox_args['tabs']['settings']['fields'] ) ) {
1157
- return;
1158
- }
1159
-
1160
- $metabox = YIT_Metabox( $this->_name . '_cptu_settings' );
1161
- $metabox->init( $metabox_args );
1162
- }
1163
-
1164
- /**
1165
- * Register Metaboxes options
1166
- *
1167
- * Add the metabox for the portfolio settings
1168
- *
1169
- * @return void
1170
- * @since 1.0
1171
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1172
- */
1173
- public function add_metabox_item_fields() {
1174
- global $pagenow, $post_type;
1175
-
1176
- // get the actual post type, to add the metabox only if necessary
1177
- if ( $pagenow == 'post.php' && isset( $_REQUEST['post'] ) ) {
1178
- $post_type = get_post_type( intval( $_REQUEST['post'] ) );
1179
- }
1180
- elseif( $pagenow == 'post.php' && isset( $_REQUEST['post_ID'] ) ){
1181
- $post_type = get_post_type( intval( $_REQUEST['post_ID'] ) );
1182
- }
1183
- elseif ( $pagenow == 'post-new.php' && isset( $_REQUEST['post_type'] ) ) {
1184
- $post_type = $_REQUEST['post_type'];
1185
- } else {
1186
- return;
1187
- }
1188
-
1189
- $layout = get_post_meta( $this->_get_id_by_name( $post_type ), $this->_args['layout_option'], true );
1190
-
1191
- if ( empty( $this->layouts[ $layout ]['item_fields'] ) ) {
1192
- return;
1193
- }
1194
-
1195
- $metabox_args = array(
1196
- 'label' => __( 'Settings', 'yith-plugin-fw' ),
1197
- 'pages' => $post_type, //or array( 'post-type1', 'post-type2')
1198
- 'context' => 'normal', //('normal', 'advanced', or 'side')
1199
- 'priority' => 'default',
1200
- 'tabs' => array(
1201
- 'settings' => array(
1202
- 'label' => __( 'Settings', 'yith-plugin-fw' ),
1203
- 'fields' => $this->layouts[ $layout ]['item_fields']
1204
- )
1205
- )
1206
- );
1207
-
1208
- $metabox = YIT_Metabox( $post_type . '_item_fields' );
1209
- $metabox->init( $metabox_args );
1210
-
1211
- }
1212
-
1213
- /**
1214
- * Add quick links inside the editing page of CPTU and Custom Post Types
1215
- *
1216
- * @return void
1217
- * @since 1.0
1218
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1219
- */
1220
- public function add_quick_links_metaboxes() {
1221
- // CPTU
1222
- add_meta_box( $this->_name . '_quick_links', __( 'Quick links', 'yith-plugin-fw' ), array( $this, 'quick_links_cptu_inner' ), $this->_name, 'side', 'high' );
1223
-
1224
- // CPTs
1225
- $args = array(
1226
- 'post_type' => $this->_name,
1227
- 'posts_per_page' => -1,
1228
- 'post_status' => 'publish'
1229
- );
1230
- $post_types = get_posts( $args );
1231
-
1232
- foreach ( $post_types as $post ) {
1233
- $post_type = get_post_meta( $post->ID, '_post_type', true );
1234
- extract( $this->_cpt_args( $post ) );
1235
- add_meta_box( $post->post_type . '_quick_links', __( 'Quick links', 'yith-plugin-fw' ), array( $this, 'quick_links_cpt_inner' ), $post_type, 'side', 'high' );
1236
- }
1237
- }
1238
-
1239
- /**
1240
- * Link to: "View Items", inside the CPTU
1241
- *
1242
- * @param $post
1243
- *
1244
- * @return void
1245
- * @since 1.0
1246
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1247
- */
1248
- public function quick_links_cptu_inner( $post ) {
1249
- extract( $this->_cpt_args( $post ) );
1250
- ?>
1251
- <a href="<?php echo admin_url( 'edit.php?post_type=' . get_post_meta( $post->ID, '_post_type', true ) ) ?>"><?php printf( __( 'View %s', 'yith-plugin-fw' ), $label_plural ) ?></a>
1252
- <?php
1253
- }
1254
-
1255
- /**
1256
- * Link to: "Edit %s", inside the CPTU
1257
- *
1258
- * @param $post
1259
- *
1260
- * @return void
1261
- * @since 1.0
1262
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1263
- */
1264
- public function quick_links_cpt_inner( $post ) {
1265
- $post = get_post( $this->_get_id_by_name( $post->post_type ) );
1266
- ?>
1267
- <a href="<?php echo admin_url( "post.php?post={$post->ID}&action=edit" ) ?>"><?php printf( __( 'Edit %s', 'yith-plugin-fw' ), $post->post_title ) ?></a>
1268
- <?php
1269
- }
1270
-
1271
- /**
1272
- * Define the columns to use in the list table of main sliders post type
1273
- *
1274
- * @param $columns array The columns used in the list table
1275
- *
1276
- * @return array
1277
- * @since 1.0
1278
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1279
- */
1280
- public function cptu_define_columns( $columns ) {
1281
- unset( $columns['date'] );
1282
-
1283
- $columns['actions'] = '';
1284
-
1285
- return $columns;
1286
- }
1287
-
1288
- /**
1289
- * Change the content of each column of the table list
1290
- *
1291
- * @param $column string The current column
1292
- * @param $post_id int The current post ID
1293
- *
1294
- * @return void
1295
- * @since 1.0
1296
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1297
- */
1298
- public function cptu_change_columns( $column, $post_id ) {
1299
- $post = get_post( $post_id );
1300
- extract( $this->_cpt_args( $post ) );
1301
-
1302
- switch ( $column ) {
1303
- case 'actions' :
1304
- echo '<a href="' . admin_url( "post.php?post={$post_id}&action=edit" ) . '" class="button-secondary">' . sprintf( __( 'Edit %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ) . '</a> ';
1305
- echo '<a href="' . admin_url( 'edit.php?post_type=' . get_post_meta( $post_id, '_post_type', true ) ) . '" class="button-secondary">' . sprintf( __( 'View %s', 'yith-plugin-fw' ), $label_plural ) . '</a> ';
1306
- break;
1307
- }
1308
- }
1309
-
1310
- /**
1311
- * Retrieve the path of layout specified in parameter
1312
- *
1313
- * @param $layout
1314
- * @param $file string The file to find
1315
- *
1316
- * @return bool|string
1317
- * @since 1.0
1318
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1319
- */
1320
- public function locate_file( $layout, $file = '' ) {
1321
- if ( ! $this->_args['manage_layouts'] ) {
1322
- return $this->template_path(). '/' . ( ! empty( $file ) ? $file . '.php' : '' );
1323
- }
1324
-
1325
- if ( ! isset( $this->layouts[ $layout ] ) ) {
1326
- $layout = 'default';
1327
- }
1328
-
1329
- return $this->layouts[ $layout ]['path'] . '/' . ( ! empty( $file ) ? $file . '.php' : '' );
1330
- }
1331
-
1332
- /**
1333
- * Retrieve the URL of layout specified in parameter
1334
- *
1335
- * @param $layout
1336
- * @param $file string The file to find
1337
- *
1338
- * @return bool|string
1339
- * @since 1.0
1340
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1341
- */
1342
- public function locate_url( $layout, $file = '' ) {
1343
- if ( ! $this->_args['manage_layouts'] ) {
1344
- return $this->template_url();
1345
-
1346
- }
1347
-
1348
- if ( ! isset( $this->layouts[ $layout ] ) ) {
1349
- $layout = 'default';
1350
- }
1351
-
1352
- return $this->layouts[ $layout ]['url'] . '/' . ( ! empty( $file ) ? $file . '.php' : '' );
1353
- }
1354
-
1355
- /**
1356
- * Retrieve the post ID relative to the post of post type
1357
- *
1358
- * @param $name string
1359
- *
1360
- * @return mixed
1361
- * @since 1.0
1362
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1363
- */
1364
- protected function _get_id_by_name( $name ) {
1365
- global $wpdb;
1366
- return $wpdb->get_var( $wpdb->prepare( "SELECT pm.post_id FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $name, $this->_name ) );
1367
- }
1368
-
1369
- /**
1370
- * Retrieve the post_type of portfolio by portfolio name
1371
- *
1372
- * @param $name string
1373
- *
1374
- * @return mixed
1375
- * @since 1.0
1376
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1377
- */
1378
- protected function _get_post_type_by_name( $name ) {
1379
- global $wpdb;
1380
- return $wpdb->get_var( $wpdb->prepare( "SELECT pm.meta_value FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND p.post_name = %s AND p.post_type = %s", '_post_type', $name, $this->_name ) );
1381
- }
1382
-
1383
- /**
1384
- * The shortcode used to show the frontend
1385
- *
1386
- * @param array $atts
1387
- * @param null $content
1388
- *
1389
- * @return string|null
1390
- * @since 1.0
1391
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1392
- */
1393
- public function add_shortcode( $atts, $content = null ) {
1394
- $atts = wp_parse_args( $atts, array(
1395
- 'name' => null,
1396
- 'cat' => array(),
1397
- 'posts_per_page' => false,
1398
- 'style' => null,
1399
- ) );
1400
-
1401
- // don't show the slider if 'name' is empty or is 'none'
1402
- if ( empty( $atts['name'] ) || 'none' == $atts['name'] ) return null;
1403
-
1404
- // compatibility fix: remove prefix if exists in portfolio object
1405
- if( function_exists( 'YIT_Portfolio' ) && method_exists( YIT_Portfolio(), 'is' ) && YIT_Portfolio()->is( $atts['name'] ) ){
1406
- $atts['name'] = str_replace( YIT_Portfolio()->post_type_prefix, '', $atts['name'] );
1407
- }
1408
-
1409
- // pass vars to template
1410
- $atts['post_type'] = $this->_get_post_type_by_name( $atts['name'] );
1411
- $atts['layout'] = $this->_args['manage_layouts'] ? get_post_meta( $this->_get_id_by_name( $atts['post_type'] ), $this->_args['layout_option'], true ) : '';
1412
- extract( apply_filters( 'yit_cptu_frontend_vars', $atts, $this->_name ) );
1413
-
1414
- // add the javascript assets
1415
- if ( $this->_args['manage_layouts'] && isset( $this->layouts[ $layout ]['js'] ) && ! empty( $this->layouts[ $layout ]['js'] ) ) {
1416
- foreach ( $this->layouts[ $layout ]['js'] as $asset ) {
1417
- if ( empty( $asset ) ) continue;
1418
-
1419
- if ( empty( $asset['src'] ) ) {
1420
- wp_enqueue_script( $asset['handle'] );
1421
- continue;
1422
- }
1423
-
1424
- yit_enqueue_script( $asset['handle'], $this->locate_url( $layout ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['in_footer'] );
1425
- }
1426
- }
1427
-
1428
- // Unique sequential index to differentiate more cpt in the same page
1429
- ++$this->index;
1430
-
1431
- ob_start();
1432
-
1433
- include( $this->locate_file( $layout, 'markup' ) );
1434
-
1435
- return ob_get_clean();
1436
-
1437
- }
1438
-
1439
- /**
1440
- * Shortcode icon
1441
- *
1442
- * Return the shortcode icone to display on shortcode panel
1443
- *
1444
- * @param $icon_url string Icone url found by yit_shortcode plugin
1445
- *
1446
- * @return string
1447
- * @since 1.0.0
1448
- * @author Antonino Scarfi' <antonio.scarfi@yithemes.it>
1449
- */
1450
- public function shortcode_icon( $icon_url ) {
1451
- return ! empty( $this->_args['shortcode_icon'] ) ? $this->_args['shortcode_icon'] : $icon_url;
1452
- }
1453
-
1454
- /**
1455
- * Return an array with cptu options to shortcode panel
1456
- *
1457
- * All definition settings to add cptu shortcode to Yit Shortcode Panel
1458
- *
1459
- * @param array $shortcodes
1460
- *
1461
- * @return array
1462
- * @since 1.0
1463
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1464
- */
1465
- public function add_shortcode_to_box( $shortcodes ) {
1466
- $post_types = array();
1467
-
1468
- foreach ( $this->get_post_types() as $post ) {
1469
- $post_types[ $post->post_name ] = $post->post_title;
1470
- }
1471
-
1472
- $args = array(
1473
- $this->_args['shortcode_name'] => array(
1474
- 'title' => $this->_labels['singular'],
1475
- 'description' => sprintf( __( 'Show frontend of the %s', 'yith-plugin-fw' ), $this->_labels['main_name'] ),
1476
- 'tab' => 'cpt',
1477
- 'create' => false,
1478
- 'has_content' => false,
1479
- 'in_visual_composer' => true,
1480
- 'attributes' => array(
1481
- 'name' => array(
1482
- 'title' => __( 'Name', 'yith-plugin-fw' ),
1483
- 'type' => 'select',
1484
- 'options' => $post_types,
1485
- 'std' => ''
1486
- ),
1487
- )
1488
- )
1489
- );
1490
-
1491
- return array_merge( $shortcodes, $args );
1492
- }
1493
-
1494
- /**
1495
- * Check the post type passed in parameter, if is generated by this CPTU
1496
- *
1497
- * @param $post_type string The post type to check
1498
- *
1499
- * @return bool
1500
- * @since 1.0
1501
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1502
- */
1503
- protected function _is_valid( $post_type ) {
1504
- return (bool)( strpos( $post_type, $this->_args['post_type_prefix'] ) !== false );
1505
- }
1506
-
1507
- /**
1508
- * Add as a valid post type all cptu when importing dummy data
1509
- *
1510
- * @param $post array The post object
1511
- *
1512
- * @return array
1513
- * @since 1.0
1514
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
1515
- */
1516
- public function add_importer_required_post_type( $post ){
1517
- global $wp_post_types, $wp_taxonomies;
1518
-
1519
- if( strpos( $post['post_type'], $this->_prefix_cpt ) === FALSE ){
1520
- return $post;
1521
- }
1522
-
1523
- if( ! isset( $wp_post_types[ $post['post_type'] ] ) ){
1524
- $wp_post_types[ $post['post_type'] ] = array(
1525
- 'name' => ''
1526
- );
1527
- }
1528
-
1529
- if( ! empty( $post['terms'] ) ){
1530
- foreach( $post['terms'] as $term ){
1531
- if( ! isset( $wp_taxonomies[ $term['domain'] ] ) ){
1532
- $wp_taxonomies[ $term['domain'] ] = array(
1533
- 'name' => ''
1534
- );
1535
- }
1536
- }
1537
- }
1538
-
1539
-
1540
- return $post;
1541
- }
1542
-
1543
- /**
1544
- * Add taxonomy when importing dummy data
1545
- *
1546
- * @param $terms array Array of terms
1547
- *
1548
- * @return array
1549
- * @since 1.0
1550
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
1551
- */
1552
- public function add_importer_required_taxonomy( $terms ){
1553
- global $wp_taxonomies;
1554
-
1555
- if( ! empty( $terms ) ){
1556
- foreach ( $terms as $term ) {
1557
- if( isset( $term['domain'] ) && ! isset( $wp_taxonomies[ $term['domain'] ] ) ){
1558
- $wp_taxonomies[ $term['domain'] ] = array(
1559
- 'name' => ''
1560
- );
1561
- }
1562
- }
1563
- }
1564
-
1565
- return $terms;
1566
- }
1567
-
1568
- /**
1569
- * Force terms recount for imported taxonomy
1570
- *
1571
- * @param $tt_ids array Terms ids
1572
- * @param $ids array Post ids
1573
- * @param $tax string Taxonomy name
1574
- *
1575
- * @return void
1576
- * @since 1.0
1577
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
1578
- */
1579
- public function recount_terms_post( $tt_ids, $ids, $tax ){
1580
- wp_update_term_count( $tt_ids, $tax );
1581
- }
1582
-
1583
- // ### ASSETS ###
1584
-
1585
- /**
1586
- * Enqueue the assets for the admin
1587
- *
1588
- * @return void
1589
- * @since 1.0
1590
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1591
- */
1592
- public function admin_assets() {
1593
- wp_enqueue_media();
1594
- wp_enqueue_script( 'yit-cptu', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cpt-unlimited.js', array('jquery'), '', true );
1595
- }
1596
-
1597
- /**
1598
- * Add the button to the top of the list table page of CPTU
1599
- *
1600
- * @return void
1601
- * @since 1.0
1602
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1603
- */
1604
- public function add_button_multiuploader() {
1605
- global $pagenow, $post_type, $wpdb;
1606
-
1607
- if( $pagenow != 'edit.php' ){
1608
- return;
1609
- }
1610
-
1611
- $cptu = $wpdb->get_var( $wpdb->prepare( "SELECT p.post_type FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s", '_post_type', $post_type ) );
1612
-
1613
- $post = get_post( $this->_get_id_by_name( $post_type ) );
1614
- if ( empty( $post ) ) {
1615
- return;
1616
- }
1617
- extract( $this->_cpt_args( $post ) );
1618
-
1619
- if ( $cptu != $this->_name || ! $this->_is_valid( $post_type ) ) {
1620
- return;
1621
- }
1622
- ?>
1623
- <script>
1624
- (function($) {
1625
- "use strict";
1626
- // Author code here
1627
-
1628
- var button = $('<a />', {
1629
- href: '#',
1630
- class: 'multi-uploader add-new-h2',
1631
- 'data-uploader_title': '<?php printf( __( 'Add %s from images', 'yith-plugin-fw' ), $label_plural ) ?>',
1632
- 'data-uploader_button_text': '<?php printf( __( 'Add %s', 'yith-plugin-fw' ), $label_plural ) ?>'
1633
- }).text('<?php _e( 'Upload multiple files', 'yith-plugin-fw' ) ?>');
1634
-
1635
- var spinner = $('<span />', {
1636
- class: 'spinner',
1637
- style: 'float: none;'
1638
- });
1639
-
1640
- button.appendTo('.wrap h2, .wrap h1').after(spinner);
1641
-
1642
- })(jQuery);
1643
- </script>
1644
- <?php
1645
- }
1646
-
1647
- /**
1648
- * Add more posts by multiupload
1649
- *
1650
- * @return void
1651
- * @since 1.0
1652
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1653
- */
1654
- public function post_multiuploader() {
1655
- if ( ! isset( $_REQUEST['images'] ) || ! isset( $_REQUEST['post_type'] ) && $this->_is_valid( $_REQUEST['post_type'] ) ) {
1656
- return;
1657
- }
1658
-
1659
- foreach ( $_REQUEST['images'] as $the ) {
1660
-
1661
- // Create post object
1662
- $arg = array(
1663
- 'post_title' => $the['title'],
1664
- 'post_type' => $_REQUEST['post_type']
1665
- );
1666
- $post_id = wp_insert_post( $arg );
1667
-
1668
- set_post_thumbnail( $post_id, $the['id'] );
1669
-
1670
- }
1671
-
1672
- die();
1673
- }
1674
-
1675
-
1676
- // ###### SINGLE TEMPLATE ######
1677
-
1678
- /**
1679
- * Load the single template file
1680
- *
1681
- * @return void
1682
- * @since 1.0
1683
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1684
- */
1685
- public function single_template() {
1686
- global $post, $wpdb;
1687
-
1688
- // if ( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ) {
1689
- // $post = get_post( $_REQUEST['post_id'] );
1690
- // }
1691
-
1692
- if ( ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ! is_single() ) || ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
1693
- return;
1694
- }
1695
-
1696
- // add the javascript assets
1697
- if ( $this->_args['manage_layouts'] ) {
1698
- foreach ( $this->layouts[ 'single' ]['js'] as $asset ) {
1699
- yit_enqueue_script( $asset['handle'], $this->locate_url( 'single' ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['in_footer'] );
1700
- }
1701
- }
1702
-
1703
- $post_name = $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $post->post_type, $this->_name ) );
1704
- extract( apply_filters( 'yit_cptu_frontend_vars', array( 'name' => $post_name ), $this->_name ) );
1705
-
1706
- include( $this->locate_file( 'single', 'markup' ) );
1707
- }
1708
-
1709
- /**
1710
- * Load a file for the configuration of single template page of portfolio
1711
- *
1712
- * @return void
1713
- * @since 1.0
1714
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1715
- */
1716
- public function single_template_config() {
1717
- global $post, $wpdb;
1718
-
1719
- if ( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ) {
1720
- $post = get_post( $_REQUEST['post_id'] );
1721
- }
1722
-
1723
- if ( ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ! is_single() ) || ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
1724
- return;
1725
- }
1726
-
1727
- $this->_layout = 'single';
1728
- $path = $this->locate_file( 'single', 'config' );
1729
-
1730
- if ( file_exists( $path ) ) {
1731
- $post_name = $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $post->post_type, $this->_name ) );
1732
- extract( apply_filters( 'yit_cptu_frontend_vars', array( 'name' => $post_name ), $this->_name ) );
1733
-
1734
- include( $path );
1735
- }
1736
- }
1737
-
1738
-
1739
- // ########################## ARCHIVE TEMPLATE ###############################
1740
-
1741
-
1742
- /**
1743
- * Load the template for archive page
1744
- *
1745
- * @return void
1746
- * @since 1.0
1747
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1748
- */
1749
- public function archive_template() {
1750
- global $wp_query;
1751
-
1752
-
1753
- // check if we are in archive template
1754
- if ( !( ! is_admin() && is_archive() && isset($wp_query->post) && $this->_is_valid( $wp_query->post->post_type ) ) ) {
1755
- return;
1756
- }
1757
-
1758
- // remove the action from loop of theme
1759
- remove_action( 'yit_content_loop', 'yit_content_loop', 10 );
1760
- add_action( 'yit_content_loop', array( $this, 'archive_template_loop' ), 10 );
1761
-
1762
- }
1763
-
1764
- /**
1765
- * Load loop for the archive template
1766
- *
1767
- * @return void
1768
- * @since 1.0
1769
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1770
- */
1771
- public function archive_template_loop() {
1772
- echo $this->add_shortcode( array( 'name' => $GLOBALS['wp_query']->post->post_type ) );
1773
- }
1774
-
1775
  }
1
+ <?php
2
+ /*
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+ if (!defined('ABSPATH')) {exit('Direct access forbidden.');
11
+ }
12
+
13
+ /**
14
+ * Manage the custom post types as Portfolio, Contact Forms and similar (called CPTU)
15
+ *
16
+ * @class YIT_CPT_Unlimited
17
+ * @package Yithemes
18
+ * @since 2.0.0
19
+ * @author Your Inspiration Themes
20
+ *
21
+ */
22
+
23
+ class YIT_CPT_Unlimited {
24
+
25
+ /**
26
+ * @var string The name of main post type of CPTU
27
+ * @since 1.0
28
+ */
29
+ protected $_name = '';
30
+
31
+ /**
32
+ * @var string The prefix of each post type created by the post of main CPTU
33
+ * @since 1.0
34
+ */
35
+ protected $_prefix_cpt = '';
36
+
37
+ /**
38
+ * @var string The labels defined for the main CPTU
39
+ * @since 1.0
40
+ */
41
+ protected $_labels = '';
42
+
43
+ /**
44
+ * @var string The configuration arguments of post type
45
+ * @since 1.0
46
+ */
47
+ protected $_args = '';
48
+
49
+ /**
50
+ * @var array All post types created by the post of main CPTU
51
+ * @since 1.0
52
+ */
53
+ public $post_types = array();
54
+
55
+ /**
56
+ * @var array $layouts Array with all portfolio layouts available for this site
57
+ * @since 1.0
58
+ */
59
+ public $layouts = array();
60
+
61
+ /**
62
+ * @var string $template_path The pathname of template folder
63
+ * @since 1.0
64
+ */
65
+ protected $template_path = '';
66
+
67
+ /**
68
+ * @var string $template_url The URL of template folder
69
+ * @since 1.0
70
+ */
71
+ protected $template_url = '';
72
+
73
+ /**
74
+ * @var int $_index Unique sequential ID to differentiate same shortcodes in the same page
75
+ */
76
+ public $index = 0;
77
+
78
+ /**
79
+ * @var string $_layout Temporary attribute to load automatically the settings for each layout
80
+ * @since 1.0
81
+ */
82
+ private $_layout = '';
83
+
84
+
85
+ /**
86
+ * Constructor
87
+ *
88
+ * Accept an array of arguments to define the characteristics of CPTU to register.
89
+ *
90
+ * @since 1.0
91
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
92
+ */
93
+ public function __construct( $args = array() ) {
94
+
95
+ $defaults = array(
96
+ 'name' => '',
97
+ 'post_type_prefix' => '',
98
+ 'labels' => array(
99
+ 'main_name' => '',
100
+ 'singular' => '',
101
+ 'plural' => '',
102
+ 'menu' => ''
103
+ ),
104
+ 'manage_layouts' => false,
105
+ 'add_multiuploader' => false,
106
+ 'sortable' => false,
107
+ 'has_single' => false,
108
+ 'has_taxonomy' => false,
109
+ 'label_item_sing' => '',
110
+ 'label_item_plur' => '',
111
+ 'shortcode_name' => '',
112
+ 'shortcode_icon' => '', // URL or icon name from http://melchoyce.github.io/dashicons/
113
+ 'layout_option' => '_type' // the option ID of layout metabox
114
+ );
115
+ $this->_args = wp_parse_args( $args, $defaults );
116
+
117
+ // fix labels
118
+ if ( empty( $this->_args['labels']['main_name'] ) ) {
119
+ $this->_args['labels']['main_name'] = $this->_args['labels']['singular'];
120
+ }
121
+ if ( empty( $this->_args['labels']['menu'] ) ) {
122
+ $this->_args['labels']['menu'] = $this->_args['labels']['singular'];
123
+ }
124
+
125
+ /* populate */
126
+ $this->_name = $this->_args['name'];
127
+ $this->_prefix_cpt = $this->_args['post_type_prefix'];
128
+ $this->_labels = $this->_args['labels'];
129
+
130
+ add_action( 'init', array( $this, 'register_post_type' ) );
131
+ add_action( 'init', array( $this, 'register_cptu_post_types' ) );
132
+
133
+ add_action( 'save_post', array( $this, 'rewrite_flush') );
134
+
135
+ // admin interface
136
+ add_action( 'admin_head', array( $this, 'add_cptu_menu_item' ) );
137
+ add_action( 'admin_init', array( $this, 'add_quick_links_metaboxes' ) );
138
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) );
139
+
140
+ // metaboxes
141
+ add_action( 'after_setup_theme', array( $this, 'add_metabox_cptu' ), 2 );
142
+ add_action( 'after_setup_theme', array( $this, 'add_metabox_item_fields' ), 2 );
143
+
144
+ // multiuploader
145
+ if ( $this->_args['add_multiuploader'] ) {
146
+ add_action( 'admin_footer', array( $this, 'add_button_multiuploader' ) );
147
+ add_action( 'wp_ajax_yit_cptu_multiuploader', array( $this, 'post_multiuploader' ) );
148
+ }
149
+
150
+ // layouts
151
+ if ( $this->_args['manage_layouts'] ) {
152
+ // get all layouts available
153
+ $this->get_layouts();
154
+ }
155
+
156
+ // single layout
157
+ if ( $this->_args['has_single'] ) {
158
+ add_action( 'yit_loop', array( $this, 'single_template' ) );
159
+ add_action( 'wp', array( $this, 'single_template_config' ) );
160
+
161
+ if ( defined('DOING_AJAX') && DOING_AJAX ) {
162
+ add_action( 'init', array( $this, 'single_template_config' ) );
163
+ }
164
+ }
165
+
166
+ // archive template
167
+ add_action( 'wp', array( $this, 'archive_template' ) );
168
+
169
+ // enqueue the assets of each layout
170
+ add_action( 'wp_enqueue_scripts', array( $this, 'frontend_assets' ) );
171
+
172
+ // add the shortcode, used to show the frontend
173
+ if ( ! empty( $this->_args['shortcode_name'] ) ) {
174
+ add_shortcode( $this->_args['shortcode_name'], array( &$this, 'add_shortcode' ) );
175
+ add_filter( 'yit_shortcode_' . $this->_args['shortcode_name'] . '_icon', array( $this, 'shortcode_icon') );
176
+ add_filter( 'yit-shortcode-plugin-init', array( $this, 'add_shortcode_to_box' ) );
177
+ }
178
+
179
+ // add sortable feature
180
+ if ( $this->_args['sortable'] ) {
181
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_sortable_assets' ) );
182
+ add_action( 'wp_ajax_cpt_sort_posts', array( $this, 'sort_posts' ) );
183
+ add_action( 'admin_init', array( $this, 'init_menu_order' ) );
184
+ add_filter( 'pre_get_posts', array( $this, 'filter_active' ) );
185
+ add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
186
+ add_filter( 'get_next_post_where', array( $this, 'sorted_next_post_where' ) );
187
+ add_filter( 'get_previous_post_where', array( $this, 'sorted_prev_post_where' ) );
188
+ add_filter( 'get_next_post_sort', array( $this, 'sorted_next_post_sort' ) );
189
+ add_filter( 'get_previous_post_sort', array( $this, 'sorted_prev_post_sort' ) );
190
+ }
191
+
192
+ // add default columns to post type table list
193
+ add_filter( 'manage_edit-' . $this->_name . '_columns', array( $this, 'cptu_define_columns' ) );
194
+ add_action( 'manage_' . $this->_name . '_posts_custom_column' , array( $this, 'cptu_change_columns' ), 10, 2 );
195
+
196
+ // add required post type for wordpress importer
197
+ add_filter( 'wp_import_post_data_raw', array( $this, 'add_importer_required_post_type' ) );
198
+ add_filter( 'wp_import_terms', array( $this, 'add_importer_required_taxonomy' ) );
199
+ add_action( 'wp_import_set_post_terms', array( $this, 'recount_terms_post' ), 10, 3 );
200
+
201
+ }
202
+
203
+ /**
204
+ * Enqueue the assets for the sortable feature
205
+ *
206
+ * @return void
207
+ * @since 1.0
208
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
209
+ */
210
+ public function admin_sortable_assets() {
211
+ global $post;
212
+
213
+ if ( ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
214
+ return;
215
+ }
216
+
217
+ wp_enqueue_script( 'yit-cptu-sortable-posts', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cptu-sortable-posts.js', array( 'jquery', 'jquery-ui-sortable' ), '1.0', true );
218
+ }
219
+
220
+ public function init_menu_order( $post_types = array() ) {
221
+ global $wpdb;
222
+
223
+ if ( empty( $post_types ) ) {
224
+ $post_types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_type FROM $wpdb->posts WHERE post_type LIKE %s", str_replace( '_', '\_', $this->_prefix_cpt ) . '%' ) );
225
+ } elseif ( ! is_array( $post_types ) ) {
226
+ $post_types = array( $post_types );
227
+ }
228
+
229
+ foreach ( $post_types as $post_type ) {
230
+ $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = '{$post_type}' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future') AND menu_order = 0" );
231
+
232
+ if ( empty( $count ) ) {
233
+ continue;
234
+ }
235
+
236
+ $sql = "SELECT ID
237
+ FROM $wpdb->posts
238
+ WHERE post_type = '" . $post_type . "'
239
+ AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
240
+ ORDER BY post_date DESC
241
+ ";
242
+
243
+ $results = $wpdb->get_results( $sql );
244
+
245
+ foreach ( $results as $key => $result ) {
246
+ $wpdb->update( $wpdb->posts, array( 'menu_order' => $key + 1 ), array( 'ID' => $result->ID ) );
247
+ }
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Save the order of posts from sortable feature
253
+ *
254
+ * @return void
255
+ * @since 1.0
256
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
257
+ */
258
+ public function sort_posts() {
259
+ global $wpdb;
260
+
261
+ parse_str( $_REQUEST['order'], $data );
262
+
263
+ if ( is_array( $data ) ) {
264
+ //$this->init_menu_order( $_REQUEST['post_type'] );
265
+
266
+ $id_arr = array( );
267
+ foreach ( $data as $key => $values ) {
268
+ foreach ( $values as $position => $id ) {
269
+ $id_arr[] = $id;
270
+ }
271
+ }
272
+
273
+
274
+ $menu_order_arr = array( );
275
+ foreach ( $id_arr as $key => $id ) {
276
+ $results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = " . $id );
277
+ foreach ( $results as $result ) {
278
+ $menu_order_arr[] = $result->menu_order;
279
+ }
280
+ }
281
+
282
+ sort( $menu_order_arr );
283
+
284
+ foreach ( $data as $key => $values ) {
285
+ foreach ( $values as $position => $id ) {
286
+ $wpdb->update( $wpdb->posts, array( 'menu_order' => $menu_order_arr[$position] ), array( 'ID' => $id ) );
287
+ }
288
+ }
289
+ }
290
+
291
+ die();
292
+ }
293
+
294
+ public function filter_active( $wp_query ) {
295
+ if ( is_admin() && isset( $wp_query->query['suppress_filters'] ) )
296
+ $wp_query->query['suppress_filters'] = false;
297
+ if ( is_admin() && isset( $wp_query->query_vars['suppress_filters'] ) )
298
+ $wp_query->query_vars['suppress_filters'] = false;
299
+ return $wp_query;
300
+ }
301
+
302
+ public function pre_get_posts( $wp_query ) {
303
+ if ( is_admin() && !defined( 'DOING_AJAX' ) ) {
304
+ if ( isset( $wp_query->query['post_type'] ) ) {
305
+ $post_types = (array) $wp_query->query['post_type'];
306
+ foreach ( $post_types as $post_type ) {
307
+ if ( $this->_is_valid( $post_type ) ) {
308
+ $wp_query->set( 'orderby', 'menu_order' );
309
+ $wp_query->set( 'order', 'ASC' );
310
+ }
311
+ }
312
+ }
313
+
314
+ } else {
315
+
316
+ $active = false;
317
+
318
+ if ( isset( $wp_query->query['suppress_filters'] ) || isset( $wp_query->query['post_type'] ) ) {
319
+ $post_types = (array) $wp_query->query['post_type'];
320
+ foreach ( $post_types as $post_type ) {
321
+ if ( $this->_is_valid( $post_type ) ) {
322
+ $active = true;
323
+ }
324
+ }
325
+ }
326
+
327
+ if ( $active ) {
328
+ if ( !isset( $wp_query->query['orderby'] ) || $wp_query->query['orderby'] == 'post_date' )
329
+ $wp_query->set( 'orderby', 'menu_order' );
330
+ if ( !isset( $wp_query->query['order'] ) || $wp_query->query['order'] == 'DESC' )
331
+ $wp_query->set( 'order', 'ASC' );
332
+ }
333
+ }
334
+ }
335
+
336
+ /**
337
+ * Filters where clause for get next post
338
+ *
339
+ * @param $where
340
+ *
341
+ * @return string
342
+ * @since 1.0
343
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
344
+ */
345
+ public function sorted_next_post_where( $where ){
346
+ global $post;
347
+ if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
348
+ $post = get_post( intval( $_REQUEST['post_id'] ) );
349
+ }
350
+ else{
351
+ $post = get_post();
352
+ }
353
+
354
+ if( ! $post || ! $this->_is_valid( $post->post_type ) ){
355
+ return $where;
356
+ }
357
+
358
+ $result = str_replace( "'" . $post->post_date . "'", $post->menu_order, $where );
359
+ $result = str_replace( 'p.post_date', 'p.menu_order', $result );
360
+
361
+ return $result;
362
+ }
363
+
364
+ /**
365
+ * Filters where clause for get prev post
366
+ *
367
+ * @param $where
368
+ *
369
+ * @return string
370
+ * @since 1.0
371
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
372
+ */
373
+ public function sorted_prev_post_where( $where ){
374
+ global $post;
375
+
376
+ if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
377
+ $post = get_post( intval( $_REQUEST['post_id'] ) );
378
+ }
379
+ else{
380
+ $post = get_post();
381
+ }
382
+
383
+ if( ! $post || ! $this->_is_valid( $post->post_type ) ){
384
+ return $where;
385
+ }
386
+
387
+ $result = str_replace( "'" . $post->post_date . "'", $post->menu_order, $where );
388
+ $result = str_replace( 'p.post_date', 'p.menu_order', $result );
389
+
390
+ return $result;
391
+ }
392
+
393
+ /**
394
+ * Filters sort clause for get next post
395
+ *
396
+ * @param $sort
397
+ *
398
+ * @return string
399
+ * @since 1.0
400
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
401
+ */
402
+ public function sorted_next_post_sort( $sort ){
403
+ global $post;
404
+
405
+ if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
406
+ $post = get_post( intval( $_REQUEST['post_id'] ) );
407
+ }
408
+ else{
409
+ $post = get_post();
410
+ }
411
+
412
+ if( ! $post || ! $this->_is_valid( $post->post_type ) ){
413
+ return $sort;
414
+ }
415
+
416
+ $result = str_replace( 'p.post_date', 'p.menu_order', $sort );
417
+ return $result;
418
+ }
419
+
420
+ /**
421
+ * Filters sort clause for get prev post
422
+ *
423
+ * @param $sort
424
+ *
425
+ * @return string
426
+ * @since 1.0
427
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
428
+ */
429
+ public function sorted_prev_post_sort( $sort ){
430
+ global $post;
431
+
432
+ if( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ){
433
+ $post = get_post( intval( $_REQUEST['post_id'] ) );
434
+ }
435
+ else{
436
+ $post = get_post();
437
+ }
438
+
439
+ if( ! $post || ! $this->_is_valid( $post->post_type ) ){
440
+ return $sort;
441
+ }
442
+
443
+ $result = str_replace( 'p.post_date', 'p.menu_order', $sort );
444
+ return $result;
445
+ }
446
+
447
+ /**
448
+ * Register post type
449
+ *
450
+ * Register the post type for the creation of portfolios
451
+ *
452
+ * @return void
453
+ * @since 1.0
454
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
455
+ */
456
+ public function register_post_type() {
457
+ $labels = array(
458
+ 'name' => ucfirst( $this->_labels['main_name'] ),
459
+ 'singular_name' => ucfirst( $this->_labels['singular'] ),
460
+ 'add_new' => sprintf( __( 'Add %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
461
+ 'add_new_item' => sprintf( __( 'Add New %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
462
+ 'edit_item' => sprintf( __( 'Edit %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
463
+ 'new_item' => sprintf( __( 'New %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
464
+ 'all_items' => sprintf( __( 'All %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
465
+ 'view_item' => sprintf( __( 'View %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ),
466
+ 'search_items' => sprintf( __( 'Search %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
467
+ 'not_found' => sprintf( __( 'No %s found', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
468
+ 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'yith-plugin-fw' ), ucfirst( $this->_labels['plural'] ) ),
469
+ 'parent_item_colon' => '',
470
+ 'menu_name' => ucfirst( $this->_labels['menu'] )
471
+ );
472
+
473
+ $args = array(
474
+ 'labels' => apply_filters( 'yit_' . $this->_name . '_labels', $labels ),
475
+ 'public' => false,
476
+ 'publicly_queryable' => false,
477
+ 'show_ui' => true,
478
+ 'show_in_menu' => true,
479
+ 'query_var' => false,
480
+ 'capability_type' => 'post',
481
+ 'hierarchical' => false,
482
+ 'menu_position' => null,
483
+ 'supports' => array( 'title' )
484
+ );
485
+
486
+ if ( ! empty( $this->_args['menu_icon'] ) ) {
487
+ $args['menu_icon'] = $this->_args['menu_icon'];
488
+ }
489
+
490
+ register_post_type( $this->_name, apply_filters( 'yit_' . $this->_name . '_args', $args ) );
491
+ }
492
+
493
+ /**
494
+ * Retrieve the values configured inside the custom post type
495
+ *
496
+ * @param $post /WP_Query The post where get the arguments configured in the cpt
497
+ *
498
+ * @return array
499
+ * @since 1.0
500
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
501
+ */
502
+ protected function _cpt_args( $post ) {
503
+ if ( ! isset( $post->ID ) ) {
504
+ return;
505
+ }
506
+
507
+ $args = apply_filters( 'yit_cptu_register_post_type_args', array(
508
+ 'layout' => get_post_meta( $post->ID, $this->_args['layout_option'], true ),
509
+ 'rewrite' => get_post_meta( $post->ID, '_rewrite', true ),
510
+ 'label_singular' => ! empty( $this->_args['label_item_sing'] ) ? $this->_args['label_item_sing'] : get_post_meta( $post->ID, '_label_singular', true ),
511
+ 'label_plural' => ! empty( $this->_args['label_item_plur'] ) ? $this->_args['label_item_plur'] : get_post_meta( $post->ID, '_label_plural', true ),
512
+ 'taxonomy' => get_post_meta( $post->ID, '_taxonomy', true ),
513
+ 'taxonomy_rewrite' => get_post_meta( $post->ID, '_taxonomy_rewrite', true ),
514
+ ), $this->_name, $post );
515
+
516
+ $title = $post->post_title;
517
+
518
+ if ( empty( $args['label_singular'] ) ) {
519
+ $args['label_singular'] = $title;
520
+ }
521
+
522
+ if ( empty( $args['label_plural'] ) ) {
523
+ $args['label_plural'] = $title;
524
+ }
525
+
526
+ return $args;
527
+ }
528
+
529
+ /**
530
+ * Retrieve the post types created for this CPTU
531
+ *
532
+ * @return array The link changed
533
+ * @since 1.0
534
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
535
+ */
536
+ public function get_post_types() {
537
+ if ( ! empty( $this->post_types ) ) {
538
+ return $this->post_types;
539
+ }
540
+
541
+ $args = array(
542
+ 'post_type' => $this->_name,
543
+ 'posts_per_page' => -1,
544
+ 'post_status' => 'publish'
545
+ );
546
+ $this->post_types = get_posts( $args );
547
+
548
+ return $this->post_types;
549
+ }
550
+
551
+ /**
552
+ * Register portfolio post types
553
+ *
554
+ * Register the post types for each portfolio created by admin
555
+ *
556
+ * @return void
557
+ * @since 1.0
558
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
559
+ */
560
+ public function register_cptu_post_types() {
561
+ $post_types = $this->get_post_types();
562
+ $pts = array();
563
+
564
+ foreach ( $post_types as $pt ) {
565
+
566
+ extract( $this->_cpt_args( $pt ) );
567
+
568
+ $name = $pt->post_name;
569
+ $title = $pt->post_title;
570
+
571
+ $labels = array(
572
+ 'name' => $title,
573
+ 'singular_name' => $label_singular,
574
+ 'add_new' => sprintf( __( 'Add %s', 'yith-plugin-fw' ), $label_singular ),
575
+ 'add_new_item' => sprintf( __( 'Add New %s', 'yith-plugin-fw' ), $label_singular ),
576
+ 'edit_item' => sprintf( __( 'Edit %s', 'yith-plugin-fw' ), $label_singular ),
577
+ 'new_item' => sprintf( __( 'New %s', 'yith-plugin-fw' ), $label_singular ),
578
+ 'all_items' => sprintf( __( 'All %s', 'yith-plugin-fw' ), $label_plural ),
579
+ 'view_item' => sprintf( __( 'View %s', 'yith-plugin-fw' ), $label_singular ),
580
+ 'search_items' => sprintf( __( 'Search %s', 'yith-plugin-fw' ), $label_plural ),
581
+ 'not_found' => sprintf( __( 'No %s found', 'yith-plugin-fw' ), $label_plural ),
582
+ 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'yith-plugin-fw' ), $label_plural ),
583
+ 'parent_item_colon' => '',
584
+ 'menu_name' => $title
585
+ );
586
+
587
+ $args = array(
588
+ 'labels' => apply_filters( 'yit_' . $this->_prefix_cpt . $name . '_labels', $labels ),
589
+ 'public' => true,
590
+ 'publicly_queryable' => true,
591
+ 'show_ui' => true,
592
+ 'show_in_menu' => false,
593
+ 'query_var' => true,
594
+ 'capability_type' => 'post',
595
+ 'hierarchical' => false,
596
+ 'menu_position' => null,
597
+ 'supports' => array( 'title', 'editor', 'thumbnail' )
598
+ );
599
+
600
+ if ( ! $this->_args['has_single'] ) {
601
+ $args['public'] = false;
602
+ $args['publicly_queryable'] = false;
603
+ $args['query_var'] = false;
604
+ }
605
+
606
+ if ( $this->_args['manage_layouts'] && isset($this->layouts[ $layout ]) && ! $this->layouts[ $layout ]['support']['description'] ) {
607
+ unset( $args['supports'][1] ); // remove 'editor'
608
+ }
609
+
610
+ if ( ! empty( $rewrite ) ) {
611
+ $args['rewrite'] = array( 'slug' => $rewrite );
612
+ }
613
+
614
+ // register post type
615
+ $post_type = yit_avoid_duplicate( str_replace( '-', '_', substr( $this->_prefix_cpt . $name, 0, 16) ), $post_types );
616
+ register_post_type( $post_type, apply_filters( 'yit_' . $this->_prefix_cpt . $name . '_args', $args, $pt ) ); // save the post type in post meta
617
+
618
+ update_post_meta( $pt->ID, '_post_type', $post_type );
619
+ $pts[] = $post_type;
620
+
621
+ // register taxonomy
622
+ if ( $this->_args['has_taxonomy'] && ! empty( $taxonomy ) ) {
623
+
624
+ $labels = array(
625
+ 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'yith-plugin-fw' ), $label_singular ),
626
+ 'singular_name' => _x( 'Category', 'taxonomy singular name', 'yith-plugin-fw' ),
627
+ 'search_items' => __( 'Search Categories', 'yith-plugin-fw' ),
628
+ 'all_items' => __( 'All Categories', 'yith-plugin-fw' ),
629
+ 'parent_item' => __( 'Parent Category', 'yith-plugin-fw' ),
630
+ 'parent_item_colon' => __( 'Parent Category:', 'yith-plugin-fw' ),
631
+ 'edit_item' => __( 'Edit Category', 'yith-plugin-fw' ),
632
+ 'update_item' => __( 'Update Category', 'yith-plugin-fw' ),
633
+ 'add_new_item' => __( 'Add New Category', 'yith-plugin-fw' ),
634
+ 'new_item_name' => __( 'New Category Name', 'yith-plugin-fw' ),
635
+ 'menu_name' => __( 'Category', 'yith-plugin-fw' ),
636
+ );
637
+
638
+ $args = array(
639
+ 'hierarchical' => true,
640
+ 'labels' => $labels,
641
+ 'show_ui' => true,
642
+ 'show_admin_column' => true,
643
+ 'query_var' => true,
644
+ );
645
+
646
+ if ( ! empty( $taxonomy_rewrite ) ) {
647
+ $args['rewrite'] = array( 'slug' => $taxonomy_rewrite );
648
+ }
649
+
650
+ register_taxonomy( substr( $taxonomy, 0, 32 ), $post_type, $args );
651
+
652
+ }
653
+
654
+ }
655
+
656
+ wp_cache_set( 'yit_cptu_post_types', $post_types );
657
+ }
658
+
659
+ /**
660
+ * Flush Rewrite Rules
661
+ *
662
+ * rewrite rules when a cpt unlimited is saved
663
+ *
664
+ * @return void
665
+ * @since 1.0
666
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
667
+ */
668
+
669
+ public function rewrite_flush( $post ){
670
+
671
+ if ( isset( $post ) && $this->_is_valid( get_post_type( intval( $post ) ) ) ) {
672
+ flush_rewrite_rules();
673
+ }
674
+
675
+ }
676
+
677
+ /**
678
+ * Add the item for each portfolio under "Portfolios"
679
+ *
680
+ * @return void
681
+ * @since 1.0
682
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
683
+ */
684
+ public function add_cptu_menu_item() {
685
+ global $submenu, $post, $parent_file, $pagenow;
686
+
687
+ // get current post type
688
+ if ( isset( $post->post_type ) ) {
689
+ $post_type = $post->post_type;
690
+ } else if ( isset( $_REQUEST['post_type'] ) ) {
691
+ $post_type = $_REQUEST['post_type'];
692
+ } else {
693
+ return;
694
+ }
695
+
696
+ $item = 'edit.php?post_type=' . $this->_name;
697
+
698
+ // add new items
699
+ if ( strpos( $post_type, $this->_prefix_cpt ) !== false ) {
700
+ global $wpdb;
701
+ $portfolio = $wpdb->get_row( $wpdb->prepare( "SELECT p.* FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $post_type, $this->_name ) );
702
+
703
+ if ( ! isset( $portfolio->ID ) ) {
704
+ return;
705
+ }
706
+
707
+ $label_singular = ! empty( $this->_args['label_item_sing'] ) ? $this->_args['label_item_sing'] : get_post_meta( $portfolio->ID, '_label_singular', true );
708
+ $label_plural = ! empty( $this->_args['label_item_plur'] ) ? $this->_args['label_item_plur'] : get_post_meta( $portfolio->ID, '_label_plural', true );
709
+
710
+ if ( empty( $label_plural ) ) {
711
+ $label_plural = $portfolio->post_title;
712
+ }
713
+
714
+ if ( empty( $label_singular ) ) {
715
+ $label_singular = $portfolio->post_title;
716
+ }
717
+
718
+ $submenu[ $item ][15] = array( ucfirst( $label_plural ), 'edit_posts', 'edit.php?post_type=' . $post_type );
719
+ $submenu[ $item ][20] = array( sprintf( __('Add %s', 'yith-plugin-fw'), ucfirst( $label_singular ) ), 'edit_posts', 'post-new.php?post_type=' . $post_type );
720
+
721
+ global $wp_taxonomies;
722
+ $taxonomy = get_post_meta( $portfolio->ID, '_taxonomy', true );
723
+ if ( isset( $wp_taxonomies[ $taxonomy ] ) ) {
724
+ $submenu[ $item ][25] = array( __('Categories', 'yith-plugin-fw'), 'edit_posts', 'edit-tags.php?taxonomy=' . $taxonomy . '&post_type=' . $post_type );
725
+ }
726
+ }
727
+
728
+ // set the parent item inside the single of each post type
729
+ if ( $pagenow == 'post.php' && isset( $_GET['post'] ) && $this->_is_valid( get_post_type( intval( $_GET['post'] ) ) ) ) {
730
+ $parent_file = 'edit.php?post_type=' . $this->_name;
731
+ }
732
+ }
733
+
734
+ /**
735
+ * Locate folder of CPTU templates, if there isn't a layouts management
736
+ *
737
+ * @return string
738
+ * @since 1.0
739
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
740
+ */
741
+ public function template_path() {
742
+ if ( ! empty( $this->template_path ) ) {
743
+ return $this->template_path;
744
+ }
745
+
746
+ // paths
747
+ $stylesheet_path_1 = get_stylesheet_directory() . '/theme/templates/' . $this->_name . '/';
748
+ $stylesheet_path_2 = get_template_directory() . '/theme/templates/' . $this->_name . '/';
749
+ $template_path_1 = get_stylesheet_directory() . '/' . $this->_name . '/';
750
+ $template_path_2 = get_template_directory() . '/' . $this->_name . '/';
751
+ $plugin_path = $this->_args['plugin_path'] . '/templates/';
752
+
753
+ foreach ( array( 'stylesheet_path_1', 'stylesheet_path_2', 'template_path_1', 'template_path_2', 'plugin_path' ) as $var ) {
754
+ $path = ${$var};
755
+
756
+ if ( file_exists( $path ) ) {
757
+ $this->template_path = $path;
758
+ }
759
+ }
760
+
761
+ return $this->template_path;
762
+ }
763
+
764
+ /**
765
+ * Locate folder of CPTU templates, if there isn't a layouts management
766
+ *
767
+ * @return string
768
+ * @since 1.0
769
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
770
+ */
771
+ public function template_url() {
772
+ if ( ! empty( $this->template_url ) ) {
773
+ return $this->template_path;
774
+ }
775
+
776
+ $this->template_url = str_replace( array(
777
+ get_stylesheet_directory(),
778
+ get_template_directory(),
779
+ $this->_args['plugin_path']
780
+ ), array(
781
+ get_stylesheet_directory_uri(),
782
+ get_template_directory_uri(),
783
+ $this->_args['plugin_url']
784
+ ), $this->template_path() );
785
+
786
+ return $this->template_url;
787
+ }
788
+
789
+ /**
790
+ * Retrieve all layouts to manage by custom post type added in the site in this order:
791
+ * 1. Child theme (if exists)
792
+ * 2. Theme
793
+ * 3. Plugin
794
+ *
795
+ * It also load the config.php file of each layout
796
+ *
797
+ * @return void
798
+ * @since 1.0
799
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
800
+ */
801
+ public function get_layouts() {
802
+
803
+ // paths
804
+ $stylesheet_path_1 = get_stylesheet_directory() . '/theme/templates/' . $this->_name . '/';
805
+ $stylesheet_path_2 = get_template_directory() . '/theme/templates/' . $this->_name . '/';
806
+ $template_path_1 = get_stylesheet_directory() . '/' . $this->_name . '/';
807
+ $template_path_2 = get_template_directory() . '/' . $this->_name . '/';
808
+ $plugin_path = $this->_args['plugin_path'] . '/templates/';
809
+
810
+ foreach ( array( 'stylesheet_path_1', 'stylesheet_path_2', 'template_path_1', 'template_path_2', 'plugin_path' ) as $var ) {
811
+ $path = ${$var};
812
+
813
+ if ( file_exists( $path ) ) {
814
+ foreach ( scandir( $path ) as $scan ) {
815
+ if ( ! isset( $this->layouts[$scan] ) && is_dir( $path . $scan ) && ! in_array( $scan, array( '.', '..', '.svn' ) ) && $scan[0] != '_' ) {
816
+ $this->layouts[$scan] = array(
817
+ 'name' => ucfirst( str_replace( '-', ' ', $scan ) ),
818
+ 'path' => $path . $scan,
819
+ 'url' => str_replace( array(
820
+ get_stylesheet_directory(),
821
+ get_template_directory(),
822
+ $this->_args['plugin_path']
823
+ ), array(
824
+ get_stylesheet_directory_uri(),
825
+ get_template_directory_uri(),
826
+ $this->_args['plugin_url']
827
+ ), $path . $scan ),
828
+ 'css' => array(),
829
+ 'js' => array(),
830
+ 'support' => array(
831
+ 'description' => true
832
+ ),
833
+ 'columns' => array()
834
+ );
835
+
836
+ // set the vars for config.php
837
+ $layout = $scan;
838
+ $this->_layout = $layout; // temporary attribute to load automatically the configuration inside the config.php, for this layout
839
+
840
+ // TODO Fare in modo di caricare il file config.php soltanto quando realmente serve
841
+ if ( ! in_array( $scan, array( 'single' ) ) && file_exists( $path . $scan . '/config.php' ) ) {
842
+ include_once( $path . $scan . '/config.php' );
843
+ }
844
+ }
845
+ }
846
+ }
847
+
848
+ }
849
+ }
850
+
851
+ /**
852
+ * Say if you want to set description for the current layout or not. This method must be used only inside the
853
+ * config.php file of layout
854
+ *
855
+ * @param $v string 'yes' or 'no'
856
+ *
857
+ * @return void
858
+ * @since 1.0
859
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
860
+ */
861
+ public function add_description_field( $v ) {
862
+ $this->layouts[ $this->_layout ]['support']['description'] = $v == 'yes' ? true : false;
863
+ }
864
+
865
+ /**
866
+ * Add the extra fields for the specific layout type of portfolio
867
+ *
868
+ * @param array $fields The fields to add
869
+ *
870
+ * @return void
871
+ * @since 1.0
872
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
873
+ */
874
+ public function add_layout_fields( $fields = array() ) {
875
+ // change the ID
876
+ foreach ( $fields as $id => $val ) {
877
+ unset( $fields[ $id ] );
878
+ $id = $this->_layout . '_' . $id;
879
+ $fields[ $id ] = $val;
880
+ }
881
+
882
+ $this->layouts[ $this->_layout ]['fields'] = $fields;
883
+ }
884
+
885
+ /**
886
+ * Add fields to add to the metabox of each item of each post type created
887
+ *
888
+ * @param array $fields The fields to add
889
+ *
890
+ * @return void
891
+ * @since 1.0
892
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
893
+ */
894
+ public function add_item_fields( $fields = array() ) {
895
+ // change the ID
896
+ foreach ( $fields as $id => $val ) {
897
+ unset( $fields[ $id ] );
898
+ //$id = $this->_layout . '_' . $id;
899
+ $fields[ $id ] = $val;
900
+ }
901
+ $this->layouts[ $this->_layout ]['item_fields'] = $fields;
902
+ }
903
+
904
+ /**
905
+ * Add columns to the table list
906
+ *
907
+ * @param array $columns The columns to add in the table list
908
+ *
909
+ * @return void
910
+ * @since 1.0
911
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
912
+ */
913
+ public function add_table_columns( $columns ) {
914
+ $this->layouts[ $this->_layout ]['columns'] = $columns;
915
+ }
916
+
917
+ /**
918
+ * Enqueue the css files of layout
919
+ *
920
+ * @param string $handle Name of the stylesheet.
921
+ * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
922
+ * @param array $deps An array of registered style handles this stylesheet depends on. Default empty array.
923
+ * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter is used
924
+ * to ensure that the correct version is sent to the client regardless of caching, and so
925
+ * should be included if a version number is available and makes sense for the stylesheet.
926
+ * @param string $media Optional. The media for which this stylesheet has been defined.
927
+ * Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
928
+ * 'screen', 'tty', or 'tv'.
929
+ *
930
+ * @return void
931
+ * @since 1.0
932
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
933
+ */
934
+ public function enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
935
+ $this->layouts[ $this->_layout ]['css'][] = compact( 'handle', 'src', 'deps', 'ver', 'media' );
936
+ }
937
+
938
+ /**
939
+ * Enqueue the js files of layout
940
+ *
941
+ * @param string $handle Name of the script.
942
+ * @param string|bool $src Path to the script from the root directory of WordPress. Example: '/js/myscript.js'.
943
+ * @param array $deps An array of registered handles this script depends on. Default empty array.
944
+ * @param string|bool $ver Optional. String specifying the script version number, if it has one. This parameter
945
+ * is used to ensure that the correct version is sent to the client regardless of caching,
946
+ * and so should be included if a version number is available and makes sense for the script.
947
+ * @param bool $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
948
+ * Default 'false'. Accepts 'false' or 'true'.
949
+ *
950
+ * @return void
951
+ * @since 1.0
952
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
953
+ */
954
+ public function enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
955
+ $this->layouts[ $this->_layout ]['js'][] = compact( 'handle', 'src', 'deps', 'ver', 'in_footer' );
956
+ }
957
+
958
+ /**
959
+ * Enqueue the assets for the frontend
960
+ *
961
+ * @return void
962
+ * @since 1.0
963
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
964
+ */
965
+ public function frontend_assets() {
966
+ global $post;
967
+
968
+ // not single
969
+ if ( ! is_single() || ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
970
+ $posts = get_posts(array(
971
+ 'post_type' => $this->_name,
972
+ 'posts_per_page' => -1,
973
+ 'post_status' => 'publish',
974
+ 'fields' => 'ids'
975
+ ));
976
+
977
+ $enqueued = array();
978
+
979
+ foreach ( $posts as $post_id ) {
980
+ $layout = get_post_meta( $post_id, $this->_args['layout_option'], true );
981
+
982
+ if ( in_array( $layout, array( $enqueued ) ) || ! isset( $this->layouts[ $layout ]['css'] ) ) {
983
+ continue;
984
+ }
985
+
986
+ foreach ( $this->layouts[ $layout ]['css'] as $asset ) {
987
+ if ( empty( $asset ) ) {
988
+ continue;
989
+ }
990
+ yit_enqueue_style( $asset['handle'], empty( $asset['src'] ) ? false : $this->locate_url( $layout ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['media'] );
991
+ }
992
+
993
+ $enqueued[] = $layout;
994
+ }
995
+ }
996
+
997
+ // load assets of single template
998
+ else {
999
+ $layout = 'single';
1000
+
1001
+ if ( ! isset( $this->layouts[ $layout ]['css'] ) ) {
1002
+ return;
1003
+ }
1004
+
1005
+ foreach ( $this->layouts[ $layout ]['css'] as $asset ) {
1006
+ if ( empty( $asset ) ) {
1007
+ continue;
1008
+ }
1009
+ yit_enqueue_style( $asset['handle'], $this->locate_url( $layout ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['media'] );
1010
+ }
1011
+ }
1012
+
1013
+ }
1014
+
1015
+ /**
1016
+ * Register Metaboxes options
1017
+ *
1018
+ * Add the metabox for the portfolio settings
1019
+ *
1020
+ * @return void
1021
+ * @since 1.0
1022
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1023
+ */
1024
+ public function add_metabox_cptu() {
1025
+
1026
+ // Reorganize layouts
1027
+ if ( $this->_args['manage_layouts'] ) {
1028
+ $layouts = array();
1029
+ foreach ( $this->layouts as $layout_id => $layout ) {
1030
+ if ( 'single' == $layout_id ) {
1031
+ continue;
1032
+ }
1033
+ $layouts[ $layout_id ] = $layout['name'];
1034
+ }
1035
+
1036
+ $layouts = apply_filters( 'yit_cptu_' . $this->_name . '_layout_values', $layouts );
1037
+ }
1038
+
1039
+ $single_layouts = apply_filters( 'yit_cptu_' . $this->_name . '_single_layout_values', array() );
1040
+
1041
+ $metabox_args = array(
1042
+ 'label' => sprintf( __( '%s Settings', 'yith-plugin-fw' ), $this->_labels['singular'] ),
1043
+ 'pages' => $this->_name, //or array( 'post-type1', 'post-type2')
1044
+ 'context' => 'normal', //('normal', 'advanced', or 'side')
1045
+ 'priority' => 'default',
1046
+ 'tabs' => array(
1047
+ 'settings' => array(
1048
+ 'label' => __( 'Settings', 'yith-plugin-fw' ),
1049
+ 'fields' => apply_filters( 'yit_cptu_fields', array(
1050
+ 'type' => array(
1051
+ 'label' => __( 'Type', 'yith-plugin-fw' ),
1052
+ 'desc' => sprintf( __( 'Layout for this %s' , 'yith-plugin-fw' ), strtolower( $this->_labels['singular'] ) ),
1053
+ 'type' => 'select',
1054
+ 'options' => isset( $layouts ) ? $layouts : array(),
1055
+ 'std' => '' ),
1056
+
1057
+ 'rewrite' => array(
1058
+ 'label' => __( 'Rewrite', 'yith-plugin-fw' ),
1059
+ 'desc' => __( 'Univocal identification name in the URL for each product (slug from post if empty)', 'yith-plugin-fw' ),
1060
+ 'type' => 'text',
1061
+ 'std' => '' ),
1062
+
1063
+ 'label_singular' => array(
1064
+ 'label' => __( 'Label in Singular', 'yith-plugin-fw' ),
1065
+ 'desc' => __( 'Set a label in singular (title of portfolio if empty)', 'yith-plugin-fw' ),
1066
+ 'type' => 'text',
1067
+ 'std' => '' ),
1068
+
1069
+ 'label_plural' => array(
1070
+ 'label' => __( 'Label in Plural', 'yith-plugin-fw' ),
1071
+ 'desc' => __( 'Set a label in plural (title of portfolio if empty)', 'yith-plugin-fw' ),
1072
+ 'type' => 'text',
1073
+ 'std' => '' ),
1074
+
1075
+ 'taxonomy' => array(
1076
+ 'label' => __( 'Taxonomy', 'yith-plugin-fw' ),
1077
+ 'desc' => __( 'If you want to use categories in the portfolio, set a name for taxonomy. Name should be a slug (must not contain capital letters nor spaces) and must not be more than 32 characters long (database structure restriction).', 'yith-plugin-fw' ),
1078
+ 'type' => 'text',
1079
+ 'std' => '' ),
1080
+
1081
+ 'taxonomy_rewrite' => array(
1082
+ 'label' => __( 'Taxonomy Rewrite', 'yith-plugin-fw' ),
1083
+ 'desc' => __( 'Set univocal name for each category page URL.', 'yith-plugin-fw' ),
1084
+ 'type' => 'text',
1085
+ 'std' => '' ),
1086
+
1087
+ 'single_layout' => array(
1088
+ 'label' => __( 'Single layout', 'yith-plugin-fw' ),
1089
+ 'desc' => __( 'Layout for single page of this portfolio', 'yith-plugin-fw' ),
1090
+ 'type' => 'select',
1091
+ 'options' => $single_layouts,
1092
+ 'std' => '' ),
1093
+ ) )
1094
+ )
1095
+ )
1096
+
1097
+ );
1098
+
1099
+ if ( ! $this->_args['has_single'] ) {
1100
+ unset( $metabox_args['tabs']['settings']['fields']['rewrite'] );
1101
+ }
1102
+
1103
+ if ( ! $this->_args['has_taxonomy'] ) {
1104
+ unset( $metabox_args['tabs']['settings']['fields']['taxonomy'] );
1105
+ unset( $metabox_args['tabs']['settings']['fields']['taxonomy_rewrite'] );
1106
+ }
1107
+
1108
+ if ( ! empty( $this->_args['label_item_sing'] ) ) {
1109
+ unset( $metabox_args['tabs']['settings']['fields']['label_singular'] );
1110
+ }
1111
+
1112
+ if ( ! empty( $this->_args['label_item_plur'] ) ) {
1113
+ unset( $metabox_args['tabs']['settings']['fields']['label_plural'] );
1114
+ }
1115
+
1116
+ if ( $this->_args['manage_layouts'] ) {
1117
+
1118
+ if ( count( $layouts ) < 1 ) {
1119
+ unset( $metabox_args['tabs']['settings']['fields']['type'] );
1120
+ }
1121
+
1122
+ // Layouts options
1123
+ foreach ( $this->layouts as $layout => $args ) {
1124
+ if ( ! isset( $args['fields'] ) ) {
1125
+ continue;
1126
+ }
1127
+
1128
+ // Section title
1129
+ $metabox_args['tabs']['settings']['fields'][ $layout . '_title' ] = array(
1130
+ 'desc' => $args['name'] . ' ' . __( 'layout settings', 'yith-plugin-fw' ),
1131
+ 'type' => 'title',
1132
+ 'deps' => array(
1133
+ 'ids' => '_type',
1134
+ 'values' => $layout
1135
+ )
1136
+ );
1137
+
1138
+ // Options
1139
+ foreach( $args['fields'] as $field_id => $field ) {
1140
+ $metabox_args['tabs']['settings']['fields'][ $field_id ] = $field;
1141
+ $metabox_args['tabs']['settings']['fields'][ $field_id ]['deps'] = array(
1142
+ 'ids' => '_type',
1143
+ 'values' => $layout
1144
+ );
1145
+ }
1146
+ }
1147
+ }else {
1148
+ unset( $metabox_args['tabs']['settings']['fields']['type'] );
1149
+ }
1150
+
1151
+ if( count( $single_layouts ) < 1 ){
1152
+ unset( $metabox_args['tabs']['settings']['fields']['single_layout'] );
1153
+ }
1154
+
1155
+ // undo if tab empty
1156
+ if ( empty( $metabox_args['tabs']['settings']['fields'] ) ) {
1157
+ return;
1158
+ }
1159
+
1160
+ $metabox = YIT_Metabox( $this->_name . '_cptu_settings' );
1161
+ $metabox->init( $metabox_args );
1162
+ }
1163
+
1164
+ /**
1165
+ * Register Metaboxes options
1166
+ *
1167
+ * Add the metabox for the portfolio settings
1168
+ *
1169
+ * @return void
1170
+ * @since 1.0
1171
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1172
+ */
1173
+ public function add_metabox_item_fields() {
1174
+ global $pagenow, $post_type;
1175
+
1176
+ // get the actual post type, to add the metabox only if necessary
1177
+ if ( $pagenow == 'post.php' && isset( $_REQUEST['post'] ) ) {
1178
+ $post_type = get_post_type( intval( $_REQUEST['post'] ) );
1179
+ }
1180
+ elseif( $pagenow == 'post.php' && isset( $_REQUEST['post_ID'] ) ){
1181
+ $post_type = get_post_type( intval( $_REQUEST['post_ID'] ) );
1182
+ }
1183
+ elseif ( $pagenow == 'post-new.php' && isset( $_REQUEST['post_type'] ) ) {
1184
+ $post_type = $_REQUEST['post_type'];
1185
+ } else {
1186
+ return;
1187
+ }
1188
+
1189
+ $layout = get_post_meta( $this->_get_id_by_name( $post_type ), $this->_args['layout_option'], true );
1190
+
1191
+ if ( empty( $this->layouts[ $layout ]['item_fields'] ) ) {
1192
+ return;
1193
+ }
1194
+
1195
+ $metabox_args = array(
1196
+ 'label' => __( 'Settings', 'yith-plugin-fw' ),
1197
+ 'pages' => $post_type, //or array( 'post-type1', 'post-type2')
1198
+ 'context' => 'normal', //('normal', 'advanced', or 'side')
1199
+ 'priority' => 'default',
1200
+ 'tabs' => array(
1201
+ 'settings' => array(
1202
+ 'label' => __( 'Settings', 'yith-plugin-fw' ),
1203
+ 'fields' => $this->layouts[ $layout ]['item_fields']
1204
+ )
1205
+ )
1206
+ );
1207
+
1208
+ $metabox = YIT_Metabox( $post_type . '_item_fields' );
1209
+ $metabox->init( $metabox_args );
1210
+
1211
+ }
1212
+
1213
+ /**
1214
+ * Add quick links inside the editing page of CPTU and Custom Post Types
1215
+ *
1216
+ * @return void
1217
+ * @since 1.0
1218
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1219
+ */
1220
+ public function add_quick_links_metaboxes() {
1221
+ // CPTU
1222
+ add_meta_box( $this->_name . '_quick_links', __( 'Quick links', 'yith-plugin-fw' ), array( $this, 'quick_links_cptu_inner' ), $this->_name, 'side', 'high' );
1223
+
1224
+ // CPTs
1225
+ $args = array(
1226
+ 'post_type' => $this->_name,
1227
+ 'posts_per_page' => -1,
1228
+ 'post_status' => 'publish'
1229
+ );
1230
+ $post_types = get_posts( $args );
1231
+
1232
+ foreach ( $post_types as $post ) {
1233
+ $post_type = get_post_meta( $post->ID, '_post_type', true );
1234
+ extract( $this->_cpt_args( $post ) );
1235
+ add_meta_box( $post->post_type . '_quick_links', __( 'Quick links', 'yith-plugin-fw' ), array( $this, 'quick_links_cpt_inner' ), $post_type, 'side', 'high' );
1236
+ }
1237
+ }
1238
+
1239
+ /**
1240
+ * Link to: "View Items", inside the CPTU
1241
+ *
1242
+ * @param $post
1243
+ *
1244
+ * @return void
1245
+ * @since 1.0
1246
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1247
+ */
1248
+ public function quick_links_cptu_inner( $post ) {
1249
+ extract( $this->_cpt_args( $post ) );
1250
+ ?>
1251
+ <a href="<?php echo admin_url( 'edit.php?post_type=' . get_post_meta( $post->ID, '_post_type', true ) ) ?>"><?php printf( __( 'View %s', 'yith-plugin-fw' ), $label_plural ) ?></a>
1252
+ <?php
1253
+ }
1254
+
1255
+ /**
1256
+ * Link to: "Edit %s", inside the CPTU
1257
+ *
1258
+ * @param $post
1259
+ *
1260
+ * @return void
1261
+ * @since 1.0
1262
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1263
+ */
1264
+ public function quick_links_cpt_inner( $post ) {
1265
+ $post = get_post( $this->_get_id_by_name( $post->post_type ) );
1266
+ ?>
1267
+ <a href="<?php echo admin_url( "post.php?post={$post->ID}&action=edit" ) ?>"><?php printf( __( 'Edit %s', 'yith-plugin-fw' ), $post->post_title ) ?></a>
1268
+ <?php
1269
+ }
1270
+
1271
+ /**
1272
+ * Define the columns to use in the list table of main sliders post type
1273
+ *
1274
+ * @param $columns array The columns used in the list table
1275
+ *
1276
+ * @return array
1277
+ * @since 1.0
1278
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1279
+ */
1280
+ public function cptu_define_columns( $columns ) {
1281
+ unset( $columns['date'] );
1282
+
1283
+ $columns['actions'] = '';
1284
+
1285
+ return $columns;
1286
+ }
1287
+
1288
+ /**
1289
+ * Change the content of each column of the table list
1290
+ *
1291
+ * @param $column string The current column
1292
+ * @param $post_id int The current post ID
1293
+ *
1294
+ * @return void
1295
+ * @since 1.0
1296
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1297
+ */
1298
+ public function cptu_change_columns( $column, $post_id ) {
1299
+ $post = get_post( $post_id );
1300
+ extract( $this->_cpt_args( $post ) );
1301
+
1302
+ switch ( $column ) {
1303
+ case 'actions' :
1304
+ echo '<a href="' . admin_url( "post.php?post={$post_id}&action=edit" ) . '" class="button-secondary">' . sprintf( __( 'Edit %s', 'yith-plugin-fw' ), ucfirst( $this->_labels['singular'] ) ) . '</a> ';
1305
+ echo '<a href="' . admin_url( 'edit.php?post_type=' . get_post_meta( $post_id, '_post_type', true ) ) . '" class="button-secondary">' . sprintf( __( 'View %s', 'yith-plugin-fw' ), $label_plural ) . '</a> ';
1306
+ break;
1307
+ }
1308
+ }
1309
+
1310
+ /**
1311
+ * Retrieve the path of layout specified in parameter
1312
+ *
1313
+ * @param $layout
1314
+ * @param $file string The file to find
1315
+ *
1316
+ * @return bool|string
1317
+ * @since 1.0
1318
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1319
+ */
1320
+ public function locate_file( $layout, $file = '' ) {
1321
+ if ( ! $this->_args['manage_layouts'] ) {
1322
+ return $this->template_path(). '/' . ( ! empty( $file ) ? $file . '.php' : '' );
1323
+ }
1324
+
1325
+ if ( ! isset( $this->layouts[ $layout ] ) ) {
1326
+ $layout = 'default';
1327
+ }
1328
+
1329
+ return $this->layouts[ $layout ]['path'] . '/' . ( ! empty( $file ) ? $file . '.php' : '' );
1330
+ }
1331
+
1332
+ /**
1333
+ * Retrieve the URL of layout specified in parameter
1334
+ *
1335
+ * @param $layout
1336
+ * @param $file string The file to find
1337
+ *
1338
+ * @return bool|string
1339
+ * @since 1.0
1340
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1341
+ */
1342
+ public function locate_url( $layout, $file = '' ) {
1343
+ if ( ! $this->_args['manage_layouts'] ) {
1344
+ return $this->template_url();
1345
+
1346
+ }
1347
+
1348
+ if ( ! isset( $this->layouts[ $layout ] ) ) {
1349
+ $layout = 'default';
1350
+ }
1351
+
1352
+ return $this->layouts[ $layout ]['url'] . '/' . ( ! empty( $file ) ? $file . '.php' : '' );
1353
+ }
1354
+
1355
+ /**
1356
+ * Retrieve the post ID relative to the post of post type
1357
+ *
1358
+ * @param $name string
1359
+ *
1360
+ * @return mixed
1361
+ * @since 1.0
1362
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1363
+ */
1364
+ protected function _get_id_by_name( $name ) {
1365
+ global $wpdb;
1366
+ return $wpdb->get_var( $wpdb->prepare( "SELECT pm.post_id FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $name, $this->_name ) );
1367
+ }
1368
+
1369
+ /**
1370
+ * Retrieve the post_type of portfolio by portfolio name
1371
+ *
1372
+ * @param $name string
1373
+ *
1374
+ * @return mixed
1375
+ * @since 1.0
1376
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1377
+ */
1378
+ protected function _get_post_type_by_name( $name ) {
1379
+ global $wpdb;
1380
+ return $wpdb->get_var( $wpdb->prepare( "SELECT pm.meta_value FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND p.post_name = %s AND p.post_type = %s", '_post_type', $name, $this->_name ) );
1381
+ }
1382
+
1383
+ /**
1384
+ * The shortcode used to show the frontend
1385
+ *
1386
+ * @param array $atts
1387
+ * @param null $content
1388
+ *
1389
+ * @return string|null
1390
+ * @since 1.0
1391
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1392
+ */
1393
+ public function add_shortcode( $atts, $content = null ) {
1394
+ $atts = wp_parse_args( $atts, array(
1395
+ 'name' => null,
1396
+ 'cat' => array(),
1397
+ 'posts_per_page' => false,
1398
+ 'style' => null,
1399
+ ) );
1400
+
1401
+ // don't show the slider if 'name' is empty or is 'none'
1402
+ if ( empty( $atts['name'] ) || 'none' == $atts['name'] ) return null;
1403
+
1404
+ // compatibility fix: remove prefix if exists in portfolio object
1405
+ if( function_exists( 'YIT_Portfolio' ) && method_exists( YIT_Portfolio(), 'is' ) && YIT_Portfolio()->is( $atts['name'] ) ){
1406
+ $atts['name'] = str_replace( YIT_Portfolio()->post_type_prefix, '', $atts['name'] );
1407
+ }
1408
+
1409
+ // pass vars to template
1410
+ $atts['post_type'] = $this->_get_post_type_by_name( $atts['name'] );
1411
+ $atts['layout'] = $this->_args['manage_layouts'] ? get_post_meta( $this->_get_id_by_name( $atts['post_type'] ), $this->_args['layout_option'], true ) : '';
1412
+ extract( apply_filters( 'yit_cptu_frontend_vars', $atts, $this->_name ) );
1413
+
1414
+ // add the javascript assets
1415
+ if ( $this->_args['manage_layouts'] && isset( $this->layouts[ $layout ]['js'] ) && ! empty( $this->layouts[ $layout ]['js'] ) ) {
1416
+ foreach ( $this->layouts[ $layout ]['js'] as $asset ) {
1417
+ if ( empty( $asset ) ) continue;
1418
+
1419
+ if ( empty( $asset['src'] ) ) {
1420
+ wp_enqueue_script( $asset['handle'] );
1421
+ continue;
1422
+ }
1423
+
1424
+ yit_enqueue_script( $asset['handle'], $this->locate_url( $layout ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['in_footer'] );
1425
+ }
1426
+ }
1427
+
1428
+ // Unique sequential index to differentiate more cpt in the same page
1429
+ ++$this->index;
1430
+
1431
+ ob_start();
1432
+
1433
+ include( $this->locate_file( $layout, 'markup' ) );
1434
+
1435
+ return ob_get_clean();
1436
+
1437
+ }
1438
+
1439
+ /**
1440
+ * Shortcode icon
1441
+ *
1442
+ * Return the shortcode icone to display on shortcode panel
1443
+ *
1444
+ * @param $icon_url string Icone url found by yit_shortcode plugin
1445
+ *
1446
+ * @return string
1447
+ * @since 1.0.0
1448
+ * @author Antonino Scarfi' <antonio.scarfi@yithemes.it>
1449
+ */
1450
+ public function shortcode_icon( $icon_url ) {
1451
+ return ! empty( $this->_args['shortcode_icon'] ) ? $this->_args['shortcode_icon'] : $icon_url;
1452
+ }
1453
+
1454
+ /**
1455
+ * Return an array with cptu options to shortcode panel
1456
+ *
1457
+ * All definition settings to add cptu shortcode to Yit Shortcode Panel
1458
+ *
1459
+ * @param array $shortcodes
1460
+ *
1461
+ * @return array
1462
+ * @since 1.0
1463
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1464
+ */
1465
+ public function add_shortcode_to_box( $shortcodes ) {
1466
+ $post_types = array();
1467
+
1468
+ foreach ( $this->get_post_types() as $post ) {
1469
+ $post_types[ $post->post_name ] = $post->post_title;
1470
+ }
1471
+
1472
+ $args = array(
1473
+ $this->_args['shortcode_name'] => array(
1474
+ 'title' => $this->_labels['singular'],
1475
+ 'description' => sprintf( __( 'Show frontend of the %s', 'yith-plugin-fw' ), $this->_labels['main_name'] ),
1476
+ 'tab' => 'cpt',
1477
+ 'create' => false,
1478
+ 'has_content' => false,
1479
+ 'in_visual_composer' => true,
1480
+ 'attributes' => array(
1481
+ 'name' => array(
1482
+ 'title' => __( 'Name', 'yith-plugin-fw' ),
1483
+ 'type' => 'select',
1484
+ 'options' => $post_types,
1485
+ 'std' => ''
1486
+ ),
1487
+ )
1488
+ )
1489
+ );
1490
+
1491
+ return array_merge( $shortcodes, $args );
1492
+ }
1493
+
1494
+ /**
1495
+ * Check the post type passed in parameter, if is generated by this CPTU
1496
+ *
1497
+ * @param $post_type string The post type to check
1498
+ *
1499
+ * @return bool
1500
+ * @since 1.0
1501
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1502
+ */
1503
+ protected function _is_valid( $post_type ) {
1504
+ return (bool)( strpos( $post_type, $this->_args['post_type_prefix'] ) !== false );
1505
+ }
1506
+
1507
+ /**
1508
+ * Add as a valid post type all cptu when importing dummy data
1509
+ *
1510
+ * @param $post array The post object
1511
+ *
1512
+ * @return array
1513
+ * @since 1.0
1514
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
1515
+ */
1516
+ public function add_importer_required_post_type( $post ){
1517
+ global $wp_post_types, $wp_taxonomies;
1518
+
1519
+ if( strpos( $post['post_type'], $this->_prefix_cpt ) === FALSE ){
1520
+ return $post;
1521
+ }
1522
+
1523
+ if( ! isset( $wp_post_types[ $post['post_type'] ] ) ){
1524
+ $wp_post_types[ $post['post_type'] ] = array(
1525
+ 'name' => ''
1526
+ );
1527
+ }
1528
+
1529
+ if( ! empty( $post['terms'] ) ){
1530
+ foreach( $post['terms'] as $term ){
1531
+ if( ! isset( $wp_taxonomies[ $term['domain'] ] ) ){
1532
+ $wp_taxonomies[ $term['domain'] ] = array(
1533
+ 'name' => ''
1534
+ );
1535
+ }
1536
+ }
1537
+ }
1538
+
1539
+
1540
+ return $post;
1541
+ }
1542
+
1543
+ /**
1544
+ * Add taxonomy when importing dummy data
1545
+ *
1546
+ * @param $terms array Array of terms
1547
+ *
1548
+ * @return array
1549
+ * @since 1.0
1550
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
1551
+ */
1552
+ public function add_importer_required_taxonomy( $terms ){
1553
+ global $wp_taxonomies;
1554
+
1555
+ if( ! empty( $terms ) ){
1556
+ foreach ( $terms as $term ) {
1557
+ if( isset( $term['domain'] ) && ! isset( $wp_taxonomies[ $term['domain'] ] ) ){
1558
+ $wp_taxonomies[ $term['domain'] ] = array(
1559
+ 'name' => ''
1560
+ );
1561
+ }
1562
+ }
1563
+ }
1564
+
1565
+ return $terms;
1566
+ }
1567
+
1568
+ /**
1569
+ * Force terms recount for imported taxonomy
1570
+ *
1571
+ * @param $tt_ids array Terms ids
1572
+ * @param $ids array Post ids
1573
+ * @param $tax string Taxonomy name
1574
+ *
1575
+ * @return void
1576
+ * @since 1.0
1577
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
1578
+ */
1579
+ public function recount_terms_post( $tt_ids, $ids, $tax ){
1580
+ wp_update_term_count( $tt_ids, $tax );
1581
+ }
1582
+
1583
+ // ### ASSETS ###
1584
+
1585
+ /**
1586
+ * Enqueue the assets for the admin
1587
+ *
1588
+ * @return void
1589
+ * @since 1.0
1590
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1591
+ */
1592
+ public function admin_assets() {
1593
+ wp_enqueue_media();
1594
+ wp_enqueue_script( 'yit-cptu', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cpt-unlimited.js', array('jquery'), '', true );
1595
+ }
1596
+
1597
+ /**
1598
+ * Add the button to the top of the list table page of CPTU
1599
+ *
1600
+ * @return void
1601
+ * @since 1.0
1602
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1603
+ */
1604
+ public function add_button_multiuploader() {
1605
+ global $pagenow, $post_type, $wpdb;
1606
+
1607
+ if( $pagenow != 'edit.php' ){
1608
+ return;
1609
+ }
1610
+
1611
+ $cptu = $wpdb->get_var( $wpdb->prepare( "SELECT p.post_type FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s", '_post_type', $post_type ) );
1612
+
1613
+ $post = get_post( $this->_get_id_by_name( $post_type ) );
1614
+ if ( empty( $post ) ) {
1615
+ return;
1616
+ }
1617
+ extract( $this->_cpt_args( $post ) );
1618
+
1619
+ if ( $cptu != $this->_name || ! $this->_is_valid( $post_type ) ) {
1620
+ return;
1621
+ }
1622
+ ?>
1623
+ <script>
1624
+ (function($) {
1625
+ "use strict";
1626
+ // Author code here
1627
+
1628
+ var button = $('<a />', {
1629
+ href: '#',
1630
+ class: 'multi-uploader add-new-h2',
1631
+ 'data-uploader_title': '<?php printf( __( 'Add %s from images', 'yith-plugin-fw' ), $label_plural ) ?>',
1632
+ 'data-uploader_button_text': '<?php printf( __( 'Add %s', 'yith-plugin-fw' ), $label_plural ) ?>'
1633
+ }).text('<?php _e( 'Upload multiple files', 'yith-plugin-fw' ) ?>');
1634
+
1635
+ var spinner = $('<span />', {
1636
+ class: 'spinner',
1637
+ style: 'float: none;'
1638
+ });
1639
+
1640
+ button.appendTo('.wrap h2, .wrap h1').after(spinner);
1641
+
1642
+ })(jQuery);
1643
+ </script>
1644
+ <?php
1645
+ }
1646
+
1647
+ /**
1648
+ * Add more posts by multiupload
1649
+ *
1650
+ * @return void
1651
+ * @since 1.0
1652
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1653
+ */
1654
+ public function post_multiuploader() {
1655
+ if ( ! isset( $_REQUEST['images'] ) || ! isset( $_REQUEST['post_type'] ) && $this->_is_valid( $_REQUEST['post_type'] ) ) {
1656
+ return;
1657
+ }
1658
+
1659
+ foreach ( $_REQUEST['images'] as $the ) {
1660
+
1661
+ // Create post object
1662
+ $arg = array(
1663
+ 'post_title' => $the['title'],
1664
+ 'post_type' => $_REQUEST['post_type']
1665
+ );
1666
+ $post_id = wp_insert_post( $arg );
1667
+
1668
+ set_post_thumbnail( $post_id, $the['id'] );
1669
+
1670
+ }
1671
+
1672
+ die();
1673
+ }
1674
+
1675
+
1676
+ // ###### SINGLE TEMPLATE ######
1677
+
1678
+ /**
1679
+ * Load the single template file
1680
+ *
1681
+ * @return void
1682
+ * @since 1.0
1683
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1684
+ */
1685
+ public function single_template() {
1686
+ global $post, $wpdb;
1687
+
1688
+ // if ( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ) {
1689
+ // $post = get_post( $_REQUEST['post_id'] );
1690
+ // }
1691
+
1692
+ if ( ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ! is_single() ) || ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
1693
+ return;
1694
+ }
1695
+
1696
+ // add the javascript assets
1697
+ if ( $this->_args['manage_layouts'] ) {
1698
+ foreach ( $this->layouts[ 'single' ]['js'] as $asset ) {
1699
+ yit_enqueue_script( $asset['handle'], $this->locate_url( 'single' ) . $asset['src'], $asset['deps'], $asset['ver'], $asset['in_footer'] );
1700
+ }
1701
+ }
1702
+
1703
+ $post_name = $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $post->post_type, $this->_name ) );
1704
+ extract( apply_filters( 'yit_cptu_frontend_vars', array( 'name' => $post_name ), $this->_name ) );
1705
+
1706
+ include( $this->locate_file( 'single', 'markup' ) );
1707
+ }
1708
+
1709
+ /**
1710
+ * Load a file for the configuration of single template page of portfolio
1711
+ *
1712
+ * @return void
1713
+ * @since 1.0
1714
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1715
+ */
1716
+ public function single_template_config() {
1717
+ global $post, $wpdb;
1718
+
1719
+ if ( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['post_id'] ) ) {
1720
+ $post = get_post( $_REQUEST['post_id'] );
1721
+ }
1722
+
1723
+ if ( ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ! is_single() ) || ! isset( $post->post_type ) || ! $this->_is_valid( $post->post_type ) ) {
1724
+ return;
1725
+ }
1726
+
1727
+ $this->_layout = 'single';
1728
+ $path = $this->locate_file( 'single', 'config' );
1729
+
1730
+ if ( file_exists( $path ) ) {
1731
+ $post_name = $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->postmeta AS pm INNER JOIN $wpdb->posts AS p ON p.ID = pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %s AND p.post_type = %s", '_post_type', $post->post_type, $this->_name ) );
1732
+ extract( apply_filters( 'yit_cptu_frontend_vars', array( 'name' => $post_name ), $this->_name ) );
1733
+
1734
+ include( $path );
1735
+ }
1736
+ }
1737
+
1738
+
1739
+ // ########################## ARCHIVE TEMPLATE ###############################
1740
+
1741
+
1742
+ /**
1743
+ * Load the template for archive page
1744
+ *
1745
+ * @return void
1746
+ * @since 1.0
1747
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1748
+ */
1749
+ public function archive_template() {
1750
+ global $wp_query;
1751
+
1752
+
1753
+ // check if we are in archive template
1754
+ if ( !( ! is_admin() && is_archive() && isset($wp_query->post) && $this->_is_valid( $wp_query->post->post_type ) ) ) {
1755
+ return;
1756
+ }
1757
+
1758
+ // remove the action from loop of theme
1759
+ remove_action( 'yit_content_loop', 'yit_content_loop', 10 );
1760
+ add_action( 'yit_content_loop', array( $this, 'archive_template_loop' ), 10 );
1761
+
1762
+ }
1763
+
1764
+ /**
1765
+ * Load loop for the archive template
1766
+ *
1767
+ * @return void
1768
+ * @since 1.0
1769
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
1770
+ */
1771
+ public function archive_template_loop() {
1772
+ echo $this->add_shortcode( array( 'name' => $GLOBALS['wp_query']->post->post_type ) );
1773
+ }
1774
+
1775
  }
plugin-fw/lib/yit-metabox.php CHANGED
@@ -1,549 +1,549 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
-
12
- if (!defined('ABSPATH')) {
13
- exit;
14
- } // Exit if accessed directly
15
-
16
- if (!class_exists('YIT_Metabox')) {
17
- /**
18
- * YIT Metabox
19
- *
20
- * the metabox can be created using this code
21
- * <code>
22
- * $args1 = array(
23
- * 'label' => __( 'Metabox Label', 'yith-plugin-fw' ),
24
- * 'pages' => 'page', //or array( 'post-type1', 'post-type2')
25
- * 'context' => 'normal', //('normal', 'advanced', or 'side')
26
- * 'priority' => 'default',
27
- * 'tabs' => array(
28
- * 'settings' => array( //tab
29
- * 'label' => __( 'Settings', 'yith-plugin-fw' ),
30
- * 'fields' => array(
31
- * 'meta_checkbox' => array(
32
- * 'label' => __( 'Show title', 'yith-plugin-fw' ),
33
- * 'desc' => __( 'Choose whether to show title of the page or not.', 'yith-plugin-fw' ),
34
- * 'type' => 'checkbox',
35
- * 'private' => false,
36
- * 'std' => '1'),
37
- * ),
38
- * ),
39
- * );
40
- *
41
- * $metabox1 = YIT_Metabox( 'yit-metabox-id' );
42
- * $metabox1->init( $args );
43
- * </code>
44
- *
45
- * @class YIT_Metaboxes
46
- * @package Yithemes
47
- * @since 1.0.0
48
- * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
49
- *
50
- */
51
- class YIT_Metabox
52
- {
53
-
54
- /**
55
- * @var string the id of metabox
56
- *
57
- * @since 1.0
58
- */
59
-
60
- public $id;
61
-
62
- /**
63
- * @var array An array where are saved all metabox settings options
64
- *
65
- * @since 1.0
66
- */
67
- private $options = array();
68
-
69
- /**
70
- * @var array An array where are saved all tabs of metabox
71
- *
72
- * @since 1.0
73
- */
74
- private $tabs = array();
75
-
76
- /**
77
- * @var object The single instance of the class
78
- * @since 1.0
79
- */
80
- protected static $_instance = array();
81
-
82
- /**
83
- * Main Instance
84
- *
85
- * @static
86
- *
87
- * @param $id
88
- *
89
- * @return object Main instance
90
- *
91
- * @since 1.0
92
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
93
- */
94
- public static function instance($id)
95
- {
96
- if (!isset(self::$_instance[$id])) {
97
- self::$_instance[$id] = new self($id);
98
- }
99
- return self::$_instance[$id];
100
- }
101
-
102
- /**
103
- * Constructor
104
- *
105
- * @param string $id
106
- *
107
- * @return \YIT_Metabox
108
- * @since 1.0
109
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
110
- */
111
- function __construct($id = '')
112
- {
113
- $this->id = $id;
114
-
115
- }
116
-
117
-
118
- /**
119
- * Init
120
- *
121
- * set options and tabs, add actions to register metabox, scripts and save data
122
- *
123
- * @param array $options
124
- *
125
- * @return void
126
- * @since 1.0
127
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
128
- */
129
- public function init($options = array())
130
- {
131
-
132
- $this->set_options($options);
133
- $this->set_tabs();
134
-
135
-
136
- add_action('add_meta_boxes', array($this, 'register_metabox'));
137
- add_action('save_post', array($this, 'save_postdata'));
138
- add_action('admin_enqueue_scripts', array($this, 'enqueue'), 15);
139
-
140
- }
141
-
142
- /**
143
- * Enqueue script and styles in admin side
144
- *
145
- * Add style and scripts to administrator
146
- *
147
- * @return void
148
- * @since 1.0
149
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
150
- */
151
- public function enqueue()
152
- {
153
-
154
- wp_enqueue_media();
155
- wp_enqueue_style('wp-color-picker');
156
- wp_enqueue_style('yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css');
157
- wp_enqueue_style('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css');
158
- wp_enqueue_script('jquery-ui-datepicker');
159
- wp_enqueue_script('yit-spinner', YIT_CORE_PLUGIN_URL . '/assets/js/panel.spinner.js', array('jquery'), '0.0.1', true);
160
- wp_enqueue_script('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array('jquery'), '1.1.0', true);
161
- wp_enqueue_script('ajax-chosen', yit_load_js_file(YIT_CORE_PLUGIN_URL . '/assets/js/chosen/ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
- wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
- wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
164
- }
165
-
166
- /**
167
- * Set Options
168
- *
169
- * Set the variable options
170
- *
171
- * @param array $options
172
- *
173
- * @return void
174
- * @since 1.0
175
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
176
- */
177
- public function set_options($options = array())
178
- {
179
- $this->options = $options;
180
-
181
- }
182
-
183
- /**
184
- * Set Tabs
185
- *
186
- * Set the variable tabs
187
- *
188
- * @internal param array $tabs
189
- *
190
- * @return void
191
- * @since 1.0
192
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
193
- */
194
- public function set_tabs()
195
- {
196
- if (!isset($this->options['tabs'])) {
197
- return;
198
- }
199
- $this->tabs = $this->options['tabs'];
200
- if (isset($this->tabs['settings']['fields'])) {
201
- $this->tabs['settings']['fields'] = array_filter($this->tabs['settings']['fields']);
202
- }
203
- }
204
-
205
-
206
- /**
207
- * Add Tab
208
- *
209
- * Add a tab inside the metabox
210
- *
211
- * @internal param array $tabs
212
- *
213
- * @param array $tab the new tab to add to the metabox
214
- * @param string $where tell where insert the tab if after or before a $refer
215
- * @param null $refer an existent tab inside metabox
216
- *
217
- * @return void
218
- * @since 1.0
219
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
220
- */
221
- public function add_tab($tab, $where = 'after', $refer = null)
222
- {
223
- if (!is_null($refer)) {
224
- $ref_pos = array_search($refer, array_keys($this->tabs));
225
- if ($ref_pos !== false) {
226
- if ($where == 'after') {
227
- $this->tabs = array_slice($this->tabs, 0, $ref_pos + 1, true) +
228
- $tab +
229
- array_slice($this->tabs, $ref_pos + 1, count($this->tabs) - 1, true);
230
- } else {
231
- $this->tabs = array_slice($this->tabs, 0, $ref_pos, true) +
232
- $tab +
233
- array_slice($this->tabs, $ref_pos, count($this->tabs), true);
234
- }
235
- }
236
- } else {
237
- $this->tabs = array_merge($tab, $this->tabs);
238
- }
239
-
240
- }
241
-
242
- /**
243
- * Remove Tab
244
- *
245
- * Remove a tab from the tabs of metabox
246
- *
247
- * @internal param array $tabs
248
- *
249
- * @param $id_tab
250
- *
251
- * @return void
252
- * @since 1.0
253
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
254
- */
255
- public function remove_tab($id_tab)
256
- {
257
- if (isset($this->tabs[$id_tab])) {
258
- unset ($this->tabs[$id_tab]);
259
- }
260
- }
261
-
262
-
263
- /**
264
- * Add Field
265
- *
266
- * Add a field inside a tab of metabox
267
- *
268
- * @internal param array $tabs
269
- *
270
- * @param string $tab_id the id of the tabs where add the field
271
- * @param array $args the field to add
272
- * @param string $where tell where insert the field if after or before a $refer
273
- * @param null $refer an existent field inside tab
274
- *
275
- * @return void
276
- * @since 1.0
277
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
278
- */
279
- public function add_field($tab_id, $args, $where = 'after', $refer = null)
280
- {
281
- if (isset($this->tabs[$tab_id])) {
282
-
283
- $cf = $this->tabs[$tab_id]['fields'];
284
- if (!is_null($refer)) {
285
- $ref_pos = array_search($refer, array_keys($cf));
286
- if ($ref_pos !== false) {
287
- if ($where == 'after') {
288
- $this->tabs[$tab_id]['fields'] = array_slice($cf, 0, $ref_pos + 1, true) +
289
- $args +
290
- array_slice($cf, $ref_pos, count($cf) - 1, true);
291
-
292
- } elseif ($where == 'before') {
293
- $this->tabs[$tab_id]['fields'] = array_slice($cf, 0, $ref_pos, true) +
294
- $args +
295
- array_slice($cf, $ref_pos, count($cf), true);
296
-
297
- }
298
- }
299
- } else {
300
- if ($where == 'first') {
301
- $this->tabs[$tab_id]['fields'] = $args + $cf;
302
-
303
- } else {
304
- $this->tabs[$tab_id]['fields'] = array_merge($this->tabs[$tab_id]['fields'], $args);
305
- }
306
- }
307
-
308
- }
309
-
310
-
311
- }
312
-
313
- /**
314
- * Remove Field
315
- *
316
- * Remove a field from the metabox, search inside the tabs and remove it if exists
317
- *
318
- * @param $id_field
319
- *
320
- * @return void
321
- * @since 1.0
322
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
323
- */
324
- public function remove_field($id_field)
325
- {
326
- foreach ($this->tabs as $tab_name => $tab) {
327
- if (isset($tab['fields'][$id_field])) {
328
- unset ($this->tabs[$tab_name]['fields'][$id_field]);
329
- }
330
- }
331
- }
332
-
333
- /**
334
- * Reorder tabs
335
- *
336
- * Order the tabs and fields and set id and name to each field
337
- *
338
- * @internal param $id_field
339
- *
340
- * @return void
341
- * @since 1.0
342
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
343
- */
344
- public function reorder_tabs()
345
- {
346
- foreach ($this->tabs as $tab_name => $tab) {
347
- foreach ($tab['fields'] as $id_field => $field) {
348
- $this->tabs[$tab_name]['fields'][$id_field]['private'] = (isset($field['private'])) ? $field['private'] : true;
349
- $this->tabs[$tab_name]['fields'][$id_field]['id'] = $this->get_option_metabox_id($id_field, $this->tabs[$tab_name]['fields'][$id_field]['private']);
350
- $this->tabs[$tab_name]['fields'][$id_field]['name'] = $this->get_option_metabox_name($this->tabs[$tab_name]['fields'][$id_field]['id']);
351
- }
352
- }
353
-
354
- }
355
-
356
-
357
- /**
358
- * Get Option Metabox ID
359
- *
360
- * return the id of the field
361
- *
362
- * @param string $id_field
363
- * @param bool $private if private add an _befor the id
364
- *
365
- * @return string
366
- * @since 1.0
367
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
368
- */
369
- public function get_option_metabox_id($id_field, $private = true)
370
- {
371
- if ($private) {
372
- return '_' . $id_field;
373
- } else {
374
- return $id_field;
375
- }
376
- }
377
-
378
- /**
379
- * Get Option Metabox Name
380
- *
381
- * return the name of the field, this name will be used as attribute name of the input field
382
- *
383
- * @param string $id_field
384
- * @param bool $private if private add an _befor the id
385
- *
386
- * @return string
387
- * @since 1.0
388
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
389
- */
390
- public function get_option_metabox_name($id_field, $private = true)
391
- {
392
- $db_name = apply_filters('yit_metaboxes_option_main_name', 'yit_metaboxes');
393
- $return = $db_name . '[';
394
-
395
- if (!strpos($id_field, '[')) {
396
- return $return . $id_field . ']';
397
- }
398
- $return .= substr($id_field, 0, strpos($id_field, '['));
399
- $return .= ']';
400
- $return .= substr($id_field, strpos($id_field, '['));
401
-
402
- return $return;
403
- }
404
-
405
- /**
406
- * Register the metabox
407
- *
408
- * call the wp function add_metabox to add the metabox
409
- *
410
- *
411
- * @return void
412
- * @since 1.0
413
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
414
- */
415
- public function register_metabox($post_type)
416
- {
417
- if (in_array($post_type, (array)$this->options['pages'])) {
418
- add_meta_box($this->id, $this->options['label'], array($this, 'show'), $post_type, $this->options['context'], $this->options['priority']);
419
- }
420
- }
421
-
422
- /**
423
- * Show metabox
424
- *
425
- * show the html of metabox
426
- *
427
- *
428
- * @return void
429
- * @since 1.0
430
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
431
- */
432
- public function show()
433
- {
434
- $this->reorder_tabs();
435
-
436
- yit_plugin_get_template(YIT_CORE_PLUGIN_PATH, 'metaboxes/tab.php', array('tabs' => $this->tabs));
437
- }
438
-
439
- /**
440
- * Save Post Data
441
- *
442
- * Save the post data in the database when save the post
443
- *
444
- * @param $post_id
445
- *
446
- * @return int
447
- * @since 1.0
448
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
449
- */
450
- public function save_postdata($post_id)
451
- {
452
-
453
-
454
- if (!isset($_POST['yit_metaboxes_nonce']) || !wp_verify_nonce($_POST['yit_metaboxes_nonce'], 'metaboxes-fields-nonce')) {
455
- return $post_id;
456
- }
457
-
458
-
459
- if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX)) {
460
- return $post_id;
461
- }
462
-
463
- if (isset($_POST['post_type'])) {
464
- $post_type = $_POST['post_type'];
465
- } else {
466
- return $post_id;
467
- }
468
-
469
- if ('page' == $post_type) {
470
- if (!current_user_can('edit_page', $post_id)) {
471
- return $post_id;
472
- }
473
- } else {
474
- if (!current_user_can('edit_post', $post_id)) {
475
- return $post_id;
476
- }
477
- }
478
-
479
- if (!in_array($post_type, (array)$this->options['pages'])) {
480
- return $post_id;
481
- }
482
-
483
- $this->reorder_tabs();
484
-
485
-
486
- foreach ($this->tabs as $tab) {
487
-
488
- foreach ($tab['fields'] as $field) {
489
-
490
- if (in_array($field['type'], array('title'))) {
491
- continue;
492
- }
493
-
494
- if (isset($_POST['yit_metaboxes'][$field['id']])) {
495
-
496
- add_post_meta($post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']], true) || update_post_meta($post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']]);
497
- } elseif (in_array($field['type'], array('onoff', 'checkbox'))) {
498
- update_post_meta($post_id, $field['id'], '0');
499
- } else {
500
- delete_post_meta($post_id, $field['id']);
501
- }
502
- }
503
- }
504
-
505
-
506
- }
507
-
508
- /**
509
- * Remove Fields
510
- *
511
- * Remove a fields list from the metabox, search inside the tabs and remove it if exists
512
- *
513
- * @param $id_fields
514
- *
515
- * @return void
516
- * @since 2.0.0
517
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
518
- */
519
- public function remove_fields($id_fields)
520
- {
521
- foreach ($id_fields as $k => $field) {
522
- $this->remove_field($field);
523
- }
524
- }
525
- }
526
- }
527
-
528
- if (!function_exists('YIT_Metabox')) {
529
-
530
- /**
531
- * Main instance of plugin
532
- *
533
- * @param $id
534
- *
535
- * @return \YIT_Metabox
536
- * @since 1.0
537
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
538
- */
539
-
540
-
541
- function YIT_Metabox($id)
542
- {
543
- return YIT_Metabox::instance($id);
544
- }
545
- }
546
-
547
-
548
-
549
-
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+
12
+ if (!defined('ABSPATH')) {
13
+ exit;
14
+ } // Exit if accessed directly
15
+
16
+ if (!class_exists('YIT_Metabox')) {
17
+ /**
18
+ * YIT Metabox
19
+ *
20
+ * the metabox can be created using this code
21
+ * <code>
22
+ * $args1 = array(
23
+ * 'label' => __( 'Metabox Label', 'yith-plugin-fw' ),
24
+ * 'pages' => 'page', //or array( 'post-type1', 'post-type2')
25
+ * 'context' => 'normal', //('normal', 'advanced', or 'side')
26
+ * 'priority' => 'default',
27
+ * 'tabs' => array(
28
+ * 'settings' => array( //tab
29
+ * 'label' => __( 'Settings', 'yith-plugin-fw' ),
30
+ * 'fields' => array(
31
+ * 'meta_checkbox' => array(
32
+ * 'label' => __( 'Show title', 'yith-plugin-fw' ),
33
+ * 'desc' => __( 'Choose whether to show title of the page or not.', 'yith-plugin-fw' ),
34
+ * 'type' => 'checkbox',
35
+ * 'private' => false,
36
+ * 'std' => '1'),
37
+ * ),
38
+ * ),
39
+ * );
40
+ *
41
+ * $metabox1 = YIT_Metabox( 'yit-metabox-id' );
42
+ * $metabox1->init( $args );
43
+ * </code>
44
+ *
45
+ * @class YIT_Metaboxes
46
+ * @package Yithemes
47
+ * @since 1.0.0
48
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
49
+ *
50
+ */
51
+ class YIT_Metabox
52
+ {
53
+
54
+ /**
55
+ * @var string the id of metabox
56
+ *
57
+ * @since 1.0
58
+ */
59
+
60
+ public $id;
61
+
62
+ /**
63
+ * @var array An array where are saved all metabox settings options
64
+ *
65
+ * @since 1.0
66
+ */
67
+ private $options = array();
68
+
69
+ /**
70
+ * @var array An array where are saved all tabs of metabox
71
+ *
72
+ * @since 1.0
73
+ */
74
+ private $tabs = array();
75
+
76
+ /**
77
+ * @var object The single instance of the class
78
+ * @since 1.0
79
+ */
80
+ protected static $_instance = array();
81
+
82
+ /**
83
+ * Main Instance
84
+ *
85
+ * @static
86
+ *
87
+ * @param $id
88
+ *
89
+ * @return object Main instance
90
+ *
91
+ * @since 1.0
92
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
93
+ */
94
+ public static function instance($id)
95
+ {
96
+ if (!isset(self::$_instance[$id])) {
97
+ self::$_instance[$id] = new self($id);
98
+ }
99
+ return self::$_instance[$id];
100
+ }
101
+
102
+ /**
103
+ * Constructor
104
+ *
105
+ * @param string $id
106
+ *
107
+ * @return \YIT_Metabox
108
+ * @since 1.0
109
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
110
+ */
111
+ function __construct($id = '')
112
+ {
113
+ $this->id = $id;
114
+
115
+ }
116
+
117
+
118
+ /**
119
+ * Init
120
+ *
121
+ * set options and tabs, add actions to register metabox, scripts and save data
122
+ *
123
+ * @param array $options
124
+ *
125
+ * @return void
126
+ * @since 1.0
127
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
128
+ */
129
+ public function init($options = array())
130
+ {
131
+
132
+ $this->set_options($options);
133
+ $this->set_tabs();
134
+
135
+
136
+ add_action('add_meta_boxes', array($this, 'register_metabox'));
137
+ add_action('save_post', array($this, 'save_postdata'));
138
+ add_action('admin_enqueue_scripts', array($this, 'enqueue'), 15);
139
+
140
+ }
141
+
142
+ /**
143
+ * Enqueue script and styles in admin side
144
+ *
145
+ * Add style and scripts to administrator
146
+ *
147
+ * @return void
148
+ * @since 1.0
149
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
150
+ */
151
+ public function enqueue()
152
+ {
153
+
154
+ wp_enqueue_media();
155
+ wp_enqueue_style('wp-color-picker');
156
+ wp_enqueue_style('yit-plugin-metaboxes', YIT_CORE_PLUGIN_URL . '/assets/css/metaboxes.css');
157
+ wp_enqueue_style('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css');
158
+ wp_enqueue_script('jquery-ui-datepicker');
159
+ wp_enqueue_script('yit-spinner', YIT_CORE_PLUGIN_URL . '/assets/js/panel.spinner.js', array('jquery'), '0.0.1', true);
160
+ wp_enqueue_script('jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array('jquery'), '1.1.0', true);
161
+ wp_enqueue_script('ajax-chosen', yit_load_js_file(YIT_CORE_PLUGIN_URL . '/assets/js/chosen/ajax-chosen.jquery.js'), array('jquery'), '1.1.0', true);
162
+ wp_enqueue_script('yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox.js', array('jquery', 'wp-color-picker'), '1.0.0', true);
163
+ wp_enqueue_style('jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-custom/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all');
164
+ }
165
+
166
+ /**
167
+ * Set Options
168
+ *
169
+ * Set the variable options
170
+ *
171
+ * @param array $options
172
+ *
173
+ * @return void
174
+ * @since 1.0
175
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
176
+ */
177
+ public function set_options($options = array())
178
+ {
179
+ $this->options = $options;
180
+
181
+ }
182
+
183
+ /**
184
+ * Set Tabs
185
+ *
186
+ * Set the variable tabs
187
+ *
188
+ * @internal param array $tabs
189
+ *
190
+ * @return void
191
+ * @since 1.0
192
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
193
+ */
194
+ public function set_tabs()
195
+ {
196
+ if (!isset($this->options['tabs'])) {
197
+ return;
198
+ }
199
+ $this->tabs = $this->options['tabs'];
200
+ if (isset($this->tabs['settings']['fields'])) {
201
+ $this->tabs['settings']['fields'] = array_filter($this->tabs['settings']['fields']);
202
+ }
203
+ }
204
+
205
+
206
+ /**
207
+ * Add Tab
208
+ *
209
+ * Add a tab inside the metabox
210
+ *
211
+ * @internal param array $tabs
212
+ *
213
+ * @param array $tab the new tab to add to the metabox
214
+ * @param string $where tell where insert the tab if after or before a $refer
215
+ * @param null $refer an existent tab inside metabox
216
+ *
217
+ * @return void
218
+ * @since 1.0
219
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
220
+ */
221
+ public function add_tab($tab, $where = 'after', $refer = null)
222
+ {
223
+ if (!is_null($refer)) {
224
+ $ref_pos = array_search($refer, array_keys($this->tabs));
225
+ if ($ref_pos !== false) {
226
+ if ($where == 'after') {
227
+ $this->tabs = array_slice($this->tabs, 0, $ref_pos + 1, true) +
228
+ $tab +
229
+ array_slice($this->tabs, $ref_pos + 1, count($this->tabs) - 1, true);
230
+ } else {
231
+ $this->tabs = array_slice($this->tabs, 0, $ref_pos, true) +
232
+ $tab +
233
+ array_slice($this->tabs, $ref_pos, count($this->tabs), true);
234
+ }
235
+ }
236
+ } else {
237
+ $this->tabs = array_merge($tab, $this->tabs);
238
+ }
239
+
240
+ }
241
+
242
+ /**
243
+ * Remove Tab
244
+ *
245
+ * Remove a tab from the tabs of metabox
246
+ *
247
+ * @internal param array $tabs
248
+ *
249
+ * @param $id_tab
250
+ *
251
+ * @return void
252
+ * @since 1.0
253
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
254
+ */
255
+ public function remove_tab($id_tab)
256
+ {
257
+ if (isset($this->tabs[$id_tab])) {
258
+ unset ($this->tabs[$id_tab]);
259
+ }
260
+ }
261
+
262
+
263
+ /**
264
+ * Add Field
265
+ *
266
+ * Add a field inside a tab of metabox
267
+ *
268
+ * @internal param array $tabs
269
+ *
270
+ * @param string $tab_id the id of the tabs where add the field
271
+ * @param array $args the field to add
272
+ * @param string $where tell where insert the field if after or before a $refer
273
+ * @param null $refer an existent field inside tab
274
+ *
275
+ * @return void
276
+ * @since 1.0
277
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
278
+ */
279
+ public function add_field($tab_id, $args, $where = 'after', $refer = null)
280
+ {
281
+ if (isset($this->tabs[$tab_id])) {
282
+
283
+ $cf = $this->tabs[$tab_id]['fields'];
284
+ if (!is_null($refer)) {
285
+ $ref_pos = array_search($refer, array_keys($cf));
286
+ if ($ref_pos !== false) {
287
+ if ($where == 'after') {
288
+ $this->tabs[$tab_id]['fields'] = array_slice($cf, 0, $ref_pos + 1, true) +
289
+ $args +
290
+ array_slice($cf, $ref_pos, count($cf) - 1, true);
291
+
292
+ } elseif ($where == 'before') {
293
+ $this->tabs[$tab_id]['fields'] = array_slice($cf, 0, $ref_pos, true) +
294
+ $args +
295
+ array_slice($cf, $ref_pos, count($cf), true);
296
+
297
+ }
298
+ }
299
+ } else {
300
+ if ($where == 'first') {
301
+ $this->tabs[$tab_id]['fields'] = $args + $cf;
302
+
303
+ } else {
304
+ $this->tabs[$tab_id]['fields'] = array_merge($this->tabs[$tab_id]['fields'], $args);
305
+ }
306
+ }
307
+
308
+ }
309
+
310
+
311
+ }
312
+
313
+ /**
314
+ * Remove Field
315
+ *
316
+ * Remove a field from the metabox, search inside the tabs and remove it if exists
317
+ *
318
+ * @param $id_field
319
+ *
320
+ * @return void
321
+ * @since 1.0
322
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
323
+ */
324
+ public function remove_field($id_field)
325
+ {
326
+ foreach ($this->tabs as $tab_name => $tab) {
327
+ if (isset($tab['fields'][$id_field])) {
328
+ unset ($this->tabs[$tab_name]['fields'][$id_field]);
329
+ }
330
+ }
331
+ }
332
+
333
+ /**
334
+ * Reorder tabs
335
+ *
336
+ * Order the tabs and fields and set id and name to each field
337
+ *
338
+ * @internal param $id_field
339
+ *
340
+ * @return void
341
+ * @since 1.0
342
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
343
+ */
344
+ public function reorder_tabs()
345
+ {
346
+ foreach ($this->tabs as $tab_name => $tab) {
347
+ foreach ($tab['fields'] as $id_field => $field) {
348
+ $this->tabs[$tab_name]['fields'][$id_field]['private'] = (isset($field['private'])) ? $field['private'] : true;
349
+ $this->tabs[$tab_name]['fields'][$id_field]['id'] = $this->get_option_metabox_id($id_field, $this->tabs[$tab_name]['fields'][$id_field]['private']);
350
+ $this->tabs[$tab_name]['fields'][$id_field]['name'] = $this->get_option_metabox_name($this->tabs[$tab_name]['fields'][$id_field]['id']);
351
+ }
352
+ }
353
+
354
+ }
355
+
356
+
357
+ /**
358
+ * Get Option Metabox ID
359
+ *
360
+ * return the id of the field
361
+ *
362
+ * @param string $id_field
363
+ * @param bool $private if private add an _befor the id
364
+ *
365
+ * @return string
366
+ * @since 1.0
367
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
368
+ */
369
+ public function get_option_metabox_id($id_field, $private = true)
370
+ {
371
+ if ($private) {
372
+ return '_' . $id_field;
373
+ } else {
374
+ return $id_field;
375
+ }
376
+ }
377
+
378
+ /**
379
+ * Get Option Metabox Name
380
+ *
381
+ * return the name of the field, this name will be used as attribute name of the input field
382
+ *
383
+ * @param string $id_field
384
+ * @param bool $private if private add an _befor the id
385
+ *
386
+ * @return string
387
+ * @since 1.0
388
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
389
+ */
390
+ public function get_option_metabox_name($id_field, $private = true)
391
+ {
392
+ $db_name = apply_filters('yit_metaboxes_option_main_name', 'yit_metaboxes');
393
+ $return = $db_name . '[';
394
+
395
+ if (!strpos($id_field, '[')) {
396
+ return $return . $id_field . ']';
397
+ }
398
+ $return .= substr($id_field, 0, strpos($id_field, '['));
399
+ $return .= ']';
400
+ $return .= substr($id_field, strpos($id_field, '['));
401
+
402
+ return $return;
403
+ }
404
+
405
+ /**
406
+ * Register the metabox
407
+ *
408
+ * call the wp function add_metabox to add the metabox
409
+ *
410
+ *
411
+ * @return void
412
+ * @since 1.0
413
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
414
+ */
415
+ public function register_metabox($post_type)
416
+ {
417
+ if (in_array($post_type, (array)$this->options['pages'])) {
418
+ add_meta_box($this->id, $this->options['label'], array($this, 'show'), $post_type, $this->options['context'], $this->options['priority']);
419
+ }
420
+ }
421
+
422
+ /**
423
+ * Show metabox
424
+ *
425
+ * show the html of metabox
426
+ *
427
+ *
428
+ * @return void
429
+ * @since 1.0
430
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
431
+ */
432
+ public function show()
433
+ {
434
+ $this->reorder_tabs();
435
+
436
+ yit_plugin_get_template(YIT_CORE_PLUGIN_PATH, 'metaboxes/tab.php', array('tabs' => $this->tabs));
437
+ }
438
+
439
+ /**
440
+ * Save Post Data
441
+ *
442
+ * Save the post data in the database when save the post
443
+ *
444
+ * @param $post_id
445
+ *
446
+ * @return int
447
+ * @since 1.0
448
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
449
+ */
450
+ public function save_postdata($post_id)
451
+ {
452
+
453
+
454
+ if (!isset($_POST['yit_metaboxes_nonce']) || !wp_verify_nonce($_POST['yit_metaboxes_nonce'], 'metaboxes-fields-nonce')) {
455
+ return $post_id;
456
+ }
457
+
458
+
459
+ if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX)) {
460
+ return $post_id;
461
+ }
462
+
463
+ if (isset($_POST['post_type'])) {
464
+ $post_type = $_POST['post_type'];
465
+ } else {
466
+ return $post_id;
467
+ }
468
+
469
+ if ('page' == $post_type) {
470
+ if (!current_user_can('edit_page', $post_id)) {
471
+ return $post_id;
472
+ }
473
+ } else {
474
+ if (!current_user_can('edit_post', $post_id)) {
475
+ return $post_id;
476
+ }
477
+ }
478
+
479
+ if (!in_array($post_type, (array)$this->options['pages'])) {
480
+ return $post_id;
481
+ }
482
+
483
+ $this->reorder_tabs();
484
+
485
+
486
+ foreach ($this->tabs as $tab) {
487
+
488
+ foreach ($tab['fields'] as $field) {
489
+
490
+ if (in_array($field['type'], array('title'))) {
491
+ continue;
492
+ }
493
+
494
+ if (isset($_POST['yit_metaboxes'][$field['id']])) {
495
+
496
+ add_post_meta($post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']], true) || update_post_meta($post_id, $field['id'], $_POST['yit_metaboxes'][$field['id']]);
497
+ } elseif (in_array($field['type'], array('onoff', 'checkbox'))) {
498
+ update_post_meta($post_id, $field['id'], '0');
499
+ } else {
500
+ delete_post_meta($post_id, $field['id']);
501
+ }
502
+ }
503
+ }
504
+
505
+
506
+ }
507
+
508
+ /**
509
+ * Remove Fields
510
+ *
511
+ * Remove a fields list from the metabox, search inside the tabs and remove it if exists
512
+ *
513
+ * @param $id_fields
514
+ *
515
+ * @return void
516
+ * @since 2.0.0
517
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
518
+ */
519
+ public function remove_fields($id_fields)
520
+ {
521
+ foreach ($id_fields as $k => $field) {
522
+ $this->remove_field($field);
523
+ }
524
+ }
525
+ }
526
+ }
527
+
528
+ if (!function_exists('YIT_Metabox')) {
529
+
530
+ /**
531
+ * Main instance of plugin
532
+ *
533
+ * @param $id
534
+ *
535
+ * @return \YIT_Metabox
536
+ * @since 1.0
537
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
538
+ */
539
+
540
+
541
+ function YIT_Metabox($id)
542
+ {
543
+ return YIT_Metabox::instance($id);
544
+ }
545
+ }
546
+
547
+
548
+
549
+
plugin-fw/lib/yit-plugin-common.php CHANGED
@@ -1,1260 +1,1260 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( ! class_exists( 'YIT_Plugin_Common' ) ) :
12
-
13
- /**
14
- * Core configuration class
15
- *
16
- * @since 1.0.0
17
- */
18
- class YIT_Plugin_Common {
19
-
20
- /**
21
- * Config array
22
- *
23
- * @var array
24
- */
25
- protected static $_config = array(
26
- 'slider' => array( 'nivo', 'elegant' ),
27
-
28
-
29
- 'awesome_icons' => array(
30
- '' => 'no-icon',
31
- 'f042' => 'adjust',
32
- 'f170' => 'adn',
33
- 'f037' => 'align-center',
34
- 'f039' => 'align-justify',
35
- 'f036' => 'align-left',
36
- 'f038' => 'align-right',
37
- 'f0f9' => 'ambulance',
38
- 'f13d' => 'anchor',
39
- 'f17b' => 'android',
40
- 'f103' => 'angle-double-down',
41
- 'f100' => 'angle-double-left',
42
- 'f101' => 'angle-double-right',
43
- 'f102' => 'angle-double-up',
44
- 'f107' => 'angle-down',
45
- 'f104' => 'angle-left',
46
- 'f105' => 'angle-right',
47
- 'f106' => 'angle-up',
48
- 'f179' => 'apple',
49
- 'f187' => 'archive',
50
- 'f0ab' => 'arrow-circle-down',
51
- 'f0a8' => 'arrow-circle-left',
52
- 'f01a' => 'arrow-circle-o-down',
53
- 'f190' => 'arrow-circle-o-left',
54
- 'f18e' => 'arrow-circle-o-right',
55
- 'f01b' => 'arrow-circle-o-up',
56
- 'f0a9' => 'arrow-circle-right',
57
- 'f0aa' => 'arrow-circle-up',
58
- 'f063' => 'arrow-down',
59
- 'f060' => 'arrow-left',
60
- 'f061' => 'arrow-right',
61
- 'f062' => 'arrow-up',
62
- 'f047' => 'arrows',
63
- 'f0b2' => 'arrows-alt',
64
- 'f07e' => 'arrows-h',
65
- 'f07d' => 'arrows-v',
66
- 'f069' => 'asterisk',
67
- 'f04a' => 'backward',
68
- 'f05e' => 'ban',
69
- 'f080' => 'bar-chart-o',
70
- 'f02a' => 'barcode',
71
- 'f0c9' => 'bars',
72
- 'f0fc' => 'beer',
73
- 'f0f3' => 'bell',
74
- 'f0a2' => 'bell-o',
75
- 'f171' => 'bitbucket',
76
- 'f172' => 'bitbucket-square',
77
- 'f032' => 'bold',
78
- 'f0e7' => 'bolt',
79
- 'f02d' => 'book',
80
- 'f02e' => 'bookmark',
81
- 'f097' => 'bookmark-o',
82
- 'f0b1' => 'briefcase',
83
- 'f15a' => 'btc',
84
- 'f188' => 'bug',
85
- 'f0f7' => 'building-o',
86
- 'f0a1' => 'bullhorn',
87
- 'f140' => 'bullseye',
88
- 'f073' => 'calendar',
89
- 'f133' => 'calendar-o',
90
- 'f030' => 'camera',
91
- 'f083' => 'camera-retro',
92
- 'f0d7' => 'caret-down',
93
- 'f0d9' => 'caret-left',
94
- 'f0da' => 'caret-right',
95
- 'f150' => 'caret-square-o-down',
96
- 'f191' => 'caret-square-o-left',
97
- 'f152' => 'caret-square-o-right',
98
- 'f151' => 'caret-square-o-up',
99
- 'f0d8' => 'caret-up',
100
- 'f0a3' => 'certificate',
101
- 'f127' => 'chain-broken',
102
- 'f00c' => 'check',
103
- 'f058' => 'check-circle',
104
- 'f05d' => 'check-circle-o',
105
- 'f14a' => 'check-square',
106
- 'f046' => 'check-square-o',
107
- 'f13a' => 'chevron-circle-down',
108
- 'f137' => 'chevron-circle-left',
109
- 'f138' => 'chevron-circle-right',
110
- 'f139' => 'chevron-circle-up',
111
- 'f078' => 'chevron-down',
112
- 'f053' => 'chevron-left',
113
- 'f054' => 'chevron-right',
114
- 'f077' => 'chevron-up',
115
- 'f10c' => 'circle-o',
116
- 'f0ea' => 'clipboard',
117
- 'f017' => 'clock-o',
118
- 'f0c2' => 'cloud',
119
- 'f0ed' => 'cloud-download',
120
- 'f0ee' => 'cloud-upload',
121
- 'f121' => 'code',
122
- 'f126' => 'code-fork',
123
- 'f0f4' => 'coffee',
124
- 'f013' => 'cog',
125
- 'f085' => 'cogs',
126
- 'f0db' => 'columns',
127
- 'f075' => 'comment',
128
- 'f0e5' => 'comment-o',
129
- 'f086' => 'comments',
130
- 'f0e6' => 'comments-o',
131
- 'f14e' => 'compass',
132
- 'f066' => 'compress',
133
- 'f09d' => 'credit-card',
134
- 'f125' => 'crop',
135
- 'f05b' => 'crosshairs',
136
- 'f13c' => 'css3',
137
- 'f0f5' => 'cutlery',
138
- 'f108' => 'desktop',
139
- 'f192' => 'dot-circle-o',
140
- 'f019' => 'download',
141
- 'f17d' => 'dribbble',
142
- 'f16b' => 'dropbox',
143
- 'f052' => 'eject',
144
- 'f141' => 'ellipsis-h',
145
- 'f142' => 'ellipsis-v',
146
- 'f0e0' => 'envelope',
147
- 'f003' => 'envelope-o',
148
- 'f12d' => 'eraser',
149
- 'f153' => 'eur',
150
- 'f0ec' => 'exchange',
151
- 'f12a' => 'exclamation',
152
- 'f06a' => 'exclamation-circle',
153
- 'f071' => 'exclamation-triangle',
154
- 'f065' => 'expand',
155
- 'f08e' => 'external-link',
156
- 'f14c' => 'external-link-square',
157
- 'f06e' => 'eye',
158
- 'f070' => 'eye-slash',
159
- 'f09a' => 'facebook',
160
- 'f082' => 'facebook-square',
161
- 'f049' => 'fast-backward',
162
- 'f050' => 'fast-forward',
163
- 'f182' => 'female',
164
- 'f0fb' => 'fighter-jet',
165
- 'f15b' => 'file',
166
- 'f016' => 'file-o',
167
- 'f15c' => 'file-text',
168
- 'f0f6' => 'file-text-o',
169
- 'f0c5' => 'files-o',
170
- 'f008' => 'film',
171
- 'f0b0' => 'filter',
172
- 'f06d' => 'fire',
173
- 'f134' => 'fire-extinguisher',
174
- 'f024' => 'flag',
175
- 'f11e' => 'flag-checkered',
176
- 'f11d' => 'flag-o',
177
- 'f0c3' => 'flask',
178
- 'f16e' => 'flickr',
179
- 'f0c7' => 'floppy-o',
180
- 'f07b' => 'folder',
181
- 'f114' => 'folder-o',
182
- 'f07c' => 'folder-open',
183
- 'f115' => 'folder-open-o',
184
- 'f031' => 'font',
185
- 'f04e' => 'forward',
186
- 'f180' => 'foursquare',
187
- 'f119' => 'frown-o',
188
- 'f11b' => 'gamepad',
189
- 'f0e3' => 'gavel',
190
- 'f154' => 'gbp',
191
- 'f06b' => 'gift',
192
- 'f09b' => 'github',
193
- 'f113' => 'github-alt',
194
- 'f092' => 'github-square',
195
- 'f184' => 'gittip',
196
- 'f000' => 'glass',
197
- 'f0ac' => 'globe',
198
- 'f0d5' => 'google-plus',
199
- 'f0d4' => 'google-plus-square',
200
- 'f0fd' => 'h-square',
201
- 'f0a7' => 'hand-o-down',
202
- 'f0a5' => 'hand-o-left',
203
- 'f0a4' => 'hand-o-right',
204
- 'f0a6' => 'hand-o-up',
205
- 'f0a0' => 'hdd-o',
206
- 'f025' => 'headphones',
207
- 'f004' => 'heart',
208
- 'f08a' => 'heart-o',
209
- 'f015' => 'home',
210
- 'f0f8' => 'hospital-o',
211
- 'f13b' => 'html5',
212
- 'f01c' => 'inbox',
213
- 'f03c' => 'indent',
214
- 'f129' => 'info',
215
- 'f05a' => 'info-circle',
216
- 'f156' => 'inr',
217
- 'f16d' => 'instagram',
218
- 'f033' => 'italic',
219
- 'f157' => 'jpy',
220
- 'f084' => 'key',
221
- 'f11c' => 'keyboard-o',
222
- 'f159' => 'krw',
223
- 'f109' => 'laptop',
224
- 'f06c' => 'leaf',
225
- 'f094' => 'lemon-o',
226
- 'f149' => 'level-down',
227
- 'f148' => 'level-up',
228
- 'f0eb' => 'lightbulb-o',
229
- 'f0c1' => 'link',
230
- 'f0e1' => 'linkedin',
231
- 'f08c' => 'linkedin-square',
232
- 'f17c' => 'linux',
233
- 'f03a' => 'list',
234
- 'f022' => 'list-alt',
235
- 'f0cb' => 'list-ol',
236
- 'f0ca' => 'list-ul',
237
- 'f124' => 'location-arrow',
238
- 'f023' => 'lock',
239
- 'f175' => 'long-arrow-down',
240
- 'f177' => 'long-arrow-left',
241
- 'f178' => 'long-arrow-right',
242
- 'f176' => 'long-arrow-up',
243
- 'f0d0' => 'magic',
244
- 'f076' => 'magnet',
245
- 'f122' => 'mail-reply-all',
246
- 'f183' => 'male',
247
- 'f041' => 'map-marker',
248
- 'f136' => 'maxcdn',
249
- 'f0fa' => 'medkit',
250
- 'f11a' => 'meh-o',
251
- 'f130' => 'microphone',
252
- 'f131' => 'microphone-slash',
253
- 'f068' => 'minus',
254
- 'f056' => 'minus-circle',
255
- 'f146' => 'minus-square',
256
- 'f147' => 'minus-square-o',
257
- 'f10b' => 'mobile',
258
- 'f0d6' => 'money',
259
- 'f186' => 'moon-o',
260
- 'f001' => 'music',
261
- 'f03b' => 'outdent',
262
- 'f18c' => 'pagelines',
263
- 'f0c6' => 'paperclip',
264
- 'f04c' => 'pause',
265
- 'f040' => 'pencil',
266
- 'f14b' => 'pencil-square',
267
- 'f044' => 'pencil-square-o',
268
- 'f095' => 'phone',
269
- 'f098' => 'phone-square',
270
- 'f03e' => 'picture-o',
271
- 'f0d2' => 'pinterest',
272
- 'f0d3' => 'pinterest-square',
273
- 'f072' => 'plane',
274
- 'f04b' => 'play',
275
- 'f144' => 'play-circle',
276
- 'f01d' => 'play-circle-o',
277
- 'f067' => 'plus',
278
- 'f055' => 'plus-circle',
279
- 'f0fe' => 'plus-square',
280
- 'f196' => 'plus-square-o',
281
- 'f011' => 'power-off',
282
- 'f02f' => 'print',
283
- 'f12e' => 'puzzle-piece',
284
- 'f029' => 'qrcode',
285
- 'f128' => 'question',
286
- 'f059' => 'question-circle',
287
- 'f10d' => 'quote-left',
288
- 'f10e' => 'quote-right',
289
- 'f074' => 'random',
290
- 'f021' => 'refresh',
291
- 'f18b' => 'renren',
292
- 'f01e' => 'repeat',
293
- 'f112' => 'reply',
294
- 'f122' => 'reply-all',
295
- 'f079' => 'retweet',
296
- 'f018' => 'road',
297
- 'f135' => 'rocket',
298
- 'f09e' => 'rss',
299
- 'f143' => 'rss-square',
300
- 'f158' => 'rub',
301
- 'f0c4' => 'scissors',
302
- 'f002' => 'search',
303
- 'f010' => 'search-minus',
304
- 'f00e' => 'search-plus',
305
- 'f064' => 'share',
306
- 'f14d' => 'share-square',
307
- 'f045' => 'share-square-o',
308
- 'f132' => 'shield',
309
- 'f07a' => 'shopping-cart',
310
- 'f090' => 'sign-in',
311
- 'f08b' => 'sign-out',
312
- 'f012' => 'signal',
313
- 'f0e8' => 'sitemap',
314
- 'f17e' => 'skype',
315
- 'f118' => 'smile-o',
316
- 'f0dc' => 'sort',
317
- 'f15d' => 'sort-alpha-asc',
318
- 'f15e' => 'sort-alpha-desc',
319
- 'f160' => 'sort-amount-asc',
320
- 'f161' => 'sort-amount-desc',
321
- 'f0dd' => 'sort-asc',
322
- 'f0de' => 'sort-desc',
323
- 'f162' => 'sort-numeric-asc',
324
- 'f163' => 'sort-numeric-desc',
325
- 'f110' => 'spinner',
326
- 'f0c8' => 'square',
327
- 'f096' => 'square-o',
328
- 'f18d' => 'stack-exchange',
329
- 'f16c' => 'stack-overflow',
330
- 'f005' => 'star',
331
- 'f089' => 'star-half',
332
- 'f123' => 'star-half-o',
333
- 'f006' => 'star-o',
334
- 'f048' => 'step-backward',
335
- 'f051' => 'step-forward',
336
- 'f0f1' => 'stethoscope',
337
- 'f04d' => 'stop',
338
- 'f0cc' => 'strikethrough',
339
- 'f12c' => 'subscript',
340
- 'f0f2' => 'suitcase',
341
- 'f185' => 'sun-o',
342
- 'f12b' => 'superscript',
343
- 'f0ce' => 'table',
344
- 'f10a' => 'tablet',
345
- 'f0e4' => 'tachometer',
346
- 'f02b' => 'tag',
347
- 'f02c' => 'tags',
348
- 'f0ae' => 'tasks',
349
- 'f120' => 'terminal',
350
- 'f034' => 'text-height',
351
- 'f035' => 'text-width',
352
- 'f00a' => 'th',
353
- 'f009' => 'th-large',
354
- 'f00b' => 'th-list',
355
- 'f08d' => 'thumb-tack',
356
- 'f165' => 'thumbs-down',
357
- 'f088' => 'thumbs-o-down',
358
- 'f087' => 'thumbs-o-up',
359
- 'f164' => 'thumbs-up',
360
- 'f145' => 'ticket',
361
- 'f00d' => 'times',
362
- 'f057' => 'times-circle',
363
- 'f05c' => 'times-circle-o',
364
- 'f043' => 'tint',
365
- 'f014' => 'trash-o',
366
- 'f181' => 'trello',
367
- 'f091' => 'trophy',
368
- 'f0d1' => 'truck',
369
- 'f195' => 'try',
370
- 'f173' => 'tumblr',
371
- 'f174' => 'tumblr-square',
372
- 'f099' => 'twitter',
373
- 'f081' => 'twitter-square',
374
- 'f0e9' => 'umbrella',
375
- 'f0cd' => 'underline',
376
- 'f0e2' => 'undo',
377
- 'f09c' => 'unlock',
378
- 'f13e' => 'unlock-alt',
379
- 'f093' => 'upload',
380
- 'f155' => 'usd',
381
- 'f007' => 'user',
382
- 'f0f0' => 'user-md',
383
- 'f0c0' => 'users',
384
- 'f03d' => 'video-camera',
385
- 'f194' => 'vimeo-square',
386
- 'f189' => 'vk',
387
- 'f027' => 'volume-down',
388
- 'f026' => 'volume-off',
389
- 'f028' => 'volume-up',
390
- 'f18a' => 'weibo',
391
- 'f193' => 'wheelchair',
392
- 'f17a' => 'windows',
393
- 'f0ad' => 'wrench',
394
- 'f168' => 'xing',
395
- 'f169' => 'xing-square',
396
- 'f167' => 'youtube',
397
- 'f16a' => 'youtube-play',
398
- 'f166' => 'youtube-square'
399
- ),
400
- 'awesome_icons2' => array(
401
- '\f042' => 'adjust',
402
- '\f170' => 'adn',
403
- '\f037' => 'align-center',
404
- '\f039' => 'align-justify',
405
- '\f036' => 'align-left',
406
- '\f038' => 'align-right',
407
- '\f0f9' => 'ambulance',
408
- '\f13d' => 'anchor',
409
- '\f17b' => 'android',
410
- '\f209' => 'angellist',
411
- '\f103' => 'angle-double-down',
412
- '\f100' => 'angle-double-left',
413
- '\f101' => 'angle-double-right',
414
- '\f102' => 'angle-double-up',
415
- '\f107' => 'angle-down',
416
- '\f104' => 'angle-left',
417
- '\f105' => 'angle-right',
418
- '\f106' => 'angle-up',
419
- '\f179' => 'apple',
420
- '\f187' => 'archive',
421
- '\f1fe' => 'area-chart',
422
- '\f0ab' => 'arrow-circle-down',
423
- '\f0a8' => 'arrow-circle-left',
424
- '\f01a' => 'arrow-circle-o-down',
425
- '\f190' => 'arrow-circle-o-left',
426
- '\f18e' => 'arrow-circle-o-right',
427
- '\f01b' => 'arrow-circle-o-up',
428
- '\f0a9' => 'arrow-circle-right',
429
- '\f0aa' => 'arrow-circle-up',
430
- '\f063' => 'arrow-down',
431
- '\f060' => 'arrow-left',
432
- '\f061' => 'arrow-right',
433
- '\f062' => 'arrow-up',
434
- '\f047' => 'arrows',
435
- '\f0b2' => 'arrows-alt',
436
- '\f07e' => 'arrows-h',
437
- '\f07d' => 'arrows-v',
438
- '\f069' => 'asterisk',
439
- '\f1fa' => 'at',
440
- '\f1b9' => 'automobile',
441
- '\f04a' => 'backward',
442
- '\f05e' => 'ban',
443
- '\f19c' => 'bank',
444
- '\f080' => 'bar-chart',
445
- '\f080' => 'bar-chart-o',
446
- '\f02a' => 'barcode',
447
- '\f0c9' => 'bars',
448
- '\f236' => 'bed',
449
- '\f0fc' => 'beer',
450
- '\f1b4' => 'behance',
451
- '\f1b5' => 'behance-square',
452
- '\f0f3' => 'bell',
453
- '\f0a2' => 'bell-o',
454
- '\f1f6' => 'bell-slash',
455
- '\f1f7' => 'bell-slash-o',
456
- '\f206' => 'bicycle',
457
- '\f1e5' => 'binoculars',
458
- '\f1fd' => 'birthday-cake',
459
- '\f171' => 'bitbucket',
460
- '\f172' => 'bitbucket-square',
461
- '\f15a' => 'bitcoin',
462
- '\f032' => 'bold',
463
- '\f0e7' => 'bolt',
464
- '\f1e2' => 'bomb',
465
- '\f02d' => 'book',
466
- '\f02e' => 'bookmark',
467
- '\f097' => 'bookmark-o',
468
- '\f0b1' => 'briefcase',
469
- '\f15a' => 'btc',
470
- '\f188' => 'bug',
471
- '\f1ad' => 'building',
472
- '\f0f7' => 'building-o',
473
- '\f0a1' => 'bullhorn',
474
- '\f140' => 'bullseye',
475
- '\f207' => 'bus',
476
- '\f20d' => 'buysellads',
477
- '\f1ba' => 'cab',
478
- '\f1ec' => 'calculator',
479
- '\f073' => 'calendar',
480
- '\f133' => 'calendar-o',
481
- '\f030' => 'camera',
482
- '\f083' => 'camera-retro',
483
- '\f1b9' => 'car',
484
- '\f0d7' => 'caret-down',
485
- '\f0d9' => 'caret-left',
486
- '\f0da' => 'caret-right',
487
- '\f150' => 'caret-square-o-down',
488
- '\f191' => 'caret-square-o-left',
489
- '\f152' => 'caret-square-o-right',
490
- '\f151' => 'caret-square-o-up',
491
- '\f0d8' => 'caret-up',
492
- '\f218' => 'cart-arrow-down',
493
- '\f217' => 'cart-plus',
494
- '\f20a' => 'cc',
495
- '\f1f3' => 'cc-amex',
496
- '\f1f2' => 'cc-discover',
497
- '\f1f1' => 'cc-mastercard',
498
- '\f1f4' => 'cc-paypal',
499
- '\f1f5' => 'cc-stripe',
500
- '\f1f0' => 'cc-visa',
501
- '\f0a3' => 'certificate',
502
- '\f0c1' => 'chain',
503
- '\f127' => 'chain-broken',
504
- '\f00c' => 'check',
505
- '\f058' => 'check-circle',
506
- '\f05d' => 'check-circle-o',
507
- '\f14a' => 'check-square',
508
- '\f046' => 'check-square-o',
509
- '\f13a' => 'chevron-circle-down',
510
- '\f137' => 'chevron-circle-left',
511
- '\f138' => 'chevron-circle-right',
512
- '\f139' => 'chevron-circle-up',
513
- '\f078' => 'chevron-down',
514
- '\f053' => 'chevron-left',
515
- '\f054' => 'chevron-right',
516
- '\f077' => 'chevron-up',
517
- '\f1ae' => 'child',
518
- '\f111' => 'circle',
519
- '\f10c' => 'circle-o',
520
- '\f1ce' => 'circle-o-notch',
521
- '\f1db' => 'circle-thin',
522
- '\f0ea' => 'clipboard',
523
- '\f017' => 'clock-o',
524
- '\f00d' => 'close',
525
- '\f0c2' => 'cloud',
526
- '\f0ed' => 'cloud-download',
527
- '\f0ee' => 'cloud-upload',
528
- '\f157' => 'cny',
529
- '\f121' => 'code',
530
- '\f126' => 'code-fork',
531
- '\f1cb' => 'codepen',
532
- '\f0f4' => 'coffee',
533
- '\f013' => 'cog',
534
- '\f085' => 'cogs',
535
- '\f0db' => 'columns',
536
- '\f075' => 'comment',
537
- '\f0e5' => 'comment-o',
538
- '\f086' => 'comments',
539
- '\f0e6' => 'comments-o',
540
- '\f14e' => 'compass',
541
- '\f066' => 'compress',
542
- '\f20e' => 'connectdevelop',
543
- '\f0c5' => 'copy',
544
- '\f1f9' => 'copyright',
545
- '\f09d' => 'credit-card',
546
- '\f125' => 'crop',
547
- '\f05b' => 'crosshairs',
548
- '\f13c' => 'css3',
549
- '\f1b2' => 'cube',
550
- '\f1b3' => 'cubes',
551
- '\f0c4' => 'cut',
552
- '\f0f5' => 'cutlery',
553
- '\f0e4' => 'dashboard',
554
- '\f210' => 'dashcube',
555
- '\f1c0' => 'database',
556
- '\f03b' => 'dedent',
557
- '\f1a5' => 'delicious',
558
- '\f108' => 'desktop',
559
- '\f1bd' => 'deviantart',
560
- '\f219' => 'diamond',
561
- '\f1a6' => 'digg',
562
- '\f155' => 'dollar',
563
- '\f192' => 'dot-circle-o',
564
- '\f019' => 'download',
565
- '\f17d' => 'dribbble',
566
- '\f16b' => 'dropbox',
567
- '\f1a9' => 'drupal',
568
- '\f044' => 'edit',
569
- '\f052' => 'eject',
570
- '\f141' => 'ellipsis-h',
571
- '\f142' => 'ellipsis-v',
572
- '\f1d1' => 'empire',
573
- '\f0e0' => 'envelope',
574
- '\f003' => 'envelope-o',
575
- '\f199' => 'envelope-square',
576
- '\f12d' => 'eraser',
577
- '\f153' => 'eur',
578
- '\f153' => 'euro',
579
- '\f0ec' => 'exchange',
580
- '\f12a' => 'exclamation',
581
- '\f06a' => 'exclamation-circle',
582
- '\f071' => 'exclamation-triangle',
583
- '\f065' => 'expand',
584
- '\f08e' => 'external-link',
585
- '\f14c' => 'external-link-square',
586
- '\f06e' => 'eye',
587
- '\f070' => 'eye-slash',
588
- '\f1fb' => 'eyedropper',
589
- '\f09a' => 'facebook',
590
- '\f09a' => 'facebook-f',
591
- '\f230' => 'facebook-official',
592
- '\f082' => 'facebook-square',
593
- '\f049' => 'fast-backward',
594
- '\f050' => 'fast-forward',
595
- '\f1ac' => 'fax',
596
- '\f182' => 'female',
597
- '\f0fb' => 'fighter-jet',
598
- '\f15b' => 'file',
599
- '\f1c6' => 'file-archive-o',
600
- '\f1c7' => 'file-audio-o',
601
- '\f1c9' => 'file-code-o',
602
- '\f1c3' => 'file-excel-o',
603
- '\f1c5' => 'file-image-o',
604
- '\f1c8' => 'file-movie-o',
605
- '\f016' => 'file-o',
606
- '\f1c1' => 'file-pdf-o',
607
- '\f1c5' => 'file-photo-o',
608
- '\f1c5' => 'file-picture-o',
609
- '\f1c4' => 'file-powerpoint-o',
610
- '\f1c7' => 'file-sound-o',
611
- '\f15c' => 'file-text',
612
- '\f0f6' => 'file-text-o',
613
- '\f1c8' => 'file-video-o',
614
- '\f1c2' => 'file-word-o',
615
- '\f1c6' => 'file-zip-o',
616
- '\f0c5' => 'files-o',
617
- '\f008' => 'film',
618
- '\f0b0' => 'filter',
619
- '\f06d' => 'fire',
620
- '\f134' => 'fire-extinguisher',
621
- '\f024' => 'flag',
622
- '\f11e' => 'flag-checkered',
623
- '\f11d' => 'flag-o',
624
- '\f0e7' => 'flash',
625
- '\f0c3' => 'flask',
626
- '\f16e' => 'flickr',
627
- '\f0c7' => 'floppy-o',
628
- '\f07b' => 'folder',
629
- '\f114' => 'folder-o',
630
- '\f07c' => 'folder-open',
631
- '\f115' => 'folder-open-o',
632
- '\f031' => 'font',
633
- '\f211' => 'forumbee',
634
- '\f04e' => 'forward',
635
- '\f180' => 'foursquare',
636
- '\f119' => 'frown-o',
637
- '\f1e3' => 'futbol-o',
638
- '\f11b' => 'gamepad',
639
- '\f0e3' => 'gavel',
640
- '\f154' => 'gbp',
641
- '\f1d1' => 'ge',
642
- '\f013' => 'gear',
643
- '\f085' => 'gears',
644
- '\f1db' => 'genderless',
645
- '\f06b' => 'gift',
646
- '\f1d3' => 'git',
647
- '\f1d2' => 'git-square',
648
- '\f09b' => 'github',
649
- '\f113' => 'github-alt',
650
- '\f092' => 'github-square',
651
- '\f184' => 'gittip',
652
- '\f000' => 'glass',
653
- '\f0ac' => 'globe',
654
- '\f1a0' => 'google',
655
- '\f0d5' => 'google-plus',
656
- '\f0d4' => 'google-plus-square',
657
- '\f1ee' => 'google-wallet',
658
- '\f19d' => 'graduation-cap',
659
- '\f184' => 'gratipay',
660
- '\f0c0' => 'group',
661
- '\f0fd' => 'h-square',
662
- '\f1d4' => 'hacker-news',
663
- '\f0a7' => 'hand-o-down',
664
- '\f0a5' => 'hand-o-left',
665
- '\f0a4' => 'hand-o-right',
666
- '\f0a6' => 'hand-o-up',
667
- '\f0a0' => 'hdd-o',
668
- '\f1dc' => 'header',
669
- '\f025' => 'headphones',
670
- '\f004' => 'heart',
671
- '\f08a' => 'heart-o',
672
- '\f21e' => 'heartbeat',
673
- '\f1da' => 'history',
674
- '\f015' => 'home',
675
- '\f0f8' => 'hospital-o',
676
- '\f236' => 'hotel',
677
- '\f13b' => 'html5',
678
- '\f20b' => 'ils',
679
- '\f03e' => 'image',
680
- '\f01c' => 'inbox',
681
- '\f03c' => 'indent',
682
- '\f129' => 'info',
683
- '\f05a' => 'info-circle',
684
- '\f156' => 'inr',
685
- '\f16d' => 'instagram',
686
- '\f19c' => 'institution',
687
- '\f208' => 'ioxhost',
688
- '\f033' => 'italic',
689
- '\f1aa' => 'joomla',
690
- '\f157' => 'jpy',
691
- '\f1cc' => 'jsfiddle',
692
- '\f084' => 'key',
693
- '\f11c' => 'keyboard-o',
694
- '\f159' => 'krw',
695
- '\f1ab' => 'language',
696
- '\f109' => 'laptop',
697
- '\f202' => 'lastfm',
698
- '\f203' => 'lastfm-square',
699
- '\f06c' => 'leaf',
700
- '\f212' => 'leanpub',
701
- '\f0e3' => 'legal',
702
- '\f094' => 'lemon-o',
703
- '\f149' => 'level-down',
704
- '\f148' => 'level-up',
705
- '\f1cd' => 'life-bouy',
706
- '\f1cd' => 'life-buoy',
707
- '\f1cd' => 'life-ring',
708
- '\f1cd' => 'life-saver',
709
- '\f0eb' => 'lightbulb-o',
710
- '\f201' => 'line-chart',
711
- '\f0c1' => 'link',
712
- '\f0e1' => 'linkedin',
713
- '\f08c' => 'linkedin-square',
714
- '\f17c' => 'linux',
715
- '\f03a' => 'list',
716
- '\f022' => 'list-alt',
717
- '\f0cb' => 'list-ol',
718
- '\f0ca' => 'list-ul',
719
- '\f124' => 'location-arrow',
720
- '\f023' => 'lock',
721
- '\f175' => 'long-arrow-down',
722
- '\f177' => 'long-arrow-left',
723
- '\f178' => 'long-arrow-right',
724
- '\f176' => 'long-arrow-up',
725
- '\f0d0' => 'magic',
726
- '\f076' => 'magnet',
727
- '\f064' => 'mail-forward',
728
- '\f112' => 'mail-reply',
729
- '\f122' => 'mail-reply-all',
730
- '\f183' => 'male',
731
- '\f041' => 'map-marker',
732
- '\f222' => 'mars',
733
- '\f227' => 'mars-double',
734
- '\f229' => 'mars-stroke',
735
- '\f22b' => 'mars-stroke-h',
736
- '\f22a' => 'mars-stroke-v',
737
- '\f136' => 'maxcdn',
738
- '\f20c' => 'meanpath',
739
- '\f23a' => 'medium',
740
- '\f0fa' => 'medkit',
741
- '\f11a' => 'meh-o',
742
- '\f223' => 'mercury',
743
- '\f130' => 'microphone',
744
- '\f131' => 'microphone-slash',
745
- '\f068' => 'minus',
746
- '\f056' => 'minus-circle',
747
- '\f146' => 'minus-square',
748
- '\f147' => 'minus-square-o',
749
- '\f10b' => 'mobile',
750
- '\f10b' => 'mobile-phone',
751
- '\f0d6' => 'money',
752
- '\f186' => 'moon-o',
753
- '\f19d' => 'mortar-board',
754
- '\f21c' => 'motorcycle',
755
- '\f001' => 'music',
756
- '\f0c9' => 'navicon',
757
- '\f22c' => 'neuter',
758
- '\f1ea' => 'newspaper-o',
759
- '\f19b' => 'openid',
760
- '\f03b' => 'outdent',
761
- '\f18c' => 'pagelines',
762
- '\f1fc' => 'paint-brush',
763
- '\f1d8' => 'paper-plane',
764
- '\f1d9' => 'paper-plane-o',
765
- '\f0c6' => 'paperclip',
766
- '\f1dd' => 'paragraph',
767
- '\f0ea' => 'paste',
768
- '\f04c' => 'pause',
769
- '\f1b0' => 'paw',
770
- '\f1ed' => 'paypal',
771
- '\f040' => 'pencil',
772
- '\f14b' => 'pencil-square',
773
- '\f044' => 'pencil-square-o',
774
- '\f095' => 'phone',
775
- '\f098' => 'phone-square',
776
- '\f03e' => 'photo',
777
- '\f03e' => 'picture-o',
778
- '\f200' => 'pie-chart',
779
- '\f1a7' => 'pied-piper',
780
- '\f1a8' => 'pied-piper-alt',
781
- '\f0d2' => 'pinterest',
782
- '\f231' => 'pinterest-p',
783
- '\f0d3' => 'pinterest-square',
784
- '\f072' => 'plane',
785
- '\f04b' => 'play',
786
- '\f144' => 'play-circle',
787
- '\f01d' => 'play-circle-o',
788
- '\f1e6' => 'plug',
789
- '\f067' => 'plus',
790
- '\f055' => 'plus-circle',
791
- '\f0fe' => 'plus-square',
792
- '\f196' => 'plus-square-o',
793
- '\f011' => 'power-off',
794
- '\f02f' => 'print',
795
- '\f12e' => 'puzzle-piece',
796
- '\f1d6' => 'qq',
797
- '\f029' => 'qrcode',
798
- '\f128' => 'question',
799
- '\f059' => 'question-circle',
800
- '\f10d' => 'quote-left',
801
- '\f10e' => 'quote-right',
802
- '\f1d0' => 'ra',
803
- '\f074' => 'random',
804
- '\f1d0' => 'rebel',
805
- '\f1b8' => 'recycle',
806
- '\f1a1' => 'reddit',
807
- '\f1a2' => 'reddit-square',
808
- '\f021' => 'refresh',
809
- '\f00d' => 'remove',
810
- '\f18b' => 'renren',
811
- '\f0c9' => 'reorder',
812
- '\f01e' => 'repeat',
813
- '\f112' => 'reply',
814
- '\f122' => 'reply-all',
815
- '\f079' => 'retweet',
816
- '\f157' => 'rmb',
817
- '\f018' => 'road',
818
- '\f135' => 'rocket',
819
- '\f0e2' => 'rotate-left',
820
- '\f01e' => 'rotate-right',
821
- '\f158' => 'rouble',
822
- '\f09e' => 'rss',
823
- '\f143' => 'rss-square',
824
- '\f158' => 'rub',
825
- '\f158' => 'ruble',
826
- '\f156' => 'rupee',
827
- '\f0c7' => 'save',
828
- '\f0c4' => 'scissors',
829
- '\f002' => 'search',
830
- '\f010' => 'search-minus',
831
- '\f00e' => 'search-plus',
832
- '\f213' => 'sellsy',
833
- '\f1d8' => 'send',
834
- '\f1d9' => 'send-o',
835
- '\f233' => 'server',
836
- '\f064' => 'share',
837
- '\f1e0' => 'share-alt',
838
- '\f1e1' => 'share-alt-square',
839
- '\f14d' => 'share-square',
840
- '\f045' => 'share-square-o',
841
- '\f20b' => 'shekel',
842
- '\f20b' => 'sheqel',
843
- '\f132' => 'shield',
844
- '\f21a' => 'ship',
845
- '\f214' => 'shirtsinbulk',
846
- '\f07a' => 'shopping-cart',
847
- '\f090' => 'sign-in',
848
- '\f08b' => 'sign-out',
849
- '\f012' => 'signal',
850
- '\f215' => 'simplybuilt',
851
- '\f0e8' => 'sitemap',
852
- '\f216' => 'skyatlas',
853
- '\f17e' => 'skype',
854
- '\f198' => 'slack',
855
- '\f1de' => 'sliders',
856
- '\f1e7' => 'slideshare',
857
- '\f118' => 'smile-o',
858
- '\f1e3' => 'soccer-ball-o',
859
- '\f0dc' => 'sort',
860
- '\f15d' => 'sort-alpha-asc',
861
- '\f15e' => 'sort-alpha-desc',
862
- '\f160' => 'sort-amount-asc',
863
- '\f161' => 'sort-amount-desc',
864
- '\f0de' => 'sort-asc',
865
- '\f0dd' => 'sort-desc',
866
- '\f0dd' => 'sort-down',
867
- '\f162' => 'sort-numeric-asc',
868
- '\f163' => 'sort-numeric-desc',
869
- '\f0de' => 'sort-up',
870
- '\f1be' => 'soundcloud',
871
- '\f197' => 'space-shuttle',
872
- '\f110' => 'spinner',
873
- '\f1b1' => 'spoon',
874
- '\f1bc' => 'spotify',
875
- '\f0c8' => 'square',
876
- '\f096' => 'square-o',
877
- '\f18d' => 'stack-exchange',
878
- '\f16c' => 'stack-overflow',
879
- '\f005' => 'star',
880
- '\f089' => 'star-half',
881
- '\f123' => 'star-half-empty',
882
- '\f123' => 'star-half-full',
883
- '\f123' => 'star-half-o',
884
- '\f006' => 'star-o',
885
- '\f1b6' => 'steam',
886
- '\f1b7' => 'steam-square',
887
- '\f048' => 'step-backward',
888
- '\f051' => 'step-forward',
889
- '\f0f1' => 'stethoscope',
890
- '\f04d' => 'stop',
891
- '\f21d' => 'street-view',
892
- '\f0cc' => 'strikethrough',
893
- '\f1a4' => 'stumbleupon',
894
- '\f1a3' => 'stumbleupon-circle',
895
- '\f12c' => 'subscript',
896
- '\f239' => 'subway',
897
- '\f0f2' => 'suitcase',
898
- '\f185' => 'sun-o',
899
- '\f12b' => 'superscript',
900
- '\f1cd' => 'support',
901
- '\f0ce' => 'table',
902
- '\f10a' => 'tablet',
903
- '\f0e4' => 'tachometer',
904
- '\f02b' => 'tag',
905
- '\f02c' => 'tags',
906
- '\f0ae' => 'tasks',
907
- '\f1ba' => 'taxi',
908
- '\f1d5' => 'tencent-weibo',
909
- '\f120' => 'terminal',
910
- '\f034' => 'text-height',
911
- '\f035' => 'text-width',
912
- '\f00a' => 'th',
913
- '\f009' => 'th-large',
914
- '\f00b' => 'th-list',
915
- '\f08d' => 'thumb-tack',
916
- '\f165' => 'thumbs-down',
917
- '\f088' => 'thumbs-o-down',
918
- '\f087' => 'thumbs-o-up',
919
- '\f164' => 'thumbs-up',
920
- '\f145' => 'ticket',
921
- '\f00d' => 'times',
922
- '\f057' => 'times-circle',
923
- '\f05c' => 'times-circle-o',
924
- '\f043' => 'tint',
925
- '\f150' => 'toggle-down',
926
- '\f191' => 'toggle-left',
927
- '\f204' => 'toggle-off',
928
- '\f205' => 'toggle-on',
929
- '\f152' => 'toggle-right',
930
- '\f151' => 'toggle-up',
931
- '\f238' => 'train',
932
- '\f224' => 'transgender',
933
- '\f225' => 'transgender-alt',
934
- '\f1f8' => 'trash',
935
- '\f014' => 'trash-o',
936
- '\f1bb' => 'tree',
937
- '\f181' => 'trello',
938
- '\f091' => 'trophy',
939
- '\f0d1' => 'truck',
940
- '\f195' => 'try',
941
- '\f1e4' => 'tty',
942
- '\f173' => 'tumblr',
943
- '\f174' => 'tumblr-square',
944
- '\f195' => 'turkish-lira',
945
- '\f1e8' => 'twitch',
946
- '\f099' => 'twitter',
947
- '\f081' => 'twitter-square',
948
- '\f0e9' => 'umbrella',
949
- '\f0cd' => 'underline',
950
- '\f0e2' => 'undo',
951
- '\f19c' => 'university',
952
- '\f127' => 'unlink',
953
- '\f09c' => 'unlock',
954
- '\f13e' => 'unlock-alt',
955
- '\f0dc' => 'unsorted',
956
- '\f093' => 'upload',
957
- '\f155' => 'usd',
958
- '\f007' => 'user',
959
- '\f0f0' => 'user-md',
960
- '\f234' => 'user-plus',
961
- '\f21b' => 'user-secret',
962
- '\f235' => 'user-times',
963
- '\f0c0' => 'users',
964
- '\f221' => 'venus',
965
- '\f226' => 'venus-double',
966
- '\f228' => 'venus-mars',
967
- '\f237' => 'viacoin',
968
- '\f03d' => 'video-camera',
969
- '\f194' => 'vimeo-square',
970
- '\f1ca' => 'vine',
971
- '\f189' => 'vk',
972
- '\f027' => 'volume-down',
973
- '\f026' => 'volume-off',
974
- '\f028' => 'volume-up',
975
- '\f071' => 'warning',
976
- '\f1d7' => 'wechat',
977
- '\f18a' => 'weibo',
978
- '\f1d7' => 'weixin',
979
- '\f232' => 'whatsapp',
980
- '\f193' => 'wheelchair',
981
- '\f1eb' => 'wifi',
982
- '\f17a' => 'windows',
983
- '\f159' => 'won',
984
- '\f19a' => 'wordpress',
985
- '\f0ad' => 'wrench',
986
- '\f168' => 'xing',
987
- '\f169' => 'xing-square',
988
- '\f19e' => 'yahoo',
989
- '\f1e9' => 'yelp',
990
- '\f157' => 'yen',
991
- '\f167' => 'youtube',
992
- '\f16a' => 'youtube-play',
993
- '\f166' => 'youtube-square',
994
- ),
995
-
996
- 'awesome_icons_socials' =>array(
997
- 'f170' => 'adn',
998
- 'f17b' => 'android',
999
- 'f179' => 'apple',
1000
- 'f171' => 'bitbucket',
1001
- 'f171' => 'bitbucket-square',
1002
- 'f02e' => 'bookmark',
1003
- 'f097' => 'bookmark-o',
1004
- 'f15a' => 'btc',
1005
- 'f13c' => 'css3',
1006
- 'f17d' => 'dribble',
1007
- 'f16b' => 'dropbox',
1008
- 'f09a' => 'facebook',
1009
- 'f082' => 'facebook-square',
1010
- 'f16e' => 'flickr',
1011
- 'f180' => 'foursquare',
1012
- 'f09b'=> 'github' ,
1013
- 'f113'=> 'github-alt',
1014
- 'f092' => 'github-square',
1015
- 'f184' => 'gittip',
1016
- 'f0d5' => 'google-plus',
1017
- 'f0d4' => 'google-plus-square',
1018
- 'f13b' => 'html5',
1019
- 'f16d' => 'instagram',
1020
- 'f0e1' => 'linkedin',
1021
- 'f08c' => 'linkedin-square',
1022
- 'f17c' => 'Linux',
1023
- 'f136' => 'maxcdn',
1024
- 'f18c' => 'pagelines',
1025
- 'f0d2' => 'pinterest',
1026
- 'f0d3' => 'pinterest-square',
1027
- 'f18b' => 'renren',
1028
- 'f09e' => 'rss',
1029
- 'f17e' => 'skype',
1030
- 'f18d' => 'stack-exchange',
1031
- 'f16c' => 'stack-overflow',
1032
- 'f181' => 'trello',
1033
- 'f173' => 'tumblr',
1034
- 'f174' => 'Tumblr Square',
1035
- 'f099' => 'twitter',
1036
- 'f081' => 'twitter-square',
1037
- 'f194' => 'vimeo-square',
1038
- 'f189' => 'vk',
1039
- 'f18a' => 'weibo',
1040
- 'f17a' => 'windows',
1041
- 'f168' => 'xing',
1042
- 'f169' => 'xing-square',
1043
- 'f167' => 'youtube'
1044
- ),
1045
- 'header_backgrounds' => array(),
1046
- 'body_backgrounds' => array(),
1047
-
1048
- // tags used in theme options (e.g. %tag%) to have some common informations
1049
- 'tag' => array( //'themeurl' => get_template_directory_uri()
1050
- ),
1051
-
1052
- 'cycle_fx' => array(
1053
- 'blindX' => 'blindX', 'blindY' => 'blindY', 'blindZ' => 'blindZ', 'cover' => 'cover', 'curtainX' => 'curtainX',
1054
- 'curtainY' => 'curtainY', 'fade' => 'fade', 'fadeZoom' => 'fadeZoom', 'growX' => 'growX', 'growY' => 'growY',
1055
- 'scrollUp' => 'scrollUp', 'scrollDown' => 'scrollDown', 'scrollLeft' => 'scrollLeft', 'scrollRight' => 'scrollRight', 'scrollHorz' => 'scrollHorz',
1056
- 'shuffle' => 'shuffle', 'slideX' => 'slideX', 'slideY' => 'slideY', 'toss' => 'toss', 'turnUp' => 'turnUp',
1057
- 'turnLeft' => 'turnLeft', 'turnRight' => 'turnRight', 'uncover' => 'uncover', 'wipe' => 'wipe', 'zoom' => 'zoom',
1058
- 'none' => 'none', 'turnDown' => 'turnDown', 'scrollVert' => 'scrollVert'
1059
- ),
1060
-
1061
- 'animate' => array(
1062
- '' => "none",
1063
- "bounce" => "bounce",
1064
- "flash" =>"flash",
1065
- "pulse" =>"pulse",
1066
- //"rubberBand"=>"rubberBand",
1067
- "shake" =>"shake",
1068
- "swing"=>"swing",
1069
- "tada" =>"tada",
1070
- "wobble"=>"wobble",
1071
- "bounceIn"=>"bounceIn",
1072
- "bounceInDown"=>"bounceInDown",
1073
- "bounceInLeft"=>"bounceInLeft",
1074
- "bounceInRight"=>"bounceInRight",
1075
- "bounceInUp"=>"bounceInUp",
1076
- "fadeIn"=>"fadeIn",
1077
- "fadeInDown"=>"fadeInDown",
1078
- "fadeInDownBig"=>"fadeInDownBig",
1079
- "fadeInLeft"=>"fadeInLeft",
1080
- "fadeInLeftBig"=>"fadeInLeftBig",
1081
- "fadeInRight"=>"fadeInRight",
1082
- "fadeInRightBig"=>"fadeInRightBig",
1083
- "fadeInUp"=>"fadeInUp",
1084
- "fadeInUpBig"=>"fadeInUpBig",
1085
- "flip"=>"flip",
1086
- "flipInX"=>"flipInX",
1087
- "flipInY"=>"flipInY",
1088
- "lightSpeedIn"=>"lightSpeedIn",
1089
- "rotateIn"=>"rotateIn",
1090
- "rotateInDownLeft"=>"rotateInDownLeft",
1091
- "rotateInDownRight"=>"rotateInDownRight",
1092
- "rotateInUpLeft"=>"rotateInUpLeft",
1093
- "rotateInUpRight"=>"rotateInUpRight",
1094
- //"slideInDown"=>"slideInDown",
1095
- //"slideInLeft"=>"slideInLeft",
1096
- //"slideInRight"=>"slideInRight",
1097
- "rollIn"=>"rollIn",
1098
- ),
1099
-
1100
- 'easings' => array(
1101
- FALSE => 'none',
1102
- 'easeInQuad' => 'easeInQuad',
1103
- 'easeOutQuad' => 'easeOutQuad',
1104
- 'easeInOutQuad' => 'easeInOutQuad',
1105
- 'easeInCubic' => 'easeInCubic',
1106
- 'easeOutCubic' => 'easeOutCubic',
1107
- 'easeInOutCubic' => 'easeInOutCubic',
1108
- 'easeInQuart' => 'easeInQuart',
1109
- 'easeOutQuart' => 'easeOutQuart',
1110
- 'easeInOutQuart' => 'easeInOutQuart',
1111
- 'easeInQuint' => 'easeInQuint',
1112
- 'easeOutQuint' => 'easeOutQuint',
1113
- 'easeInOutQuint' => 'easeInOutQuint',
1114
- 'easeInSine' => 'easeInSine',
1115
- 'easeOutSine' => 'easeOutSine',
1116
- 'easeInOutSine' => 'easeInOutSine',
1117
- 'easeInExpo' => 'easeInExpo',
1118
- 'easeOutExpo' => 'easeOutExpo',
1119
- 'easeInOutExpo' => 'easeInOutExpo',
1120
- 'easeInCirc' => 'easeInCirc',
1121
- 'easeOutCirc' => 'easeOutCirc',
1122
- 'easeInOutCirc' => 'easeInOutCirc',
1123
- 'easeInElastic' => 'easeInElastic',
1124
- 'easeOutElastic' => 'easeOutElastic',
1125
- 'easeInOutElastic' => 'easeInOutElastic',
1126
- 'easeInBack' => 'easeInBack',
1127
- 'easeOutBack' => 'easeOutBack',
1128
- 'easeInOutBack' => 'easeInOutBack',
1129
- 'easeInBounce' => 'easeInBounce',
1130
- 'easeOutBounce' => 'easeOutBounce',
1131
- 'easeInOutBounce' => 'easeInOutBounce'
1132
- )
1133
- );
1134
-
1135
- /**
1136
- * Get configuration array
1137
- *
1138
- * @return array
1139
- */
1140
- public static function load() {
1141
- self::_loadThemeInfo();
1142
- //ksort( self::$_config['awesome_icons'] );
1143
-
1144
- return self::$_config;
1145
- }
1146
-
1147
- /**
1148
- * Return theme data
1149
- *
1150
- * First the method checks if the wp_get_theme() function exists (WP 3.4.0 at least).
1151
- * If not, the method calls the deprecated function get_template_directory()
1152
- *
1153
- * @return array
1154
- */
1155
- protected static function _loadThemeInfo() {
1156
- $theme = wp_get_theme();
1157
-
1158
- self::$_config['theme'] = array(
1159
- 'name' => $theme->Name,
1160
- 'description' => $theme->Description,
1161
- 'author' => $theme->Author,
1162
- 'authoruri' => $theme->{'Author URI'},
1163
- 'version' => $theme->Version,
1164
- 'template' => $theme->Template,
1165
- 'status' => $theme->Status,
1166
- 'tags' => $theme->Tags
1167
- );
1168
- }
1169
-
1170
-
1171
- public function init() {
1172
- self::$_config['header_backgrounds'] = apply_filters( 'yit_header_backgrounds', self::$_config['header_backgrounds'] );
1173
- self::$_config['body_backgrounds'] = apply_filters( 'yit_body_backgrounds', self::$_config['body_backgrounds'] );
1174
- }
1175
-
1176
- /**
1177
- * Return the font awesome array icon
1178
- *
1179
- * @return string Array
1180
- * @access public
1181
- * @since 1.0.0
1182
- */
1183
- public static function get_awesome_icons() {
1184
- return self::$_config['awesome_icons'];
1185
- }
1186
-
1187
- /**
1188
- * Return the font awesome array socials icon
1189
- *
1190
- * @return string Array
1191
- * @access public
1192
- * @since 1.0.0
1193
- */
1194
- public static function get_awesome_icons_socials() {
1195
- return self::$_config['awesome_icons_socials'];
1196
- }
1197
-
1198
-
1199
- /**
1200
- * Return the list of icons
1201
- *
1202
- * @return string Array
1203
- * @access public
1204
- * @since 1.0.0
1205
- */
1206
- public static function get_icon_list() {
1207
-
1208
- $standard_icon_list = array(
1209
- 'FontAwesome' => self::$_config['awesome_icons2']
1210
- );
1211
-
1212
- return apply_filters( 'yit_icon_list', $standard_icon_list );
1213
- }
1214
-
1215
- /**
1216
- * Return the data of icon
1217
- *
1218
- * @return string Array
1219
- * @access public
1220
- * @since 1.0.0
1221
- */
1222
- public static function get_icon( $icon ) {
1223
-
1224
- $icon_list = self::get_icon_list();
1225
- $icon_data = '';
1226
- if ( $icon != '' ) {
1227
- $ic = explode( ':', $icon );
1228
- $icon_code = array_search( $ic[1], $icon_list[$ic[0]] );
1229
-
1230
- if( $icon_code ){
1231
- $icon_code = ( strpos( $icon_code, '\\' ) === 0 ) ? '&#x' . substr( $icon_code, 1 ) . ';' : $icon_code;
1232
- }
1233
-
1234
- $icon_data = 'data-font="' . $ic[0] . '" data-key="' . $ic[1] . '" data-icon="' . $icon_code . '"';
1235
- }
1236
-
1237
- return $icon_data;
1238
- }
1239
-
1240
-
1241
- /*
1242
- * Return the code of the relative awesome class name
1243
- *
1244
- * @return string
1245
- * @access public
1246
- * @since 1.0.0
1247
- */
1248
- public static function get_awesome_icons_code_by_value($class){
1249
- $awesome_icons=self::$_config['awesome_icons'];
1250
- foreach($awesome_icons as $key => $value){
1251
- if($class==$value) {
1252
- return $key;
1253
- }
1254
- }
1255
-
1256
- return "";
1257
- }
1258
- }
1259
-
1260
  endif;
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( ! class_exists( 'YIT_Plugin_Common' ) ) :
12
+
13
+ /**
14
+ * Core configuration class
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class YIT_Plugin_Common {
19
+
20
+ /**
21
+ * Config array
22
+ *
23
+ * @var array
24
+ */
25
+ protected static $_config = array(
26
+ 'slider' => array( 'nivo', 'elegant' ),
27
+
28
+
29
+ 'awesome_icons' => array(
30
+ '' => 'no-icon',
31
+ 'f042' => 'adjust',
32
+ 'f170' => 'adn',
33
+ 'f037' => 'align-center',
34
+ 'f039' => 'align-justify',
35
+ 'f036' => 'align-left',
36
+ 'f038' => 'align-right',
37
+ 'f0f9' => 'ambulance',
38
+ 'f13d' => 'anchor',
39
+ 'f17b' => 'android',
40
+ 'f103' => 'angle-double-down',
41
+ 'f100' => 'angle-double-left',
42
+ 'f101' => 'angle-double-right',
43
+ 'f102' => 'angle-double-up',
44
+ 'f107' => 'angle-down',
45
+ 'f104' => 'angle-left',
46
+ 'f105' => 'angle-right',
47
+ 'f106' => 'angle-up',
48
+ 'f179' => 'apple',
49
+ 'f187' => 'archive',
50
+ 'f0ab' => 'arrow-circle-down',
51
+ 'f0a8' => 'arrow-circle-left',
52
+ 'f01a' => 'arrow-circle-o-down',
53
+ 'f190' => 'arrow-circle-o-left',
54
+ 'f18e' => 'arrow-circle-o-right',
55
+ 'f01b' => 'arrow-circle-o-up',
56
+ 'f0a9' => 'arrow-circle-right',
57
+ 'f0aa' => 'arrow-circle-up',
58
+ 'f063' => 'arrow-down',
59
+ 'f060' => 'arrow-left',
60
+ 'f061' => 'arrow-right',
61
+ 'f062' => 'arrow-up',
62
+ 'f047' => 'arrows',
63
+ 'f0b2' => 'arrows-alt',
64
+ 'f07e' => 'arrows-h',
65
+ 'f07d' => 'arrows-v',
66
+ 'f069' => 'asterisk',
67
+ 'f04a' => 'backward',
68
+ 'f05e' => 'ban',
69
+ 'f080' => 'bar-chart-o',
70
+ 'f02a' => 'barcode',
71
+ 'f0c9' => 'bars',
72
+ 'f0fc' => 'beer',
73
+ 'f0f3' => 'bell',
74
+ 'f0a2' => 'bell-o',
75
+ 'f171' => 'bitbucket',
76
+ 'f172' => 'bitbucket-square',
77
+ 'f032' => 'bold',
78
+ 'f0e7' => 'bolt',
79
+ 'f02d' => 'book',
80
+ 'f02e' => 'bookmark',
81
+ 'f097' => 'bookmark-o',
82
+ 'f0b1' => 'briefcase',
83
+ 'f15a' => 'btc',
84
+ 'f188' => 'bug',
85
+ 'f0f7' => 'building-o',
86
+ 'f0a1' => 'bullhorn',
87
+ 'f140' => 'bullseye',
88
+ 'f073' => 'calendar',
89
+ 'f133' => 'calendar-o',
90
+ 'f030' => 'camera',
91
+ 'f083' => 'camera-retro',
92
+ 'f0d7' => 'caret-down',
93
+ 'f0d9' => 'caret-left',
94
+ 'f0da' => 'caret-right',
95
+ 'f150' => 'caret-square-o-down',
96
+ 'f191' => 'caret-square-o-left',
97
+ 'f152' => 'caret-square-o-right',
98
+ 'f151' => 'caret-square-o-up',
99
+ 'f0d8' => 'caret-up',
100
+ 'f0a3' => 'certificate',
101
+ 'f127' => 'chain-broken',
102
+ 'f00c' => 'check',
103
+ 'f058' => 'check-circle',
104
+ 'f05d' => 'check-circle-o',
105
+ 'f14a' => 'check-square',
106
+ 'f046' => 'check-square-o',
107
+ 'f13a' => 'chevron-circle-down',
108
+ 'f137' => 'chevron-circle-left',
109
+ 'f138' => 'chevron-circle-right',
110
+ 'f139' => 'chevron-circle-up',
111
+ 'f078' => 'chevron-down',
112
+ 'f053' => 'chevron-left',
113
+ 'f054' => 'chevron-right',
114
+ 'f077' => 'chevron-up',
115
+ 'f10c' => 'circle-o',
116
+ 'f0ea' => 'clipboard',
117
+ 'f017' => 'clock-o',
118
+ 'f0c2' => 'cloud',
119
+ 'f0ed' => 'cloud-download',
120
+ 'f0ee' => 'cloud-upload',
121
+ 'f121' => 'code',
122
+ 'f126' => 'code-fork',
123
+ 'f0f4' => 'coffee',
124
+ 'f013' => 'cog',
125
+ 'f085' => 'cogs',
126
+ 'f0db' => 'columns',
127
+ 'f075' => 'comment',
128
+ 'f0e5' => 'comment-o',
129
+ 'f086' => 'comments',
130
+ 'f0e6' => 'comments-o',
131
+ 'f14e' => 'compass',
132
+ 'f066' => 'compress',
133
+ 'f09d' => 'credit-card',
134
+ 'f125' => 'crop',
135
+ 'f05b' => 'crosshairs',
136
+ 'f13c' => 'css3',
137
+ 'f0f5' => 'cutlery',
138
+ 'f108' => 'desktop',
139
+ 'f192' => 'dot-circle-o',
140
+ 'f019' => 'download',
141
+ 'f17d' => 'dribbble',
142
+ 'f16b' => 'dropbox',
143
+ 'f052' => 'eject',
144
+ 'f141' => 'ellipsis-h',
145
+ 'f142' => 'ellipsis-v',
146
+ 'f0e0' => 'envelope',
147
+ 'f003' => 'envelope-o',
148
+ 'f12d' => 'eraser',
149
+ 'f153' => 'eur',
150
+ 'f0ec' => 'exchange',
151
+ 'f12a' => 'exclamation',
152
+ 'f06a' => 'exclamation-circle',
153
+ 'f071' => 'exclamation-triangle',
154
+ 'f065' => 'expand',
155
+ 'f08e' => 'external-link',
156
+ 'f14c' => 'external-link-square',
157
+ 'f06e' => 'eye',
158
+ 'f070' => 'eye-slash',
159
+ 'f09a' => 'facebook',
160
+ 'f082' => 'facebook-square',
161
+ 'f049' => 'fast-backward',
162
+ 'f050' => 'fast-forward',
163
+ 'f182' => 'female',
164
+ 'f0fb' => 'fighter-jet',
165
+ 'f15b' => 'file',
166
+ 'f016' => 'file-o',
167
+ 'f15c' => 'file-text',
168
+ 'f0f6' => 'file-text-o',
169
+ 'f0c5' => 'files-o',
170
+ 'f008' => 'film',
171
+ 'f0b0' => 'filter',
172
+ 'f06d' => 'fire',
173
+ 'f134' => 'fire-extinguisher',
174
+ 'f024' => 'flag',
175
+ 'f11e' => 'flag-checkered',
176
+ 'f11d' => 'flag-o',
177
+ 'f0c3' => 'flask',
178
+ 'f16e' => 'flickr',
179
+ 'f0c7' => 'floppy-o',
180
+ 'f07b' => 'folder',
181
+ 'f114' => 'folder-o',
182
+ 'f07c' => 'folder-open',
183
+ 'f115' => 'folder-open-o',
184
+ 'f031' => 'font',
185
+ 'f04e' => 'forward',
186
+ 'f180' => 'foursquare',
187
+ 'f119' => 'frown-o',
188
+ 'f11b' => 'gamepad',
189
+ 'f0e3' => 'gavel',
190
+ 'f154' => 'gbp',
191
+ 'f06b' => 'gift',
192
+ 'f09b' => 'github',
193
+ 'f113' => 'github-alt',
194
+ 'f092' => 'github-square',
195
+ 'f184' => 'gittip',
196
+ 'f000' => 'glass',
197
+ 'f0ac' => 'globe',
198
+ 'f0d5' => 'google-plus',
199
+ 'f0d4' => 'google-plus-square',
200
+ 'f0fd' => 'h-square',
201
+ 'f0a7' => 'hand-o-down',
202
+ 'f0a5' => 'hand-o-left',
203
+ 'f0a4' => 'hand-o-right',
204
+ 'f0a6' => 'hand-o-up',
205
+ 'f0a0' => 'hdd-o',
206
+ 'f025' => 'headphones',
207
+ 'f004' => 'heart',
208
+ 'f08a' => 'heart-o',
209
+ 'f015' => 'home',
210
+ 'f0f8' => 'hospital-o',
211
+ 'f13b' => 'html5',
212
+ 'f01c' => 'inbox',
213
+ 'f03c' => 'indent',
214
+ 'f129' => 'info',
215
+ 'f05a' => 'info-circle',
216
+ 'f156' => 'inr',
217
+ 'f16d' => 'instagram',
218
+ 'f033' => 'italic',
219
+ 'f157' => 'jpy',
220
+ 'f084' => 'key',
221
+ 'f11c' => 'keyboard-o',
222
+ 'f159' => 'krw',
223
+ 'f109' => 'laptop',
224
+ 'f06c' => 'leaf',
225
+ 'f094' => 'lemon-o',
226
+ 'f149' => 'level-down',
227
+ 'f148' => 'level-up',
228
+ 'f0eb' => 'lightbulb-o',
229
+ 'f0c1' => 'link',
230
+ 'f0e1' => 'linkedin',
231
+ 'f08c' => 'linkedin-square',
232
+ 'f17c' => 'linux',
233
+ 'f03a' => 'list',
234
+ 'f022' => 'list-alt',
235
+ 'f0cb' => 'list-ol',
236
+ 'f0ca' => 'list-ul',
237
+ 'f124' => 'location-arrow',
238
+ 'f023' => 'lock',
239
+ 'f175' => 'long-arrow-down',
240
+ 'f177' => 'long-arrow-left',
241
+ 'f178' => 'long-arrow-right',
242
+ 'f176' => 'long-arrow-up',
243
+ 'f0d0' => 'magic',
244
+ 'f076' => 'magnet',
245
+ 'f122' => 'mail-reply-all',
246
+ 'f183' => 'male',
247
+ 'f041' => 'map-marker',
248
+ 'f136' => 'maxcdn',
249
+ 'f0fa' => 'medkit',
250
+ 'f11a' => 'meh-o',
251
+ 'f130' => 'microphone',
252
+ 'f131' => 'microphone-slash',
253
+ 'f068' => 'minus',
254
+ 'f056' => 'minus-circle',
255
+ 'f146' => 'minus-square',
256
+ 'f147' => 'minus-square-o',
257
+ 'f10b' => 'mobile',
258
+ 'f0d6' => 'money',
259
+ 'f186' => 'moon-o',
260
+ 'f001' => 'music',
261
+ 'f03b' => 'outdent',
262
+ 'f18c' => 'pagelines',
263
+ 'f0c6' => 'paperclip',
264
+ 'f04c' => 'pause',
265
+ 'f040' => 'pencil',
266
+ 'f14b' => 'pencil-square',
267
+ 'f044' => 'pencil-square-o',
268
+ 'f095' => 'phone',
269
+ 'f098' => 'phone-square',
270
+ 'f03e' => 'picture-o',
271
+ 'f0d2' => 'pinterest',
272
+ 'f0d3' => 'pinterest-square',
273
+ 'f072' => 'plane',
274
+ 'f04b' => 'play',
275
+ 'f144' => 'play-circle',
276
+ 'f01d' => 'play-circle-o',
277
+ 'f067' => 'plus',
278
+ 'f055' => 'plus-circle',
279
+ 'f0fe' => 'plus-square',
280
+ 'f196' => 'plus-square-o',
281
+ 'f011' => 'power-off',
282
+ 'f02f' => 'print',
283
+ 'f12e' => 'puzzle-piece',
284
+ 'f029' => 'qrcode',
285
+ 'f128' => 'question',
286
+ 'f059' => 'question-circle',
287
+ 'f10d' => 'quote-left',
288
+ 'f10e' => 'quote-right',
289
+ 'f074' => 'random',
290
+ 'f021' => 'refresh',
291
+ 'f18b' => 'renren',
292
+ 'f01e' => 'repeat',
293
+ 'f112' => 'reply',
294
+ 'f122' => 'reply-all',
295
+ 'f079' => 'retweet',
296
+ 'f018' => 'road',
297
+ 'f135' => 'rocket',
298
+ 'f09e' => 'rss',
299
+ 'f143' => 'rss-square',
300
+ 'f158' => 'rub',
301
+ 'f0c4' => 'scissors',
302
+ 'f002' => 'search',
303
+ 'f010' => 'search-minus',
304
+ 'f00e' => 'search-plus',
305
+ 'f064' => 'share',
306
+ 'f14d' => 'share-square',
307
+ 'f045' => 'share-square-o',
308
+ 'f132' => 'shield',
309
+ 'f07a' => 'shopping-cart',
310
+ 'f090' => 'sign-in',
311
+ 'f08b' => 'sign-out',
312
+ 'f012' => 'signal',
313
+ 'f0e8' => 'sitemap',
314
+ 'f17e' => 'skype',
315
+ 'f118' => 'smile-o',
316
+ 'f0dc' => 'sort',
317
+ 'f15d' => 'sort-alpha-asc',
318
+ 'f15e' => 'sort-alpha-desc',
319
+ 'f160' => 'sort-amount-asc',
320
+ 'f161' => 'sort-amount-desc',
321
+ 'f0dd' => 'sort-asc',
322
+ 'f0de' => 'sort-desc',
323
+ 'f162' => 'sort-numeric-asc',
324
+ 'f163' => 'sort-numeric-desc',
325
+ 'f110' => 'spinner',
326
+ 'f0c8' => 'square',
327
+ 'f096' => 'square-o',
328
+ 'f18d' => 'stack-exchange',
329
+ 'f16c' => 'stack-overflow',
330
+ 'f005' => 'star',
331
+ 'f089' => 'star-half',
332
+ 'f123' => 'star-half-o',
333
+ 'f006' => 'star-o',
334
+ 'f048' => 'step-backward',
335
+ 'f051' => 'step-forward',
336
+ 'f0f1' => 'stethoscope',
337
+ 'f04d' => 'stop',
338
+ 'f0cc' => 'strikethrough',
339
+ 'f12c' => 'subscript',
340
+ 'f0f2' => 'suitcase',
341
+ 'f185' => 'sun-o',
342
+ 'f12b' => 'superscript',
343
+ 'f0ce' => 'table',
344
+ 'f10a' => 'tablet',
345
+ 'f0e4' => 'tachometer',
346
+ 'f02b' => 'tag',
347
+ 'f02c' => 'tags',
348
+ 'f0ae' => 'tasks',
349
+ 'f120' => 'terminal',
350
+ 'f034' => 'text-height',
351
+ 'f035' => 'text-width',
352
+ 'f00a' => 'th',
353
+ 'f009' => 'th-large',
354
+ 'f00b' => 'th-list',
355
+ 'f08d' => 'thumb-tack',
356
+ 'f165' => 'thumbs-down',
357
+ 'f088' => 'thumbs-o-down',
358
+ 'f087' => 'thumbs-o-up',
359
+ 'f164' => 'thumbs-up',
360
+ 'f145' => 'ticket',
361
+ 'f00d' => 'times',
362
+ 'f057' => 'times-circle',
363
+ 'f05c' => 'times-circle-o',
364
+ 'f043' => 'tint',
365
+ 'f014' => 'trash-o',
366
+ 'f181' => 'trello',
367
+ 'f091' => 'trophy',
368
+ 'f0d1' => 'truck',
369
+ 'f195' => 'try',
370
+ 'f173' => 'tumblr',
371
+ 'f174' => 'tumblr-square',
372
+ 'f099' => 'twitter',
373
+ 'f081' => 'twitter-square',
374
+ 'f0e9' => 'umbrella',
375
+ 'f0cd' => 'underline',
376
+ 'f0e2' => 'undo',
377
+ 'f09c' => 'unlock',
378
+ 'f13e' => 'unlock-alt',
379
+ 'f093' => 'upload',
380
+ 'f155' => 'usd',
381
+ 'f007' => 'user',
382
+ 'f0f0' => 'user-md',
383
+ 'f0c0' => 'users',
384
+ 'f03d' => 'video-camera',
385
+ 'f194' => 'vimeo-square',
386
+ 'f189' => 'vk',
387
+ 'f027' => 'volume-down',
388
+ 'f026' => 'volume-off',
389
+ 'f028' => 'volume-up',
390
+ 'f18a' => 'weibo',
391
+ 'f193' => 'wheelchair',
392
+ 'f17a' => 'windows',
393
+ 'f0ad' => 'wrench',
394
+ 'f168' => 'xing',
395
+ 'f169' => 'xing-square',
396
+ 'f167' => 'youtube',
397
+ 'f16a' => 'youtube-play',
398
+ 'f166' => 'youtube-square'
399
+ ),
400
+ 'awesome_icons2' => array(
401
+ '\f042' => 'adjust',
402
+ '\f170' => 'adn',
403
+ '\f037' => 'align-center',
404
+ '\f039' => 'align-justify',
405
+ '\f036' => 'align-left',
406
+ '\f038' => 'align-right',
407
+ '\f0f9' => 'ambulance',
408
+ '\f13d' => 'anchor',
409
+ '\f17b' => 'android',
410
+ '\f209' => 'angellist',
411
+ '\f103' => 'angle-double-down',
412
+ '\f100' => 'angle-double-left',
413
+ '\f101' => 'angle-double-right',
414
+ '\f102' => 'angle-double-up',
415
+ '\f107' => 'angle-down',
416
+ '\f104' => 'angle-left',
417
+ '\f105' => 'angle-right',
418
+ '\f106' => 'angle-up',
419
+ '\f179' => 'apple',
420
+ '\f187' => 'archive',
421
+ '\f1fe' => 'area-chart',
422
+ '\f0ab' => 'arrow-circle-down',
423
+ '\f0a8' => 'arrow-circle-left',
424
+ '\f01a' => 'arrow-circle-o-down',
425
+ '\f190' => 'arrow-circle-o-left',
426
+ '\f18e' => 'arrow-circle-o-right',
427
+ '\f01b' => 'arrow-circle-o-up',
428
+ '\f0a9' => 'arrow-circle-right',
429
+ '\f0aa' => 'arrow-circle-up',
430
+ '\f063' => 'arrow-down',
431
+ '\f060' => 'arrow-left',
432
+ '\f061' => 'arrow-right',
433
+ '\f062' => 'arrow-up',
434
+ '\f047' => 'arrows',
435
+ '\f0b2' => 'arrows-alt',
436
+ '\f07e' => 'arrows-h',
437
+ '\f07d' => 'arrows-v',
438
+ '\f069' => 'asterisk',
439
+ '\f1fa' => 'at',
440
+ '\f1b9' => 'automobile',
441
+ '\f04a' => 'backward',
442
+ '\f05e' => 'ban',
443
+ '\f19c' => 'bank',
444
+ '\f080' => 'bar-chart',
445
+ '\f080' => 'bar-chart-o',
446
+ '\f02a' => 'barcode',
447
+ '\f0c9' => 'bars',
448
+ '\f236' => 'bed',
449
+ '\f0fc' => 'beer',
450
+ '\f1b4' => 'behance',
451
+ '\f1b5' => 'behance-square',
452
+ '\f0f3' => 'bell',
453
+ '\f0a2' => 'bell-o',
454
+ '\f1f6' => 'bell-slash',
455
+ '\f1f7' => 'bell-slash-o',
456
+ '\f206' => 'bicycle',
457
+ '\f1e5' => 'binoculars',
458
+ '\f1fd' => 'birthday-cake',
459
+ '\f171' => 'bitbucket',
460
+ '\f172' => 'bitbucket-square',
461
+ '\f15a' => 'bitcoin',
462
+ '\f032' => 'bold',
463
+ '\f0e7' => 'bolt',
464
+ '\f1e2' => 'bomb',
465
+ '\f02d' => 'book',
466
+ '\f02e' => 'bookmark',
467
+ '\f097' => 'bookmark-o',
468
+ '\f0b1' => 'briefcase',
469
+ '\f15a' => 'btc',
470
+ '\f188' => 'bug',
471
+ '\f1ad' => 'building',
472
+ '\f0f7' => 'building-o',
473
+ '\f0a1' => 'bullhorn',
474
+ '\f140' => 'bullseye',
475
+ '\f207' => 'bus',
476
+ '\f20d' => 'buysellads',
477
+ '\f1ba' => 'cab',
478
+ '\f1ec' => 'calculator',
479
+ '\f073' => 'calendar',
480
+ '\f133' => 'calendar-o',
481
+ '\f030' => 'camera',
482
+ '\f083' => 'camera-retro',
483
+ '\f1b9' => 'car',
484
+ '\f0d7' => 'caret-down',
485
+ '\f0d9' => 'caret-left',
486
+ '\f0da' => 'caret-right',
487
+ '\f150' => 'caret-square-o-down',
488
+ '\f191' => 'caret-square-o-left',
489
+ '\f152' => 'caret-square-o-right',
490
+ '\f151' => 'caret-square-o-up',
491
+ '\f0d8' => 'caret-up',
492
+ '\f218' => 'cart-arrow-down',
493
+ '\f217' => 'cart-plus',
494
+ '\f20a' => 'cc',
495
+ '\f1f3' => 'cc-amex',
496
+ '\f1f2' => 'cc-discover',
497
+ '\f1f1' => 'cc-mastercard',
498
+ '\f1f4' => 'cc-paypal',
499
+ '\f1f5' => 'cc-stripe',
500
+ '\f1f0' => 'cc-visa',
501
+ '\f0a3' => 'certificate',
502
+ '\f0c1' => 'chain',
503
+ '\f127' => 'chain-broken',
504
+ '\f00c' => 'check',
505
+ '\f058' => 'check-circle',
506
+ '\f05d' => 'check-circle-o',
507
+ '\f14a' => 'check-square',
508
+ '\f046' => 'check-square-o',
509
+ '\f13a' => 'chevron-circle-down',
510
+ '\f137' => 'chevron-circle-left',
511
+ '\f138' => 'chevron-circle-right',
512
+ '\f139' => 'chevron-circle-up',
513
+ '\f078' => 'chevron-down',
514
+ '\f053' => 'chevron-left',
515
+ '\f054' => 'chevron-right',
516
+ '\f077' => 'chevron-up',
517
+ '\f1ae' => 'child',
518
+ '\f111' => 'circle',
519
+ '\f10c' => 'circle-o',
520
+ '\f1ce' => 'circle-o-notch',
521
+ '\f1db' => 'circle-thin',
522
+ '\f0ea' => 'clipboard',
523
+ '\f017' => 'clock-o',
524
+ '\f00d' => 'close',
525
+ '\f0c2' => 'cloud',
526
+ '\f0ed' => 'cloud-download',
527
+ '\f0ee' => 'cloud-upload',
528
+ '\f157' => 'cny',
529
+ '\f121' => 'code',
530
+ '\f126' => 'code-fork',
531
+ '\f1cb' => 'codepen',
532
+ '\f0f4' => 'coffee',
533
+ '\f013' => 'cog',
534
+ '\f085' => 'cogs',
535
+ '\f0db' => 'columns',
536
+ '\f075' => 'comment',
537
+ '\f0e5' => 'comment-o',
538
+ '\f086' => 'comments',
539
+ '\f0e6' => 'comments-o',
540
+ '\f14e' => 'compass',
541
+ '\f066' => 'compress',
542
+ '\f20e' => 'connectdevelop',
543
+ '\f0c5' => 'copy',
544
+ '\f1f9' => 'copyright',
545
+ '\f09d' => 'credit-card',
546
+ '\f125' => 'crop',
547
+ '\f05b' => 'crosshairs',
548
+ '\f13c' => 'css3',
549
+ '\f1b2' => 'cube',
550
+ '\f1b3' => 'cubes',
551
+ '\f0c4' => 'cut',
552
+ '\f0f5' => 'cutlery',
553
+ '\f0e4' => 'dashboard',
554
+ '\f210' => 'dashcube',
555
+ '\f1c0' => 'database',
556
+ '\f03b' => 'dedent',
557
+ '\f1a5' => 'delicious',
558
+ '\f108' => 'desktop',
559
+ '\f1bd' => 'deviantart',
560
+ '\f219' => 'diamond',
561
+ '\f1a6' => 'digg',
562
+ '\f155' => 'dollar',
563
+ '\f192' => 'dot-circle-o',
564
+ '\f019' => 'download',
565
+ '\f17d' => 'dribbble',
566
+ '\f16b' => 'dropbox',
567
+ '\f1a9' => 'drupal',
568
+ '\f044' => 'edit',
569
+ '\f052' => 'eject',
570
+ '\f141' => 'ellipsis-h',
571
+ '\f142' => 'ellipsis-v',
572
+ '\f1d1' => 'empire',
573
+ '\f0e0' => 'envelope',
574
+ '\f003' => 'envelope-o',
575
+ '\f199' => 'envelope-square',
576
+ '\f12d' => 'eraser',
577
+ '\f153' => 'eur',
578
+ '\f153' => 'euro',
579
+ '\f0ec' => 'exchange',
580
+ '\f12a' => 'exclamation',
581
+ '\f06a' => 'exclamation-circle',
582
+ '\f071' => 'exclamation-triangle',
583
+ '\f065' => 'expand',
584
+ '\f08e' => 'external-link',
585
+ '\f14c' => 'external-link-square',
586
+ '\f06e' => 'eye',
587
+ '\f070' => 'eye-slash',
588
+ '\f1fb' => 'eyedropper',
589
+ '\f09a' => 'facebook',
590
+ '\f09a' => 'facebook-f',
591
+ '\f230' => 'facebook-official',
592
+ '\f082' => 'facebook-square',
593
+ '\f049' => 'fast-backward',
594
+ '\f050' => 'fast-forward',
595
+ '\f1ac' => 'fax',
596
+ '\f182' => 'female',
597
+ '\f0fb' => 'fighter-jet',
598
+ '\f15b' => 'file',
599
+ '\f1c6' => 'file-archive-o',
600
+ '\f1c7' => 'file-audio-o',
601
+ '\f1c9' => 'file-code-o',
602
+ '\f1c3' => 'file-excel-o',
603
+ '\f1c5' => 'file-image-o',
604
+ '\f1c8' => 'file-movie-o',
605
+ '\f016' => 'file-o',
606
+ '\f1c1' => 'file-pdf-o',
607
+ '\f1c5' => 'file-photo-o',
608
+ '\f1c5' => 'file-picture-o',
609
+ '\f1c4' => 'file-powerpoint-o',
610
+ '\f1c7' => 'file-sound-o',
611
+ '\f15c' => 'file-text',
612
+ '\f0f6' => 'file-text-o',
613
+ '\f1c8' => 'file-video-o',
614
+ '\f1c2' => 'file-word-o',
615
+ '\f1c6' => 'file-zip-o',
616
+ '\f0c5' => 'files-o',
617
+ '\f008' => 'film',
618
+ '\f0b0' => 'filter',
619
+ '\f06d' => 'fire',
620
+ '\f134' => 'fire-extinguisher',
621
+ '\f024' => 'flag',
622
+ '\f11e' => 'flag-checkered',
623
+ '\f11d' => 'flag-o',
624
+ '\f0e7' => 'flash',
625
+ '\f0c3' => 'flask',
626
+ '\f16e' => 'flickr',
627
+ '\f0c7' => 'floppy-o',
628
+ '\f07b' => 'folder',
629
+ '\f114' => 'folder-o',
630
+ '\f07c' => 'folder-open',
631
+ '\f115' => 'folder-open-o',
632
+ '\f031' => 'font',
633
+ '\f211' => 'forumbee',
634
+ '\f04e' => 'forward',
635
+ '\f180' => 'foursquare',
636
+ '\f119' => 'frown-o',
637
+ '\f1e3' => 'futbol-o',
638
+ '\f11b' => 'gamepad',
639
+ '\f0e3' => 'gavel',
640
+ '\f154' => 'gbp',
641
+ '\f1d1' => 'ge',
642
+ '\f013' => 'gear',
643
+ '\f085' => 'gears',
644
+ '\f1db' => 'genderless',
645
+ '\f06b' => 'gift',
646
+ '\f1d3' => 'git',
647
+ '\f1d2' => 'git-square',
648
+ '\f09b' => 'github',
649
+ '\f113' => 'github-alt',
650
+ '\f092' => 'github-square',
651
+ '\f184' => 'gittip',
652
+ '\f000' => 'glass',
653
+ '\f0ac' => 'globe',
654
+ '\f1a0' => 'google',
655
+ '\f0d5' => 'google-plus',
656
+ '\f0d4' => 'google-plus-square',
657
+ '\f1ee' => 'google-wallet',
658
+ '\f19d' => 'graduation-cap',
659
+ '\f184' => 'gratipay',
660
+ '\f0c0' => 'group',
661
+ '\f0fd' => 'h-square',
662
+ '\f1d4' => 'hacker-news',
663
+ '\f0a7' => 'hand-o-down',
664
+ '\f0a5' => 'hand-o-left',
665
+ '\f0a4' => 'hand-o-right',
666
+ '\f0a6' => 'hand-o-up',
667
+ '\f0a0' => 'hdd-o',
668
+ '\f1dc' => 'header',
669
+ '\f025' => 'headphones',
670
+ '\f004' => 'heart',
671
+ '\f08a' => 'heart-o',
672
+ '\f21e' => 'heartbeat',
673
+ '\f1da' => 'history',
674
+ '\f015' => 'home',
675
+ '\f0f8' => 'hospital-o',
676
+ '\f236' => 'hotel',
677
+ '\f13b' => 'html5',
678
+ '\f20b' => 'ils',
679
+ '\f03e' => 'image',
680
+ '\f01c' => 'inbox',
681
+ '\f03c' => 'indent',
682
+ '\f129' => 'info',
683
+ '\f05a' => 'info-circle',
684
+ '\f156' => 'inr',
685
+ '\f16d' => 'instagram',
686
+ '\f19c' => 'institution',
687
+ '\f208' => 'ioxhost',
688
+ '\f033' => 'italic',
689
+ '\f1aa' => 'joomla',
690
+ '\f157' => 'jpy',
691
+ '\f1cc' => 'jsfiddle',
692
+ '\f084' => 'key',
693
+ '\f11c' => 'keyboard-o',
694
+ '\f159' => 'krw',
695
+ '\f1ab' => 'language',
696
+ '\f109' => 'laptop',
697
+ '\f202' => 'lastfm',
698
+ '\f203' => 'lastfm-square',
699
+ '\f06c' => 'leaf',
700
+ '\f212' => 'leanpub',
701
+ '\f0e3' => 'legal',
702
+ '\f094' => 'lemon-o',
703
+ '\f149' => 'level-down',
704
+ '\f148' => 'level-up',
705
+ '\f1cd' => 'life-bouy',
706
+ '\f1cd' => 'life-buoy',
707
+ '\f1cd' => 'life-ring',
708
+ '\f1cd' => 'life-saver',
709
+ '\f0eb' => 'lightbulb-o',
710
+ '\f201' => 'line-chart',
711
+ '\f0c1' => 'link',
712
+ '\f0e1' => 'linkedin',
713
+ '\f08c' => 'linkedin-square',
714
+ '\f17c' => 'linux',
715
+ '\f03a' => 'list',
716
+ '\f022' => 'list-alt',
717
+ '\f0cb' => 'list-ol',
718
+ '\f0ca' => 'list-ul',
719
+ '\f124' => 'location-arrow',
720
+ '\f023' => 'lock',
721
+ '\f175' => 'long-arrow-down',
722
+ '\f177' => 'long-arrow-left',
723
+ '\f178' => 'long-arrow-right',
724
+ '\f176' => 'long-arrow-up',
725
+ '\f0d0' => 'magic',
726
+ '\f076' => 'magnet',
727
+ '\f064' => 'mail-forward',
728
+ '\f112' => 'mail-reply',
729
+ '\f122' => 'mail-reply-all',
730
+ '\f183' => 'male',
731
+ '\f041' => 'map-marker',
732
+ '\f222' => 'mars',
733
+ '\f227' => 'mars-double',
734
+ '\f229' => 'mars-stroke',
735
+ '\f22b' => 'mars-stroke-h',
736
+ '\f22a' => 'mars-stroke-v',
737
+ '\f136' => 'maxcdn',
738
+ '\f20c' => 'meanpath',
739
+ '\f23a' => 'medium',
740
+ '\f0fa' => 'medkit',
741
+ '\f11a' => 'meh-o',
742
+ '\f223' => 'mercury',
743
+ '\f130' => 'microphone',
744
+ '\f131' => 'microphone-slash',
745
+ '\f068' => 'minus',
746
+ '\f056' => 'minus-circle',
747
+ '\f146' => 'minus-square',
748
+ '\f147' => 'minus-square-o',
749
+ '\f10b' => 'mobile',
750
+ '\f10b' => 'mobile-phone',
751
+ '\f0d6' => 'money',
752
+ '\f186' => 'moon-o',
753
+ '\f19d' => 'mortar-board',
754
+ '\f21c' => 'motorcycle',
755
+ '\f001' => 'music',
756
+ '\f0c9' => 'navicon',
757
+ '\f22c' => 'neuter',
758
+ '\f1ea' => 'newspaper-o',
759
+ '\f19b' => 'openid',
760
+ '\f03b' => 'outdent',
761
+ '\f18c' => 'pagelines',
762
+ '\f1fc' => 'paint-brush',
763
+ '\f1d8' => 'paper-plane',
764
+ '\f1d9' => 'paper-plane-o',
765
+ '\f0c6' => 'paperclip',
766
+ '\f1dd' => 'paragraph',
767
+ '\f0ea' => 'paste',
768
+ '\f04c' => 'pause',
769
+ '\f1b0' => 'paw',
770
+ '\f1ed' => 'paypal',
771
+ '\f040' => 'pencil',
772
+ '\f14b' => 'pencil-square',
773
+ '\f044' => 'pencil-square-o',
774
+ '\f095' => 'phone',
775
+ '\f098' => 'phone-square',
776
+ '\f03e' => 'photo',
777
+ '\f03e' => 'picture-o',
778
+ '\f200' => 'pie-chart',
779
+ '\f1a7' => 'pied-piper',
780
+ '\f1a8' => 'pied-piper-alt',
781
+ '\f0d2' => 'pinterest',
782
+ '\f231' => 'pinterest-p',
783
+ '\f0d3' => 'pinterest-square',
784
+ '\f072' => 'plane',
785
+ '\f04b' => 'play',
786
+ '\f144' => 'play-circle',
787
+ '\f01d' => 'play-circle-o',
788
+ '\f1e6' => 'plug',
789
+ '\f067' => 'plus',
790
+ '\f055' => 'plus-circle',
791
+ '\f0fe' => 'plus-square',
792
+ '\f196' => 'plus-square-o',
793
+ '\f011' => 'power-off',
794
+ '\f02f' => 'print',
795
+ '\f12e' => 'puzzle-piece',
796
+ '\f1d6' => 'qq',
797
+ '\f029' => 'qrcode',
798
+ '\f128' => 'question',
799
+ '\f059' => 'question-circle',
800
+ '\f10d' => 'quote-left',
801
+ '\f10e' => 'quote-right',
802
+ '\f1d0' => 'ra',
803
+ '\f074' => 'random',
804
+ '\f1d0' => 'rebel',
805
+ '\f1b8' => 'recycle',
806
+ '\f1a1' => 'reddit',
807
+ '\f1a2' => 'reddit-square',
808
+ '\f021' => 'refresh',
809
+ '\f00d' => 'remove',
810
+ '\f18b' => 'renren',
811
+ '\f0c9' => 'reorder',
812
+ '\f01e' => 'repeat',
813
+ '\f112' => 'reply',
814
+ '\f122' => 'reply-all',
815
+ '\f079' => 'retweet',
816
+ '\f157' => 'rmb',
817
+ '\f018' => 'road',
818
+ '\f135' => 'rocket',
819
+ '\f0e2' => 'rotate-left',
820
+ '\f01e' => 'rotate-right',
821
+ '\f158' => 'rouble',
822
+ '\f09e' => 'rss',
823
+ '\f143' => 'rss-square',
824
+ '\f158' => 'rub',
825
+ '\f158' => 'ruble',
826
+ '\f156' => 'rupee',
827
+ '\f0c7' => 'save',
828
+ '\f0c4' => 'scissors',
829
+ '\f002' => 'search',
830
+ '\f010' => 'search-minus',
831
+ '\f00e' => 'search-plus',
832
+ '\f213' => 'sellsy',
833
+ '\f1d8' => 'send',
834
+ '\f1d9' => 'send-o',
835
+ '\f233' => 'server',
836
+ '\f064' => 'share',
837
+ '\f1e0' => 'share-alt',
838
+ '\f1e1' => 'share-alt-square',
839
+ '\f14d' => 'share-square',
840
+ '\f045' => 'share-square-o',
841
+ '\f20b' => 'shekel',
842
+ '\f20b' => 'sheqel',
843
+ '\f132' => 'shield',
844
+ '\f21a' => 'ship',
845
+ '\f214' => 'shirtsinbulk',
846
+ '\f07a' => 'shopping-cart',
847
+ '\f090' => 'sign-in',
848
+ '\f08b' => 'sign-out',
849
+ '\f012' => 'signal',
850
+ '\f215' => 'simplybuilt',
851
+ '\f0e8' => 'sitemap',
852
+ '\f216' => 'skyatlas',
853
+ '\f17e' => 'skype',
854
+ '\f198' => 'slack',
855
+ '\f1de' => 'sliders',
856
+ '\f1e7' => 'slideshare',
857
+ '\f118' => 'smile-o',
858
+ '\f1e3' => 'soccer-ball-o',
859
+ '\f0dc' => 'sort',
860
+ '\f15d' => 'sort-alpha-asc',
861
+ '\f15e' => 'sort-alpha-desc',
862
+ '\f160' => 'sort-amount-asc',
863
+ '\f161' => 'sort-amount-desc',
864
+ '\f0de' => 'sort-asc',
865
+ '\f0dd' => 'sort-desc',
866
+ '\f0dd' => 'sort-down',
867
+ '\f162' => 'sort-numeric-asc',
868
+ '\f163' => 'sort-numeric-desc',
869
+ '\f0de' => 'sort-up',
870
+ '\f1be' => 'soundcloud',
871
+ '\f197' => 'space-shuttle',
872
+ '\f110' => 'spinner',
873
+ '\f1b1' => 'spoon',
874
+ '\f1bc' => 'spotify',
875
+ '\f0c8' => 'square',
876
+ '\f096' => 'square-o',
877
+ '\f18d' => 'stack-exchange',
878
+ '\f16c' => 'stack-overflow',
879
+ '\f005' => 'star',
880
+ '\f089' => 'star-half',
881
+ '\f123' => 'star-half-empty',
882
+ '\f123' => 'star-half-full',
883
+ '\f123' => 'star-half-o',
884
+ '\f006' => 'star-o',
885
+ '\f1b6' => 'steam',
886
+ '\f1b7' => 'steam-square',
887
+ '\f048' => 'step-backward',
888
+ '\f051' => 'step-forward',
889
+ '\f0f1' => 'stethoscope',
890
+ '\f04d' => 'stop',
891
+ '\f21d' => 'street-view',
892
+ '\f0cc' => 'strikethrough',
893
+ '\f1a4' => 'stumbleupon',
894
+ '\f1a3' => 'stumbleupon-circle',
895
+ '\f12c' => 'subscript',
896
+ '\f239' => 'subway',
897
+ '\f0f2' => 'suitcase',
898
+ '\f185' => 'sun-o',
899
+ '\f12b' => 'superscript',
900
+ '\f1cd' => 'support',
901
+ '\f0ce' => 'table',
902
+ '\f10a' => 'tablet',
903
+ '\f0e4' => 'tachometer',
904
+ '\f02b' => 'tag',
905
+ '\f02c' => 'tags',
906
+ '\f0ae' => 'tasks',
907
+ '\f1ba' => 'taxi',
908
+ '\f1d5' => 'tencent-weibo',
909
+ '\f120' => 'terminal',
910
+ '\f034' => 'text-height',
911
+ '\f035' => 'text-width',
912
+ '\f00a' => 'th',
913
+ '\f009' => 'th-large',
914
+ '\f00b' => 'th-list',
915
+ '\f08d' => 'thumb-tack',
916
+ '\f165' => 'thumbs-down',
917
+ '\f088' => 'thumbs-o-down',
918
+ '\f087' => 'thumbs-o-up',
919
+ '\f164' => 'thumbs-up',
920
+ '\f145' => 'ticket',
921
+ '\f00d' => 'times',
922
+ '\f057' => 'times-circle',
923
+ '\f05c' => 'times-circle-o',
924
+ '\f043' => 'tint',
925
+ '\f150' => 'toggle-down',
926
+ '\f191' => 'toggle-left',
927
+ '\f204' => 'toggle-off',
928
+ '\f205' => 'toggle-on',
929
+ '\f152' => 'toggle-right',
930
+ '\f151' => 'toggle-up',
931
+ '\f238' => 'train',
932
+ '\f224' => 'transgender',
933
+ '\f225' => 'transgender-alt',
934
+ '\f1f8' => 'trash',
935
+ '\f014' => 'trash-o',
936
+ '\f1bb' => 'tree',
937
+ '\f181' => 'trello',
938
+ '\f091' => 'trophy',
939
+ '\f0d1' => 'truck',
940
+ '\f195' => 'try',
941
+ '\f1e4' => 'tty',
942
+ '\f173' => 'tumblr',
943
+ '\f174' => 'tumblr-square',
944
+ '\f195' => 'turkish-lira',
945
+ '\f1e8' => 'twitch',
946
+ '\f099' => 'twitter',
947
+ '\f081' => 'twitter-square',
948
+ '\f0e9' => 'umbrella',
949
+ '\f0cd' => 'underline',
950
+ '\f0e2' => 'undo',
951
+ '\f19c' => 'university',
952
+ '\f127' => 'unlink',
953
+ '\f09c' => 'unlock',
954
+ '\f13e' => 'unlock-alt',
955
+ '\f0dc' => 'unsorted',
956
+ '\f093' => 'upload',
957
+ '\f155' => 'usd',
958
+ '\f007' => 'user',
959
+ '\f0f0' => 'user-md',
960
+ '\f234' => 'user-plus',
961
+ '\f21b' => 'user-secret',
962
+ '\f235' => 'user-times',
963
+ '\f0c0' => 'users',
964
+ '\f221' => 'venus',
965
+ '\f226' => 'venus-double',
966
+ '\f228' => 'venus-mars',
967
+ '\f237' => 'viacoin',
968
+ '\f03d' => 'video-camera',
969
+ '\f194' => 'vimeo-square',
970
+ '\f1ca' => 'vine',
971
+ '\f189' => 'vk',
972
+ '\f027' => 'volume-down',
973
+ '\f026' => 'volume-off',
974
+ '\f028' => 'volume-up',
975
+ '\f071' => 'warning',
976
+ '\f1d7' => 'wechat',
977
+ '\f18a' => 'weibo',
978
+ '\f1d7' => 'weixin',
979
+ '\f232' => 'whatsapp',
980
+ '\f193' => 'wheelchair',
981
+ '\f1eb' => 'wifi',
982
+ '\f17a' => 'windows',
983
+ '\f159' => 'won',
984
+ '\f19a' => 'wordpress',
985
+ '\f0ad' => 'wrench',
986
+ '\f168' => 'xing',
987
+ '\f169' => 'xing-square',
988
+ '\f19e' => 'yahoo',
989
+ '\f1e9' => 'yelp',
990
+ '\f157' => 'yen',
991
+ '\f167' => 'youtube',
992
+ '\f16a' => 'youtube-play',
993
+ '\f166' => 'youtube-square',
994
+ ),
995
+
996
+ 'awesome_icons_socials' =>array(
997
+ 'f170' => 'adn',
998
+ 'f17b' => 'android',
999
+ 'f179' => 'apple',
1000
+ 'f171' => 'bitbucket',
1001
+ 'f171' => 'bitbucket-square',
1002
+ 'f02e' => 'bookmark',
1003
+ 'f097' => 'bookmark-o',
1004
+ 'f15a' => 'btc',
1005
+ 'f13c' => 'css3',
1006
+ 'f17d' => 'dribble',
1007
+ 'f16b' => 'dropbox',
1008
+ 'f09a' => 'facebook',
1009
+ 'f082' => 'facebook-square',
1010
+ 'f16e' => 'flickr',
1011
+ 'f180' => 'foursquare',
1012
+ 'f09b'=> 'github' ,
1013
+ 'f113'=> 'github-alt',
1014
+ 'f092' => 'github-square',
1015
+ 'f184' => 'gittip',
1016
+ 'f0d5' => 'google-plus',
1017
+ 'f0d4' => 'google-plus-square',
1018
+ 'f13b' => 'html5',
1019
+ 'f16d' => 'instagram',
1020
+ 'f0e1' => 'linkedin',
1021
+ 'f08c' => 'linkedin-square',
1022
+ 'f17c' => 'Linux',
1023
+ 'f136' => 'maxcdn',
1024
+ 'f18c' => 'pagelines',
1025
+ 'f0d2' => 'pinterest',
1026
+ 'f0d3' => 'pinterest-square',
1027
+ 'f18b' => 'renren',
1028
+ 'f09e' => 'rss',
1029
+ 'f17e' => 'skype',
1030
+ 'f18d' => 'stack-exchange',
1031
+ 'f16c' => 'stack-overflow',
1032
+ 'f181' => 'trello',
1033
+ 'f173' => 'tumblr',
1034
+ 'f174' => 'Tumblr Square',
1035
+ 'f099' => 'twitter',
1036
+ 'f081' => 'twitter-square',
1037
+ 'f194' => 'vimeo-square',
1038
+ 'f189' => 'vk',
1039
+ 'f18a' => 'weibo',
1040
+ 'f17a' => 'windows',
1041
+ 'f168' => 'xing',
1042
+ 'f169' => 'xing-square',
1043
+ 'f167' => 'youtube'
1044
+ ),
1045
+ 'header_backgrounds' => array(),
1046
+ 'body_backgrounds' => array(),
1047
+
1048
+ // tags used in theme options (e.g. %tag%) to have some common informations
1049
+ 'tag' => array( //'themeurl' => get_template_directory_uri()
1050
+ ),
1051
+
1052
+ 'cycle_fx' => array(
1053
+ 'blindX' => 'blindX', 'blindY' => 'blindY', 'blindZ' => 'blindZ', 'cover' => 'cover', 'curtainX' => 'curtainX',
1054
+ 'curtainY' => 'curtainY', 'fade' => 'fade', 'fadeZoom' => 'fadeZoom', 'growX' => 'growX', 'growY' => 'growY',
1055
+ 'scrollUp' => 'scrollUp', 'scrollDown' => 'scrollDown', 'scrollLeft' => 'scrollLeft', 'scrollRight' => 'scrollRight', 'scrollHorz' => 'scrollHorz',
1056
+ 'shuffle' => 'shuffle', 'slideX' => 'slideX', 'slideY' => 'slideY', 'toss' => 'toss', 'turnUp' => 'turnUp',
1057
+ 'turnLeft' => 'turnLeft', 'turnRight' => 'turnRight', 'uncover' => 'uncover', 'wipe' => 'wipe', 'zoom' => 'zoom',
1058
+ 'none' => 'none', 'turnDown' => 'turnDown', 'scrollVert' => 'scrollVert'
1059
+ ),
1060
+
1061
+ 'animate' => array(
1062
+ '' => "none",
1063
+ "bounce" => "bounce",
1064
+ "flash" =>"flash",
1065
+ "pulse" =>"pulse",
1066
+ //"rubberBand"=>"rubberBand",
1067
+ "shake" =>"shake",
1068
+ "swing"=>"swing",
1069
+ "tada" =>"tada",
1070
+ "wobble"=>"wobble",
1071
+ "bounceIn"=>"bounceIn",
1072
+ "bounceInDown"=>"bounceInDown",
1073
+ "bounceInLeft"=>"bounceInLeft",
1074
+ "bounceInRight"=>"bounceInRight",
1075
+ "bounceInUp"=>"bounceInUp",
1076
+ "fadeIn"=>"fadeIn",
1077
+ "fadeInDown"=>"fadeInDown",
1078
+ "fadeInDownBig"=>"fadeInDownBig",
1079
+ "fadeInLeft"=>"fadeInLeft",
1080
+ "fadeInLeftBig"=>"fadeInLeftBig",
1081
+ "fadeInRight"=>"fadeInRight",
1082
+ "fadeInRightBig"=>"fadeInRightBig",
1083
+ "fadeInUp"=>"fadeInUp",
1084
+ "fadeInUpBig"=>"fadeInUpBig",
1085
+ "flip"=>"flip",
1086
+ "flipInX"=>"flipInX",
1087
+ "flipInY"=>"flipInY",
1088
+ "lightSpeedIn"=>"lightSpeedIn",
1089
+ "rotateIn"=>"rotateIn",
1090
+ "rotateInDownLeft"=>"rotateInDownLeft",
1091
+ "rotateInDownRight"=>"rotateInDownRight",
1092
+ "rotateInUpLeft"=>"rotateInUpLeft",
1093
+ "rotateInUpRight"=>"rotateInUpRight",
1094
+ //"slideInDown"=>"slideInDown",
1095
+ //"slideInLeft"=>"slideInLeft",
1096
+ //"slideInRight"=>"slideInRight",
1097
+ "rollIn"=>"rollIn",
1098
+ ),
1099
+
1100
+ 'easings' => array(
1101
+ FALSE => 'none',
1102
+ 'easeInQuad' => 'easeInQuad',
1103
+ 'easeOutQuad' => 'easeOutQuad',
1104
+ 'easeInOutQuad' => 'easeInOutQuad',
1105
+ 'easeInCubic' => 'easeInCubic',
1106
+ 'easeOutCubic' => 'easeOutCubic',
1107
+ 'easeInOutCubic' => 'easeInOutCubic',
1108
+ 'easeInQuart' => 'easeInQuart',
1109
+ 'easeOutQuart' => 'easeOutQuart',
1110
+ 'easeInOutQuart' => 'easeInOutQuart',
1111
+ 'easeInQuint' => 'easeInQuint',
1112
+ 'easeOutQuint' => 'easeOutQuint',
1113
+ 'easeInOutQuint' => 'easeInOutQuint',
1114
+ 'easeInSine' => 'easeInSine',
1115
+ 'easeOutSine' => 'easeOutSine',
1116
+ 'easeInOutSine' => 'easeInOutSine',
1117
+ 'easeInExpo' => 'easeInExpo',
1118
+ 'easeOutExpo' => 'easeOutExpo',
1119
+ 'easeInOutExpo' => 'easeInOutExpo',
1120
+ 'easeInCirc' => 'easeInCirc',
1121
+ 'easeOutCirc' => 'easeOutCirc',
1122
+ 'easeInOutCirc' => 'easeInOutCirc',
1123
+ 'easeInElastic' => 'easeInElastic',
1124
+ 'easeOutElastic' => 'easeOutElastic',
1125
+ 'easeInOutElastic' => 'easeInOutElastic',
1126
+ 'easeInBack' => 'easeInBack',
1127
+ 'easeOutBack' => 'easeOutBack',
1128
+ 'easeInOutBack' => 'easeInOutBack',
1129
+ 'easeInBounce' => 'easeInBounce',
1130
+ 'easeOutBounce' => 'easeOutBounce',
1131
+ 'easeInOutBounce' => 'easeInOutBounce'
1132
+ )
1133
+ );
1134
+
1135
+ /**
1136
+ * Get configuration array
1137
+ *
1138
+ * @return array
1139
+ */
1140
+ public static function load() {
1141
+ self::_loadThemeInfo();
1142
+ //ksort( self::$_config['awesome_icons'] );
1143
+
1144
+ return self::$_config;
1145
+ }
1146
+
1147
+ /**
1148
+ * Return theme data
1149
+ *
1150
+ * First the method checks if the wp_get_theme() function exists (WP 3.4.0 at least).
1151
+ * If not, the method calls the deprecated function get_template_directory()
1152
+ *
1153
+ * @return array
1154
+ */
1155
+ protected static function _loadThemeInfo() {
1156
+ $theme = wp_get_theme();
1157
+
1158
+ self::$_config['theme'] = array(
1159
+ 'name' => $theme->Name,
1160
+ 'description' => $theme->Description,
1161
+ 'author' => $theme->Author,
1162
+ 'authoruri' => $theme->{'Author URI'},
1163
+ 'version' => $theme->Version,
1164
+ 'template' => $theme->Template,
1165
+ 'status' => $theme->Status,
1166
+ 'tags' => $theme->Tags
1167
+ );
1168
+ }
1169
+
1170
+
1171
+ public function init() {
1172
+ self::$_config['header_backgrounds'] = apply_filters( 'yit_header_backgrounds', self::$_config['header_backgrounds'] );
1173
+ self::$_config['body_backgrounds'] = apply_filters( 'yit_body_backgrounds', self::$_config['body_backgrounds'] );
1174
+ }
1175
+
1176
+ /**
1177
+ * Return the font awesome array icon
1178
+ *
1179
+ * @return string Array
1180
+ * @access public
1181
+ * @since 1.0.0
1182
+ */
1183
+ public static function get_awesome_icons() {
1184
+ return self::$_config['awesome_icons'];
1185
+ }
1186
+
1187
+ /**
1188
+ * Return the font awesome array socials icon
1189
+ *
1190
+ * @return string Array
1191
+ * @access public
1192
+ * @since 1.0.0
1193
+ */
1194
+ public static function get_awesome_icons_socials() {
1195
+ return self::$_config['awesome_icons_socials'];
1196
+ }
1197
+
1198
+
1199
+ /**
1200
+ * Return the list of icons
1201
+ *
1202
+ * @return string Array
1203
+ * @access public
1204
+ * @since 1.0.0
1205
+ */
1206
+ public static function get_icon_list() {
1207
+
1208
+ $standard_icon_list = array(
1209
+ 'FontAwesome' => self::$_config['awesome_icons2']
1210
+ );
1211
+
1212
+ return apply_filters( 'yit_icon_list', $standard_icon_list );
1213
+ }
1214
+
1215
+ /**
1216
+ * Return the data of icon
1217
+ *
1218
+ * @return string Array
1219
+ * @access public
1220
+ * @since 1.0.0
1221
+ */
1222
+ public static function get_icon( $icon ) {
1223
+
1224
+ $icon_list = self::get_icon_list();
1225
+ $icon_data = '';
1226
+ if ( $icon != '' ) {
1227
+ $ic = explode( ':', $icon );
1228
+ $icon_code = array_search( $ic[1], $icon_list[$ic[0]] );
1229
+
1230
+ if( $icon_code ){
1231
+ $icon_code = ( strpos( $icon_code, '\\' ) === 0 ) ? '&#x' . substr( $icon_code, 1 ) . ';' : $icon_code;
1232
+ }
1233
+
1234
+ $icon_data = 'data-font="' . $ic[0] . '" data-key="' . $ic[1] . '" data-icon="' . $icon_code . '"';
1235
+ }
1236
+
1237
+ return $icon_data;
1238
+ }
1239
+
1240
+
1241
+ /*
1242
+ * Return the code of the relative awesome class name
1243
+ *
1244
+ * @return string
1245
+ * @access public
1246
+ * @since 1.0.0
1247
+ */
1248
+ public static function get_awesome_icons_code_by_value($class){
1249
+ $awesome_icons=self::$_config['awesome_icons'];
1250
+ foreach($awesome_icons as $key => $value){
1251
+ if($class==$value) {
1252
+ return $key;
1253
+ }
1254
+ }
1255
+
1256
+ return "";
1257
+ }
1258
+ }
1259
+
1260
  endif;
plugin-fw/lib/yit-plugin-gradients.php CHANGED
@@ -1,536 +1,536 @@
1
- <?php
2
- /**
3
- * Your Inspiration Themes
4
- *
5
- * In this files there is a collection of a functions useful for the core
6
- * of the framework.
7
- *
8
- * @package WordPress
9
- * @subpackage Your Inspiration Themes
10
- * @author Your Inspiration Themes Team <info@yithemes.com>
11
- *
12
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
13
- * that is bundled with this package in the file LICENSE.txt.
14
- * It is also available through the world-wide-web at this URL:
15
- * http://www.gnu.org/licenses/gpl-3.0.txt
16
- */
17
-
18
- /**
19
- * Handles colors
20
- *
21
- * @since 1.0
22
- */
23
- /**
24
- * Generates CSS 3 gradients for all browsers.
25
- *
26
- * @since 1.0
27
- */
28
-
29
- if ( ! class_exists( 'YIT_Gradients' ) ) {
30
-
31
- class YIT_Gradients {
32
-
33
- /**
34
- * An array of colors to use for a gradient.
35
- *
36
- * @var array
37
- * @since 1.0
38
- */
39
- public $colors_gradient = array();
40
-
41
- /**
42
- * Set properties
43
- *
44
- * @param string $key
45
- * @param $value
46
- *
47
- * @internal param array $colors_gradient
48
- * @return void
49
- * @since 1.0
50
- */
51
- public function set( $key, $value ) {
52
- if ( property_exists( $this, $key ) ) {
53
- $this->{$key} = $value;
54
- }
55
- }
56
-
57
- /**
58
- * Get properties
59
- *
60
- * @param string $key
61
- *
62
- * @return mixed
63
- * @since 1.0
64
- */
65
- public function get( $key ) {
66
- if ( property_exists( $this, $key ) ) {
67
- return $this->{$key};
68
- }
69
- }
70
-
71
- /**
72
- * Add a color to use in a gradient.
73
- *
74
- * @param string $color
75
- * @param int $position
76
- *
77
- * @return void
78
- * @since 1.0
79
- */
80
- public function add_color_gradient( $color, $position ) {
81
- $the_color['color'] = $color;
82
- $the_color['position'] = $position;
83
-
84
- array_push( $this->colors_gradient, $the_color );
85
- }
86
-
87
- /**
88
- * Generate the CSS code for a gradient.
89
- *
90
- * @param string $role
91
- * @param string $direction
92
- *
93
- * @return string|bool
94
- * @since 1.0
95
- */
96
- public function gradient( $role, $direction ) {
97
- if ( ! empty( $this->colors_gradient ) ) {
98
-
99
- $css = array(
100
- 'old' => $this->_make_old_gradient( $this->colors_gradient[0]['color'] ), //old browser
101
- 'ff3' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'moz' ), //firefox 3.6+
102
- 'chr_saf4' => $this->_make_chr_saf4_gradient( $this->colors_gradient, $direction ), //chrome and safari4+
103
- 'chr10_saf5' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'webkit' ), //chrome10+ and safari5+
104
- 'opera' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'o' ), //opera11.10+
105
- 'ie10' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'ms' ), //internet explorer 10+
106
- 'w3c' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'w3c' ), //w3c
107
- 'ie6_9' => $this->_make_ie6_gradient( $this->colors_gradient, $direction ) //ie6-9
108
- );
109
-
110
- $css = $role . '{' . implode( ';', $css ) . '}';
111
-
112
- $this->colors_gradient = array();
113
-
114
- return $css;
115
- }
116
- }
117
-
118
- /**
119
- * Reverse a gradient. This method should be used only before calling ::make_gradient(). Otherwise it will not works.
120
- *
121
- * @return void
122
- * @since 1.0
123
- */
124
- public function reverse_gradient() {
125
- $colors_gradient = array_reverse( $this->get( 'colors_gradient' ) );
126
-
127
- for ( $i = 0; $i < count( $colors_gradient ); $i ++ ) {
128
- $colors_gradient[$i]['position'] = 100 - $colors_gradient[$i]['position'];
129
- }
130
-
131
- $this->set( 'colors_gradient', $colors_gradient );
132
- }
133
-
134
- /**
135
- * Generate the CSS code for a gradient.
136
- *
137
- * @param string $role
138
- * @param string $direction
139
- *
140
- * @return string|bool
141
- * @since 1.0
142
- */
143
- public function get_gradient( $role, $direction ) {
144
- return $this->gradient( $role, $direction );
145
- }
146
-
147
- /**
148
- * Generate the CSS code for a gradient.
149
- *
150
- * @param string $role
151
- * @param string $direction
152
- *
153
- * @return void
154
- * @since 1.0
155
- */
156
- public function the_gradient( $role, $direction ) {
157
- echo $this->get_gradient( $role, $direction );
158
- }
159
-
160
- /**
161
- * Generate the CSS code for a gradient.
162
- *
163
- * @param string $role
164
- * @param string $from
165
- * @param string $to
166
- * @param string $direction
167
- *
168
- * @return string|bool
169
- * @since 1.0
170
- */
171
- public function gradient_from_to( $role, $from, $to, $direction ) {
172
-
173
- $colors = array(
174
- array(
175
- 'color' => $from,
176
- 'position' => 0
177
- ),
178
- array(
179
- 'color' => $to,
180
- 'position' => 100
181
- ),
182
- );
183
-
184
- $this->set( 'colors_gradient', $colors );
185
- return $this->get_gradient( $role, $direction );
186
- }
187
-
188
- /**
189
- * Generate the CSS code for a gradient.
190
- *
191
- * @param string $role
192
- * @param string $color
193
- * @param string $direction
194
- * @param int|string $factor
195
- *
196
- * @return string|bool
197
- * @since 1.0
198
- */
199
- public function gradient_darker( $role, $color, $direction, $factor = 30 ) {
200
-
201
- $colors = array(
202
- array(
203
- 'color' => $color,
204
- 'position' => 0
205
- ),
206
- array(
207
- 'color' => $this->hex_darker( $color, $factor ),
208
- 'position' => 100
209
- ),
210
- );
211
-
212
- $this->set( 'colors_gradient', $colors );
213
- return $this->get_gradient( $role, $direction );
214
- }
215
-
216
- /**
217
- * Generate the CSS code for a gradient.
218
- *
219
- * @param string $role
220
- * @param string $color
221
- * @param string $direction
222
- * @param int|string $factor
223
- *
224
- * @return string|bool
225
- * @since 1.0
226
- */
227
- public function gradient_lighter( $role, $color, $direction, $factor = 30 ) {
228
-
229
- $colors = array(
230
- array(
231
- 'color' => $color,
232
- 'position' => 0
233
- ),
234
- array(
235
- 'color' => $this->hex_lighter( $color, $factor ),
236
- 'position' => 100
237
- ),
238
- );
239
-
240
- $this->set( 'colors_gradient', $colors );
241
- return $this->get_gradient( $role, $direction );
242
- }
243
-
244
- /**
245
- * Generate the CSS code for a gradient that not supports gradients (add only a background color).
246
- *
247
- * @param $color
248
- *
249
- * @internal param string $role
250
- * @return string|bool
251
- * @access private
252
- * @since 1.0
253
- */
254
- private function _make_old_gradient( $color ) {
255
- return 'background:' . $color;
256
- }
257
-
258
- /**
259
- * Generate the CSS code for a gradient in IE6-9.
260
- *
261
- * @param $colors
262
- * @param $direction
263
- *
264
- * @internal param string $role
265
- * @return string|bool
266
- * @access private
267
- * @since 1.0
268
- */
269
- private function _make_ie6_gradient( $colors, $direction ) {
270
- $css = 'filter:progid:DXImageTransform.Microsoft.gradient(';
271
- $css .= 'startColorstr=\'' . $colors[0]['color'] . '\',';
272
- $css .= 'endColorstr=\'' . $colors[count( $colors ) - 1]['color'] . '\',';
273
-
274
- if ( $direction == 'horizontal' ) {
275
- $css .= 'GradientType=1';
276
- }
277
- else {
278
- $css .= 'GradientType=0';
279
- } //vertical
280
-
281
- $css .= ')';
282
-
283
- return $css;
284
- }
285
-
286
- /**
287
- * Make the CSS 3 for a gradient in modern browsers( FF3.6+, Chrome, Safari5+, Opera11.10+, IE10+ )
288
- *
289
- * @param array $colors
290
- * @param string $direction
291
- * @param $browser
292
- *
293
- * @return string
294
- * @access private
295
- * @since 1.0
296
- */
297
- private function _make_modern_gradient( $colors, $direction, $browser ) {
298
- $css = 'background:';
299
-
300
- //Add the browser suffix
301
- if ( $browser != 'w3c' ) {
302
- $browser = '-' . $browser . '-';
303
- }
304
- else {
305
- $browser = '';
306
- }
307
-
308
- switch ( $direction ) {
309
- case 'vertical' :
310
- $css .= $browser . 'linear-gradient(top,';
311
- break;
312
- case 'horizontal' :
313
- $css .= $browser . 'linear-gradient(left,';
314
- break;
315
- case 'diagonal-bottom':
316
- $css .= $browser . 'linear-gradient(-45deg,';
317
- break;
318
- case 'diagonal-top' :
319
- $css .= $browser . 'linear-gradient(45deg,';
320
- break;
321
- case 'radial' :
322
- $css .= $browser . 'radial-gradient(center, ellipse cover,';
323
- break;
324
- }
325
-
326
- foreach ( $colors as $stop ) {
327
- $css .= $stop['color'] . ' ' . $stop['position'] . '%, ';
328
- }
329
-
330
- $css = rtrim( $css );
331
- $css = rtrim( $css, ',' );
332
- $css .= ')';
333
-
334
- return $css;
335
- }
336
-
337
- /**
338
- * Make the CSS 3 for a gradient in Chrome and Safari 4+
339
- *
340
- * @param array $colors
341
- * @param string $direction
342
- *
343
- * @return string
344
- * @access private
345
- * @since 1.0
346
- */
347
- private function _make_chr_saf4_gradient( $colors, $direction ) {
348
- $css = 'background:';
349
-
350
- switch ( $direction ) {
351
- case 'vertical' :
352
- $css .= '-webkit-gradient(linear,left top,left bottom,';
353
- break;
354
- case 'horizontal' :
355
- $css .= '-webkit-gradient(linear,left top,right top,';
356
- break;
357
- case 'diagonal-bottom':
358
- $css .= '-webkit-gradient(linear,left top,right bottom,';
359
- break;
360
- case 'diagonal-top' :
361
- $css .= '-webkit-gradient(linear,left bottom,right top,';
362
- break;
363
- case 'radial' :
364
- $css .= '-webkit-gradient(radial,center center, 0px, center center, 100%,';
365
- break;
366
- }
367
-
368
- foreach ( $colors as $stop ) {
369
- $css .= 'color-stop(' . $stop['position'] . '%, ' . $stop['color'] . '), ';
370
- }
371
-
372
- $css = rtrim( $css );
373
- $css = rtrim( $css, ',' );
374
- $css .= ')';
375
-
376
- return $css;
377
- }
378
-
379
-
380
- /**
381
- * Return an instance of the model called
382
- *
383
- * @param string $class The name of class that I want the instance
384
- *
385
- * @since 2.0.0
386
- * @author Simone D'Amico <simone.damico@yithemes.com>
387
- * @return mixed
388
- */
389
- public function getModel( $class ) {
390
- return YIT_Registry::get_instance()->$class;
391
- }
392
-
393
-
394
- /**
395
- * Return a color darker then $color.
396
- *
397
- * @param string $color
398
- * @param int $factor
399
- *
400
- * @return string
401
- * @since 1.0
402
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
403
- */
404
- public function hex_darker( $color, $factor = 30 ) {
405
- $color = str_replace( '#', '', $color );
406
-
407
- $base['R'] = hexdec( substr( $color, 0, 2 ) );
408
- $base['G'] = hexdec( substr( $color, 2, 2 ) );
409
- $base['B'] = hexdec( substr( $color, 4, 2 ) );
410
-
411
- $color = '#';
412
-
413
- foreach ( $base as $k => $v ) {
414
- $amount = $v / 100;
415
- $amount = round( $amount * $factor );
416
- $new_decimal = $v - $amount;
417
-
418
- $new_hex_component = dechex( $new_decimal );
419
-
420
- if ( strlen( $new_hex_component ) < 2 ) {
421
- $new_hex_component = "0" . $new_hex_component;
422
- }
423
-
424
- $color .= $new_hex_component;
425
- }
426
-
427
- return $color;
428
- }
429
-
430
- /**
431
- * Return a color lighter then $color.
432
- *
433
- * @param string $color
434
- * @param int $factor
435
- *
436
- * @return string
437
- * @since 1.0
438
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
439
- */
440
- public function hex_lighter( $color, $factor = 30 ) {
441
- $color = str_replace( '#', '', $color );
442
-
443
- $base['R'] = hexdec( $color{0} . $color{1} );
444
- $base['G'] = hexdec( $color{2} . $color{3} );
445
- $base['B'] = hexdec( $color{4} . $color{5} );
446
-
447
- $color = '#';
448
-
449
- foreach ( $base as $k => $v ) {
450
- $amount = 255 - $v;
451
- $amount = $amount / 100;
452
- $amount = round( $amount * $factor );
453
- $new_decimal = $v + $amount;
454
-
455
- $new_hex_component = dechex( $new_decimal );
456
-
457
- if ( strlen( $new_hex_component ) < 2 ) {
458
- $new_hex_component = "0" . $new_hex_component;
459
- }
460
-
461
- $color .= $new_hex_component;
462
- }
463
-
464
- return $color;
465
- }
466
-
467
- /**
468
- * Detect if we must use a color darker or lighter then the background.
469
- *
470
- * @param string $color
471
- * @param string $dark
472
- * @param string $light
473
- *
474
- * @return string
475
- * @since 1.0
476
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
477
- */
478
- public function light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
479
- $hex = str_replace( '#', '', $color );
480
-
481
- $c_r = hexdec( substr( $hex, 0, 2 ) );
482
- $c_g = hexdec( substr( $hex, 2, 2 ) );
483
- $c_b = hexdec( substr( $hex, 4, 2 ) );
484
- $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
485
-
486
- return ( $brightness > 155 ) ? $dark : $light;
487
- }
488
-
489
- /**
490
- * Detect if we must use a color darker or lighter then the background.
491
- *
492
- * @param $hex
493
- *
494
- * @internal param string $color
495
- * @return string
496
- * @since 1.0
497
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
498
- */
499
- public function hex2rgb( $hex ) {
500
- $hex = str_replace( "#", "", $hex );
501
-
502
- if ( strlen( $hex ) == 3 ) {
503
- $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
504
- $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
505
- $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
506
- }
507
- else {
508
- $r = hexdec( substr( $hex, 0, 2 ) );
509
- $g = hexdec( substr( $hex, 2, 2 ) );
510
- $b = hexdec( substr( $hex, 4, 2 ) );
511
- }
512
- $rgb = array( $r, $g, $b );
513
- //return implode(",", $rgb); // returns the rgb values separated by commas
514
- return $rgb; // returns an array with the rgb values
515
- }
516
-
517
- /**
518
- * Magic method for this class
519
- *
520
- * @param $name string The name of magic property
521
- *
522
- * @since 2.0.0
523
- * @author Simone D'Amico <simone.damico@yithemes.com>
524
- * @return mixed
525
- */
526
- public function __get( $name ) {
527
- if ( $name == 'request' ) {
528
- if ( ! $this->_request instanceof YIT_Request ) {
529
- $this->_request = YIT_Registry::get_instance()->request;
530
- }
531
-
532
- return $this->_request;
533
- }
534
- }
535
- }
536
  }
1
+ <?php
2
+ /**
3
+ * Your Inspiration Themes
4
+ *
5
+ * In this files there is a collection of a functions useful for the core
6
+ * of the framework.
7
+ *
8
+ * @package WordPress
9
+ * @subpackage Your Inspiration Themes
10
+ * @author Your Inspiration Themes Team <info@yithemes.com>
11
+ *
12
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
13
+ * that is bundled with this package in the file LICENSE.txt.
14
+ * It is also available through the world-wide-web at this URL:
15
+ * http://www.gnu.org/licenses/gpl-3.0.txt
16
+ */
17
+
18
+ /**
19
+ * Handles colors
20
+ *
21
+ * @since 1.0
22
+ */
23
+ /**
24
+ * Generates CSS 3 gradients for all browsers.
25
+ *
26
+ * @since 1.0
27
+ */
28
+
29
+ if ( ! class_exists( 'YIT_Gradients' ) ) {
30
+
31
+ class YIT_Gradients {
32
+
33
+ /**
34
+ * An array of colors to use for a gradient.
35
+ *
36
+ * @var array
37
+ * @since 1.0
38
+ */
39
+ public $colors_gradient = array();
40
+
41
+ /**
42
+ * Set properties
43
+ *
44
+ * @param string $key
45
+ * @param $value
46
+ *
47
+ * @internal param array $colors_gradient
48
+ * @return void
49
+ * @since 1.0
50
+ */
51
+ public function set( $key, $value ) {
52
+ if ( property_exists( $this, $key ) ) {
53
+ $this->{$key} = $value;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Get properties
59
+ *
60
+ * @param string $key
61
+ *
62
+ * @return mixed
63
+ * @since 1.0
64
+ */
65
+ public function get( $key ) {
66
+ if ( property_exists( $this, $key ) ) {
67
+ return $this->{$key};
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Add a color to use in a gradient.
73
+ *
74
+ * @param string $color
75
+ * @param int $position
76
+ *
77
+ * @return void
78
+ * @since 1.0
79
+ */
80
+ public function add_color_gradient( $color, $position ) {
81
+ $the_color['color'] = $color;
82
+ $the_color['position'] = $position;
83
+
84
+ array_push( $this->colors_gradient, $the_color );
85
+ }
86
+
87
+ /**
88
+ * Generate the CSS code for a gradient.
89
+ *
90
+ * @param string $role
91
+ * @param string $direction
92
+ *
93
+ * @return string|bool
94
+ * @since 1.0
95
+ */
96
+ public function gradient( $role, $direction ) {
97
+ if ( ! empty( $this->colors_gradient ) ) {
98
+
99
+ $css = array(
100
+ 'old' => $this->_make_old_gradient( $this->colors_gradient[0]['color'] ), //old browser
101
+ 'ff3' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'moz' ), //firefox 3.6+
102
+ 'chr_saf4' => $this->_make_chr_saf4_gradient( $this->colors_gradient, $direction ), //chrome and safari4+
103
+ 'chr10_saf5' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'webkit' ), //chrome10+ and safari5+
104
+ 'opera' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'o' ), //opera11.10+
105
+ 'ie10' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'ms' ), //internet explorer 10+
106
+ 'w3c' => $this->_make_modern_gradient( $this->colors_gradient, $direction, 'w3c' ), //w3c
107
+ 'ie6_9' => $this->_make_ie6_gradient( $this->colors_gradient, $direction ) //ie6-9
108
+ );
109
+
110
+ $css = $role . '{' . implode( ';', $css ) . '}';
111
+
112
+ $this->colors_gradient = array();
113
+
114
+ return $css;
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Reverse a gradient. This method should be used only before calling ::make_gradient(). Otherwise it will not works.
120
+ *
121
+ * @return void
122
+ * @since 1.0
123
+ */
124
+ public function reverse_gradient() {
125
+ $colors_gradient = array_reverse( $this->get( 'colors_gradient' ) );
126
+
127
+ for ( $i = 0; $i < count( $colors_gradient ); $i ++ ) {
128
+ $colors_gradient[$i]['position'] = 100 - $colors_gradient[$i]['position'];
129
+ }
130
+
131
+ $this->set( 'colors_gradient', $colors_gradient );
132
+ }
133
+
134
+ /**
135
+ * Generate the CSS code for a gradient.
136
+ *
137
+ * @param string $role
138
+ * @param string $direction
139
+ *
140
+ * @return string|bool
141
+ * @since 1.0
142
+ */
143
+ public function get_gradient( $role, $direction ) {
144
+ return $this->gradient( $role, $direction );
145
+ }
146
+
147
+ /**
148
+ * Generate the CSS code for a gradient.
149
+ *
150
+ * @param string $role
151
+ * @param string $direction
152
+ *
153
+ * @return void
154
+ * @since 1.0
155
+ */
156
+ public function the_gradient( $role, $direction ) {
157
+ echo $this->get_gradient( $role, $direction );
158
+ }
159
+
160
+ /**
161
+ * Generate the CSS code for a gradient.
162
+ *
163
+ * @param string $role
164
+ * @param string $from
165
+ * @param string $to
166
+ * @param string $direction
167
+ *
168
+ * @return string|bool
169
+ * @since 1.0
170
+ */
171
+ public function gradient_from_to( $role, $from, $to, $direction ) {
172
+
173
+ $colors = array(
174
+ array(
175
+ 'color' => $from,
176
+ 'position' => 0
177
+ ),
178
+ array(
179
+ 'color' => $to,
180
+ 'position' => 100
181
+ ),
182
+ );
183
+
184
+ $this->set( 'colors_gradient', $colors );
185
+ return $this->get_gradient( $role, $direction );
186
+ }
187
+
188
+ /**
189
+ * Generate the CSS code for a gradient.
190
+ *
191
+ * @param string $role
192
+ * @param string $color
193
+ * @param string $direction
194
+ * @param int|string $factor
195
+ *
196
+ * @return string|bool
197
+ * @since 1.0
198
+ */
199
+ public function gradient_darker( $role, $color, $direction, $factor = 30 ) {
200
+
201
+ $colors = array(
202
+ array(
203
+ 'color' => $color,
204
+ 'position' => 0
205
+ ),
206
+ array(
207
+ 'color' => $this->hex_darker( $color, $factor ),
208
+ 'position' => 100
209
+ ),
210
+ );
211
+
212
+ $this->set( 'colors_gradient', $colors );
213
+ return $this->get_gradient( $role, $direction );
214
+ }
215
+
216
+ /**
217
+ * Generate the CSS code for a gradient.
218
+ *
219
+ * @param string $role
220
+ * @param string $color
221
+ * @param string $direction
222
+ * @param int|string $factor
223
+ *
224
+ * @return string|bool
225
+ * @since 1.0
226
+ */
227
+ public function gradient_lighter( $role, $color, $direction, $factor = 30 ) {
228
+
229
+ $colors = array(
230
+ array(
231
+ 'color' => $color,
232
+ 'position' => 0
233
+ ),
234
+ array(
235
+ 'color' => $this->hex_lighter( $color, $factor ),
236
+ 'position' => 100
237
+ ),
238
+ );
239
+
240
+ $this->set( 'colors_gradient', $colors );
241
+ return $this->get_gradient( $role, $direction );
242
+ }
243
+
244
+ /**
245
+ * Generate the CSS code for a gradient that not supports gradients (add only a background color).
246
+ *
247
+ * @param $color
248
+ *
249
+ * @internal param string $role
250
+ * @return string|bool
251
+ * @access private
252
+ * @since 1.0
253
+ */
254
+ private function _make_old_gradient( $color ) {
255
+ return 'background:' . $color;
256
+ }
257
+
258
+ /**
259
+ * Generate the CSS code for a gradient in IE6-9.
260
+ *
261
+ * @param $colors
262
+ * @param $direction
263
+ *
264
+ * @internal param string $role
265
+ * @return string|bool
266
+ * @access private
267
+ * @since 1.0
268
+ */
269
+ private function _make_ie6_gradient( $colors, $direction ) {
270
+ $css = 'filter:progid:DXImageTransform.Microsoft.gradient(';
271
+ $css .= 'startColorstr=\'' . $colors[0]['color'] . '\',';
272
+ $css .= 'endColorstr=\'' . $colors[count( $colors ) - 1]['color'] . '\',';
273
+
274
+ if ( $direction == 'horizontal' ) {
275
+ $css .= 'GradientType=1';
276
+ }
277
+ else {
278
+ $css .= 'GradientType=0';
279
+ } //vertical
280
+
281
+ $css .= ')';
282
+
283
+ return $css;
284
+ }
285
+
286
+ /**
287
+ * Make the CSS 3 for a gradient in modern browsers( FF3.6+, Chrome, Safari5+, Opera11.10+, IE10+ )
288
+ *
289
+ * @param array $colors
290
+ * @param string $direction
291
+ * @param $browser
292
+ *
293
+ * @return string
294
+ * @access private
295
+ * @since 1.0
296
+ */
297
+ private function _make_modern_gradient( $colors, $direction, $browser ) {
298
+ $css = 'background:';
299
+
300
+ //Add the browser suffix
301
+ if ( $browser != 'w3c' ) {
302
+ $browser = '-' . $browser . '-';
303
+ }
304
+ else {
305
+ $browser = '';
306
+ }
307
+
308
+ switch ( $direction ) {
309
+ case 'vertical' :
310
+ $css .= $browser . 'linear-gradient(top,';
311
+ break;
312
+ case 'horizontal' :
313
+ $css .= $browser . 'linear-gradient(left,';
314
+ break;
315
+ case 'diagonal-bottom':
316
+ $css .= $browser . 'linear-gradient(-45deg,';
317
+ break;
318
+ case 'diagonal-top' :
319
+ $css .= $browser . 'linear-gradient(45deg,';
320
+ break;
321
+ case 'radial' :
322
+ $css .= $browser . 'radial-gradient(center, ellipse cover,';
323
+ break;
324
+ }
325
+
326
+ foreach ( $colors as $stop ) {
327
+ $css .= $stop['color'] . ' ' . $stop['position'] . '%, ';
328
+ }
329
+
330
+ $css = rtrim( $css );
331
+ $css = rtrim( $css, ',' );
332
+ $css .= ')';
333
+
334
+ return $css;
335
+ }
336
+
337
+ /**
338
+ * Make the CSS 3 for a gradient in Chrome and Safari 4+
339
+ *
340
+ * @param array $colors
341
+ * @param string $direction
342
+ *
343
+ * @return string
344
+ * @access private
345
+ * @since 1.0
346
+ */
347
+ private function _make_chr_saf4_gradient( $colors, $direction ) {
348
+ $css = 'background:';
349
+
350
+ switch ( $direction ) {
351
+ case 'vertical' :
352
+ $css .= '-webkit-gradient(linear,left top,left bottom,';
353
+ break;
354
+ case 'horizontal' :
355
+ $css .= '-webkit-gradient(linear,left top,right top,';
356
+ break;
357
+ case 'diagonal-bottom':
358
+ $css .= '-webkit-gradient(linear,left top,right bottom,';
359
+ break;
360
+ case 'diagonal-top' :
361
+ $css .= '-webkit-gradient(linear,left bottom,right top,';
362
+ break;
363
+ case 'radial' :
364
+ $css .= '-webkit-gradient(radial,center center, 0px, center center, 100%,';
365
+ break;
366
+ }
367
+
368
+ foreach ( $colors as $stop ) {
369
+ $css .= 'color-stop(' . $stop['position'] . '%, ' . $stop['color'] . '), ';
370
+ }
371
+
372
+ $css = rtrim( $css );
373
+ $css = rtrim( $css, ',' );
374
+ $css .= ')';
375
+
376
+ return $css;
377
+ }
378
+
379
+
380
+ /**
381
+ * Return an instance of the model called
382
+ *
383
+ * @param string $class The name of class that I want the instance
384
+ *
385
+ * @since 2.0.0
386
+ * @author Simone D'Amico <simone.damico@yithemes.com>
387
+ * @return mixed
388
+ */
389
+ public function getModel( $class ) {
390
+ return YIT_Registry::get_instance()->$class;
391
+ }
392
+
393
+
394
+ /**
395
+ * Return a color darker then $color.
396
+ *
397
+ * @param string $color
398
+ * @param int $factor
399
+ *
400
+ * @return string
401
+ * @since 1.0
402
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
403
+ */
404
+ public function hex_darker( $color, $factor = 30 ) {
405
+ $color = str_replace( '#', '', $color );
406
+
407
+ $base['R'] = hexdec( substr( $color, 0, 2 ) );
408
+ $base['G'] = hexdec( substr( $color, 2, 2 ) );
409
+ $base['B'] = hexdec( substr( $color, 4, 2 ) );
410
+
411
+ $color = '#';
412
+
413
+ foreach ( $base as $k => $v ) {
414
+ $amount = $v / 100;
415
+ $amount = round( $amount * $factor );
416
+ $new_decimal = $v - $amount;
417
+
418
+ $new_hex_component = dechex( $new_decimal );
419
+
420
+ if ( strlen( $new_hex_component ) < 2 ) {
421
+ $new_hex_component = "0" . $new_hex_component;
422
+ }
423
+
424
+ $color .= $new_hex_component;
425
+ }
426
+
427
+ return $color;
428
+ }
429
+
430
+ /**
431
+ * Return a color lighter then $color.
432
+ *
433
+ * @param string $color
434
+ * @param int $factor
435
+ *
436
+ * @return string
437
+ * @since 1.0
438
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
439
+ */
440
+ public function hex_lighter( $color, $factor = 30 ) {
441
+ $color = str_replace( '#', '', $color );
442
+
443
+ $base['R'] = hexdec( $color{0} . $color{1} );
444
+ $base['G'] = hexdec( $color{2} . $color{3} );
445
+ $base['B'] = hexdec( $color{4} . $color{5} );
446
+
447
+ $color = '#';
448
+
449
+ foreach ( $base as $k => $v ) {
450
+ $amount = 255 - $v;
451
+ $amount = $amount / 100;
452
+ $amount = round( $amount * $factor );
453
+ $new_decimal = $v + $amount;
454
+
455
+ $new_hex_component = dechex( $new_decimal );
456
+
457
+ if ( strlen( $new_hex_component ) < 2 ) {
458
+ $new_hex_component = "0" . $new_hex_component;
459
+ }
460
+
461
+ $color .= $new_hex_component;
462
+ }
463
+
464
+ return $color;
465
+ }
466
+
467
+ /**
468
+ * Detect if we must use a color darker or lighter then the background.
469
+ *
470
+ * @param string $color
471
+ * @param string $dark
472
+ * @param string $light
473
+ *
474
+ * @return string
475
+ * @since 1.0
476
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
477
+ */
478
+ public function light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
479
+ $hex = str_replace( '#', '', $color );
480
+
481
+ $c_r = hexdec( substr( $hex, 0, 2 ) );
482
+ $c_g = hexdec( substr( $hex, 2, 2 ) );
483
+ $c_b = hexdec( substr( $hex, 4, 2 ) );
484
+ $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
485
+
486
+ return ( $brightness > 155 ) ? $dark : $light;
487
+ }
488
+
489
+ /**
490
+ * Detect if we must use a color darker or lighter then the background.
491
+ *
492
+ * @param $hex
493
+ *
494
+ * @internal param string $color
495
+ * @return string
496
+ * @since 1.0
497
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
498
+ */
499
+ public function hex2rgb( $hex ) {
500
+ $hex = str_replace( "#", "", $hex );
501
+
502
+ if ( strlen( $hex ) == 3 ) {
503
+ $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
504
+ $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
505
+ $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
506
+ }
507
+ else {
508
+ $r = hexdec( substr( $hex, 0, 2 ) );
509
+ $g = hexdec( substr( $hex, 2, 2 ) );
510
+ $b = hexdec( substr( $hex, 4, 2 ) );
511
+ }
512
+ $rgb = array( $r, $g, $b );
513
+ //return implode(",", $rgb); // returns the rgb values separated by commas
514
+ return $rgb; // returns an array with the rgb values
515
+ }
516
+
517
+ /**
518
+ * Magic method for this class
519
+ *
520
+ * @param $name string The name of magic property
521
+ *
522
+ * @since 2.0.0
523
+ * @author Simone D'Amico <simone.damico@yithemes.com>
524
+ * @return mixed
525
+ */
526
+ public function __get( $name ) {
527
+ if ( $name == 'request' ) {
528
+ if ( ! $this->_request instanceof YIT_Request ) {
529
+ $this->_request = YIT_Registry::get_instance()->request;
530
+ }
531
+
532
+ return $this->_request;
533
+ }
534
+ }
535
+ }
536
  }
plugin-fw/lib/yit-plugin-panel-sidebar.php ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( !defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( !class_exists( 'YIT_Plugin_Panel_Sidebar' ) ) {
16
+ /**
17
+ * YIT Plugin Panel Sidebar
18
+ *
19
+ * @class YIT_Plugin_Panel_Sidebar
20
+ * @package Yithemes
21
+ * @since 1.0
22
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
23
+ */
24
+ class YIT_Plugin_Panel_Sidebar {
25
+ /**
26
+ * @var string version of class
27
+ */
28
+ public $version = '1.0.1';
29
+
30
+
31
+ /**
32
+ * @var array array of widgets
33
+ */
34
+ public $widgets = array();
35
+
36
+ /**
37
+ * @type string
38
+ */
39
+ protected $_remote_widget_xml = 'http://bit.ly/1UJ83xN';
40
+
41
+ /**
42
+ * default priority for Remote Widgets
43
+ *
44
+ * @type int
45
+ */
46
+ public $default_remote_widget_priority = 40;
47
+
48
+ /**
49
+ * parent panel
50
+ *
51
+ * @var YIT_Plugin_Panel
52
+ */
53
+ public $panel;
54
+
55
+ private $_is_collapsed;
56
+
57
+ /**
58
+ * @type string
59
+ */
60
+ public static $transient_remote_widgets = 'yit_panel_sidebar_remote_widgets';
61
+
62
+ /**
63
+ * @type string
64
+ */
65
+ public static $transient_updated_remote_widgets = 'yit_panel_sidebar_remote_widgets_update';
66
+
67
+ /**
68
+ * @type string
69
+ */
70
+ public static $collapse_option = 'yith_plugin_panel_sidebar_collapse';
71
+
72
+ /**
73
+ * Constructor
74
+ *
75
+ * @param YIT_Plugin_Panel $panel the parent panel
76
+ *
77
+ * @since 1.0
78
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
79
+ */
80
+ private function __construct( $panel ) {
81
+ $this->panel = $panel;
82
+
83
+ /* load and sort default widgets and remote widgets */
84
+ $this->load_widgets();
85
+
86
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
87
+ add_filter( 'yit_admin_panel_content_class', array( $this, 'filter_admin_panel_content_class' ) );
88
+ }
89
+
90
+ /**
91
+ * get instance
92
+ *
93
+ * @static
94
+ * @return YIT_Plugin_Panel_Sidebar
95
+ *
96
+ * @since 1.0
97
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
98
+ */
99
+ public static function instance( $panel ) {
100
+ return new self( $panel );
101
+ }
102
+
103
+ /**
104
+ * return true if is collapsed by option
105
+ *
106
+ * @return bool
107
+ */
108
+ public function is_collapsed() {
109
+ if ( !isset( $this->_is_collapsed ) ) {
110
+ $this->_is_collapsed = get_option( self::$collapse_option, 'no' ) === 'yes';
111
+ }
112
+
113
+ return $this->_is_collapsed;
114
+ }
115
+
116
+ /**
117
+ * if is collapsed add a class to panel wrapper
118
+ *
119
+ * @param $class
120
+ *
121
+ * @return string
122
+ */
123
+ public function filter_admin_panel_content_class( $class ) {
124
+ if ( $this->is_collapsed() ) {
125
+ $class .= ' yit-admin-panel-content-wrap-full';
126
+ }
127
+
128
+ return $class;
129
+ }
130
+
131
+ /**
132
+ * Add one or more widgets to $this->widgets
133
+ *
134
+ * @param array $widgets
135
+ */
136
+ public function add_widgets( $widgets ) {
137
+ $this->widgets = array_merge( $this->widgets, $widgets );
138
+ }
139
+
140
+ /**
141
+ * delete transients
142
+ */
143
+ public static function delete_transients() {
144
+ delete_transient( self::$transient_remote_widgets );
145
+ delete_transient( self::$transient_updated_remote_widgets );
146
+ }
147
+
148
+ /**
149
+ * filter and sort widgets
150
+ */
151
+ private function _filter_and_sort_widgets() {
152
+ /* filter widgets */
153
+ $page_name = isset( $this->panel->settings[ 'page' ] ) ? $this->panel->settings[ 'page' ] : '';
154
+ $this->widgets = apply_filters( 'yit_plugin_panel_sidebar_widgets', $this->widgets, $page_name );
155
+
156
+ /*sort widgets*/
157
+ uasort( $this->widgets, array( $this, 'sort_widgets' ) );
158
+ }
159
+
160
+ /**
161
+ * get Remote Widget by XML from YIThemes
162
+ *
163
+ * @return array
164
+ *
165
+ * @since 1.0
166
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
167
+ */
168
+ public function get_remote_widgets() {
169
+ $remote_widgets = get_transient( self::$transient_remote_widgets );
170
+ $updated = get_transient( self::$transient_updated_remote_widgets );
171
+ $is_debug = defined( 'YIT_FW_REMOTE_WIDGETS_DEBUG' ) && YIT_FW_REMOTE_WIDGETS_DEBUG;
172
+
173
+ if ( $is_debug || $updated === false || $remote_widgets === false ) {
174
+ $remote_widgets = array();
175
+ } else {
176
+ return $remote_widgets;
177
+ }
178
+
179
+ $expiration = 1 * DAY_IN_SECONDS;
180
+ $updated_expiration = DAY_IN_SECONDS; // update frequency
181
+
182
+ $remote_xml = wp_remote_get( $this->_remote_widget_xml );
183
+ if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
184
+ try {
185
+ // suppress all XML errors when loading the document
186
+ libxml_use_internal_errors( true );
187
+
188
+ $xml_data = new SimpleXmlElement( $remote_xml[ 'body' ] );
189
+ $xml_remote_widgets = isset( $xml_data->widget ) ? $xml_data->widget : array();
190
+
191
+ $enabled_args = array(
192
+ 'title',
193
+ 'icon',
194
+ 'content',
195
+ 'class',
196
+ 'title_class',
197
+ 'badge',
198
+ 'badge_text',
199
+ 'image',
200
+ 'image_class',
201
+ 'priority',
202
+ 'starting',
203
+ 'expiration',
204
+ );
205
+
206
+ $last_remote_priority = $this->default_remote_widget_priority;
207
+
208
+ foreach ( $xml_remote_widgets as $xml_widget ) {
209
+ if ( !isset( $xml_widget->id ) )
210
+ continue;
211
+
212
+ $widget_id = (string)$xml_widget->id;
213
+ $widget_array = array();
214
+ foreach ( $enabled_args as $key ) {
215
+ if ( isset( $xml_widget->$key ) ) {
216
+ $widget_array[ $key ] = (string)$xml_widget->$key;
217
+ } else {
218
+ if ( $key == 'priority' ) {
219
+ $widget_array[ $key ] = $last_remote_priority;
220
+ $last_remote_priority += 10;
221
+ }
222
+ }
223
+ }
224
+ $remote_widgets[ $widget_id ] = $widget_array;
225
+ }
226
+
227
+ $xml_expiration = isset( $xml_data->expiration ) ? (string)$xml_data->expiration : '';
228
+ if ( !empty( $xml_expiration ) ) {
229
+ $expiration = strtotime( $xml_expiration ) - strtotime( 'now' );
230
+ // if the XML is expired removes widgets
231
+ if ( $expiration < 1 )
232
+ $remote_widgets = array();
233
+
234
+ $is_urgent = isset( $xml_data->urgent ) ? !!$xml_data->urgent : false;
235
+ $is_urgent = true;
236
+ if ( !$is_urgent ) {
237
+ $four_days_random = mt_rand( 0, 4 * DAY_IN_SECONDS );
238
+ $expiration += $four_days_random;
239
+ } else {
240
+ /**
241
+ * - - - - - U R G E N T - - - - -
242
+ * it will be updated the exact day, BUT in different time! :)
243
+ * [to prevent too many request at the same time]
244
+ */
245
+ $one_day_random = mt_rand( 0, DAY_IN_SECONDS );
246
+ $expiration += $one_day_random;
247
+ }
248
+ }
249
+
250
+ $four_days_random = mt_rand( 0, 4 * DAY_IN_SECONDS );
251
+
252
+ /* to prevent multiple request if it's expired */
253
+ if ( $expiration < 1 ) {
254
+ $expiration = 1 * DAY_IN_SECONDS + $four_days_random;
255
+ }
256
+ }
257
+ catch ( Exception $e ) {
258
+
259
+ }
260
+
261
+ //$updated_expiration = 30 * DAY_IN_SECONDS + $four_days_random;
262
+ }
263
+
264
+ set_transient( self::$transient_remote_widgets, $remote_widgets, $expiration );
265
+ set_transient( self::$transient_updated_remote_widgets, true, $updated_expiration );
266
+
267
+ return $remote_widgets;
268
+ }
269
+
270
+ /**
271
+ * load and sort default widgets and remote widgets
272
+ *
273
+ * @since 1.0
274
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
275
+ */
276
+ public function load_widgets() {
277
+ /* get static widgets */
278
+ $this->widgets = include( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/sidebar/widgets/widgets.php' );
279
+
280
+ /* get remote widgets */
281
+ $remote_widgets = $this->get_remote_widgets();
282
+ $this->add_widgets( $remote_widgets );
283
+ }
284
+
285
+ /**
286
+ * Print the panel sidebar
287
+ *
288
+ * @return void
289
+ *
290
+ * @since 1.0
291
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
292
+ */
293
+ public function print_panel_sidebar() {
294
+ do_action( 'yit_panel_before_sidebar' );
295
+
296
+ include( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/sidebar/sidebar.php' );
297
+
298
+ do_action( 'yit_panel_after_sidebar' );
299
+ }
300
+
301
+ /**
302
+ * Print the panel sidebar widgets
303
+ *
304
+ * @return void
305
+ *
306
+ * @since 1.0
307
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
308
+ */
309
+ public function print_panel_sidebar_widgets() {
310
+ $basename = YIT_CORE_PLUGIN_PATH;
311
+ $path = '/panel/sidebar/widget.php';
312
+
313
+ $default_args = array(
314
+ 'id' => '',
315
+ 'title' => '',
316
+ 'icon' => '',
317
+ 'content' => '',
318
+ 'class' => '',
319
+ 'title_class' => '',
320
+ 'template' => '',
321
+ 'badge' => '',
322
+ 'badge_text' => '',
323
+ 'image' => '',
324
+ 'image_class' => '',
325
+ 'args' => array(),
326
+ 'hide_if_empty_args' => '',
327
+ 'priority' => 10,
328
+ 'starting' => '',
329
+ 'expiration' => '',
330
+ );
331
+
332
+ $this->_filter_and_sort_widgets();
333
+
334
+ foreach ( $this->widgets as $widget_id => $widget ) {
335
+ $args = array_merge( $widget, array( 'id' => $widget_id ) );
336
+ $args = wp_parse_args( $args, $default_args );
337
+
338
+ $is_started = empty( $args[ 'starting' ] ) || strtotime( $args[ 'starting' ] . ' midnight' ) <= strtotime( 'midnight' );
339
+ $is_expired = !empty( $args[ 'expiration' ] ) && strtotime( $args[ 'expiration' ] . ' midnight' ) < strtotime( 'midnight' );
340
+
341
+ if ( $is_expired || !$is_started )
342
+ continue;
343
+
344
+ if ( !empty( $args[ 'hide_if_empty_args' ] ) ) {
345
+ $hide_if_empty_args = $args[ 'hide_if_empty_args' ];
346
+ $continue = false;
347
+ foreach ( $hide_if_empty_args as $hide_if_empty_arg ) {
348
+ if ( empty( $args[ 'args' ][ $hide_if_empty_arg ] ) ) {
349
+ $continue = true;
350
+ break;
351
+ }
352
+ }
353
+ if ( $continue )
354
+ continue;
355
+ }
356
+
357
+ do_action( 'yit_panel_sidebar_before_widget', $widget_id, $widget );
358
+
359
+ yit_plugin_get_template( $basename, $path, $args );
360
+
361
+ do_action( 'yit_panel_sidebar_after_widget', $widget_id, $widget );
362
+ }
363
+ }
364
+
365
+ /**
366
+ * set transient for first activation
367
+ * to prevent too many calls to YIThemes
368
+ */
369
+ public static function set_transient_for_first_activation() {
370
+ $remote_widgets = get_transient( self::$transient_remote_widgets );
371
+ $updated = get_transient( self::$transient_updated_remote_widgets );
372
+
373
+ $first_activation = $updated === false && $remote_widgets === false;
374
+ if ( $first_activation ) {
375
+ $seven_days_random = mt_rand( 0, 7 * DAY_IN_SECONDS );
376
+ $expiration = 1 * DAY_IN_SECONDS + $seven_days_random;
377
+
378
+ set_transient( self::$transient_remote_widgets, array(), $expiration );
379
+ set_transient( self::$transient_updated_remote_widgets, true, $expiration );
380
+ }
381
+ }
382
+
383
+ /**
384
+ * Sort widgets by priority
385
+ *
386
+ * @param $a
387
+ * @param $b
388
+ *
389
+ * @return bool
390
+ *
391
+ * @since 1.0
392
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
393
+ */
394
+ public function sort_widgets( $a, $b ) {
395
+ $priority_a = isset( $a[ 'priority' ] ) ? intval( $a[ 'priority' ] ) : $this->default_remote_widget_priority;
396
+ $priority_b = isset( $b[ 'priority' ] ) ? intval( $b[ 'priority' ] ) : $this->default_remote_widget_priority;
397
+ if ( $priority_a == $priority_b ) {
398
+ return 0;
399
+ } elseif ( $priority_a > $priority_b ) {
400
+ return 1;
401
+ } else {
402
+ return -1;
403
+ }
404
+ }
405
+
406
+ /**
407
+ * Add Admin WC Style and Scripts
408
+ *
409
+ * @return void
410
+ *
411
+ * @since 1.0
412
+ * @author Leanza Francesco <leanzafrancesco@gmail.com
413
+ */
414
+ public function admin_enqueue_scripts() {
415
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
416
+
417
+ wp_enqueue_style( 'opensans-font', '//fonts.googleapis.com/css?family=Open+Sans:400,500,600,700,800,100,200,300,900' );
418
+ wp_enqueue_style( 'yit-plugin-sidebar-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel-sidebar.css', $this->version );
419
+ wp_enqueue_script( 'yit-plugin-sidebar-js', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel-sidebar' . $min . '.js', array( 'jquery' ), $this->version, true );
420
+ wp_localize_script( 'yit-plugin-sidebar-js', 'sidebar_labels', array(
421
+ 'hide_sidebar' => __( 'Hide sidebar', 'yith-plugin-fw' ),
422
+ 'show_sidebar' => __( 'Show sidebar', 'yith-plugin-fw' ),
423
+ 'wrapper_class' => 'yit-admin-panel-content-wrap',
424
+ ) );
425
+ }
426
+ }
427
+ }
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -1,428 +1,451 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( ! defined( 'ABSPATH' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
16
- /**
17
- * YIT Plugin Panel for WooCommerce
18
- *
19
- * Setting Page to Manage Plugins
20
- *
21
- * @class YIT_Plugin_Panel
22
- * @package Yithemes
23
- * @since 1.0
24
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
26
- */
27
-
28
- class YIT_Plugin_Panel_WooCommerce extends YIT_Plugin_Panel {
29
-
30
- /**
31
- * @var string version of class
32
- */
33
- public $version = '1.0.0';
34
-
35
- /**
36
- * @var array a setting list of parameters
37
- */
38
- public $settings = array();
39
-
40
- /**
41
- * @var array a setting list of parameters
42
- */
43
- public $wc_type = array();
44
-
45
- /**
46
- * @var array
47
- */
48
- protected $_tabs_path_files;
49
-
50
- /**
51
- * Constructor
52
- *
53
- * @since 1.0
54
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
55
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
56
- */
57
- public function __construct( $args = array() ) {
58
-
59
- $this->wc_type = array(
60
- 'checkbox',
61
- 'textarea',
62
- 'multiselect',
63
- 'multi_select_countries',
64
- 'image_width'
65
- );
66
-
67
- if ( ! empty( $args ) ) {
68
- $this->settings = $args;
69
- $this->_tabs_path_files = $this->get_tabs_path_files();
70
-
71
- if( isset( $this->settings['create_menu_page'] ) && $this->settings[ 'create_menu_page'] ){
72
- $this->add_menu_page();
73
- }
74
- add_action( 'admin_init', array( $this, 'set_default_options') );
75
- add_action( 'admin_menu', array( $this, 'add_setting_page' ) );
76
- add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
77
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
78
- add_action( 'admin_init', array( $this, 'woocommerce_update_options' ) );
79
- add_filter( 'woocommerce_screen_ids', array( $this, 'add_allowed_screen_id' ) );
80
- add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'maybe_unserialize_panel_data' ), 10, 3 );
81
-
82
- /* Add VideoBox and InfoBox */
83
- add_action( 'woocommerce_admin_field_boxinfo', array( $this, 'add_infobox' ), 10, 1 );
84
- add_action( 'woocommerce_admin_field_videobox', array( $this, 'add_videobox' ), 10, 1 );
85
-
86
- /* WooCommerce 2.4 Support */
87
- add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
88
- }
89
- }
90
-
91
-
92
- /**
93
- * Show a tabbed panel to setting page
94
- *
95
- * a callback function called by add_setting_page => add_submenu_page
96
- *
97
- * @return void
98
- * @since 1.0
99
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
100
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
101
- */
102
- public function yit_panel() {
103
- $additional_info = array(
104
- 'current_tab' => $this->get_current_tab(),
105
- 'available_tabs' => $this->settings['admin-tabs'],
106
- 'default_tab' => $this->get_available_tabs( true ), //get default tabs
107
- 'page' => $this->settings['page']
108
- );
109
-
110
- $additional_info = apply_filters( 'yith_admin_tab_params', $additional_info );
111
- $additional_info['additional_info'] = $additional_info;
112
-
113
- extract( $additional_info );
114
- require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-panel.php' );
115
- }
116
-
117
- /**
118
- * Show a input fields to upload images
119
- *
120
- *
121
- * @return void
122
- * @since 1.0
123
- * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
124
- */
125
-
126
- public function yit_upload_update( $option_value ) {
127
- return $option_value;
128
- }
129
-
130
- /**
131
- * Show a input fields to upload images
132
- *
133
- *
134
- * @return void
135
- * @since 1.0
136
- * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
137
- */
138
-
139
- public function yit_upload( $args = array() ) {
140
- if ( ! empty( $args ) ) {
141
- $args['value'] = ( get_option($args['id'])) ? get_option($args['id']) : $args['default'];
142
- extract( $args );
143
-
144
- include( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-upload.php' );
145
- }
146
- }
147
-
148
- /**
149
- * Add the plugin woocommerce page settings in the screen ids of woocommerce
150
- *
151
- * @param $screen_ids
152
- *
153
- * @return mixed
154
- * @since 1.0.0
155
- * @author Antonino Scarfì <antonino.scarfi@yithemes.com>
156
- */
157
- public function add_allowed_screen_id( $screen_ids ) {
158
- global $admin_page_hooks;
159
-
160
- if ( ! isset( $admin_page_hooks[ $this->settings['parent_page'] ] ) ) {
161
- return $screen_ids;
162
- }
163
-
164
- $screen_ids[] = $admin_page_hooks[ $this->settings['parent_page'] ] . '_page_' . $this->settings['page'];
165
-
166
- return $screen_ids;
167
- }
168
-
169
- /**
170
- * Returns current active tab slug
171
- *
172
- * @return string
173
- * @since 2.0.0
174
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
175
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
176
- */
177
- public function get_current_tab() {
178
- global $pagenow;
179
- $tabs = $this->get_available_tabs();
180
-
181
- if ( $pagenow == 'admin.php' && isset( $_REQUEST['tab'] ) && in_array( $_REQUEST['tab'], $tabs ) ) {
182
- return $_REQUEST['tab'];
183
- }
184
- else {
185
- return $tabs[0];
186
- }
187
- }
188
-
189
- /**
190
- * Return available tabs
191
- *
192
- * read all options and show sections and fields
193
- *
194
- * @param bool false for all tabs slug, true for current tab
195
- *
196
- * @return mixed Array tabs | String current tab
197
- * @since 1.0
198
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
199
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
200
- */
201
- public function get_available_tabs( $default = false ) {
202
- $tabs = array_keys( $this->settings['admin-tabs'] );
203
- return $default ? $tabs[0] : $tabs;
204
- }
205
-
206
-
207
- /**
208
- * Add sections and fields to setting panel
209
- *
210
- * read all options and show sections and fields
211
- *
212
- * @return void
213
- * @since 1.0
214
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
215
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
216
- */
217
- public function add_fields() {
218
- $yit_options = $this->get_main_array_options();
219
- $current_tab = $this->get_current_tab();
220
-
221
- if ( ! $current_tab ) {
222
- return;
223
- }
224
-
225
- woocommerce_admin_fields( $yit_options[$current_tab] );
226
- }
227
-
228
- /**
229
- * Print the panel content
230
- *
231
- * check if the tab is a wc options tab or custom tab and print the content
232
- *
233
- * @return void
234
- * @since 1.0
235
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
236
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
237
- */
238
- public function print_panel_content() {
239
- $yit_options = $this->get_main_array_options();
240
- $current_tab = $this->get_current_tab();
241
- $custom_tab_action = $this->is_custom_tab( $yit_options, $current_tab );
242
-
243
- if ( $custom_tab_action ) {
244
- $this->print_custom_tab( $custom_tab_action );
245
- return;
246
- }
247
- else {
248
- require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-form.php' );
249
- }
250
- }
251
-
252
- /**
253
- * Update options
254
- *
255
- * @return void
256
- * @since 1.0
257
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
258
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
259
- * @see woocommerce_update_options function
260
- * @internal fire two action (before and after update): yit_panel_wc_before_update and yit_panel_wc_after_update
261
- */
262
- public function woocommerce_update_options() {
263
-
264
- if ( isset( $_POST['yit_panel_wc_options_nonce'] ) && wp_verify_nonce( $_POST['yit_panel_wc_options_nonce'], 'yit_panel_wc_options_'.$this->settings['page'] ) ) {
265
-
266
- do_action( 'yit_panel_wc_before_update' );
267
-
268
- $yit_options = $this->get_main_array_options();
269
- $current_tab = $this->get_current_tab();
270
-
271
- if( version_compare( WC()->version, '2.4.0', '>=' ) ) {
272
- if ( ! empty( $yit_options[ $current_tab ] ) ) {
273
- foreach ( $yit_options[ $current_tab ] as $option ) {
274
- if ( isset( $option['id'] ) && isset( $_POST[ $option['id'] ] ) && isset( $option['type' ] ) && ! in_array( $option['type'], $this->wc_type ) ) {
275
- $_POST[ $option['id'] ] = maybe_serialize( $_POST[ $option['id'] ] );
276
- }
277
- }
278
- }
279
- }
280
-
281
- foreach($_POST as $name => $value) {
282
-
283
- // Check if current POST var name ends with a specific needle and make some stuff here
284
- $attachment_id_needle = "-yith-attachment-id";
285
- $is_hidden_input = (($temp = strlen($name) - strlen($attachment_id_needle)) >= 0 && strpos($name, $attachment_id_needle, $temp) !== FALSE);
286
- if ($is_hidden_input){
287
- // Is an input element of type "hidden" coupled with an input element for selecting an element from the media gallery
288
- $yit_options[ $current_tab ][$name] = array(
289
- "type" => "text",
290
- "id" => $name
291
- );
292
- }
293
- }
294
-
295
- woocommerce_update_options( $yit_options[ $current_tab ] );
296
-
297
- do_action( 'yit_panel_wc_after_update' );
298
-
299
- } elseif( isset( $_REQUEST['yit-action'] ) && $_REQUEST['yit-action'] == 'wc-options-reset'
300
- && isset( $_POST['yith_wc_reset_options_nonce'] ) && wp_verify_nonce( $_POST['yith_wc_reset_options_nonce'], 'yith_wc_reset_options_'.$this->settings['page'] )){
301
-
302
- $yit_options = $this->get_main_array_options();
303
- $current_tab = $this->get_current_tab();
304
-
305
- foreach( $yit_options[ $current_tab ] as $id => $option ){
306
- if( isset( $option['default'] ) ){
307
- update_option( $option['id'], $option['default'] );
308
- }
309
- }
310
- }
311
- }
312
-
313
- /**
314
- * Add Admin WC Style and Scripts
315
- *
316
- * @return void
317
- * @since 1.0
318
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
319
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
320
- */
321
- public function admin_enqueue_scripts() {
322
- global $woocommerce, $pagenow;
323
-
324
- wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
325
-
326
- wp_enqueue_media();
327
- wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css', array(), $woocommerce->version );
328
- wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
329
-
330
- if ( 'customize.php' != $pagenow ){
331
-
332
- wp_enqueue_style ( 'wp-jquery-ui-dialog' );
333
-
334
- }
335
-
336
- wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
337
- wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
338
- wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
339
- wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.min.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
340
- wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
341
- 'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
342
- ) );
343
-
344
- if( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yit-plugins_page' ) !== false ){
345
- wp_enqueue_style( 'yit-plugin-style' );
346
- wp_enqueue_script( 'yit-plugin-panel' );
347
- }
348
- }
349
-
350
- /**
351
- * Default options
352
- *
353
- * Sets up the default options used on the settings page
354
- *
355
- * @access public
356
- * @return void
357
- * @since 1.0.0
358
- */
359
- public function set_default_options() {
360
-
361
- $default_options = $this->get_main_array_options();
362
-
363
- foreach ($default_options as $section) {
364
- foreach ( $section as $value ) {
365
- if ( ( isset( $value['std'] ) || isset( $value['default'] ) ) && isset( $value['id'] ) ) {
366
- $default_value = ( isset( $value['default'] ) ) ? $value['default'] : $value['std'];
367
-
368
- if ( $value['type'] == 'image_width' ) {
369
- add_option($value['id'].'_width', $default_value);
370
- add_option($value['id'].'_height', $default_value);
371
- } else {
372
- add_option($value['id'], $default_value);
373
- }
374
- }
375
-
376
- }
377
- }
378
-
379
- }
380
-
381
- /**
382
- * Add the woocommerce body class in plugin panel page
383
- *
384
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
385
- * @since 2.0
386
- * @param $classes The body classes
387
- *
388
- * @return array Filtered body classes
389
- */
390
- public function admin_body_class( $admin_body_classes ){
391
- global $pagenow;
392
- return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
393
- }
394
-
395
- /**
396
- * Maybe unserialize panel data
397
- *
398
- * @param $value mixed Option value
399
- * @param $option mixed Option settings array
400
- * @param $raw_value string Raw option value
401
- *
402
- * @return mixed Filtered return value
403
- * @author Antonio La Rocca <antonio.larocca@yithemes.com>
404
- * @since 2.0
405
- */
406
- public function maybe_unserialize_panel_data( $value, $option, $raw_value ) {
407
-
408
-
409
- if( ! version_compare( WC()->version, '2.4.0', '>=' ) || ! isset( $option['type' ] ) || in_array( $option['type'], $this->wc_type ) ) {
410
- return $value;
411
- }
412
-
413
- $yit_options = $this->get_main_array_options();
414
- $current_tab = $this->get_current_tab();
415
-
416
- if( ! empty( $yit_options[ $current_tab ] ) ){
417
- foreach( $yit_options[ $current_tab ] as $option_array ){
418
- if( isset( $option_array['id'] ) && isset( $option['id'] ) && $option_array['id'] == $option['id'] ){
419
- return maybe_unserialize( $value );
420
- }
421
- }
422
- }
423
-
424
- return $value;
425
- }
426
-
427
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  }
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
16
+ /**
17
+ * YIT Plugin Panel for WooCommerce
18
+ *
19
+ * Setting Page to Manage Plugins
20
+ *
21
+ * @class YIT_Plugin_Panel
22
+ * @package Yithemes
23
+ * @since 1.0
24
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
26
+ */
27
+
28
+ class YIT_Plugin_Panel_WooCommerce extends YIT_Plugin_Panel {
29
+
30
+ /**
31
+ * @var string version of class
32
+ */
33
+ public $version = '1.0.0';
34
+
35
+ /**
36
+ * @var array a setting list of parameters
37
+ */
38
+ public $settings = array();
39
+
40
+ /**
41
+ * @var array a setting list of parameters
42
+ */
43
+ public $wc_type = array();
44
+
45
+ /**
46
+ * @var array
47
+ */
48
+ protected $_tabs_path_files;
49
+
50
+ /**
51
+ * Constructor
52
+ *
53
+ * @since 1.0
54
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
55
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
56
+ */
57
+ public function __construct( $args = array() ) {
58
+
59
+ $this->wc_type = array(
60
+ 'checkbox',
61
+ 'textarea',
62
+ 'multiselect',
63
+ 'multi_select_countries',
64
+ 'image_width'
65
+ );
66
+
67
+ if ( ! empty( $args ) ) {
68
+ $this->settings = $args;
69
+ $this->_tabs_path_files = $this->get_tabs_path_files();
70
+
71
+ if( isset( $this->settings['create_menu_page'] ) && $this->settings[ 'create_menu_page'] ){
72
+ $this->add_menu_page();
73
+ }
74
+
75
+ if ( !empty( $this->settings[ 'links' ] ) ) {
76
+ $this->links = $this->settings[ 'links' ];
77
+ }
78
+
79
+ add_action( 'admin_init', array( $this, 'set_default_options') );
80
+ add_action( 'admin_menu', array( $this, 'add_setting_page' ) );
81
+ add_action( 'admin_menu', array( $this, 'add_premium_version_upgrade_to_menu' ), 100 );
82
+ add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
83
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
84
+ add_action( 'admin_init', array( $this, 'woocommerce_update_options' ) );
85
+ add_filter( 'woocommerce_screen_ids', array( $this, 'add_allowed_screen_id' ) );
86
+ add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'maybe_unserialize_panel_data' ), 10, 3 );
87
+
88
+ /* Add VideoBox and InfoBox */
89
+ add_action( 'woocommerce_admin_field_boxinfo', array( $this, 'add_infobox' ), 10, 1 );
90
+ add_action( 'woocommerce_admin_field_videobox', array( $this, 'add_videobox' ), 10, 1 );
91
+
92
+ /* WooCommerce 2.4 Support */
93
+ add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
94
+ }
95
+
96
+ /* add YIT Plugin sidebar */
97
+ $this->sidebar = YIT_Plugin_Panel_Sidebar::instance( $this );
98
+ }
99
+
100
+
101
+ /**
102
+ * Show a tabbed panel to setting page
103
+ *
104
+ * a callback function called by add_setting_page => add_submenu_page
105
+ *
106
+ * @return void
107
+ * @since 1.0
108
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
109
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
110
+ */
111
+ public function yit_panel() {
112
+ $additional_info = array(
113
+ 'current_tab' => $this->get_current_tab(),
114
+ 'available_tabs' => $this->settings['admin-tabs'],
115
+ 'default_tab' => $this->get_available_tabs( true ), //get default tabs
116
+ 'page' => $this->settings['page']
117
+ );
118
+
119
+ $additional_info = apply_filters( 'yith_admin_tab_params', $additional_info );
120
+ $additional_info['additional_info'] = $additional_info;
121
+
122
+ extract( $additional_info );
123
+ require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-panel.php' );
124
+ }
125
+
126
+ /**
127
+ * Show a input fields to upload images
128
+ *
129
+ *
130
+ * @return void
131
+ * @since 1.0
132
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
133
+ */
134
+
135
+ public function yit_upload_update( $option_value ) {
136
+ return $option_value;
137
+ }
138
+
139
+ /**
140
+ * Show a input fields to upload images
141
+ *
142
+ *
143
+ * @return void
144
+ * @since 1.0
145
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
146
+ */
147
+
148
+ public function yit_upload( $args = array() ) {
149
+ if ( ! empty( $args ) ) {
150
+ $args['value'] = ( get_option($args['id'])) ? get_option($args['id']) : $args['default'];
151
+ extract( $args );
152
+
153
+ include( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-upload.php' );
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Add the plugin woocommerce page settings in the screen ids of woocommerce
159
+ *
160
+ * @param $screen_ids
161
+ *
162
+ * @return mixed
163
+ * @since 1.0.0
164
+ * @author Antonino Scarfì <antonino.scarfi@yithemes.com>
165
+ */
166
+ public function add_allowed_screen_id( $screen_ids ) {
167
+ global $admin_page_hooks;
168
+
169
+ if ( ! isset( $admin_page_hooks[ $this->settings['parent_page'] ] ) ) {
170
+ return $screen_ids;
171
+ }
172
+
173
+ $screen_ids[] = $admin_page_hooks[ $this->settings['parent_page'] ] . '_page_' . $this->settings['page'];
174
+
175
+ return $screen_ids;
176
+ }
177
+
178
+ /**
179
+ * Returns current active tab slug
180
+ *
181
+ * @return string
182
+ * @since 2.0.0
183
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
184
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
185
+ */
186
+ public function get_current_tab() {
187
+ global $pagenow;
188
+ $tabs = $this->get_available_tabs();
189
+
190
+ if ( $pagenow == 'admin.php' && isset( $_REQUEST['tab'] ) && in_array( $_REQUEST['tab'], $tabs ) ) {
191
+ return $_REQUEST['tab'];
192
+ }
193
+ else {
194
+ return $tabs[0];
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Return available tabs
200
+ *
201
+ * read all options and show sections and fields
202
+ *
203
+ * @param bool false for all tabs slug, true for current tab
204
+ *
205
+ * @return mixed Array tabs | String current tab
206
+ * @since 1.0
207
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
208
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
209
+ */
210
+ public function get_available_tabs( $default = false ) {
211
+ $tabs = array_keys( $this->settings['admin-tabs'] );
212
+ return $default ? $tabs[0] : $tabs;
213
+ }
214
+
215
+
216
+ /**
217
+ * Add sections and fields to setting panel
218
+ *
219
+ * read all options and show sections and fields
220
+ *
221
+ * @return void
222
+ * @since 1.0
223
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
224
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
225
+ */
226
+ public function add_fields() {
227
+ $yit_options = $this->get_main_array_options();
228
+ $current_tab = $this->get_current_tab();
229
+
230
+ if ( ! $current_tab ) {
231
+ return;
232
+ }
233
+
234
+ woocommerce_admin_fields( $yit_options[$current_tab] );
235
+ }
236
+
237
+ /**
238
+ * Print the panel content
239
+ *
240
+ * check if the tab is a wc options tab or custom tab and print the content
241
+ *
242
+ * @return void
243
+ * @since 1.0
244
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
245
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
246
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
247
+ */
248
+ public function print_panel_content() {
249
+ $yit_options = $this->get_main_array_options();
250
+ $current_tab = $this->get_current_tab();
251
+ $custom_tab_action = $this->is_custom_tab( $yit_options, $current_tab );
252
+ $hide_sidebar = $this->hide_sidebar( $yit_options, $current_tab );
253
+
254
+ if ( $custom_tab_action ) {
255
+ $this->print_custom_tab( $custom_tab_action, $hide_sidebar );
256
+ return;
257
+ }
258
+ else {
259
+ require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/woocommerce/woocommerce-form.php' );
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Update options
265
+ *
266
+ * @return void
267
+ * @since 1.0
268
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
269
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
270
+ * @see woocommerce_update_options function
271
+ * @internal fire two action (before and after update): yit_panel_wc_before_update and yit_panel_wc_after_update
272
+ */
273
+ public function woocommerce_update_options() {
274
+
275
+ if ( isset( $_POST['yit_panel_wc_options_nonce'] ) && wp_verify_nonce( $_POST['yit_panel_wc_options_nonce'], 'yit_panel_wc_options_'.$this->settings['page'] ) ) {
276
+
277
+ do_action( 'yit_panel_wc_before_update' );
278
+
279
+ $yit_options = $this->get_main_array_options();
280
+ $current_tab = $this->get_current_tab();
281
+
282
+ if( version_compare( WC()->version, '2.4.0', '>=' ) ) {
283
+ if ( ! empty( $yit_options[ $current_tab ] ) ) {
284
+ foreach ( $yit_options[ $current_tab ] as $option ) {
285
+ if ( isset( $option['id'] ) && isset( $_POST[ $option['id'] ] ) && isset( $option['type' ] ) && ! in_array( $option['type'], $this->wc_type ) ) {
286
+ $_POST[ $option['id'] ] = maybe_serialize( $_POST[ $option['id'] ] );
287
+ }
288
+ }
289
+ }
290
+ }
291
+
292
+ foreach($_POST as $name => $value) {
293
+
294
+ // Check if current POST var name ends with a specific needle and make some stuff here
295
+ $attachment_id_needle = "-yith-attachment-id";
296
+ $is_hidden_input = (($temp = strlen($name) - strlen($attachment_id_needle)) >= 0 && strpos($name, $attachment_id_needle, $temp) !== FALSE);
297
+ if ($is_hidden_input){
298
+ // Is an input element of type "hidden" coupled with an input element for selecting an element from the media gallery
299
+ $yit_options[ $current_tab ][$name] = array(
300
+ "type" => "text",
301
+ "id" => $name
302
+ );
303
+ }
304
+ }
305
+
306
+ woocommerce_update_options( $yit_options[ $current_tab ] );
307
+
308
+ do_action( 'yit_panel_wc_after_update' );
309
+
310
+ } elseif( isset( $_REQUEST['yit-action'] ) && $_REQUEST['yit-action'] == 'wc-options-reset'
311
+ && isset( $_POST['yith_wc_reset_options_nonce'] ) && wp_verify_nonce( $_POST['yith_wc_reset_options_nonce'], 'yith_wc_reset_options_'.$this->settings['page'] )){
312
+
313
+ do_action( 'yit_panel_wc_before_reset' );
314
+
315
+ $yit_options = $this->get_main_array_options();
316
+ $current_tab = $this->get_current_tab();
317
+
318
+ foreach( $yit_options[ $current_tab ] as $id => $option ){
319
+ if( isset( $option['default'] ) ){
320
+ update_option( $option['id'], $option['default'] );
321
+ }
322
+ }
323
+
324
+ do_action( 'yit_panel_wc_after_reset' );
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Add Admin WC Style and Scripts
330
+ *
331
+ * @return void
332
+ * @since 1.0
333
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
334
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
335
+ */
336
+ public function admin_enqueue_scripts() {
337
+ global $woocommerce, $pagenow;
338
+
339
+ wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
340
+
341
+ wp_enqueue_media();
342
+ wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css', array(), $woocommerce->version );
343
+ wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $woocommerce->version );
344
+ wp_register_style( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/css/colorbox.css', array(), $woocommerce->version );
345
+ wp_register_style( 'yit-upgrade-to-pro', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrade-to-pro.css', array( 'colorbox' ), $woocommerce->version );
346
+
347
+ if ( 'customize.php' != $pagenow ){
348
+
349
+ wp_enqueue_style ( 'wp-jquery-ui-dialog' );
350
+
351
+ }
352
+
353
+ wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
354
+ wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
355
+ wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', array( 'jquery', 'jquery-ui-datepicker','jquery-ui-dialog', 'jquery-ui-sortable', 'iris', 'chosen' ), $woocommerce->version, true );
356
+ wp_register_script( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/js/jquery.colorbox.js', array( 'jquery' ), '1.6.3', true );
357
+ wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.min.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
358
+ wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
359
+ 'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
360
+ ) );
361
+
362
+ if( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ){
363
+ wp_enqueue_style( 'yit-plugin-style' );
364
+ wp_enqueue_script( 'yit-plugin-panel' );
365
+ }
366
+
367
+ if( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith_upgrade_premium_version' ) !== false ){
368
+ wp_enqueue_style( 'yit-upgrade-to-pro' );
369
+ wp_enqueue_script( 'colorbox' );
370
+ }
371
+ }
372
+
373
+ /**
374
+ * Default options
375
+ *
376
+ * Sets up the default options used on the settings page
377
+ *
378
+ * @access public
379
+ * @return void
380
+ * @since 1.0.0
381
+ */
382
+ public function set_default_options() {
383
+
384
+ $default_options = $this->get_main_array_options();
385
+
386
+ foreach ($default_options as $section) {
387
+ foreach ( $section as $value ) {
388
+ if ( ( isset( $value['std'] ) || isset( $value['default'] ) ) && isset( $value['id'] ) ) {
389
+ $default_value = ( isset( $value['default'] ) ) ? $value['default'] : $value['std'];
390
+
391
+ if ( $value['type'] == 'image_width' ) {
392
+ add_option($value['id'].'_width', $default_value);
393
+ add_option($value['id'].'_height', $default_value);
394
+ } else {
395
+ add_option($value['id'], $default_value);
396
+ }
397
+ }
398
+
399
+ }
400
+ }
401
+
402
+ }
403
+
404
+ /**
405
+ * Add the woocommerce body class in plugin panel page
406
+ *
407
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
408
+ * @since 2.0
409
+ * @param $classes The body classes
410
+ *
411
+ * @return array Filtered body classes
412
+ */
413
+ public function admin_body_class( $admin_body_classes ){
414
+ global $pagenow;
415
+ return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
416
+ }
417
+
418
+ /**
419
+ * Maybe unserialize panel data
420
+ *
421
+ * @param $value mixed Option value
422
+ * @param $option mixed Option settings array
423
+ * @param $raw_value string Raw option value
424
+ *
425
+ * @return mixed Filtered return value
426
+ * @author Antonio La Rocca <antonio.larocca@yithemes.com>
427
+ * @since 2.0
428
+ */
429
+ public function maybe_unserialize_panel_data( $value, $option, $raw_value ) {
430
+
431
+
432
+ if( ! version_compare( WC()->version, '2.4.0', '>=' ) || ! isset( $option['type' ] ) || in_array( $option['type'], $this->wc_type ) ) {
433
+ return $value;
434
+ }
435
+
436
+ $yit_options = $this->get_main_array_options();
437
+ $current_tab = $this->get_current_tab();
438
+
439
+ if( ! empty( $yit_options[ $current_tab ] ) ){
440
+ foreach( $yit_options[ $current_tab ] as $option_array ){
441
+ if( isset( $option_array['id'] ) && isset( $option['id'] ) && $option_array['id'] == $option['id'] ){
442
+ return maybe_unserialize( $value );
443
+ }
444
+ }
445
+ }
446
+
447
+ return $value;
448
+ }
449
+
450
+ }
451
  }
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -1,803 +1,921 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( ! defined( 'ABSPATH' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
16
- /**
17
- * YIT Plugin Panel
18
- *
19
- * Setting Page to Manage Plugins
20
- *
21
- * @class YIT_Plugin_Panel
22
- * @package Yithemes
23
- * @since 1.0
24
- * @author Your Inspiration Themes
25
- */
26
-
27
- class YIT_Plugin_Panel {
28
-
29
- /**
30
- * @var string version of class
31
- */
32
- public $version = '1.0.0';
33
-
34
- /**
35
- * @var array a setting list of parameters
36
- */
37
- public $settings = array();
38
-
39
- /**
40
- * @var array
41
- */
42
- protected $_tabs_path_files;
43
-
44
- /**
45
- * @var array
46
- */
47
- private $_main_array_options = array();
48
-
49
- /**
50
- * Constructor
51
- *
52
- * @since 1.0
53
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
54
- *
55
- * @param array $args
56
- */
57
- public function __construct( $args = array() ) {
58
-
59
- if ( ! empty( $args ) ) {
60
-
61
- $default_args = array(
62
- 'parent_slug' => 'edit.php?',
63
- 'page_title' => __( 'Plugin Settings', 'yith-plugin-fw' ),
64
- 'menu_title' => __( 'Settings', 'yith-plugin-fw' ),
65
- 'capability' => 'manage_options',
66
- 'icon_url' => '',
67
- 'position' => null
68
- );
69
-
70
- $this->settings = wp_parse_args( $args, $default_args );
71
- $this->_tabs_path_files = $this->get_tabs_path_files();
72
-
73
- if ( isset( $this->settings['create_menu_page'] ) && $this->settings['create_menu_page'] ) {
74
- $this->add_menu_page();
75
- }
76
-
77
- add_action( 'admin_init', array( $this, 'register_settings' ) );
78
- add_action( 'admin_menu', array( $this, 'add_setting_page' ), 20 );
79
- add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
80
- add_action( 'admin_init', array( $this, 'add_fields' ) );
81
-
82
- }
83
-
84
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
85
- }
86
-
87
- /**
88
- * Add Menu page link
89
- *
90
- * @return void
91
- * @since 1.0
92
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
93
- */
94
- public function add_menu_page() {
95
- global $admin_page_hooks;
96
-
97
- if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
98
- $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
99
- add_menu_page( 'yit_plugin_panel', __( 'YIT Plugins', 'yith-plugin-fw' ), 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
100
- }
101
- }
102
-
103
- /**
104
- * Remove duplicate submenu
105
- *
106
- * Submenu page hack: Remove the duplicate YIT Plugin link on subpages
107
- *
108
- * @return void
109
- * @since 1.0
110
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
111
- */
112
- public function remove_duplicate_submenu_page() {
113
- /* === Duplicate Items Hack === */
114
- remove_submenu_page( 'yit_plugin_panel', 'yit_plugin_panel' );
115
- }
116
-
117
- /**
118
- * Enqueue script and styles in admin side
119
- *
120
- * Add style and scripts to administrator
121
- *
122
- * @return void
123
- * @since 1.0
124
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
125
- */
126
- public function admin_enqueue_scripts() {
127
-
128
- global $wp_scripts, $pagenow;
129
-
130
- //scripts
131
- wp_enqueue_media();
132
- wp_enqueue_script( 'jquery-ui' );
133
- wp_enqueue_script( 'jquery-ui-core' );
134
- wp_enqueue_script( 'jquery-ui-slider' );
135
- wp_enqueue_script( 'jquery-ui-dialog' );
136
- wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
137
- wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
138
- wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
139
- wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
140
-
141
- //styles
142
- $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
143
- wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
144
- wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
145
- wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', $this->version );
146
- wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
147
- wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
148
- wp_enqueue_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
149
-
150
- if( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yit-plugins_page' ) !== false ) || apply_filters( 'yit_plugin_panel_asset_loading', false ) ){
151
- wp_enqueue_style( 'yit-plugin-style' );
152
- wp_enqueue_script( 'yit-plugin-panel' );
153
- }
154
- }
155
-
156
- /**
157
- * Register Settings
158
- *
159
- * Generate wp-admin settings pages by registering your settings and using a few callbacks to control the output
160
- *
161
- * @return void
162
- * @since 1.0
163
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
164
- */
165
- public function register_settings() {
166
- register_setting( 'yit_' . $this->settings['parent'] . '_options', 'yit_' . $this->settings['parent'] . '_options', array( $this, 'options_validate' ) );
167
- }
168
-
169
- /**
170
- * Options Validate
171
- *
172
- * a callback function called by Register Settings function
173
- *
174
- * @param $input
175
- *
176
- * @return array validate input fields
177
- * @since 1.0
178
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
179
- */
180
- public function options_validate( $input ) {
181
-
182
- $current_tab = ! empty( $input['current_tab'] ) ? $input['current_tab'] : 'general';
183
-
184
- $yit_options = $this->get_main_array_options();
185
-
186
- // default
187
- $valid_input = $this->get_options();
188
-
189
- $submit = ( ! empty( $input['submit-general'] ) ? true : false );
190
- $reset = ( ! empty( $input['reset-general'] ) ? true : false );
191
-
192
- foreach ( $yit_options[$current_tab] as $section => $data ) {
193
- foreach ( $data as $option ) {
194
- if ( isset( $option['sanitize_call'] ) && isset( $option['id'] ) ) { //yiw_debug($option, false);
195
- if ( is_array( $option['sanitize_call'] ) ) :
196
- foreach ( $option['sanitize_call'] as $callback ) {
197
- if ( is_array( $input[$option['id']] ) ) {
198
- $valid_input[$option['id']] = array_map( $callback, $input[$option['id']] );
199
- }
200
- else {
201
- $valid_input[$option['id']] = call_user_func( $callback, $input[$option['id']] );
202
- }
203
- }
204
- else :
205
- if ( is_array( $input[$option['id']] ) ) {
206
- $valid_input[$option['id']] = array_map( $option['sanitize_call'], $input[$option['id']] );
207
- }
208
- else {
209
- $valid_input[$option['id']] = call_user_func( $option['sanitize_call'], $input[$option['id']] );
210
- }
211
- endif;
212
- }
213
- else {
214
- if ( isset( $option['id'] ) ) {
215
- if ( isset( $input[$option['id']] ) ) {
216
- $valid_input[$option['id']] = $input[$option['id']];
217
- }
218
- else {
219
- $valid_input[$option['id']] = 'no';
220
- }
221
-
222
- }
223
- }
224
-
225
- }
226
- }
227
-
228
- return $valid_input;
229
- }
230
-
231
- /**
232
- * Add Setting SubPage
233
- *
234
- * add Setting SubPage to wordpress administrator
235
- *
236
- * @return array validate input fields
237
- * @since 1.0
238
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
239
- */
240
- public function add_setting_page() {
241
- $this->settings['icon_url'] = isset( $this->settings['icon_url'] ) ? $this->settings['icon_url'] : '';
242
- $this->settings['position'] = isset( $this->settings['position'] ) ? $this->settings['position'] : null;
243
- $parent = $this->settings['parent_slug'] . $this->settings['parent_page'];
244
-
245
- if ( ! empty( $parent ) ) {
246
- add_submenu_page( $parent, $this->settings['page_title'], $this->settings['menu_title'], $this->settings['capability'], $this->settings['page'], array( $this, 'yit_panel' ) );
247
- } else {
248
- add_menu_page( $this->settings['page_title'], $this->settings['menu_title'], $this->settings['capability'], $this->settings['page'], array( $this, 'yit_panel' ), $this->settings['icon_url'], $this->settings['position'] );
249
- }
250
- /* === Duplicate Items Hack === */
251
- $this->remove_duplicate_submenu_page();
252
- do_action( 'yit_after_add_settings_page' );
253
- }
254
-
255
- /**
256
- * Show a tabbed panel to setting page
257
- *
258
- * a callback function called by add_setting_page => add_submenu_page
259
- *
260
- * @return void
261
- * @since 1.0
262
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
263
- */
264
- public function yit_panel() {
265
-
266
- $tabs = '';
267
- $current_tab = $this->get_current_tab();
268
- $yit_options = $this->get_main_array_options();
269
-
270
- // tabs
271
- foreach ( $this->settings['admin-tabs'] as $tab => $tab_value ) {
272
- $active_class = ( $current_tab == $tab ) ? ' nav-tab-active' : '';
273
- $tabs .= '<a class="nav-tab' . $active_class . '" href="?' . $this->settings['parent_page'] . '&page=' . $this->settings['page'] . '&tab=' . $tab . '">' . $tab_value . '</a>';
274
- }
275
- ?>
276
- <div id="icon-themes" class="icon32"><br /></div>
277
- <h2 class="nav-tab-wrapper">
278
- <?php echo $tabs ?>
279
- </h2>
280
- <?php
281
- $custom_tab_action = $this->is_custom_tab( $yit_options, $current_tab );
282
- if ( $custom_tab_action ) {
283
- $this->print_custom_tab( $custom_tab_action );
284
- return;
285
- }
286
- ?>
287
- <?php $this->print_video_box(); ?>
288
- <div id="wrap" class="plugin-option">
289
- <?php $this->message(); ?>
290
- <h2><?php echo $this->get_tab_title() ?></h2>
291
- <?php if ( $this->is_show_form() ) : ?>
292
- <form method="post" action="options.php">
293
- <?php do_settings_sections( 'yit' ); ?>
294
- <p>&nbsp;</p>
295
- <?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
296
- <input type="hidden" name="<?php echo $this->get_name_field( 'current_tab' ) ?>" value="<?php echo esc_attr( $current_tab ) ?>" />
297
- <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>" style="float:left;margin-right:10px;" />
298
- </form>
299
- <form method="post">
300
- <?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
301
- <input type="hidden" name="yit-action" value="reset" />
302
- <input type="submit" name="yit-reset" class="button-secondary" value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>" onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');" />
303
- </form>
304
- <p>&nbsp;</p>
305
- <?php endif ?>
306
- </div>
307
- <?php
308
- }
309
-
310
- public function is_custom_tab( $options, $current_tab ) {
311
- foreach ( $options[$current_tab] as $section => $option ) {
312
- if ( isset( $option['type'] ) && isset( $option['action'] ) && 'custom_tab' == $option['type'] && ! empty( $option['action'] ) ) {
313
- return $option['action'];
314
- }
315
- else {
316
- return false;
317
- }
318
- }
319
- }
320
-
321
- /**
322
- * Fire the action to print the custom tab
323
- *
324
- *
325
- * @param $action Action to fire
326
- *
327
- * @return void
328
- * @since 1.0
329
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
330
- */
331
- public function print_custom_tab( $action ) {
332
- do_action( $action );
333
- }
334
-
335
- /**
336
- * Add sections and fields to setting panel
337
- *
338
- * read all options and show sections and fields
339
- *
340
- * @return void
341
- * @since 1.0
342
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
343
- */
344
- public function add_fields() {
345
- $yit_options = $this->get_main_array_options();
346
- $current_tab = $this->get_current_tab();
347
-
348
- if ( ! $current_tab ) {
349
- return;
350
- }
351
- foreach ( $yit_options[$current_tab] as $section => $data ) {
352
- add_settings_section( "yit_settings_{$current_tab}_{$section}", $this->get_section_title( $section ), $this->get_section_description( $section ), 'yit' );
353
- foreach ( $data as $option ) {
354
- if ( isset( $option['id'] ) && isset( $option['type'] ) && isset( $option['name'] ) ) {
355
- add_settings_field( "yit_setting_" . $option['id'], $option['name'], array( $this, 'render_field' ), 'yit', "yit_settings_{$current_tab}_{$section}", array( 'option' => $option, 'label_for' => $this->get_id_field( $option['id'] ) ) );
356
- }
357
- }
358
- }
359
- }
360
-
361
-
362
- /**
363
- * Add the tabs to admin bar menu
364
- *
365
- * set all tabs of settings page on wp admin bar
366
- *
367
- * @return void|array return void when capability is false
368
- * @since 1.0
369
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
370
- */
371
- public function add_admin_bar_menu() {
372
-
373
- global $wp_admin_bar;
374
-
375
- if ( ! current_user_can( 'manage_options' ) ) {
376
- return;
377
- }
378
-
379
- if ( ! empty( $this->settings['admin_tabs'] ) ) {
380
- foreach ( $this->settings['admin-tabs'] as $item => $title ) {
381
-
382
- $wp_admin_bar->add_menu( array(
383
- 'parent' => $this->settings['parent'],
384
- 'title' => $title,
385
- 'id' => $this->settings['parent'] . '-' . $item,
386
- 'href' => admin_url( 'themes.php' ) . '?page=' . $this->settings['parent_page'] . '&tab=' . $item
387
- ) );
388
- }
389
- }
390
- }
391
-
392
-
393
- /**
394
- * Get current tab
395
- *
396
- * get the id of tab showed, return general is the current tab is not defined
397
- *
398
- * @return string
399
- * @since 1.0
400
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
401
- */
402
- function get_current_tab() {
403
- $admin_tabs = array_keys( $this->settings['admin-tabs'] );
404
-
405
- if ( ! isset( $_GET['page'] ) || $_GET['page'] != $this->settings['page'] ) {
406
- return false;
407
- }
408
- if ( isset( $_REQUEST['yit_tab_options'] ) ) {
409
- return $_REQUEST['yit_tab_options'];
410
- }
411
- elseif ( isset( $_GET['tab'] ) && isset( $this->_tabs_path_files[$_GET['tab']] ) ) {
412
- return $_GET['tab'];
413
- }
414
- elseif ( isset( $admin_tabs[0] ) ) {
415
- return $admin_tabs[0];
416
- }
417
- else {
418
- return 'general';
419
- }
420
- }
421
-
422
-
423
- /**
424
- * Message
425
- *
426
- * define an array of message and show the content od message if
427
- * is find in the query string
428
- *
429
- * @return void
430
- * @since 1.0
431
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
432
- */
433
- public function message() {
434
-
435
- $message = array(
436
- 'element_exists' => $this->get_message( '<strong>' . __( 'The element you have entered already exists. Please, enter another name.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
437
- 'saved' => $this->get_message( '<strong>' . __( 'Settings saved', 'yith-plugin-fw' ) . '.</strong>', 'updated', false ),
438
- 'reset' => $this->get_message( '<strong>' . __( 'Settings reset', 'yith-plugin-fw' ) . '.</strong>', 'updated', false ),
439
- 'delete' => $this->get_message( '<strong>' . __( 'Element deleted correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
440
- 'updated' => $this->get_message( '<strong>' . __( 'Element updated correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
441
- 'settings-updated' => $this->get_message( '<strong>' . __( 'Element updated correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
442
- 'imported' => $this->get_message( '<strong>' . __( 'Database imported correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
443
- 'no-imported' => $this->get_message( '<strong>' . __( 'An error has occurred during import. Please try again.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
444
- 'file-not-valid' => $this->get_message( '<strong>' . __( 'The added file is not valid.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
445
- 'cant-import' => $this->get_message( '<strong>' . __( 'Sorry, import is disabled.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
446
- 'ord' => $this->get_message( '<strong>' . __( 'Sorting successful.', 'yith-plugin-fw' ) . '</strong>', 'updated', false )
447
- );
448
-
449
- foreach ( $message as $key => $value ) {
450
- if ( isset( $_GET[$key] ) ) {
451
- echo $message[$key];
452
- }
453
- }
454
-
455
- }
456
-
457
- /**
458
- * Get Message
459
- *
460
- * return html code of message
461
- *
462
- * @param $message
463
- * @param string $type can be 'error' or 'updated'
464
- * @param bool $echo
465
- *
466
- * @return void|string
467
- * @since 1.0
468
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
469
- */
470
- public function get_message( $message, $type = 'error', $echo = true ) {
471
- $message = '<div id="message" class="' . $type . ' fade"><p>' . $message . '</p></div>';
472
- if ( $echo ) {
473
- echo $message;
474
- }
475
- return $message;
476
- }
477
-
478
-
479
- /**
480
- * Get Tab Path Files
481
- *
482
- * return an array with filenames of tabs
483
- *
484
- * @return array
485
- * @since 1.0
486
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
487
- */
488
- function get_tabs_path_files() {
489
-
490
- $option_files_path = $this->settings['options-path'] . '/';
491
-
492
- $tabs = array();
493
-
494
- foreach ( ( array ) glob( $option_files_path . '*.php' ) as $filename ) {
495
- preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
496
-
497
- if ( ! isset( $filename_parts[1] ) ) {
498
- continue;
499
- }
500
-
501
- $tab = $filename_parts[1];
502
-
503
- $tabs[$tab] = $filename;
504
- }
505
-
506
- return $tabs;
507
- }
508
-
509
- /**
510
- * Get main array options
511
- *
512
- * return an array with all options defined on options-files
513
- *
514
- * @return array
515
- * @since 1.0
516
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
517
- */
518
- function get_main_array_options() {
519
- if ( ! empty( $this->_main_array_options ) ) {
520
- return $this->_main_array_options;
521
- }
522
-
523
- foreach ( $this->settings['admin-tabs'] as $item => $v ) {
524
- $path = $this->settings['options-path'] . '/' . $item . '-options.php';
525
- if ( file_exists( $path ) ) {
526
- $this->_main_array_options = array_merge( $this->_main_array_options, include $path );
527
- }
528
- }
529
-
530
- return $this->_main_array_options;
531
- }
532
-
533
-
534
- /**
535
- * Set an array with all default options
536
- *
537
- * put default options in an array
538
- *
539
- * @return array
540
- * @since 1.0
541
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
542
- */
543
- public function get_default_options() {
544
- $yit_options = $this->get_main_array_options();
545
- $default_options = array();
546
-
547
- foreach ( $yit_options as $tab => $sections ) {
548
- foreach ( $sections as $section ) {
549
- foreach ( $section as $id => $value ) {
550
- if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
551
- $default_options[$value['id']] = $value['std'];
552
- }
553
- }
554
- }
555
- }
556
-
557
- unset( $yit_options );
558
- return $default_options;
559
- }
560
-
561
-
562
- /**
563
- * Get the title of the tab
564
- *
565
- * return the title of tab
566
- *
567
- * @return string
568
- * @since 1.0
569
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
570
- */
571
- function get_tab_title() {
572
- $yit_options = $this->get_main_array_options();
573
- $current_tab = $this->get_current_tab();
574
-
575
- foreach ( $yit_options[$current_tab] as $sections => $data ) {
576
- foreach ( $data as $option ) {
577
- if ( isset( $option['type'] ) && $option['type'] == 'title' ) {
578
- return $option['name'];
579
- }
580
- }
581
- }
582
- }
583
-
584
- /**
585
- * Get the title of the section
586
- *
587
- * return the title of section
588
- *
589
- * @param $section
590
- *
591
- * @return string
592
- * @since 1.0
593
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
594
- */
595
- function get_section_title( $section ) {
596
- $yit_options = $this->get_main_array_options();
597
- $current_tab = $this->get_current_tab();
598
-
599
- foreach ( $yit_options[$current_tab][$section] as $option ) {
600
- if ( isset( $option['type'] ) && $option['type'] == 'section' ) {
601
- return $option['name'];
602
- }
603
- }
604
- }
605
-
606
- /**
607
- * Get the description of the section
608
- *
609
- * return the description of section if is set
610
- *
611
- * @param $section
612
- *
613
- * @return string
614
- * @since 1.0
615
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
616
- */
617
- function get_section_description( $section ) {
618
- $yit_options = $this->get_main_array_options();
619
- $current_tab = $this->get_current_tab();
620
-
621
- foreach ( $yit_options[$current_tab][$section] as $option ) {
622
- if ( isset( $option['type'] ) && $option['type'] == 'section' && isset( $option['desc'] ) ) {
623
- return '<p>' . $option['desc'] . '</p>';
624
- }
625
- }
626
- }
627
-
628
-
629
- /**
630
- * Show form when necessary
631
- *
632
- * return true if 'showform' is not defined
633
- *
634
- * @return bool
635
- * @since 1.0
636
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
637
- */
638
- function is_show_form() {
639
- $yit_options = $this->get_main_array_options();
640
- $current_tab = $this->get_current_tab();
641
-
642
- foreach ( $yit_options[$current_tab] as $sections => $data ) {
643
- foreach ( $data as $option ) {
644
- if ( ! isset( $option['type'] ) || $option['type'] != 'title' ) {
645
- continue;
646
- }
647
- if ( isset( $option['showform'] ) ) {
648
- return $option['showform'];
649
- }
650
- else {
651
- return true;
652
- }
653
- }
654
- }
655
- }
656
-
657
- /**
658
- * Get name field
659
- *
660
- * return a string with the name of the input field
661
- *
662
- * @param string $name
663
- *
664
- * @return string
665
- * @since 1.0
666
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
667
- */
668
- function get_name_field( $name = '' ) {
669
- return 'yit_' . $this->settings['parent'] . '_options[' . $name . ']';
670
- }
671
-
672
- /**
673
- * Get id field
674
- *
675
- * return a string with the id of the input field
676
- *
677
- * @param string $id
678
- *
679
- * @return string
680
- * @since 1.0
681
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
682
- */
683
- function get_id_field( $id ) {
684
- return 'yit_' . $this->settings['parent'] . '_options_' . $id;
685
- }
686
-
687
-
688
- /**
689
- * Render the field showed in the setting page
690
- *
691
- * include the file of the option type, if file do not exists
692
- * return a text area
693
- *
694
- * @param array $param
695
- *
696
- * @return void
697
- * @since 1.0
698
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
699
- */
700
- function render_field( $param ) {
701
-
702
- if ( ! empty( $param ) && isset( $param ['option'] ) ) {
703
- $option = $param ['option'];
704
- $db_options = $this->get_options();
705
-
706
- $custom_attributes = array();
707
-
708
- if ( ! empty( $option['custom_attributes'] ) && is_array( $option['custom_attributes'] ) ) {
709
- foreach ( $option['custom_attributes'] as $attribute => $attribute_value ) {
710
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
711
- }
712
- }
713
-
714
- $custom_attributes = implode( ' ', $custom_attributes );
715
- $std = isset( $option['std'] ) ? $option['std'] : '';
716
- $db_value = ( isset( $db_options[$option['id']] ) ) ? $db_options[$option['id']] : $std;
717
-
718
- if ( isset( $option['deps'] ) ) {
719
- $deps = $option['deps'];
720
- }
721
- $type = YIT_CORE_PLUGIN_PATH . '/templates/panel/types/' . $option['type'] . '.php';
722
- if ( file_exists( $type ) ) {
723
- include $type;
724
- }
725
- else {
726
- do_action( "yit_panel_{$option['type']}", $option, $db_value, $custom_attributes );
727
- }
728
- }
729
- }
730
-
731
- /**
732
- * Get options from db
733
- *
734
- * return the options from db, if the options aren't defined in the db,
735
- * get the default options ad add the options in the db
736
- *
737
- * @return array
738
- * @since 1.0
739
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
740
- */
741
- public function get_options() {
742
- $options = get_option( 'yit_' . $this->settings['parent'] . '_options' );
743
- if ( $options === false || ( isset( $_REQUEST['yit-action'] ) && $_REQUEST['yit-action'] == 'reset' ) ) {
744
- $options = $this->get_default_options();
745
- }
746
- return $options;
747
- }
748
-
749
- /**
750
- * Show a box panel with specific content in two columns as a new woocommerce type
751
- *
752
- *
753
- * @param array $args
754
- *
755
- * @return void
756
- * @since 1.0
757
- * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
758
- */
759
- public function add_infobox( $args = array() ) {
760
- if ( ! empty( $args ) ) {
761
- extract( $args );
762
- require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/boxinfo.php' );
763
- }
764
- }
765
-
766
- /**
767
- * Show a box panel with specific content in two columns as a new woocommerce type
768
- *
769
- * @param array $args
770
- *
771
- * @return void
772
- * @since 1.0
773
- * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
774
- */
775
- public function add_videobox( $args = array() ) {
776
- if ( ! empty( $args ) ) {
777
- extract( $args );
778
- require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/videobox.php' );
779
- }
780
- }
781
-
782
- /**
783
- * Fire the action to print the custom tab
784
- *
785
- * @return void
786
- * @since 1.0
787
- * @author Antonino Scarfì <antonino.scarfi@yithemes.com>
788
- */
789
- public function print_video_box() {
790
- $file = $this->settings['options-path'] . '/video-box.php';
791
-
792
- if ( ! file_exists( $file ) ) {
793
- return;
794
- }
795
-
796
- $args = include_once( $file );
797
-
798
- $this->add_videobox( $args );
799
- }
800
-
801
- }
802
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
803
  }
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
16
+ /**
17
+ * YIT Plugin Panel
18
+ *
19
+ * Setting Page to Manage Plugins
20
+ *
21
+ * @class YIT_Plugin_Panel
22
+ * @package Yithemes
23
+ * @since 1.0
24
+ * @author Your Inspiration Themes
25
+ */
26
+
27
+ class YIT_Plugin_Panel {
28
+
29
+ /**
30
+ * @var string version of class
31
+ */
32
+ public $version = '1.0.0';
33
+
34
+ /**
35
+ * @var array a setting list of parameters
36
+ */
37
+ public $settings = array();
38
+
39
+ /**
40
+ * @var array
41
+ */
42
+ protected $_tabs_path_files;
43
+
44
+ /**
45
+ * @var array
46
+ */
47
+ private $_main_array_options = array();
48
+
49
+ /**
50
+ * @var YIT_Plugin_Panel_Sidebar
51
+ */
52
+ public $sidebar;
53
+
54
+ /**
55
+ * @var array
56
+ */
57
+ public $links;
58
+
59
+ /**
60
+ * Constructor
61
+ *
62
+ * @since 1.0
63
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
64
+ *
65
+ * @param array $args
66
+ */
67
+ public function __construct( $args = array() ) {
68
+
69
+ if ( ! empty( $args ) ) {
70
+
71
+ $default_args = array(
72
+ 'parent_slug' => 'edit.php?',
73
+ 'page_title' => __( 'Plugin Settings', 'yith-plugin-fw' ),
74
+ 'menu_title' => __( 'Settings', 'yith-plugin-fw' ),
75
+ 'capability' => 'manage_options',
76
+ 'icon_url' => '',
77
+ 'position' => null
78
+ );
79
+
80
+ $this->settings = wp_parse_args( $args, $default_args );
81
+ $this->_tabs_path_files = $this->get_tabs_path_files();
82
+
83
+ if ( isset( $this->settings['create_menu_page'] ) && $this->settings['create_menu_page'] ) {
84
+ $this->add_menu_page();
85
+ }
86
+
87
+ if ( !empty( $this->settings[ 'links' ] ) ) {
88
+ $this->links = $this->settings[ 'links' ];
89
+ }
90
+
91
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
92
+ add_action( 'admin_menu', array( $this, 'add_setting_page' ), 20 );
93
+ add_action( 'admin_menu', array( $this, 'add_premium_version_upgrade_to_menu' ), 100 );
94
+ add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
95
+ add_action( 'admin_init', array( $this, 'add_fields' ) );
96
+ }
97
+
98
+ /* add YIT Plugin sidebar */
99
+ $this->sidebar = YIT_Plugin_Panel_Sidebar::instance( $this );
100
+
101
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
102
+ }
103
+
104
+ /**
105
+ * Add Menu page link
106
+ *
107
+ * @return void
108
+ * @since 1.0
109
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
110
+ */
111
+ public function add_menu_page() {
112
+ global $admin_page_hooks;
113
+
114
+ if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
115
+ $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
116
+ add_menu_page( 'yit_plugin_panel', __( 'YITH Plugins', 'yith-plugin-fw' ), 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Remove duplicate submenu
122
+ *
123
+ * Submenu page hack: Remove the duplicate YIT Plugin link on subpages
124
+ *
125
+ * @return void
126
+ * @since 1.0
127
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
128
+ */
129
+ public function remove_duplicate_submenu_page() {
130
+ /* === Duplicate Items Hack === */
131
+ remove_submenu_page( 'yit_plugin_panel', 'yit_plugin_panel' );
132
+ }
133
+
134
+ /**
135
+ * Enqueue script and styles in admin side
136
+ *
137
+ * Add style and scripts to administrator
138
+ *
139
+ * @return void
140
+ * @since 1.0
141
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
142
+ */
143
+ public function admin_enqueue_scripts() {
144
+
145
+ global $wp_scripts, $pagenow;
146
+
147
+ //scripts
148
+ wp_enqueue_media();
149
+ wp_enqueue_script( 'jquery-ui' );
150
+ wp_enqueue_script( 'jquery-ui-core' );
151
+ wp_enqueue_script( 'jquery-ui-slider' );
152
+ wp_enqueue_script( 'jquery-ui-dialog' );
153
+ wp_enqueue_script( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/js/chosen/chosen.jquery.js', array( 'jquery' ), '1.1.0', true );
154
+ wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.js', array( 'jquery', 'jquery-chosen' ), $this->version, true );
155
+ wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
156
+ wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
157
+ wp_register_script( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/js/jquery.colorbox.js', array( 'jquery' ), '1.6.3', true );
158
+
159
+ //styles
160
+ $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
161
+ wp_register_style( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/css/codemirror/codemirror.css' );
162
+ wp_enqueue_style( 'jquery-ui-overcast', YIT_CORE_PLUGIN_URL . '/assets/css/overcast/jquery-ui-custom/jquery-ui-1.8.9.custom.css', false, '1.8.9', 'all' );
163
+ wp_register_style( 'yit-plugin-style', YIT_CORE_PLUGIN_URL . '/assets/css/yit-plugin-panel.css', array(), $this->version );
164
+ wp_enqueue_style( 'raleway-font', '//fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,100,200,300,900' );
165
+ wp_enqueue_style( 'jquery-chosen', YIT_CORE_PLUGIN_URL . '/assets/css/chosen/chosen.css' );
166
+ wp_enqueue_style( 'yit-jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
167
+ wp_register_style( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/css/colorbox.css', array(), $this->version );
168
+ wp_register_style( 'yit-upgrade-to-pro', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrade-to-pro.css', array( 'colorbox' ), $this->version );
169
+
170
+ if( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) || apply_filters( 'yit_plugin_panel_asset_loading', false ) ){
171
+ wp_enqueue_style( 'yit-plugin-style' );
172
+ wp_enqueue_script( 'yit-plugin-panel' );
173
+ }
174
+
175
+ if( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith_upgrade_premium_version' ) !== false ){
176
+ wp_enqueue_style( 'yit-upgrade-to-pro' );
177
+ wp_enqueue_script( 'colorbox' );
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Register Settings
183
+ *
184
+ * Generate wp-admin settings pages by registering your settings and using a few callbacks to control the output
185
+ *
186
+ * @return void
187
+ * @since 1.0
188
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
189
+ */
190
+ public function register_settings() {
191
+ register_setting( 'yit_' . $this->settings['parent'] . '_options', 'yit_' . $this->settings['parent'] . '_options', array( $this, 'options_validate' ) );
192
+ }
193
+
194
+ /**
195
+ * Options Validate
196
+ *
197
+ * a callback function called by Register Settings function
198
+ *
199
+ * @param $input
200
+ *
201
+ * @return array validate input fields
202
+ * @since 1.0
203
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
204
+ */
205
+ public function options_validate( $input ) {
206
+
207
+ $current_tab = ! empty( $input['current_tab'] ) ? $input['current_tab'] : 'general';
208
+
209
+ $yit_options = $this->get_main_array_options();
210
+
211
+ // default
212
+ $valid_input = $this->get_options();
213
+
214
+ $submit = ( ! empty( $input['submit-general'] ) ? true : false );
215
+ $reset = ( ! empty( $input['reset-general'] ) ? true : false );
216
+
217
+ foreach ( $yit_options[$current_tab] as $section => $data ) {
218
+ foreach ( $data as $option ) {
219
+ if ( isset( $option['sanitize_call'] ) && isset( $option['id'] ) ) { //yiw_debug($option, false);
220
+ if ( is_array( $option['sanitize_call'] ) ) :
221
+ foreach ( $option['sanitize_call'] as $callback ) {
222
+ if ( is_array( $input[$option['id']] ) ) {
223
+ $valid_input[$option['id']] = array_map( $callback, $input[$option['id']] );
224
+ }
225
+ else {
226
+ $valid_input[$option['id']] = call_user_func( $callback, $input[$option['id']] );
227
+ }
228
+ }
229
+ else :
230
+ if ( is_array( $input[$option['id']] ) ) {
231
+ $valid_input[$option['id']] = array_map( $option['sanitize_call'], $input[$option['id']] );
232
+ }
233
+ else {
234
+ $valid_input[$option['id']] = call_user_func( $option['sanitize_call'], $input[$option['id']] );
235
+ }
236
+ endif;
237
+ }
238
+ else {
239
+ if ( isset( $option['id'] ) ) {
240
+ if ( isset( $input[$option['id']] ) ) {
241
+ $valid_input[$option['id']] = $input[$option['id']];
242
+ }
243
+ else {
244
+ $valid_input[$option['id']] = 'no';
245
+ }
246
+
247
+ }
248
+ }
249
+
250
+ }
251
+ }
252
+
253
+ return $valid_input;
254
+ }
255
+
256
+ /**
257
+ * Add Setting SubPage
258
+ *
259
+ * add Setting SubPage to wordpress administrator
260
+ *
261
+ * @return array validate input fields
262
+ * @since 1.0
263
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
264
+ */
265
+ public function add_setting_page() {
266
+ $this->settings['icon_url'] = isset( $this->settings['icon_url'] ) ? $this->settings['icon_url'] : '';
267
+ $this->settings['position'] = isset( $this->settings['position'] ) ? $this->settings['position'] : null;
268
+ $parent = $this->settings['parent_slug'] . $this->settings['parent_page'];
269
+
270
+ if ( ! empty( $parent ) ) {
271
+ add_submenu_page( $parent, $this->settings['page_title'], $this->settings['menu_title'], $this->settings['capability'], $this->settings['page'], array( $this, 'yit_panel' ) );
272
+ } else {
273
+ add_menu_page( $this->settings['page_title'], $this->settings['menu_title'], $this->settings['capability'], $this->settings['page'], array( $this, 'yit_panel' ), $this->settings['icon_url'], $this->settings['position'] );
274
+ }
275
+ /* === Duplicate Items Hack === */
276
+ $this->remove_duplicate_submenu_page();
277
+ do_action( 'yit_after_add_settings_page' );
278
+
279
+
280
+ }
281
+
282
+ /**
283
+ * Add Premium Version upgrade menu item
284
+ *
285
+ * @return void
286
+ * @since 2.9.13
287
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
288
+ */
289
+ public function add_premium_version_upgrade_to_menu(){
290
+ global $_parent_pages;
291
+
292
+ if( apply_filters( 'yit_show_upgrade_to_premium_version', ! isset( $_parent_pages['yith_upgrade_premium_version'] ) ) ){
293
+ add_submenu_page( 'yit_plugin_panel', __( 'Premium version upgrade', 'yith-plugin-fw' ), __( 'Premium version upgrade', 'yith-plugin-fw' ), 'install_plugins', 'yith_upgrade_premium_version', array( $this, 'show_premium_version_upgrade' ) );
294
+ }
295
+ }
296
+
297
+ /**
298
+ * Show a tabbed panel to setting page
299
+ *
300
+ * a callback function called by add_setting_page => add_submenu_page
301
+ *
302
+ * @return void
303
+ * @since 1.0
304
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
305
+ */
306
+ public function yit_panel() {
307
+
308
+ $tabs = '';
309
+ $current_tab = $this->get_current_tab();
310
+ $yit_options = $this->get_main_array_options();
311
+
312
+ // tabs
313
+ foreach ( $this->settings['admin-tabs'] as $tab => $tab_value ) {
314
+ $active_class = ( $current_tab == $tab ) ? ' nav-tab-active' : '';
315
+ $tabs .= '<a class="nav-tab' . $active_class . '" href="?' . $this->settings['parent_page'] . '&page=' . $this->settings['page'] . '&tab=' . $tab . '">' . $tab_value . '</a>';
316
+ }
317
+ ?>
318
+ <div id="icon-themes" class="icon32"><br /></div>
319
+ <h2 class="nav-tab-wrapper">
320
+ <?php echo $tabs ?>
321
+ </h2>
322
+ <?php
323
+ $custom_tab_action = $this->is_custom_tab( $yit_options, $current_tab );
324
+ $hide_sidebar = $this->hide_sidebar();
325
+ if ( $custom_tab_action ) {
326
+ $this->print_custom_tab( $custom_tab_action, $hide_sidebar );
327
+ return;
328
+ }
329
+ ?>
330
+ <?php $this->print_video_box(); ?>
331
+ <?php
332
+ $panel_content_class = !$hide_sidebar ? apply_filters( 'yit_admin_panel_content_class', 'yit-admin-panel-content-wrap' ) : 'yit-admin-panel-content-wrap-no-sidebar';
333
+ ?>
334
+ <div id="wrap" class="plugin-option yit-admin-panel-container">
335
+ <?php $this->message(); ?>
336
+ <div class="<?php echo $panel_content_class; ?>">
337
+ <h2><?php echo $this->get_tab_title() ?></h2>
338
+ <?php if ( $this->is_show_form() ) : ?>
339
+ <form method="post" action="options.php">
340
+ <?php do_settings_sections( 'yit' ); ?>
341
+ <p>&nbsp;</p>
342
+ <?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
343
+ <input type="hidden" name="<?php echo $this->get_name_field( 'current_tab' ) ?>" value="<?php echo esc_attr( $current_tab ) ?>" />
344
+ <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>" style="float:left;margin-right:10px;" />
345
+ </form>
346
+ <form method="post">
347
+ <?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
348
+ <input type="hidden" name="yit-action" value="reset" />
349
+ <input type="submit" name="yit-reset" class="button-secondary" value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>" onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');" />
350
+ </form>
351
+ <p>&nbsp;</p>
352
+ <?php endif ?>
353
+ </div>
354
+ <?php
355
+ /**
356
+ * Add panel Sidebar
357
+ */
358
+ if ( !$hide_sidebar )
359
+ $this->print_panel_sidebar();
360
+ ?>
361
+ </div>
362
+ <?php
363
+ }
364
+
365
+ public function is_custom_tab( $options, $current_tab ) {
366
+ foreach ( $options[$current_tab] as $section => $option ) {
367
+ if ( isset( $option['type'] ) && isset( $option['action'] ) && 'custom_tab' == $option['type'] && ! empty( $option['action'] ) ) {
368
+ return $option['action'];
369
+ }
370
+ else {
371
+ return false;
372
+ }
373
+ }
374
+ return false;
375
+ }
376
+
377
+ /**
378
+ * Print the panel sidebar
379
+ *
380
+ * @return void
381
+ * @since 1.0
382
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
383
+ */
384
+ public function print_panel_sidebar() {
385
+ $this->sidebar->print_panel_sidebar();
386
+ }
387
+
388
+ /**
389
+ * @param $options
390
+ * @param $current_tab
391
+ *
392
+ * @return bool
393
+ *
394
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
395
+ */
396
+ public function hide_sidebar( $options = '', $current_tab = '' ) {
397
+ if ( $options === '' )
398
+ $options = $this->get_main_array_options();
399
+ if ( $current_tab === '' )
400
+ $current_tab = $this->get_current_tab();
401
+
402
+ $hide = false;
403
+
404
+ foreach ( $options[ $current_tab ] as $section => $option ) {
405
+ if ( isset( $option[ 'hide_sidebar' ] ) ) {
406
+ $hide = !!$option[ 'hide_sidebar' ];
407
+ }
408
+ break;
409
+ }
410
+
411
+ $page = isset( $this->settings[ 'page' ] ) ? $this->settings[ 'page' ] : '';
412
+
413
+ return apply_filters( 'yit_panel_hide_sidebar', $hide, $page );
414
+ }
415
+
416
+ /**
417
+ * Fire the action to print the custom tab
418
+ *
419
+ *
420
+ * @param string $action Action to fire
421
+ * @param bool $hide_sidebar
422
+ *
423
+ * @return void
424
+ * @since 1.0
425
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
426
+ * @author Leanza Francesco <leanzafrancesco@gmail.com>
427
+ */
428
+ public function print_custom_tab( $action, $hide_sidebar = false ) {
429
+ if ( !$hide_sidebar ) {
430
+ $panel_content_class = apply_filters( 'yit_admin_panel_content_class', 'yit-admin-panel-content-wrap' ) ;
431
+ echo "<div class='yit-admin-panel-container'>";
432
+ echo "<div class='$panel_content_class'>";
433
+
434
+ do_action( $action );
435
+
436
+ echo "</div>";
437
+ $this->print_panel_sidebar();
438
+ echo "</div>";
439
+ } else {
440
+ do_action( $action );
441
+ }
442
+ }
443
+
444
+ /**
445
+ * Add sections and fields to setting panel
446
+ *
447
+ * read all options and show sections and fields
448
+ *
449
+ * @return void
450
+ * @since 1.0
451
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
452
+ */
453
+ public function add_fields() {
454
+ $yit_options = $this->get_main_array_options();
455
+ $current_tab = $this->get_current_tab();
456
+
457
+ if ( ! $current_tab ) {
458
+ return;
459
+ }
460
+ foreach ( $yit_options[$current_tab] as $section => $data ) {
461
+ add_settings_section( "yit_settings_{$current_tab}_{$section}", $this->get_section_title( $section ), $this->get_section_description( $section ), 'yit' );
462
+ foreach ( $data as $option ) {
463
+ if ( isset( $option['id'] ) && isset( $option['type'] ) && isset( $option['name'] ) ) {
464
+ add_settings_field( "yit_setting_" . $option['id'], $option['name'], array( $this, 'render_field' ), 'yit', "yit_settings_{$current_tab}_{$section}", array( 'option' => $option, 'label_for' => $this->get_id_field( $option['id'] ) ) );
465
+ }
466
+ }
467
+ }
468
+ }
469
+
470
+
471
+ /**
472
+ * Add the tabs to admin bar menu
473
+ *
474
+ * set all tabs of settings page on wp admin bar
475
+ *
476
+ * @return void|array return void when capability is false
477
+ * @since 1.0
478
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
479
+ */
480
+ public function add_admin_bar_menu() {
481
+
482
+ global $wp_admin_bar;
483
+
484
+ if ( ! current_user_can( 'manage_options' ) ) {
485
+ return;
486
+ }
487
+
488
+ if ( ! empty( $this->settings['admin_tabs'] ) ) {
489
+ foreach ( $this->settings['admin-tabs'] as $item => $title ) {
490
+
491
+ $wp_admin_bar->add_menu( array(
492
+ 'parent' => $this->settings['parent'],
493
+ 'title' => $title,
494
+ 'id' => $this->settings['parent'] . '-' . $item,
495
+ 'href' => admin_url( 'themes.php' ) . '?page=' . $this->settings['parent_page'] . '&tab=' . $item
496
+ ) );
497
+ }
498
+ }
499
+ }
500
+
501
+
502
+ /**
503
+ * Get current tab
504
+ *
505
+ * get the id of tab showed, return general is the current tab is not defined
506
+ *
507
+ * @return string
508
+ * @since 1.0
509
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
510
+ */
511
+ function get_current_tab() {
512
+ $admin_tabs = array_keys( $this->settings['admin-tabs'] );
513
+
514
+ if ( ! isset( $_GET['page'] ) || $_GET['page'] != $this->settings['page'] ) {
515
+ return false;
516
+ }
517
+ if ( isset( $_REQUEST['yit_tab_options'] ) ) {
518
+ return $_REQUEST['yit_tab_options'];
519
+ }
520
+ elseif ( isset( $_GET['tab'] ) && isset( $this->_tabs_path_files[$_GET['tab']] ) ) {
521
+ return $_GET['tab'];
522
+ }
523
+ elseif ( isset( $admin_tabs[0] ) ) {
524
+ return $admin_tabs[0];
525
+ }
526
+ else {
527
+ return 'general';
528
+ }
529
+ }
530
+
531
+
532
+ /**
533
+ * Message
534
+ *
535
+ * define an array of message and show the content od message if
536
+ * is find in the query string
537
+ *
538
+ * @return void
539
+ * @since 1.0
540
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
541
+ */
542
+ public function message() {
543
+
544
+ $message = array(
545
+ 'element_exists' => $this->get_message( '<strong>' . __( 'The element you have entered already exists. Please, enter another name.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
546
+ 'saved' => $this->get_message( '<strong>' . __( 'Settings saved', 'yith-plugin-fw' ) . '.</strong>', 'updated', false ),
547
+ 'reset' => $this->get_message( '<strong>' . __( 'Settings reset', 'yith-plugin-fw' ) . '.</strong>', 'updated', false ),
548
+ 'delete' => $this->get_message( '<strong>' . __( 'Element deleted correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
549
+ 'updated' => $this->get_message( '<strong>' . __( 'Element updated correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
550
+ 'settings-updated' => $this->get_message( '<strong>' . __( 'Element updated correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
551
+ 'imported' => $this->get_message( '<strong>' . __( 'Database imported correctly.', 'yith-plugin-fw' ) . '</strong>', 'updated', false ),
552
+ 'no-imported' => $this->get_message( '<strong>' . __( 'An error has occurred during import. Please try again.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
553
+ 'file-not-valid' => $this->get_message( '<strong>' . __( 'The added file is not valid.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
554
+ 'cant-import' => $this->get_message( '<strong>' . __( 'Sorry, import is disabled.', 'yith-plugin-fw' ) . '</strong>', 'error', false ),
555
+ 'ord' => $this->get_message( '<strong>' . __( 'Sorting successful.', 'yith-plugin-fw' ) . '</strong>', 'updated', false )
556
+ );
557
+
558
+ foreach ( $message as $key => $value ) {
559
+ if ( isset( $_GET[$key] ) ) {
560
+ echo $message[$key];
561
+ }
562
+ }
563
+
564
+ }
565
+
566
+ /**
567
+ * Get Message
568
+ *
569
+ * return html code of message
570
+ *
571
+ * @param $message
572
+ * @param string $type can be 'error' or 'updated'
573
+ * @param bool $echo
574
+ *
575
+ * @return void|string
576
+ * @since 1.0
577
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
578
+ */
579
+ public function get_message( $message, $type = 'error', $echo = true ) {
580
+ $message = '<div id="message" class="' . $type . ' fade"><p>' . $message . '</p></div>';
581
+ if ( $echo ) {
582
+ echo $message;
583
+ }
584
+ return $message;
585
+ }
586
+
587
+
588
+ /**
589
+ * Get Tab Path Files
590
+ *
591
+ * return an array with filenames of tabs
592
+ *
593
+ * @return array
594
+ * @since 1.0
595
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
596
+ */
597
+ function get_tabs_path_files() {
598
+
599
+ $option_files_path = $this->settings['options-path'] . '/';
600
+
601
+ $tabs = array();
602
+
603
+ foreach ( ( array ) glob( $option_files_path . '*.php' ) as $filename ) {
604
+ preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
605
+
606
+ if ( ! isset( $filename_parts[1] ) ) {
607
+ continue;
608
+ }
609
+
610
+ $tab = $filename_parts[1];
611
+
612
+ $tabs[$tab] = $filename;
613
+ }
614
+
615
+ return $tabs;
616
+ }
617
+
618
+ /**
619
+ * Get main array options
620
+ *
621
+ * return an array with all options defined on options-files
622
+ *
623
+ * @return array
624
+ * @since 1.0
625
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
626
+ */
627
+ function get_main_array_options() {
628
+ if ( ! empty( $this->_main_array_options ) ) {
629
+ return $this->_main_array_options;
630
+ }
631
+
632
+ foreach ( $this->settings['admin-tabs'] as $item => $v ) {
633
+ $path = $this->settings['options-path'] . '/' . $item . '-options.php';
634
+ if ( file_exists( $path ) ) {
635
+ $this->_main_array_options = array_merge( $this->_main_array_options, include $path );
636
+ }
637
+ }
638
+
639
+ return $this->_main_array_options;
640
+ }
641
+
642
+
643
+ /**
644
+ * Set an array with all default options
645
+ *
646
+ * put default options in an array
647
+ *
648
+ * @return array
649
+ * @since 1.0
650
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
651
+ */
652
+ public function get_default_options() {
653
+ $yit_options = $this->get_main_array_options();
654
+ $default_options = array();
655
+
656
+ foreach ( $yit_options as $tab => $sections ) {
657
+ foreach ( $sections as $section ) {
658
+ foreach ( $section as $id => $value ) {
659
+ if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
660
+ $default_options[$value['id']] = $value['std'];
661
+ }
662
+ }
663
+ }
664
+ }
665
+
666
+ unset( $yit_options );
667
+ return $default_options;
668
+ }
669
+
670
+
671
+ /**
672
+ * Get the title of the tab
673
+ *
674
+ * return the title of tab
675
+ *
676
+ * @return string
677
+ * @since 1.0
678
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
679
+ */
680
+ function get_tab_title() {
681
+ $yit_options = $this->get_main_array_options();
682
+ $current_tab = $this->get_current_tab();
683
+
684
+ foreach ( $yit_options[$current_tab] as $sections => $data ) {
685
+ foreach ( $data as $option ) {
686
+ if ( isset( $option['type'] ) && $option['type'] == 'title' ) {
687
+ return $option['name'];
688
+ }
689
+ }
690
+ }
691
+ }
692
+
693
+ /**
694
+ * Get the title of the section
695
+ *
696
+ * return the title of section
697
+ *
698
+ * @param $section
699
+ *
700
+ * @return string
701
+ * @since 1.0
702
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
703
+ */
704
+ function get_section_title( $section ) {
705
+ $yit_options = $this->get_main_array_options();
706
+ $current_tab = $this->get_current_tab();
707
+
708
+ foreach ( $yit_options[$current_tab][$section] as $option ) {
709
+ if ( isset( $option['type'] ) && $option['type'] == 'section' ) {
710
+ return $option['name'];
711
+ }
712
+ }
713
+ }
714
+
715
+ /**
716
+ * Get the description of the section
717
+ *
718
+ * return the description of section if is set
719
+ *
720
+ * @param $section
721
+ *
722
+ * @return string
723
+ * @since 1.0
724
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
725
+ */
726
+ function get_section_description( $section ) {
727
+ $yit_options = $this->get_main_array_options();
728
+ $current_tab = $this->get_current_tab();
729
+
730
+ foreach ( $yit_options[$current_tab][$section] as $option ) {
731
+ if ( isset( $option['type'] ) && $option['type'] == 'section' && isset( $option['desc'] ) ) {
732
+ return '<p>' . $option['desc'] . '</p>';
733
+ }
734
+ }
735
+ }
736
+
737
+
738
+ /**
739
+ * Show form when necessary
740
+ *
741
+ * return true if 'showform' is not defined
742
+ *
743
+ * @return bool
744
+ * @since 1.0
745
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
746
+ */
747
+ function is_show_form() {
748
+ $yit_options = $this->get_main_array_options();
749
+ $current_tab = $this->get_current_tab();
750
+
751
+ foreach ( $yit_options[$current_tab] as $sections => $data ) {
752
+ foreach ( $data as $option ) {
753
+ if ( ! isset( $option['type'] ) || $option['type'] != 'title' ) {
754
+ continue;
755
+ }
756
+ if ( isset( $option['showform'] ) ) {
757
+ return $option['showform'];
758
+ }
759
+ else {
760
+ return true;
761
+ }
762
+ }
763
+ }
764
+ }
765
+
766
+ /**
767
+ * Get name field
768
+ *
769
+ * return a string with the name of the input field
770
+ *
771
+ * @param string $name
772
+ *
773
+ * @return string
774
+ * @since 1.0
775
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
776
+ */
777
+ function get_name_field( $name = '' ) {
778
+ return 'yit_' . $this->settings['parent'] . '_options[' . $name . ']';
779
+ }
780
+
781
+ /**
782
+ * Get id field
783
+ *
784
+ * return a string with the id of the input field
785
+ *
786
+ * @param string $id
787
+ *
788
+ * @return string
789
+ * @since 1.0
790
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
791
+ */
792
+ function get_id_field( $id ) {
793
+ return 'yit_' . $this->settings['parent'] . '_options_' . $id;
794
+ }
795
+
796
+
797
+ /**
798
+ * Render the field showed in the setting page
799
+ *
800
+ * include the file of the option type, if file do not exists
801
+ * return a text area
802
+ *
803
+ * @param array $param
804
+ *
805
+ * @return void
806
+ * @since 1.0
807
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
808
+ */
809
+ function render_field( $param ) {
810
+
811
+ if ( ! empty( $param ) && isset( $param ['option'] ) ) {
812
+ $option = $param ['option'];
813
+ $db_options = $this->get_options();
814
+
815
+ $custom_attributes = array();
816
+
817
+ if ( ! empty( $option['custom_attributes'] ) && is_array( $option['custom_attributes'] ) ) {
818
+ foreach ( $option['custom_attributes'] as $attribute => $attribute_value ) {
819
+ $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
820
+ }
821
+ }
822
+
823
+ $custom_attributes = implode( ' ', $custom_attributes );
824
+ $std = isset( $option['std'] ) ? $option['std'] : '';
825
+ $db_value = ( isset( $db_options[$option['id']] ) ) ? $db_options[$option['id']] : $std;
826
+
827
+ if ( isset( $option['deps'] ) ) {
828
+ $deps = $option['deps'];
829
+ }
830
+ $type = YIT_CORE_PLUGIN_PATH . '/templates/panel/types/' . $option['type'] . '.php';
831
+ if ( file_exists( $type ) ) {
832
+ include $type;
833
+ }
834
+ else {
835
+ do_action( "yit_panel_{$option['type']}", $option, $db_value, $custom_attributes );
836
+ }
837
+ }
838
+ }
839
+
840
+ /**
841
+ * Get options from db
842
+ *
843
+ * return the options from db, if the options aren't defined in the db,
844
+ * get the default options ad add the options in the db
845
+ *
846
+ * @return array
847
+ * @since 1.0
848
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
849
+ */
850
+ public function get_options() {
851
+ $options = get_option( 'yit_' . $this->settings['parent'] . '_options' );
852
+ if ( $options === false || ( isset( $_REQUEST['yit-action'] ) && $_REQUEST['yit-action'] == 'reset' ) ) {
853
+ $options = $this->get_default_options();
854
+ }
855
+ return $options;
856
+ }
857
+
858
+ /**
859
+ * Show a box panel with specific content in two columns as a new woocommerce type
860
+ *
861
+ *
862
+ * @param array $args
863
+ *
864
+ * @return void
865
+ * @since 1.0
866
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
867
+ */
868
+ public function add_infobox( $args = array() ) {
869
+ if ( ! empty( $args ) ) {
870
+ extract( $args );
871
+ require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/boxinfo.php' );
872
+ }
873
+ }
874
+
875
+ /**
876
+ * Show a box panel with specific content in two columns as a new woocommerce type
877
+ *
878
+ * @param array $args
879
+ *
880
+ * @return void
881
+ * @since 1.0
882
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.com>
883
+ */
884
+ public function add_videobox( $args = array() ) {
885
+ if ( ! empty( $args ) ) {
886
+ extract( $args );
887
+ require_once( YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/videobox.php' );
888
+ }
889
+ }
890
+
891
+ /**
892
+ * Fire the action to print the custom tab
893
+ *
894
+ * @return void
895
+ * @since 1.0
896
+ * @author Antonino Scarfì <antonino.scarfi@yithemes.com>
897
+ */
898
+ public function print_video_box() {
899
+ $file = $this->settings['options-path'] . '/video-box.php';
900
+
901
+ if ( ! file_exists( $file ) ) {
902
+ return;
903
+ }
904
+
905
+ $args = include_once( $file );
906
+
907
+ $this->add_videobox( $args );
908
+ }
909
+
910
+ /**
911
+ * Show the upgrade to pro version page
912
+ *
913
+ * @return void
914
+ * @since 2.9.13
915
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
916
+ */
917
+ public function show_premium_version_upgrade() {
918
+ yit_plugin_get_template ( YIT_CORE_PLUGIN_PATH, 'upgrade/upgrade-to-pro-version.php', array( 'core_plugin_url' => YIT_CORE_PLUGIN_URL ) ) ;
919
+ }
920
+ }
921
  }
plugin-fw/lib/yit-plugin-subpanel.php CHANGED
@@ -1,164 +1,164 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Plugin Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- if ( ! defined( 'ABSPATH' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- if ( ! class_exists( 'YIT_Plugin_SubPanel' ) ) {
16
- /**
17
- * YIT Plugin Panel
18
- *
19
- * Setting Page to Manage Plugins
20
- *
21
- * @class YIT_Plugin_Panel
22
- * @package Yithemes
23
- * @since 1.0
24
- * @author Your Inspiration Themes
25
- */
26
-
27
- class YIT_Plugin_SubPanel extends YIT_Plugin_Panel {
28
-
29
- /**
30
- * @var string version of class
31
- */
32
- public $version = '1.0.0';
33
-
34
- /**
35
- * @var array a setting list of parameters
36
- */
37
- public $settings = array();
38
-
39
-
40
- /**
41
- * @var array
42
- */
43
- private $_main_array_options = array();
44
-
45
- /**
46
- * Constructor
47
- *
48
- * @since 1.0
49
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
50
- */
51
-
52
- public function __construct( $args = array() ) {
53
- if ( ! empty( $args ) ) {
54
- $this->settings = $args;
55
- $this->settings['parent'] = $this->settings['page'];
56
- $this->_tabs_path_files = $this->get_tabs_path_files();
57
-
58
- add_action( 'admin_init', array( $this, 'register_settings' ) );
59
- add_action( 'admin_menu', array( &$this, 'add_setting_page' ) );
60
- add_action( 'admin_bar_menu', array( &$this, 'add_admin_bar_menu' ), 100 );
61
- add_action( 'admin_init', array( &$this, 'add_fields' ) );
62
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
63
- }
64
- }
65
-
66
-
67
- /**
68
- * Register Settings
69
- *
70
- * Generate wp-admin settings pages by registering your settings and using a few callbacks to control the output
71
- *
72
- * @return void
73
- * @since 1.0
74
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
75
- */
76
- public function register_settings() {
77
- register_setting( 'yit_' . $this->settings['page'] . '_options', 'yit_' . $this->settings['page'] . '_options', array( &$this, 'options_validate' ) );
78
- }
79
-
80
-
81
-
82
- /**
83
- * Add Setting SubPage
84
- *
85
- * add Setting SubPage to wordpress administrator
86
- *
87
- * @return array validate input fields
88
- * @since 1.0
89
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
90
- */
91
- public function add_setting_page() {
92
- global $admin_page_hooks;
93
- $logo = YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png';
94
-
95
- $admin_logo = function_exists( 'yit_get_option' ) ? yit_get_option( 'admin-logo-menu' ) : '';
96
-
97
- if ( isset( $admin_logo ) && !empty( $admin_logo ) && $admin_logo != '' && $admin_logo ) {
98
- $logo = $admin_logo;
99
- }
100
-
101
- if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ) {
102
- $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
103
- add_menu_page( 'yit_plugin_panel', __( 'YIT Plugins', 'yith-plugin-fw' ), 'nosuchcapability', 'yit_plugin_panel', NULL, $logo, $position );
104
- }
105
-
106
- add_submenu_page( 'yit_plugin_panel', $this->settings['label'], $this->settings['label'], 'manage_options', $this->settings['page'], array( $this, 'yit_panel' ) );
107
- remove_submenu_page( 'yit_plugin_panel', 'yit_plugin_panel' );
108
-
109
- }
110
-
111
- /**
112
- * Show a tabbed panel to setting page
113
- *
114
- * a callback function called by add_setting_page => add_submenu_page
115
- *
116
- * @return void
117
- * @since 1.0
118
- * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
119
- */
120
- public function yit_panel() {
121
-
122
- $tabs = '';
123
- $current_tab = $this->get_current_tab();
124
-
125
- // tabs
126
- foreach ( $this->settings['admin-tabs'] as $tab => $tab_value ) {
127
- $active_class = ( $current_tab == $tab ) ? ' nav-tab-active' : '';
128
- $tabs .= '<a class="nav-tab' . $active_class . '" href="?page=' . $this->settings['page'] . '&tab=' . $tab . '">' . $tab_value . '</a>';
129
- }
130
- ?>
131
- <div id="icon-themes" class="icon32"><br /></div>
132
- <h2 class="nav-tab-wrapper">
133
- <?php echo $tabs ?>
134
- </h2>
135
-
136
- <div id="wrap" class="plugin-option">
137
- <?php $this->message(); ?>
138
- <h2><?php echo $this->get_tab_title() ?></h2>
139
-
140
- <?php if ( $this->is_show_form() ) : ?>
141
- <form method="post" action="options.php">
142
- <?php do_settings_sections( 'yit' ); ?>
143
- <p>&nbsp;</p>
144
- <?php settings_fields( 'yit_' . $this->settings['page'] . '_options' ); ?>
145
- <input type="hidden" name="<?php echo $this->get_name_field( 'current_tab' ) ?>" value="<?php echo esc_attr( $current_tab ) ?>" />
146
- <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>" style="float:left;margin-right:10px;" />
147
- </form>
148
- <form method="post">
149
- <?php $warning = __( 'If you continue with this action, you will reset all the options in this page.', 'yith-plugin-fw' ) ?>
150
- <input type="hidden" name="yit-action" value="reset" />
151
- <input type="submit" name="yit-reset" class="button-secondary" value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>" onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');" />
152
- </form>
153
- <p>&nbsp;</p>
154
- <?php endif ?>
155
- </div>
156
- <?php
157
- }
158
-
159
-
160
-
161
- }
162
-
163
- }
164
-
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YIT_Plugin_SubPanel' ) ) {
16
+ /**
17
+ * YIT Plugin Panel
18
+ *
19
+ * Setting Page to Manage Plugins
20
+ *
21
+ * @class YIT_Plugin_Panel
22
+ * @package Yithemes
23
+ * @since 1.0
24
+ * @author Your Inspiration Themes
25
+ */
26
+
27
+ class YIT_Plugin_SubPanel extends YIT_Plugin_Panel {
28
+
29
+ /**
30
+ * @var string version of class
31
+ */
32
+ public $version = '1.0.0';
33
+
34
+ /**
35
+ * @var array a setting list of parameters
36
+ */
37
+ public $settings = array();
38
+
39
+
40
+ /**
41
+ * @var array
42
+ */
43
+ private $_main_array_options = array();
44
+
45
+ /**
46
+ * Constructor
47
+ *
48
+ * @since 1.0
49
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
50
+ */
51
+
52
+ public function __construct( $args = array() ) {
53
+ if ( ! empty( $args ) ) {
54
+ $this->settings = $args;
55
+ $this->settings['parent'] = $this->settings['page'];
56
+ $this->_tabs_path_files = $this->get_tabs_path_files();
57
+
58
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
59
+ add_action( 'admin_menu', array( &$this, 'add_setting_page' ) );
60
+ add_action( 'admin_bar_menu', array( &$this, 'add_admin_bar_menu' ), 100 );
61
+ add_action( 'admin_init', array( &$this, 'add_fields' ) );
62
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
63
+ }
64
+ }
65
+
66
+
67
+ /**
68
+ * Register Settings
69
+ *
70
+ * Generate wp-admin settings pages by registering your settings and using a few callbacks to control the output
71
+ *
72
+ * @return void
73
+ * @since 1.0
74
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
75
+ */
76
+ public function register_settings() {
77
+ register_setting( 'yit_' . $this->settings['page'] . '_options', 'yit_' . $this->settings['page'] . '_options', array( &$this, 'options_validate' ) );
78
+ }
79
+
80
+
81
+
82
+ /**
83
+ * Add Setting SubPage
84
+ *
85
+ * add Setting SubPage to wordpress administrator
86
+ *
87
+ * @return array validate input fields
88
+ * @since 1.0
89
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
90
+ */
91
+ public function add_setting_page() {
92
+ global $admin_page_hooks;
93
+ $logo = YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png';
94
+
95
+ $admin_logo = function_exists( 'yit_get_option' ) ? yit_get_option( 'admin-logo-menu' ) : '';
96
+
97
+ if ( isset( $admin_logo ) && !empty( $admin_logo ) && $admin_logo != '' && $admin_logo ) {
98
+ $logo = $admin_logo;
99
+ }
100
+
101
+ if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ) {
102
+ $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
103
+ add_menu_page( 'yit_plugin_panel', __( 'YITH Plugins', 'yith-plugin-fw' ), 'nosuchcapability', 'yit_plugin_panel', NULL, $logo, $position );
104
+ }
105
+
106
+ add_submenu_page( 'yit_plugin_panel', $this->settings['label'], $this->settings['label'], 'manage_options', $this->settings['page'], array( $this, 'yit_panel' ) );
107
+ remove_submenu_page( 'yit_plugin_panel', 'yit_plugin_panel' );
108
+
109
+ }
110
+
111
+ /**
112
+ * Show a tabbed panel to setting page
113
+ *
114
+ * a callback function called by add_setting_page => add_submenu_page
115
+ *
116
+ * @return void
117
+ * @since 1.0
118
+ * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
119
+ */
120
+ public function yit_panel() {
121
+
122
+ $tabs = '';
123
+ $current_tab = $this->get_current_tab();
124
+
125
+ // tabs
126
+ foreach ( $this->settings['admin-tabs'] as $tab => $tab_value ) {
127
+ $active_class = ( $current_tab == $tab ) ? ' nav-tab-active' : '';
128
+ $tabs .= '<a class="nav-tab' . $active_class . '" href="?page=' . $this->settings['page'] . '&tab=' . $tab . '">' . $tab_value . '</a>';
129
+ }
130
+ ?>
131
+ <div id="icon-themes" class="icon32"><br /></div>
132
+ <h2 class="nav-tab-wrapper">
133
+ <?php echo $tabs ?>
134
+ </h2>
135
+
136
+ <div id="wrap" class="plugin-option">
137
+ <?php $this->message(); ?>
138
+ <h2><?php echo $this->get_tab_title() ?></h2>
139
+
140
+ <?php if ( $this->is_show_form() ) : ?>
141
+ <form method="post" action="options.php">
142
+ <?php do_settings_sections( 'yit' ); ?>
143
+ <p>&nbsp;</p>
144
+ <?php settings_fields( 'yit_' . $this->settings['page'] . '_options' ); ?>
145
+ <input type="hidden" name="<?php echo $this->get_name_field( 'current_tab' ) ?>" value="<?php echo esc_attr( $current_tab ) ?>" />
146
+ <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>" style="float:left;margin-right:10px;" />
147
+ </form>
148
+ <form method="post">
149
+ <?php $warning = __( 'If you continue with this action, you will reset all the options in this page.', 'yith-plugin-fw' ) ?>
150
+ <input type="hidden" name="yit-action" value="reset" />
151
+ <input type="submit" name="yit-reset" class="button-secondary" value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>" onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');" />
152
+ </form>
153
+ <p>&nbsp;</p>
154
+ <?php endif ?>
155
+ </div>
156
+ <?php
157
+ }
158
+
159
+
160
+
161
+ }
162
+
163
+ }
164
+
plugin-fw/lib/yit-pointers.php CHANGED
@@ -1,390 +1,390 @@
1
- <?php
2
- /*
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- /**
15
- *
16
- *
17
- * @class yit-pointers
18
- * @package Yithemes
19
- * @since Version 2.0.0
20
- * @author Your Inspiration Themes
21
- *
22
- */
23
- if ( ! class_exists( 'YIT_Pointers' ) ) {
24
- /**
25
- * YIT Pointers
26
- *
27
- * Initializes the new feature pointers.
28
- *
29
- * @class YIT_Pointers
30
- * @package Yithemes
31
- * @since 1.0
32
- * @author Your Inspiration Themes
33
- * @see WP_Internal_Pointers
34
- */
35
- class YIT_Pointers {
36
-
37
- /**
38
- * @var YIT_Upgrade The main instance
39
- */
40
- protected static $_instance;
41
-
42
- /**
43
- * @var screen id where to show pointer
44
- */
45
- public $screen_ids = array();
46
-
47
- public $pointers = array();
48
-
49
- public $special_screen = array();
50
-
51
- protected $_plugins_registered = array();
52
-
53
- protected $_default_pointer = array();
54
-
55
- protected $_default_position = array( 'edge' => 'left', 'align' => 'center' );
56
-
57
- /**
58
- * Construct
59
- *
60
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
61
- * @since 1.0
62
- */
63
- public function __construct() {
64
-
65
- $this->_default_pointer['plugins'] = array(
66
- 'screen_id' => 'plugins',
67
- 'options' => array(
68
- 'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">Yithemes.com</a> %s
69
- <a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
70
- __( 'Plugins Activated', 'yith-plugin-fw' ),
71
- __( 'From now on, you can find all plugin options in YIT Plugin menu.
72
- For each plugin installed, customization settings will be available as a new entry in YIT Plugin menu.', 'yith-plugin-fw' ),
73
- __( 'Discover all our plugins available on:', 'yith-plugin-fw' ),
74
- __( 'and', 'yith-plugin-fw' )
75
- ),
76
- ),
77
- );
78
-
79
- $this->_default_pointer['update'] = array(
80
- 'screen_id' => 'update',
81
- 'options' => array(
82
- 'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">Yithemes.com</a> %s
83
- <a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
84
- __( 'Plugins Upgraded', 'yith-plugin-fw' ),
85
- __( 'From now on, you can find all options of your plugins in YIT Plugin menu.
86
- Any time one of our plugins is updated, a new entry will be added to this menu.
87
- For example, after the update, plugin options (such as for YITH WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.)
88
- will be moved from previous location to YIT Plugin tab.', 'yith-plugin-fw' ),
89
- __( 'Discover all our plugins available on:', 'yith-plugin-fw' ),
90
- __( 'and', 'yith-plugin-fw' )
91
- ),
92
- ),
93
- );
94
-
95
- $this->_default_pointer = $this->parse_args( $this->_default_pointer );
96
-
97
- /**
98
- * Screens that require a particular action
99
- */
100
- $this->special_screen = apply_filters( 'yit-pointer-special-screen', array( 'plugins', 'update' ) );
101
-
102
- add_action( 'admin_enqueue_scripts', array( $this, 'pointer_load' ) );
103
- add_action( 'admin_init', array( $this, 'add_pointers' ), 100 );
104
- }
105
-
106
- public function parse_args( $args ) {
107
- $default = array(
108
- 'pointer_id' => 'yith_default_pointer',
109
- 'target' => '#toplevel_page_yit_plugin_panel',
110
- 'init' => null
111
- );
112
-
113
- foreach ( $args as $id => $pointer ) {
114
- $args[ $id ] = wp_parse_args( $pointer, $default );
115
- $args[ $id ]['options']['position'] = $this->_default_position;
116
- }
117
-
118
- return $args;
119
- }
120
-
121
- public function add_pointers(){
122
- if( ! empty( $this->screen_ids ) ){
123
- foreach( $this->screen_ids as $screen_id ){
124
- add_filter( "yit_pointers-{$screen_id}", array( $this, 'pointers' ) );
125
- }
126
- }
127
- }
128
-
129
- /**
130
- * Main plugin Instance
131
- *
132
- * @static
133
- * @return object Main instance
134
- *
135
- * @since 1.0
136
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
137
- */
138
- public static function instance() {
139
- if ( is_null( self::$_instance ) ) {
140
- self::$_instance = new self();
141
- }
142
-
143
- return self::$_instance;
144
- }
145
-
146
- public function register( $args ) {
147
-
148
- foreach ( $args as $id => $pointer ) {
149
-
150
- extract( $pointer );
151
-
152
- if ( ! isset( $screen_id ) && ! empty( $screen_id ) && ! isset( $init ) && ! empty( $init ) ) {
153
- return;
154
- }
155
-
156
- if ( ! in_array( $screen_id, $this->screen_ids ) ) {
157
- $this->screen_ids[] = $screen_id;
158
- }
159
-
160
- $this->pointers[$screen_id][$pointer_id] = array(
161
- 'target' => $target,
162
- 'options' => array(
163
- 'content' => $content,
164
- 'position' => $position,
165
- ),
166
- 'init' => isset( $init ) ? $init : false
167
- );
168
- }
169
- }
170
-
171
- public function get_plugins_init( $screen_id ) {
172
-
173
- $registered = array();
174
-
175
- foreach( $this->pointers[ $screen_id ] as $pointer_id => $pointer ){
176
- $registered[ $pointer['init'] ] = $pointer_id;
177
- }
178
-
179
- return $registered;
180
- }
181
-
182
- public function pointer_load( $hook_suffix ) {
183
-
184
- /**
185
- * Get pointers for this screen
186
- */
187
- $screen = get_current_screen();
188
- $pointers = apply_filters( "yit_pointers-{$screen->id}", array() );
189
-
190
- if ( ! $pointers || ! is_array( $pointers ) ) {
191
- return;
192
- }
193
-
194
- /**
195
- * Get dismissed pointers
196
- */
197
- $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
198
- $valid_pointers = array();
199
- //$point_id = null;
200
-
201
- /**
202
- * show pointers only on plugin activate action
203
- */
204
- if( in_array( $screen->id, $this->special_screen ) ){
205
-
206
- $show = false;
207
- $registered = $this->get_plugins_init( $screen->id );
208
- $recently_activate = get_option( 'yit_recently_activated', array() );
209
-
210
- /**
211
- * For "plugins" screen
212
- */
213
- $is_single_activate = ( isset( $_GET['activate'] ) && 'true' == $_GET['activate'] ) ? true : false;
214
- $is_multi_activate = ( isset( $_GET['activate-multi'] ) && 'true' == $_GET['activate-multi'] ) ? true : false;
215
-
216
- /**
217
- * For "update" screen
218
- *
219
- * Single plugin update use GET method
220
- *
221
- * Multi update plugins with bulk action send two post args called "action" and "action2"
222
- * action refer to first bulk action button (at the top of plugins table)
223
- * action2 refer to last bulk action button (at the bottom of plugins table)
224
- *
225
- */
226
- $is_single_upgrade = ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) ? true : false;
227
- $is_multi_upgrade = ( isset( $_POST['action'] ) && 'update-selected' == $_POST['action'] ) || ( isset( $_POST['action2'] ) && 'update-selected' == $_POST['action2'] ) ? true: false;
228
-
229
- if( $is_single_activate || $is_single_upgrade ){
230
-
231
- $point_id = '';
232
-
233
- /**
234
- * Single activation plugin
235
- * Single update plugin
236
- */
237
- foreach( $registered as $init => $p_id ){
238
- if ( in_array( $init, $recently_activate ) ) {
239
- $point_id = $p_id;
240
- $pointer = $pointers[ $point_id ];
241
-
242
- /**
243
- * Sanity check
244
- */
245
- if ( ! ( in_array( $point_id, $dismissed ) || empty( $pointer ) || empty( $point_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) ) {
246
- /**
247
- * Add the pointer to $valid_pointers array
248
- */
249
- $pointer['pointer_id'] = $point_id;
250
- $valid_pointers['pointers'][] = $pointer;
251
- $show = true;
252
- }
253
- break;
254
- }
255
- }
256
- } else if( $is_multi_activate || $is_multi_upgrade ){
257
-
258
- /**
259
- * Bulk Action: multi plugins activation
260
- * Bulk Action: multi plugins update
261
- */
262
- $point_id = array();
263
- $screen_id = $screen->id;
264
-
265
- if( $is_multi_upgrade && isset( $_POST['checked'] ) && ( count( $_POST['checked'] ) > 0 ) ){
266
- $recently_activate = $_POST['checked'];
267
- $screen_id = 'update';
268
- $pointers = apply_filters( "yit_pointers-{$screen_id}", array() );
269
- }
270
-
271
- foreach ( $registered as $init => $p_id ) {
272
- if ( in_array( $init, $recently_activate ) ) {
273
- $point_id[] = $p_id;
274
- }
275
- }
276
-
277
- /**
278
- * Bulk Action: Activate Plugins
279
- *
280
- * count( $point_id ) is the number of YITH plugins that have registered specific pointers
281
- * case 0 -> No pointers -> Exit
282
- * case 1 -> Only one pointers to show -> Use the specific plugin pointer
283
- * defautl -> Two or more plugins need to show a pointer -> use a generic pointers
284
- *
285
- */
286
- switch ( count( $point_id ) ) {
287
- case 0:
288
- $show = false;
289
- break;
290
-
291
- case 1:
292
- $point_id = array_pop( $point_id );
293
- $pointer = $pointers[$point_id];
294
- /**
295
- * Sanity check
296
- */
297
- if ( ! ( in_array( $point_id, $dismissed ) || empty( $pointer ) || empty( $point_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) ) {
298
- /**
299
- * Add the pointer to $valid_pointers array
300
- */
301
- $pointer['pointer_id'] = $point_id;
302
- $valid_pointers['pointers'][] = $pointer;
303
- $show = true;
304
- }
305
- break;
306
-
307
- default:
308
- $valid_pointers['pointers'][] = $this->_default_pointer[ $screen_id ];
309
- $show = true;
310
- break;
311
- }
312
- }
313
-
314
- update_option( 'yit_recently_activated', array() );
315
-
316
- if( ! $show ){
317
- return;
318
- }
319
-
320
- } else {
321
- /**
322
- * Check pointers and remove dismissed ones.
323
- */
324
- foreach ( $pointers as $pointer_id => $pointer ) {
325
-
326
- /**
327
- * Sanity check
328
- */
329
- if ( in_array( $pointer_id, $dismissed ) || empty( $pointer ) || empty( $pointer_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) {
330
- continue;
331
- }
332
-
333
- $pointer['pointer_id'] = $pointer_id;
334
-
335
- /**
336
- * Add the pointer to $valid_pointers array
337
- */
338
- $valid_pointers['pointers'][] = $pointer;
339
- }
340
- }
341
-
342
- /**
343
- * No valid pointers? Stop here.
344
- */
345
- if ( empty( $valid_pointers ) ) {
346
- return;
347
- }
348
-
349
- $script_file = function_exists( 'yit_load_js_file' ) ? yit_load_js_file( 'yit-wp-pointer.js' ) : 'yit-wp-pointer.min.js';
350
-
351
- /**
352
- * Enqueue wp-pointer script and style
353
- */
354
- wp_enqueue_style( 'wp-pointer' );
355
- wp_enqueue_script( 'wp-pointer' );
356
-
357
- wp_enqueue_script( 'yit-wp-pointer', YIT_CORE_PLUGIN_URL . '/assets/js/' . $script_file, array( 'wp-pointer' ), false, true );
358
- wp_localize_script( 'yit-wp-pointer', 'custom_pointer', $valid_pointers );
359
- }
360
-
361
- public function pointers( $pointers ){
362
- $screen_id = str_replace( 'yit_pointers-', '', current_filter() );
363
- $pointers_to_add = $this->get_pointers( $screen_id );
364
-
365
- return ! empty( $pointers_to_add ) ? array_merge( $pointers, $pointers_to_add ) : $pointers;
366
- }
367
-
368
- public function get_pointers( $screen_id ){
369
- return isset( $this->pointers[ $screen_id ] ) ? $this->pointers[ $screen_id ] : array();
370
- }
371
- }
372
- }
373
-
374
- if ( ! function_exists( 'YIT_Pointers' ) ) {
375
- /**
376
- * Main instance of plugin
377
- *
378
- * @return object YIT_Pointers
379
- * @since 1.0
380
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
381
- */
382
- function YIT_Pointers() {
383
- return YIT_Pointers::instance();
384
- }
385
- }
386
-
387
- /**
388
- * Instance a YIT_Pointers object
389
- */
390
  YIT_Pointers();
1
+ <?php
2
+ /*
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ /**
15
+ *
16
+ *
17
+ * @class yit-pointers
18
+ * @package Yithemes
19
+ * @since Version 2.0.0
20
+ * @author Your Inspiration Themes
21
+ *
22
+ */
23
+ if ( ! class_exists( 'YIT_Pointers' ) ) {
24
+ /**
25
+ * YIT Pointers
26
+ *
27
+ * Initializes the new feature pointers.
28
+ *
29
+ * @class YIT_Pointers
30
+ * @package Yithemes
31
+ * @since 1.0
32
+ * @author Your Inspiration Themes
33
+ * @see WP_Internal_Pointers
34
+ */
35
+ class YIT_Pointers {
36
+
37
+ /**
38
+ * @var YIT_Upgrade The main instance
39
+ */
40
+ protected static $_instance;
41
+
42
+ /**
43
+ * @var screen id where to show pointer
44
+ */
45
+ public $screen_ids = array();
46
+
47
+ public $pointers = array();
48
+
49
+ public $special_screen = array();
50
+
51
+ protected $_plugins_registered = array();
52
+
53
+ protected $_default_pointer = array();
54
+
55
+ protected $_default_position = array( 'edge' => 'left', 'align' => 'center' );
56
+
57
+ /**
58
+ * Construct
59
+ *
60
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
61
+ * @since 1.0
62
+ */
63
+ public function __construct() {
64
+
65
+ $this->_default_pointer['plugins'] = array(
66
+ 'screen_id' => 'plugins',
67
+ 'options' => array(
68
+ 'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">Yithemes.com</a> %s
69
+ <a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
70
+ __( 'Plugins Activated', 'yith-plugin-fw' ),
71
+ __( 'From now on, you can find all plugin options in YIT Plugin menu.
72
+ For each plugin installed, customization settings will be available as a new entry in YIT Plugin menu.', 'yith-plugin-fw' ),
73
+ __( 'Discover all our plugins available on:', 'yith-plugin-fw' ),
74
+ __( 'and', 'yith-plugin-fw' )
75
+ ),
76
+ ),
77
+ );
78
+
79
+ $this->_default_pointer['update'] = array(
80
+ 'screen_id' => 'update',
81
+ 'options' => array(
82
+ 'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">Yithemes.com</a> %s
83
+ <a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
84
+ __( 'Plugins Upgraded', 'yith-plugin-fw' ),
85
+ __( 'From now on, you can find all options of your plugins in YIT Plugin menu.
86
+ Any time one of our plugins is updated, a new entry will be added to this menu.
87
+ For example, after the update, plugin options (such as for YITH WooCommerce Wishlist, YITH WooCommerce Ajax Search, etc.)
88
+ will be moved from previous location to YIT Plugin tab.', 'yith-plugin-fw' ),
89
+ __( 'Discover all our plugins available on:', 'yith-plugin-fw' ),
90
+ __( 'and', 'yith-plugin-fw' )
91
+ ),
92
+ ),
93
+ );
94
+
95
+ $this->_default_pointer = $this->parse_args( $this->_default_pointer );
96
+
97
+ /**
98
+ * Screens that require a particular action
99
+ */
100
+ $this->special_screen = apply_filters( 'yit-pointer-special-screen', array( 'plugins', 'update' ) );
101
+
102
+ add_action( 'admin_enqueue_scripts', array( $this, 'pointer_load' ) );
103
+ add_action( 'admin_init', array( $this, 'add_pointers' ), 100 );
104
+ }
105
+
106
+ public function parse_args( $args ) {
107
+ $default = array(
108
+ 'pointer_id' => 'yith_default_pointer',
109
+ 'target' => '#toplevel_page_yit_plugin_panel',
110
+ 'init' => null
111
+ );
112
+
113
+ foreach ( $args as $id => $pointer ) {
114
+ $args[ $id ] = wp_parse_args( $pointer, $default );
115
+ $args[ $id ]['options']['position'] = $this->_default_position;
116
+ }
117
+
118
+ return $args;
119
+ }
120
+
121
+ public function add_pointers(){
122
+ if( ! empty( $this->screen_ids ) ){
123
+ foreach( $this->screen_ids as $screen_id ){
124
+ add_filter( "yit_pointers-{$screen_id}", array( $this, 'pointers' ) );
125
+ }
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Main plugin Instance
131
+ *
132
+ * @static
133
+ * @return object Main instance
134
+ *
135
+ * @since 1.0
136
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
137
+ */
138
+ public static function instance() {
139
+ if ( is_null( self::$_instance ) ) {
140
+ self::$_instance = new self();
141
+ }
142
+
143
+ return self::$_instance;
144
+ }
145
+
146
+ public function register( $args ) {
147
+
148
+ foreach ( $args as $id => $pointer ) {
149
+
150
+ extract( $pointer );
151
+
152
+ if ( ! isset( $screen_id ) && ! empty( $screen_id ) && ! isset( $init ) && ! empty( $init ) ) {
153
+ return;
154
+ }
155
+
156
+ if ( ! in_array( $screen_id, $this->screen_ids ) ) {
157
+ $this->screen_ids[] = $screen_id;
158
+ }
159
+
160
+ $this->pointers[$screen_id][$pointer_id] = array(
161
+ 'target' => $target,
162
+ 'options' => array(
163
+ 'content' => $content,
164
+ 'position' => $position,
165
+ ),
166
+ 'init' => isset( $init ) ? $init : false
167
+ );
168
+ }
169
+ }
170
+
171
+ public function get_plugins_init( $screen_id ) {
172
+
173
+ $registered = array();
174
+
175
+ foreach( $this->pointers[ $screen_id ] as $pointer_id => $pointer ){
176
+ $registered[ $pointer['init'] ] = $pointer_id;
177
+ }
178
+
179
+ return $registered;
180
+ }
181
+
182
+ public function pointer_load( $hook_suffix ) {
183
+
184
+ /**
185
+ * Get pointers for this screen
186
+ */
187
+ $screen = get_current_screen();
188
+ $pointers = apply_filters( "yit_pointers-{$screen->id}", array() );
189
+
190
+ if ( ! $pointers || ! is_array( $pointers ) ) {
191
+ return;
192
+ }
193
+
194
+ /**
195
+ * Get dismissed pointers
196
+ */
197
+ $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
198
+ $valid_pointers = array();
199
+ //$point_id = null;
200
+
201
+ /**
202
+ * show pointers only on plugin activate action
203
+ */
204
+ if( in_array( $screen->id, $this->special_screen ) ){
205
+
206
+ $show = false;
207
+ $registered = $this->get_plugins_init( $screen->id );
208
+ $recently_activate = get_option( 'yit_recently_activated', array() );
209
+
210
+ /**
211
+ * For "plugins" screen
212
+ */
213
+ $is_single_activate = ( isset( $_GET['activate'] ) && 'true' == $_GET['activate'] ) ? true : false;
214
+ $is_multi_activate = ( isset( $_GET['activate-multi'] ) && 'true' == $_GET['activate-multi'] ) ? true : false;
215
+
216
+ /**
217
+ * For "update" screen
218
+ *
219
+ * Single plugin update use GET method
220
+ *
221
+ * Multi update plugins with bulk action send two post args called "action" and "action2"
222
+ * action refer to first bulk action button (at the top of plugins table)
223
+ * action2 refer to last bulk action button (at the bottom of plugins table)
224
+ *
225
+ */
226
+ $is_single_upgrade = ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) ? true : false;
227
+ $is_multi_upgrade = ( isset( $_POST['action'] ) && 'update-selected' == $_POST['action'] ) || ( isset( $_POST['action2'] ) && 'update-selected' == $_POST['action2'] ) ? true: false;
228
+
229
+ if( $is_single_activate || $is_single_upgrade ){
230
+
231
+ $point_id = '';
232
+
233
+ /**
234
+ * Single activation plugin
235
+ * Single update plugin
236
+ */
237
+ foreach( $registered as $init => $p_id ){
238
+ if ( in_array( $init, $recently_activate ) ) {
239
+ $point_id = $p_id;
240
+ $pointer = $pointers[ $point_id ];
241
+
242
+ /**
243
+ * Sanity check
244
+ */
245
+ if ( ! ( in_array( $point_id, $dismissed ) || empty( $pointer ) || empty( $point_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) ) {
246
+ /**
247
+ * Add the pointer to $valid_pointers array
248
+ */
249
+ $pointer['pointer_id'] = $point_id;
250
+ $valid_pointers['pointers'][] = $pointer;
251
+ $show = true;
252
+ }
253
+ break;
254
+ }
255
+ }
256
+ } else if( $is_multi_activate || $is_multi_upgrade ){
257
+
258
+ /**
259
+ * Bulk Action: multi plugins activation
260
+ * Bulk Action: multi plugins update
261
+ */
262
+ $point_id = array();
263
+ $screen_id = $screen->id;
264
+
265
+ if( $is_multi_upgrade && isset( $_POST['checked'] ) && ( count( $_POST['checked'] ) > 0 ) ){
266
+ $recently_activate = $_POST['checked'];
267
+ $screen_id = 'update';
268
+ $pointers = apply_filters( "yit_pointers-{$screen_id}", array() );
269
+ }
270
+
271
+ foreach ( $registered as $init => $p_id ) {
272
+ if ( in_array( $init, $recently_activate ) ) {
273
+ $point_id[] = $p_id;
274
+ }
275
+ }
276
+
277
+ /**
278
+ * Bulk Action: Activate Plugins
279
+ *
280
+ * count( $point_id ) is the number of YITH plugins that have registered specific pointers
281
+ * case 0 -> No pointers -> Exit
282
+ * case 1 -> Only one pointers to show -> Use the specific plugin pointer
283
+ * defautl -> Two or more plugins need to show a pointer -> use a generic pointers
284
+ *
285
+ */
286
+ switch ( count( $point_id ) ) {
287
+ case 0:
288
+ $show = false;
289
+ break;
290
+
291
+ case 1:
292
+ $point_id = array_pop( $point_id );
293
+ $pointer = $pointers[$point_id];
294
+ /**
295
+ * Sanity check
296
+ */
297
+ if ( ! ( in_array( $point_id, $dismissed ) || empty( $pointer ) || empty( $point_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) ) {
298
+ /**
299
+ * Add the pointer to $valid_pointers array
300
+ */
301
+ $pointer['pointer_id'] = $point_id;
302
+ $valid_pointers['pointers'][] = $pointer;
303
+ $show = true;
304
+ }
305
+ break;
306
+
307
+ default:
308
+ $valid_pointers['pointers'][] = $this->_default_pointer[ $screen_id ];
309
+ $show = true;
310
+ break;
311
+ }
312
+ }
313
+
314
+ update_option( 'yit_recently_activated', array() );
315
+
316
+ if( ! $show ){
317
+ return;
318
+ }
319
+
320
+ } else {
321
+ /**
322
+ * Check pointers and remove dismissed ones.
323
+ */
324
+ foreach ( $pointers as $pointer_id => $pointer ) {
325
+
326
+ /**
327
+ * Sanity check
328
+ */
329
+ if ( in_array( $pointer_id, $dismissed ) || empty( $pointer ) || empty( $pointer_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) {
330
+ continue;
331
+ }
332
+
333
+ $pointer['pointer_id'] = $pointer_id;
334
+
335
+ /**
336
+ * Add the pointer to $valid_pointers array
337
+ */
338
+ $valid_pointers['pointers'][] = $pointer;
339
+ }
340
+ }
341
+
342
+ /**
343
+ * No valid pointers? Stop here.
344
+ */
345
+ if ( empty( $valid_pointers ) ) {
346
+ return;
347
+ }
348
+
349
+ $script_file = function_exists( 'yit_load_js_file' ) ? yit_load_js_file( 'yit-wp-pointer.js' ) : 'yit-wp-pointer.min.js';
350
+
351
+ /**
352
+ * Enqueue wp-pointer script and style
353
+ */
354
+ wp_enqueue_style( 'wp-pointer' );
355
+ wp_enqueue_script( 'wp-pointer' );
356
+
357
+ wp_enqueue_script( 'yit-wp-pointer', YIT_CORE_PLUGIN_URL . '/assets/js/' . $script_file, array( 'wp-pointer' ), false, true );
358
+ wp_localize_script( 'yit-wp-pointer', 'custom_pointer', $valid_pointers );
359
+ }
360
+
361
+ public function pointers( $pointers ){
362
+ $screen_id = str_replace( 'yit_pointers-', '', current_filter() );
363
+ $pointers_to_add = $this->get_pointers( $screen_id );
364
+
365
+ return ! empty( $pointers_to_add ) ? array_merge( $pointers, $pointers_to_add ) : $pointers;
366
+ }
367
+
368
+ public function get_pointers( $screen_id ){
369
+ return isset( $this->pointers[ $screen_id ] ) ? $this->pointers[ $screen_id ] : array();
370
+ }
371
+ }
372
+ }
373
+
374
+ if ( ! function_exists( 'YIT_Pointers' ) ) {
375
+ /**
376
+ * Main instance of plugin
377
+ *
378
+ * @return object YIT_Pointers
379
+ * @since 1.0
380
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
381
+ */
382
+ function YIT_Pointers() {
383
+ return YIT_Pointers::instance();
384
+ }
385
+ }
386
+
387
+ /**
388
+ * Instance a YIT_Pointers object
389
+ */
390
  YIT_Pointers();
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -1,556 +1,556 @@
1
- <?php
2
- /*
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YIT_Upgrade' ) ) {
15
- /**
16
- * YIT Upgrade
17
- *
18
- * Notify and Update plugin
19
- *
20
- * @class YIT_Upgrade
21
- * @package Yithemes
22
- * @since 1.0
23
- * @author Your Inspiration Themes
24
- * @see WP_Updater Class
25
- */
26
-
27
- class YIT_Upgrade {
28
-
29
- /**
30
- * @var string XML notifier update
31
- */
32
- protected $_xml = 'http://update.yithemes.com/plugins/%plugin_slug%.xml';
33
-
34
- /**
35
- * @var string api server url
36
- */
37
- protected $_package_url = 'http://www.yithemes.com';
38
-
39
- /**
40
- * @var array The registered plugins
41
- */
42
- protected $_plugins = array();
43
-
44
- /**
45
- * @var YIT_Upgrade The main instance
46
- */
47
- protected static $_instance;
48
-
49
- /**
50
- * Construct
51
- *
52
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
53
- * @since 1.0
54
- */
55
- public function __construct() {
56
- add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download') , 10, 3 );
57
- add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
58
-
59
- if( is_network_admin() ){
60
- add_action( 'admin_enqueue_scripts', array( $this, 'network_admin_enqueue_scripts' ) );
61
- }
62
-
63
- $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
64
- if ( $is_debug_enabled ) {
65
- $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
66
- add_filter( 'block_local_requests', '__return_false' );
67
- }
68
- }
69
-
70
- /**
71
- * Main plugin Instance
72
- *
73
- * @param $plugin_slug | string The plugin slug
74
- * @param $plugin_init | string The plugin init file
75
- *
76
- * @return void
77
- *
78
- * @since 1.0
79
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
80
- */
81
- public function register( $plugin_slug, $plugin_init ) {
82
-
83
- if( ! function_exists( 'get_plugins' ) ){
84
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
85
- }
86
-
87
- $plugins = get_plugins();
88
- $plugin_info = $plugins[ $plugin_init ];
89
-
90
- $this->_plugins[ $plugin_init ] = array(
91
- 'info' => $plugin_info,
92
- 'slug' => $plugin_slug,
93
- );
94
-
95
- /* === HOOKS === */
96
- if( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ){
97
- add_action( 'admin_init', array( $this, 'remove_wp_plugin_update_row' ), 15 );
98
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
99
- } else if( is_multisite() && current_user_can( 'update_plugins' ) ) {
100
- $transient = 'yith_register_' . md5( $plugin_slug );
101
- if( apply_filters( 'yith_register_delete_transient', false ) ){
102
- delete_transient( $transient );
103
- }
104
- $info = get_transient( $transient );
105
- if( false === $info || apply_filters( 'yith_register_delete_transient', false ) ){
106
- $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
107
- $remote_xml = wp_remote_get( $xml );
108
-
109
- if( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
110
- $plugin_remote_info = new SimpleXmlElement( $remote_xml['body'] );
111
- $info['Latest'] = (string) $plugin_remote_info->latest;
112
- $info['changelog'] = (string) $plugin_remote_info->changelog;
113
- YIT_Plugin_Licence()->check( $plugin_slug, false );
114
- set_transient( $transient, $info, DAY_IN_SECONDS );
115
- }
116
- }
117
-
118
- $this->_plugins[ $plugin_init ]['info']['Latest'] = $info['Latest'];
119
- $this->_plugins[ $plugin_init ]['info']['changelog'] = $info['changelog'];
120
- add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
121
- }
122
- }
123
-
124
- /**
125
- * Add the multisite updater scripts
126
- *
127
- * @return void
128
- *
129
- * @since 1.0
130
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
131
- */
132
- public function multisite_updater_script(){
133
-
134
- $update_url = $changelogs = $details_url = array();
135
- $strings = array(
136
- 'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
137
- 'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
138
- 'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
139
- 'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
140
- 'update_now' => __( 'Update now.', 'yith-plugin-fw' )
141
-
142
- );
143
-
144
- foreach( $this->_plugins as $init => $info ){
145
- $update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
146
- $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
147
- $details_url[ $init ] = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
148
- $plugin_changelog = isset( $this->_plugins[ $init ]['info']['changelog'] ) ? $this->_plugins[ $init ]['info']['changelog'] : '';
149
- $changelogs[ $init ] = $this->in_theme_update_message( $this->_plugins[ $init ], $plugin_changelog, $changelog_id, false );
150
- }
151
-
152
- $localize_script_args = array(
153
- 'registered' => $this->_plugins,
154
- 'activated' => YIT_Plugin_Licence()->get_activated_products(),
155
- 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
156
- 'update_url' => $update_url,
157
- 'details_url' => $details_url,
158
- 'strings' => $strings,
159
- 'changelogs' => $changelogs
160
- );
161
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
162
- yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
163
-
164
- wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
165
- }
166
-
167
- public function network_admin_enqueue_scripts(){
168
- yit_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
169
- }
170
-
171
- /**
172
- * Retrive the zip package file
173
- *
174
- * @param bool $reply Whether to bail without returning the package. Default false.
175
- * @param string $package The package file name.
176
- * @param \WP_Upgrader $upgrader WP_Upgrader instance.
177
- *
178
- * @return string | The download file
179
- *
180
- * @since 1.0
181
- * @see wp-admin/includes/class-wp-upgrader.php
182
- * @access public
183
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
184
- */
185
- public function upgrader_pre_download( $reply, $package, $upgrader ) {
186
- $plugin = false;
187
- $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
188
-
189
- if( ! $is_bulk ){
190
- $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
191
- }
192
-
193
- else {
194
- //Bulk action upgrade
195
- $action_url = parse_url( $upgrader->skin->options['url'] );
196
- parse_str( rawurldecode( htmlspecialchars_decode( $action_url['query'] ) ) );
197
- $plugins = explode( ',', $plugins );
198
- foreach( $plugins as $plugin_init ){
199
- $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_init );
200
- if( $to_upgrade['Name'] == $upgrader->skin->plugin_info['Name'] ){
201
- $plugin = $plugin_init;
202
- }
203
- }
204
- }
205
-
206
- /**
207
- * It isn't YITH Premium plugins, please wordpress update it for me!
208
- */
209
- if( ! $plugin ) {
210
- return $reply;
211
- }
212
-
213
- $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
214
-
215
- /**
216
- * False ? It isn't YITH Premium plugins, please wordpress update it for me!
217
- */
218
- if( false === $plugin_info ) {
219
- return $reply;
220
- }
221
-
222
- $licence = YIT_Plugin_Licence()->get_licence();
223
- $product_id = $plugin_info['product_id'];
224
- $args = array(
225
- 'email' => $licence[ $product_id ]['email'],
226
- 'licence_key' => $licence[$product_id]['licence_key'],
227
- 'product_id' => $plugin_info['product_id'],
228
- 'secret_key' => $plugin_info['secret_key'],
229
- 'instance' => YIT_Plugin_Licence()->get_home_url(),
230
- 'wc-api' => 'download-api',
231
- 'request' => 'download'
232
- );
233
-
234
- if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
235
- //Local file or remote?
236
- return $package;
237
- }
238
-
239
- if ( empty( $package ) ) {
240
- return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
241
- }
242
-
243
- $upgrader->skin->feedback( 'downloading_package', __( 'YIThemes Repository', 'yith-plugin-fw' ) );
244
-
245
- $download_file = $this->_download_url( $package, $args );
246
-
247
- /**
248
- * Regenerate update_plugins transient
249
- */
250
- $this->force_regenerate_update_transient();
251
-
252
- if ( is_wp_error( $download_file ) ) {
253
- return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
254
- }
255
-
256
- return $download_file;
257
- }
258
-
259
- /**
260
- * Retrive the temp filename
261
- *
262
- * @param string $url The package url
263
- * @param string $body The post data fields
264
- * @param int $timeout Execution timeout (default: 300)
265
- *
266
- * @return string | The temp filename
267
- *
268
- * @since 1.0
269
- * @see wp-admin/includes/class-wp-upgrader.php
270
- * @access protected
271
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
272
- */
273
- protected function _download_url( $url, $body, $timeout = 300 ) {
274
-
275
- //WARNING: The file is not automatically deleted, The script must unlink() the file.
276
- if ( ! $url ) {
277
- return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yit' ) );
278
- }
279
-
280
- $tmpfname = wp_tempnam( $url );
281
-
282
- $args = array(
283
- 'timeout' => $timeout,
284
- 'stream' => true,
285
- 'filename' => $tmpfname,
286
- 'body' => $body
287
- );
288
-
289
- if ( ! $tmpfname ) {
290
- return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yit' ) );
291
- }
292
-
293
- $response = wp_safe_remote_post( $url, $args );
294
-
295
- if ( is_wp_error( $response ) ) {
296
- unlink( $tmpfname );
297
- return $response;
298
- }
299
-
300
- if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
301
- unlink( $tmpfname );
302
- return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
303
- }
304
-
305
- $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
306
-
307
- if ( $content_md5 ) {
308
- $md5_check = verify_file_md5( $tmpfname, $content_md5 );
309
- if ( is_wp_error( $md5_check ) ) {
310
- unlink( $tmpfname );
311
- return $md5_check;
312
- }
313
- }
314
-
315
- return $tmpfname;
316
- }
317
-
318
- /**
319
- * Main plugin Instance
320
- *
321
- * @static
322
- * @return object Main instance
323
- *
324
- * @since 1.0
325
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
326
- */
327
- public static function instance() {
328
- if ( is_null( self::$_instance ) ) {
329
- self::$_instance = new self();
330
- }
331
-
332
- return self::$_instance;
333
- }
334
-
335
- /**
336
- * Delete the update plugins transient
337
- *
338
- * @return void
339
- *
340
- * @since 1.0
341
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
342
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
343
- */
344
- public function force_regenerate_update_transient(){
345
- delete_site_transient( 'update_plugins' );
346
- }
347
-
348
- /**
349
- * Check for plugins update
350
- *
351
- * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
352
- *
353
- * @param mixed $transient | update_plugins transient value
354
- * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
355
- *
356
- * @return mixed $transient | The new update_plugins transient value
357
- *
358
- * @since 1.0
359
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
360
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
361
- */
362
- public function check_update( $transient, $save = false ) {
363
-
364
- foreach ($this->_plugins as $init => $plugin) {
365
- $xml = str_replace('%plugin_slug%', $this->_plugins[$init]['slug'], $this->_xml);
366
- $remote_xml = wp_remote_get($xml);
367
-
368
- if (!is_wp_error($remote_xml) && isset($remote_xml['response']['code']) && '200' == $remote_xml['response']['code']) {
369
-
370
-
371
- $plugin_remote_info = new SimpleXmlElement($remote_xml['body']);
372
-
373
- if (version_compare($plugin_remote_info->latest, $plugin['info']['Version'], '>') && !isset($transient->response[$init])) {
374
-
375
- $package = YIT_Plugin_Licence()->check($init) ? $this->_package_url : null;
376
-
377
- $obj = new stdClass();
378
- $obj->slug = (string)$init;
379
- $obj->new_version = (string)$plugin_remote_info->latest;
380
- $obj->changelog = (string)$plugin_remote_info->changelog;
381
- $obj->package = $package;
382
- $obj->plugin = $init;
383
- $transient->response[$init] = $obj;
384
- }
385
-
386
- }
387
- }
388
-
389
- if( $save ) {
390
- set_site_transient( 'update_plugins', $transient );
391
- }
392
-
393
- return $transient;
394
- }
395
-
396
- /**
397
- * Add the plugin update row in plugin page
398
- *
399
- * @return void
400
- * @fire "in_theme_update_message-{$init}" action
401
- *
402
- * @since 1.0
403
- * @see after_plugin_row_{$init} action
404
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
405
- */
406
- public function plugin_update_row() {
407
-
408
- $current = get_site_transient( 'update_plugins' );
409
- $init = str_replace( 'after_plugin_row_', '', current_filter() );
410
-
411
- if ( ! isset( $current->response[ $init ] ) ) {
412
- return false;
413
- }
414
-
415
- /**
416
- * stdClass Object
417
- */
418
- $r = $current->response[ $init ];
419
-
420
- $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
421
- $details_url = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
422
-
423
- /**
424
- * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
425
- */
426
- $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
427
-
428
- if( is_network_admin() || ! is_multisite() || true ) {
429
- echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
430
-
431
- if( ! current_user_can( 'update_plugins' ) ){
432
- printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw'), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
433
- }elseif( is_plugin_active_for_network( $init ) ){
434
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
435
- }elseif ( empty( $r->package ) ) {
436
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
437
- } else {
438
- printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw'), $this->_plugins[ $init ]['info']['Name'], esc_url($details_url), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $init, 'upgrade-plugin_' . $init ) );
439
- }
440
-
441
- /**
442
- * Fires at the end of the update message container in each
443
- * row of the themes list table.
444
- *
445
- * The dynamic portion of the hook name, `$theme_key`, refers to
446
- * the theme slug as found in the WordPress.org themes repository.
447
- *
448
- * @since Wordpress 3.1.0
449
- * }
450
- */
451
- do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
452
-
453
- echo '</div></td></tr>';
454
- }
455
- }
456
-
457
- /**
458
- * Remove the standard plugin_update_row
459
- *
460
- * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
461
- *
462
- * @return void
463
- * @fire "in_theme_update_message-{$init}" action
464
- *
465
- * @since 1.0
466
- * @see after_plugin_row_{$init} action
467
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
468
- */
469
- public function remove_wp_plugin_update_row() {
470
- foreach( $this->_plugins as $init => $plugin ){
471
- remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10, 2 );
472
- add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
473
- add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
474
- }
475
- }
476
-
477
- public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ){
478
-
479
- $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
480
- <div class='yit-plugin-changelog'>
481
- <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
482
- <p>{$changelog}</p>
483
- </div>
484
- </div>";
485
-
486
- if( $echo ){
487
- echo $res;
488
- }
489
- else{
490
- return $res;
491
- }
492
- }
493
-
494
- /**
495
- * Auto-Update Plugin in multisite
496
- *
497
- * Manage the non standard upgrade-plugin-multisite action
498
- *
499
- * @return void
500
- *
501
- * @since 1.0
502
- * @see upgrade-plugin action
503
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
504
- */
505
- public function upgrade_plugin_multisite(){
506
-
507
- $plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
508
- $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
509
-
510
- if( 'upgrade-plugin-multisite' != $action ){
511
- wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
512
- }
513
-
514
- if ( ! current_user_can( 'update_plugins' ) ) {
515
- wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
516
- }
517
-
518
- $this->check_update( get_site_transient( 'update_plugins') , true );
519
-
520
- check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
521
-
522
- $title = __( 'Update Plugin', 'yith-plugin-fw' );
523
- $parent_file = 'plugins.php';
524
- $submenu_file = 'plugins.php';
525
-
526
- wp_enqueue_script( 'updates' );
527
- require_once( ABSPATH . 'wp-admin/admin-header.php' );
528
-
529
- $nonce = 'upgrade-plugin-multisite_' . $plugin;
530
- $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
531
-
532
- $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
533
- $upgrader->upgrade( $plugin );
534
-
535
- include( ABSPATH . 'wp-admin/admin-footer.php' );
536
- }
537
- }
538
- }
539
-
540
- if ( ! function_exists( 'YIT_Upgrade' ) ) {
541
- /**
542
- * Main instance of plugin
543
- *
544
- * @return object
545
- * @since 1.0
546
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
547
- */
548
- function YIT_Upgrade() {
549
- return YIT_Upgrade::instance();
550
- }
551
- }
552
-
553
- /**
554
- * Instance a YIT_Upgrade object
555
- */
556
- YIT_Upgrade();
1
+ <?php
2
+ /*
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists( 'YIT_Upgrade' ) ) {
15
+ /**
16
+ * YIT Upgrade
17
+ *
18
+ * Notify and Update plugin
19
+ *
20
+ * @class YIT_Upgrade
21
+ * @package Yithemes
22
+ * @since 1.0
23
+ * @author Your Inspiration Themes
24
+ * @see WP_Updater Class
25
+ */
26
+
27
+ class YIT_Upgrade {
28
+
29
+ /**
30
+ * @var string XML notifier update
31
+ */
32
+ protected $_xml = 'http://update.yithemes.com/plugins/%plugin_slug%.xml';
33
+
34
+ /**
35
+ * @var string api server url
36
+ */
37
+ protected $_package_url = 'http://www.yithemes.com';
38
+
39
+ /**
40
+ * @var array The registered plugins
41
+ */
42
+ protected $_plugins = array();
43
+
44
+ /**
45
+ * @var YIT_Upgrade The main instance
46
+ */
47
+ protected static $_instance;
48
+
49
+ /**
50
+ * Construct
51
+ *
52
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
53
+ * @since 1.0
54
+ */
55
+ public function __construct() {
56
+ add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download') , 10, 3 );
57
+ add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
58
+
59
+ if( is_network_admin() ){
60
+ add_action( 'admin_enqueue_scripts', array( $this, 'network_admin_enqueue_scripts' ) );
61
+ }
62
+
63
+ $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
64
+ if ( $is_debug_enabled ) {
65
+ $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
66
+ add_filter( 'block_local_requests', '__return_false' );
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Main plugin Instance
72
+ *
73
+ * @param $plugin_slug | string The plugin slug
74
+ * @param $plugin_init | string The plugin init file
75
+ *
76
+ * @return void
77
+ *
78
+ * @since 1.0
79
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
80
+ */
81
+ public function register( $plugin_slug, $plugin_init ) {
82
+
83
+ if( ! function_exists( 'get_plugins' ) ){
84
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
85
+ }
86
+
87
+ $plugins = get_plugins();
88
+ $plugin_info = $plugins[ $plugin_init ];
89
+
90
+ $this->_plugins[ $plugin_init ] = array(
91
+ 'info' => $plugin_info,
92
+ 'slug' => $plugin_slug,
93
+ );
94
+
95
+ /* === HOOKS === */
96
+ if( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ){
97
+ add_action( 'admin_init', array( $this, 'remove_wp_plugin_update_row' ), 15 );
98
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
99
+ } else if( is_multisite() && current_user_can( 'update_plugins' ) ) {
100
+ $transient = 'yith_register_' . md5( $plugin_slug );
101
+ if( apply_filters( 'yith_register_delete_transient', false ) ){
102
+ delete_transient( $transient );
103
+ }
104
+ $info = get_transient( $transient );
105
+ if( false === $info || apply_filters( 'yith_register_delete_transient', false ) ){
106
+ $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
107
+ $remote_xml = wp_remote_get( $xml );
108
+
109
+ if( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
110
+ $plugin_remote_info = new SimpleXmlElement( $remote_xml['body'] );
111
+ $info['Latest'] = (string) $plugin_remote_info->latest;
112
+ $info['changelog'] = (string) $plugin_remote_info->changelog;
113
+ YIT_Plugin_Licence()->check( $plugin_slug, false );
114
+ set_transient( $transient, $info, DAY_IN_SECONDS );
115
+ }
116
+ }
117
+
118
+ $this->_plugins[ $plugin_init ]['info']['Latest'] = $info['Latest'];
119
+ $this->_plugins[ $plugin_init ]['info']['changelog'] = $info['changelog'];
120
+ add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Add the multisite updater scripts
126
+ *
127
+ * @return void
128
+ *
129
+ * @since 1.0
130
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
131
+ */
132
+ public function multisite_updater_script(){
133
+
134
+ $update_url = $changelogs = $details_url = array();
135
+ $strings = array(
136
+ 'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
137
+ 'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
138
+ 'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
139
+ 'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
140
+ 'update_now' => __( 'Update now.', 'yith-plugin-fw' )
141
+
142
+ );
143
+
144
+ foreach( $this->_plugins as $init => $info ){
145
+ $update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
146
+ $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
147
+ $details_url[ $init ] = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
148
+ $plugin_changelog = isset( $this->_plugins[ $init ]['info']['changelog'] ) ? $this->_plugins[ $init ]['info']['changelog'] : '';
149
+ $changelogs[ $init ] = $this->in_theme_update_message( $this->_plugins[ $init ], $plugin_changelog, $changelog_id, false );
150
+ }
151
+
152
+ $localize_script_args = array(
153
+ 'registered' => $this->_plugins,
154
+ 'activated' => YIT_Plugin_Licence()->get_activated_products(),
155
+ 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
156
+ 'update_url' => $update_url,
157
+ 'details_url' => $details_url,
158
+ 'strings' => $strings,
159
+ 'changelogs' => $changelogs
160
+ );
161
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
162
+ yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
163
+
164
+ wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
165
+ }
166
+
167
+ public function network_admin_enqueue_scripts(){
168
+ yit_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
169
+ }
170
+
171
+ /**
172
+ * Retrive the zip package file
173
+ *
174
+ * @param bool $reply Whether to bail without returning the package. Default false.
175
+ * @param string $package The package file name.
176
+ * @param \WP_Upgrader $upgrader WP_Upgrader instance.
177
+ *
178
+ * @return string | The download file
179
+ *
180
+ * @since 1.0
181
+ * @see wp-admin/includes/class-wp-upgrader.php
182
+ * @access public
183
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
184
+ */
185
+ public function upgrader_pre_download( $reply, $package, $upgrader ) {
186
+ $plugin = false;
187
+ $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
188
+
189
+ if( ! $is_bulk ){
190
+ $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
191
+ }
192
+
193
+ else {
194
+ //Bulk action upgrade
195
+ $action_url = parse_url( $upgrader->skin->options['url'] );
196
+ parse_str( rawurldecode( htmlspecialchars_decode( $action_url['query'] ) ) );
197
+ $plugins = explode( ',', $plugins );
198
+ foreach( $plugins as $plugin_init ){
199
+ $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_init );
200
+ if( $to_upgrade['Name'] == $upgrader->skin->plugin_info['Name'] ){
201
+ $plugin = $plugin_init;
202
+ }
203
+ }
204
+ }
205
+
206
+ /**
207
+ * It isn't YITH Premium plugins, please wordpress update it for me!
208
+ */
209
+ if( ! $plugin ) {
210
+ return $reply;
211
+ }
212
+
213
+ $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
214
+
215
+ /**
216
+ * False ? It isn't YITH Premium plugins, please wordpress update it for me!
217
+ */
218
+ if( false === $plugin_info ) {
219
+ return $reply;
220
+ }
221
+
222
+ $licence = YIT_Plugin_Licence()->get_licence();
223
+ $product_id = $plugin_info['product_id'];
224
+ $args = array(
225
+ 'email' => $licence[ $product_id ]['email'],
226
+ 'licence_key' => $licence[$product_id]['licence_key'],
227
+ 'product_id' => $plugin_info['product_id'],
228
+ 'secret_key' => $plugin_info['secret_key'],
229
+ 'instance' => YIT_Plugin_Licence()->get_home_url(),
230
+ 'wc-api' => 'download-api',
231
+ 'request' => 'download'
232
+ );
233
+
234
+ if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
235
+ //Local file or remote?
236
+ return $package;
237
+ }
238
+
239
+ if ( empty( $package ) ) {
240
+ return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
241
+ }
242
+
243
+ $upgrader->skin->feedback( 'downloading_package', __( 'YIThemes Repository', 'yith-plugin-fw' ) );
244
+
245
+ $download_file = $this->_download_url( $package, $args );
246
+
247
+ /**
248
+ * Regenerate update_plugins transient
249
+ */
250
+ $this->force_regenerate_update_transient();
251
+
252
+ if ( is_wp_error( $download_file ) ) {
253
+ return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
254
+ }
255
+
256
+ return $download_file;
257
+ }
258
+
259
+ /**
260
+ * Retrive the temp filename
261
+ *
262
+ * @param string $url The package url
263
+ * @param string $body The post data fields
264
+ * @param int $timeout Execution timeout (default: 300)
265
+ *
266
+ * @return string | The temp filename
267
+ *
268
+ * @since 1.0
269
+ * @see wp-admin/includes/class-wp-upgrader.php
270
+ * @access protected
271
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
272
+ */
273
+ protected function _download_url( $url, $body, $timeout = 300 ) {
274
+
275
+ //WARNING: The file is not automatically deleted, The script must unlink() the file.
276
+ if ( ! $url ) {
277
+ return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yit' ) );
278
+ }
279
+
280
+ $tmpfname = wp_tempnam( $url );
281
+
282
+ $args = array(
283
+ 'timeout' => $timeout,
284
+ 'stream' => true,
285
+ 'filename' => $tmpfname,
286
+ 'body' => $body
287
+ );
288
+
289
+ if ( ! $tmpfname ) {
290
+ return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yit' ) );
291
+ }
292
+
293
+ $response = wp_safe_remote_post( $url, $args );
294
+
295
+ if ( is_wp_error( $response ) ) {
296
+ unlink( $tmpfname );
297
+ return $response;
298
+ }
299
+
300
+ if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
301
+ unlink( $tmpfname );
302
+ return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
303
+ }
304
+
305
+ $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
306
+
307
+ if ( $content_md5 ) {
308
+ $md5_check = verify_file_md5( $tmpfname, $content_md5 );
309
+ if ( is_wp_error( $md5_check ) ) {
310
+ unlink( $tmpfname );
311
+ return $md5_check;
312
+ }
313
+ }
314
+
315
+ return $tmpfname;
316
+ }
317
+
318
+ /**
319
+ * Main plugin Instance
320
+ *
321
+ * @static
322
+ * @return object Main instance
323
+ *
324
+ * @since 1.0
325
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
326
+ */
327
+ public static function instance() {
328
+ if ( is_null( self::$_instance ) ) {
329
+ self::$_instance = new self();
330
+ }
331
+
332
+ return self::$_instance;
333
+ }
334
+
335
+ /**
336
+ * Delete the update plugins transient
337
+ *
338
+ * @return void
339
+ *
340
+ * @since 1.0
341
+ * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
342
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
343
+ */
344
+ public function force_regenerate_update_transient(){
345
+ delete_site_transient( 'update_plugins' );
346
+ }
347
+
348
+ /**
349
+ * Check for plugins update
350
+ *
351
+ * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
352
+ *
353
+ * @param mixed $transient | update_plugins transient value
354
+ * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
355
+ *
356
+ * @return mixed $transient | The new update_plugins transient value
357
+ *
358
+ * @since 1.0
359
+ * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
360
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
361
+ */
362
+ public function check_update( $transient, $save = false ) {
363
+
364
+ foreach ($this->_plugins as $init => $plugin) {
365
+ $xml = str_replace('%plugin_slug%', $this->_plugins[$init]['slug'], $this->_xml);
366
+ $remote_xml = wp_remote_get($xml);
367
+
368
+ if (!is_wp_error($remote_xml) && isset($remote_xml['response']['code']) && '200' == $remote_xml['response']['code']) {
369
+
370
+
371
+ $plugin_remote_info = new SimpleXmlElement($remote_xml['body']);
372
+
373
+ if (version_compare($plugin_remote_info->latest, $plugin['info']['Version'], '>') && !isset($transient->response[$init])) {
374
+
375
+ $package = YIT_Plugin_Licence()->check($init) ? $this->_package_url : null;
376
+
377
+ $obj = new stdClass();
378
+ $obj->slug = (string)$init;
379
+ $obj->new_version = (string)$plugin_remote_info->latest;
380
+ $obj->changelog = (string)$plugin_remote_info->changelog;
381
+ $obj->package = $package;
382
+ $obj->plugin = $init;
383
+ $transient->response[$init] = $obj;
384
+ }
385
+
386
+ }
387
+ }
388
+
389
+ if( $save ) {
390
+ set_site_transient( 'update_plugins', $transient );
391
+ }
392
+
393
+ return $transient;
394
+ }
395
+
396
+ /**
397
+ * Add the plugin update row in plugin page
398
+ *
399
+ * @return void
400
+ * @fire "in_theme_update_message-{$init}" action
401
+ *
402
+ * @since 1.0
403
+ * @see after_plugin_row_{$init} action
404
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
405
+ */
406
+ public function plugin_update_row() {
407
+
408
+ $current = get_site_transient( 'update_plugins' );
409
+ $init = str_replace( 'after_plugin_row_', '', current_filter() );
410
+
411
+ if ( ! isset( $current->response[ $init ] ) ) {
412
+ return false;
413
+ }
414
+
415
+ /**
416
+ * stdClass Object
417
+ */
418
+ $r = $current->response[ $init ];
419
+
420
+ $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
421
+ $details_url = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
422
+
423
+ /**
424
+ * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
425
+ */
426
+ $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
427
+
428
+ if( is_network_admin() || ! is_multisite() || true ) {
429
+ echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
430
+
431
+ if( ! current_user_can( 'update_plugins' ) ){
432
+ printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw'), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
433
+ }elseif( is_plugin_active_for_network( $init ) ){
434
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
435
+ }elseif ( empty( $r->package ) ) {
436
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
437
+ } else {
438
+ printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw'), $this->_plugins[ $init ]['info']['Name'], esc_url($details_url), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $init, 'upgrade-plugin_' . $init ) );
439
+ }
440
+
441
+ /**
442
+ * Fires at the end of the update message container in each
443
+ * row of the themes list table.
444
+ *
445
+ * The dynamic portion of the hook name, `$theme_key`, refers to
446
+ * the theme slug as found in the WordPress.org themes repository.
447
+ *
448
+ * @since Wordpress 3.1.0
449
+ * }
450
+ */
451
+ do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
452
+
453
+ echo '</div></td></tr>';
454
+ }
455
+ }
456
+
457
+ /**
458
+ * Remove the standard plugin_update_row
459
+ *
460
+ * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
461
+ *
462
+ * @return void
463
+ * @fire "in_theme_update_message-{$init}" action
464
+ *
465
+ * @since 1.0
466
+ * @see after_plugin_row_{$init} action
467
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
468
+ */
469
+ public function remove_wp_plugin_update_row() {
470
+ foreach( $this->_plugins as $init => $plugin ){
471
+ remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10, 2 );
472
+ add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
473
+ add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
474
+ }
475
+ }
476
+
477
+ public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ){
478
+
479
+ $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
480
+ <div class='yit-plugin-changelog'>
481
+ <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
482
+ <p>{$changelog}</p>
483
+ </div>
484
+ </div>";
485
+
486
+ if( $echo ){
487
+ echo $res;
488
+ }
489
+ else{
490
+ return $res;
491
+ }
492
+ }
493
+
494
+ /**
495
+ * Auto-Update Plugin in multisite
496
+ *
497
+ * Manage the non standard upgrade-plugin-multisite action
498
+ *
499
+ * @return void
500
+ *
501
+ * @since 1.0
502
+ * @see upgrade-plugin action
503
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
504
+ */
505
+ public function upgrade_plugin_multisite(){
506
+
507
+ $plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
508
+ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
509
+
510
+ if( 'upgrade-plugin-multisite' != $action ){
511
+ wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
512
+ }
513
+
514
+ if ( ! current_user_can( 'update_plugins' ) ) {
515
+ wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
516
+ }
517
+
518
+ $this->check_update( get_site_transient( 'update_plugins') , true );
519
+
520
+ check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
521
+
522
+ $title = __( 'Update Plugin', 'yith-plugin-fw' );
523
+ $parent_file = 'plugins.php';
524
+ $submenu_file = 'plugins.php';
525
+
526
+ wp_enqueue_script( 'updates' );
527
+ require_once( ABSPATH . 'wp-admin/admin-header.php' );
528
+
529
+ $nonce = 'upgrade-plugin-multisite_' . $plugin;
530
+ $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
531
+
532
+ $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
533
+ $upgrader->upgrade( $plugin );
534
+
535
+ include( ABSPATH . 'wp-admin/admin-footer.php' );
536
+ }
537
+ }
538
+ }
539
+
540
+ if ( ! function_exists( 'YIT_Upgrade' ) ) {
541
+ /**
542
+ * Main instance of plugin
543
+ *
544
+ * @return YIT_Upgrade
545
+ * @since 1.0
546
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
547
+ */
548
+ function YIT_Upgrade() {
549
+ return YIT_Upgrade::instance();
550
+ }
551
+ }
552
+
553
+ /**
554
+ * Instance a YIT_Upgrade object
555
+ */
556
+ YIT_Upgrade();
plugin-fw/lib/yit-video.php CHANGED
@@ -1,200 +1,200 @@
1
- <?php
2
- /**
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
-
12
- if ( ! defined( 'ABSPATH' ) ) {
13
- exit;
14
- } // Exit if accessed directly
15
-
16
- if ( ! class_exists( 'YIT_Video' ) ) {
17
- /**
18
- * YIT Video
19
- *
20
- * Class to manage the video from youtube and vimeo or other services
21
- *
22
- * @class YIT_Video
23
- * @package Yithemes
24
- * @since 1.0.0
25
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
26
- *
27
- */
28
-
29
- class YIT_Video {
30
-
31
- /**
32
- * Generate the HTML for a youtube video
33
- *
34
- * @static
35
- *
36
- * @param array $args Array of arguments to configure the video to generate
37
- *
38
- * @return string
39
- * @since 1.0
40
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
41
- */
42
- public static function youtube( $args = array() ) {
43
- $defaults = array(
44
- 'id' => '',
45
- 'url' => '',
46
- 'width' => 425,
47
- 'height' => 356,
48
- 'echo' => false
49
- );
50
- $args = wp_parse_args( $args, $defaults );
51
- extract( $args );
52
-
53
- // get video ID if you have only URL
54
- if ( empty( $id ) && ! empty( $url ) ) {
55
- $id = self::video_id_by_url( $url );
56
- } elseif ( empty( $id ) && empty( $url ) ) {
57
- return;
58
- }
59
-
60
- ob_start();
61
-
62
- $id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
63
- $id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
64
-
65
- <div class="post_video youtube">
66
- <iframe wmode="transparent" width="<?php echo $width; ?>" height="<?php echo $height; ?>" src="https://www.youtube.com/embed/<?php echo $id; ?>?wmode=transparent" frameborder="0" allowfullscreen></iframe>
67
- </div>
68
-
69
- <?php
70
- $html = apply_filters( 'yit_video_youtube', ob_get_clean() );
71
-
72
- if( $echo ) echo $html;
73
-
74
- return $html;
75
- }
76
-
77
- /**
78
- * Generate the HTML for a vimeo video
79
- *
80
- * @static
81
- *
82
- * @param array $args Array of arguments to configure the video to generate
83
- *
84
- * @return string
85
- * @since 1.0
86
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
87
- */
88
- public static function vimeo( $args = array() ) {
89
- $defaults = array(
90
- 'id' => '',
91
- 'url' => '',
92
- 'width' => 425,
93
- 'height' => 356,
94
- 'echo' => false
95
- );
96
- $args = wp_parse_args( $args, $defaults );
97
- extract( $args );
98
-
99
- // get video ID if you have only URL
100
- if ( empty( $id ) && ! empty( $url ) ) {
101
- $id = self::video_id_by_url( $url );
102
- }
103
-
104
- ob_start();
105
-
106
- $id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
107
- $id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
108
-
109
- <div class="post_video vimeo">
110
- <iframe wmode="transparent" src="http://player.vimeo.com/video/<?php echo $id; ?>?title=0&amp;byline=0&amp;portrait=0" width="<?php echo $width; ?>" height="<?php echo $height; ?>" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
111
- </div>
112
-
113
- <?php
114
- $html = apply_filters( 'yit_video_vimeo', ob_get_clean() );
115
-
116
- if( $echo ) echo $html;
117
-
118
- return $html;
119
- }
120
-
121
- /**
122
- * Retrieve video ID from URL
123
- *
124
- * @static
125
- *
126
- * @param array $url The URL of video
127
- *
128
- * @return bool|string
129
- * @since 1.0
130
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
131
- */
132
- public static function video_id_by_url( $url ) {
133
- $parsed = parse_url( esc_url( $url ) );
134
- if ( ! isset( $parsed['host'] ) ) {
135
- return false;
136
- }
137
-
138
-
139
- switch ( $parsed['host'] ) {
140
- case 'youtube.com' :
141
- case 'www.youtube.com' :
142
- case 'youtu.be' :
143
- case 'www.youtu.be' :
144
- $id = self::youtube_id_by_url( $url );
145
- return "youtube:$id";
146
-
147
- case 'www.vimeo.com' :
148
- case 'vimeo.com' :
149
- preg_match( '/http(s)?:\/\/(\w+.)?vimeo\.com\/(.*)?(\/[0-9]+)/', $url, $matches );
150
- $id = trim( $matches[4], '/' );
151
- return "vimeo:$id";
152
-
153
- default :
154
- return false;
155
-
156
- }
157
- }
158
-
159
- /**
160
- * Retrieve video ID from URL
161
- *
162
- * @static
163
- *
164
- * @param array $url The URL of video
165
- *
166
- * @return bool|string
167
- * @since 1.0
168
- * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
169
- */
170
- protected static function youtube_id_by_url( $url ) {
171
- if ( preg_match( '/http(s)?:\/\/youtu.be/', $url, $matches) ) {
172
- $url = parse_url($url, PHP_URL_PATH);
173
- $url = str_replace( '/', '', $url);
174
- return $url;
175
-
176
- } elseif ( preg_match( '/watch/', $url, $matches) ) {
177
- $arr = parse_url($url);
178
- $url = str_replace( 'v=', '', $arr['query'] );
179
- return $url;
180
-
181
- } elseif ( preg_match( '/http(s)?:\/\/(\w+.)?youtube.com\/v/', $url, $matches) ) {
182
- $arr = parse_url($url);
183
- $url = str_replace( '/v/', '', $arr['path'] );
184
- return $url;
185
-
186
- } elseif ( preg_match( '/http(s)?:\/\/(\w+.)?youtube.com\/embed/', $url, $matches) ) {
187
- $arr = parse_url($url);
188
- $url = str_replace( '/embed/', '', $arr['path'] );
189
- return $url;
190
-
191
- } elseif ( preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+#", $url, $matches) ) {
192
- return $matches[0];
193
-
194
- } else {
195
- return false;
196
- }
197
- }
198
-
199
- }
200
  }
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ } // Exit if accessed directly
15
+
16
+ if ( ! class_exists( 'YIT_Video' ) ) {
17
+ /**
18
+ * YIT Video
19
+ *
20
+ * Class to manage the video from youtube and vimeo or other services
21
+ *
22
+ * @class YIT_Video
23
+ * @package Yithemes
24
+ * @since 1.0.0
25
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
26
+ *
27
+ */
28
+
29
+ class YIT_Video {
30
+
31
+ /**
32
+ * Generate the HTML for a youtube video
33
+ *
34
+ * @static
35
+ *
36
+ * @param array $args Array of arguments to configure the video to generate
37
+ *
38
+ * @return string
39
+ * @since 1.0
40
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
41
+ */
42
+ public static function youtube( $args = array() ) {
43
+ $defaults = array(
44
+ 'id' => '',
45
+ 'url' => '',
46
+ 'width' => 425,
47
+ 'height' => 356,
48
+ 'echo' => false
49
+ );
50
+ $args = wp_parse_args( $args, $defaults );
51
+ extract( $args );
52
+
53
+ // get video ID if you have only URL
54
+ if ( empty( $id ) && ! empty( $url ) ) {
55
+ $id = self::video_id_by_url( $url );
56
+ } elseif ( empty( $id ) && empty( $url ) ) {
57
+ return;
58
+ }
59
+
60
+ ob_start();
61
+
62
+ $id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
63
+ $id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
64
+
65
+ <div class="post_video youtube">
66
+ <iframe wmode="transparent" width="<?php echo $width; ?>" height="<?php echo $height; ?>" src="https://www.youtube.com/embed/<?php echo $id; ?>?wmode=transparent" frameborder="0" allowfullscreen></iframe>
67
+ </div>
68
+
69
+ <?php
70
+ $html = apply_filters( 'yit_video_youtube', ob_get_clean() );
71
+
72
+ if( $echo ) echo $html;
73
+
74
+ return $html;
75
+ }
76
+
77
+ /**
78
+ * Generate the HTML for a vimeo video
79
+ *
80
+ * @static
81
+ *
82
+ * @param array $args Array of arguments to configure the video to generate
83
+ *
84
+ * @return string
85
+ * @since 1.0
86
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
87
+ */
88
+ public static function vimeo( $args = array() ) {
89
+ $defaults = array(
90
+ 'id' => '',
91
+ 'url' => '',
92
+ 'width' => 425,
93
+ 'height' => 356,
94
+ 'echo' => false
95
+ );
96
+ $args = wp_parse_args( $args, $defaults );
97
+ extract( $args );
98
+
99
+ // get video ID if you have only URL
100
+ if ( empty( $id ) && ! empty( $url ) ) {
101
+ $id = self::video_id_by_url( $url );
102
+ }
103
+
104
+ ob_start();
105
+
106
+ $id = preg_replace( '/[&|&amp;]feature=([\w\-]*)/', '', $id );
107
+ $id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
108
+
109
+ <div class="post_video vimeo">
110
+ <iframe wmode="transparent" src="http://player.vimeo.com/video/<?php echo $id; ?>?title=0&amp;byline=0&amp;portrait=0" width="<?php echo $width; ?>" height="<?php echo $height; ?>" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
111
+ </div>
112
+
113
+ <?php
114
+ $html = apply_filters( 'yit_video_vimeo', ob_get_clean() );
115
+
116
+ if( $echo ) echo $html;
117
+
118
+ return $html;
119
+ }
120
+
121
+ /**
122
+ * Retrieve video ID from URL
123
+ *
124
+ * @static
125
+ *
126
+ * @param array $url The URL of video
127
+ *
128
+ * @return bool|string
129
+ * @since 1.0
130
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
131
+ */
132
+ public static function video_id_by_url( $url ) {
133
+ $parsed = parse_url( esc_url( $url ) );
134
+ if ( ! isset( $parsed['host'] ) ) {
135
+ return false;
136
+ }
137
+
138
+
139
+ switch ( $parsed['host'] ) {
140
+ case 'youtube.com' :
141
+ case 'www.youtube.com' :
142
+ case 'youtu.be' :
143
+ case 'www.youtu.be' :
144
+ $id = self::youtube_id_by_url( $url );
145
+ return "youtube:$id";
146
+
147
+ case 'www.vimeo.com' :
148
+ case 'vimeo.com' :
149
+ preg_match( '/http(s)?:\/\/(\w+.)?vimeo\.com\/(.*)?(\/[0-9]+)/', $url, $matches );
150
+ $id = trim( $matches[4], '/' );
151
+ return "vimeo:$id";
152
+
153
+ default :
154
+ return false;
155
+
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Retrieve video ID from URL
161
+ *
162
+ * @static
163
+ *
164
+ * @param array $url The URL of video
165
+ *
166
+ * @return bool|string
167
+ * @since 1.0
168
+ * @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
169
+ */
170
+ protected static function youtube_id_by_url( $url ) {
171
+ if ( preg_match( '/http(s)?:\/\/youtu.be/', $url, $matches) ) {
172
+ $url = parse_url($url, PHP_URL_PATH);
173
+ $url = str_replace( '/', '', $url);
174
+ return $url;
175
+
176
+ } elseif ( preg_match( '/watch/', $url, $matches) ) {
177
+ $arr = parse_url($url);
178
+ $url = str_replace( 'v=', '', $arr['query'] );
179
+ return $url;
180
+
181
+ } elseif ( preg_match( '/http(s)?:\/\/(\w+.)?youtube.com\/v/', $url, $matches) ) {
182
+ $arr = parse_url($url);
183
+ $url = str_replace( '/v/', '', $arr['path'] );
184
+ return $url;
185
+
186
+ } elseif ( preg_match( '/http(s)?:\/\/(\w+.)?youtube.com\/embed/', $url, $matches) ) {
187
+ $arr = parse_url($url);
188
+ $url = str_replace( '/embed/', '', $arr['path'] );
189
+ return $url;
190
+
191
+ } elseif ( preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+#", $url, $matches) ) {
192
+ return $matches[0];
193
+
194
+ } else {
195
+ return false;
196
+ }
197
+ }
198
+
199
+ }
200
  }
plugin-fw/licence/assets/css/yit-licence.css CHANGED
@@ -1,439 +1,439 @@
1
- /* === Plugins Upgrader === */
2
-
3
- .yit-plugin-changelog-wrapper {
4
- display: none;
5
- }
6
-
7
- .yit-plugin-changelog-title {
8
- text-transform: uppercase;
9
- }
10
-
11
- .yit-plugin-changelog {
12
- background: #fcfcfc;
13
- height: 97%;
14
- z-index: 999;
15
- overflow: auto;
16
- }
17
-
18
- /* === Plugins Licence Activation === */
19
-
20
- .yit-container.product-licence-activation {
21
- font-family: 'Raleway', sans-serif;
22
- }
23
-
24
- .yit-container.product-licence-activation .to-active-wrapper {
25
- margin-bottom: 60px;
26
- max-width: 900px;
27
- }
28
-
29
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form {
30
- position: relative;
31
- border-color: #e1e1e1;
32
- border-style: solid;
33
- border-width: 0;
34
- }
35
-
36
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:first-child {
37
- border-top-width: 1px;
38
- }
39
-
40
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:last-child {
41
- border-bottom-width: 1px;
42
- }
43
-
44
- .yit-container.product-licence-activation .to-active-wrapper table.to-active-table {
45
- border-width: 0;
46
- border-spacing: 0;
47
- width: 100%;
48
- }
49
-
50
- .yit-container.product-licence-activation .message {
51
- display: none;
52
- line-height: normal;
53
- background: #ffffff url(../images/licence-error.png) 15px center no-repeat;
54
- padding-left: 65px;
55
- padding-right: 15px;
56
- width: 150px;
57
- }
58
-
59
- .yit-container.product-licence-activation .message-wrapper {
60
- height: 75px;
61
- display: none;
62
- position: absolute;
63
- top: 0;
64
- right: -250px;
65
- border: 1px solid #ff3838;
66
- }
67
-
68
- .yit-container.product-licence-activation .message-wrapper.visible {
69
- display: table;
70
- }
71
-
72
- .yit-container.product-licence-activation .message {
73
- display: table-cell;
74
- vertical-align: middle;
75
- }
76
-
77
- .yit-container.product-licence-activation .arrow-left:after,
78
- .yit-container.product-licence-activation .arrow-left:before {
79
- content: "";
80
- display: block;
81
- width: 0;
82
- height: 0;
83
- position: absolute;
84
- }
85
-
86
- .yit-container.product-licence-activation .arrow-left:before {
87
- border-top: 9px solid transparent;
88
- border-bottom: 9px solid transparent;
89
- border-right: 9px solid #ff3838;
90
- top: 26px;
91
- left: -9px;
92
- }
93
-
94
- .yit-container.product-licence-activation .arrow-left:after {
95
- border-top: 8px solid transparent;
96
- border-bottom: 8px solid transparent;
97
- border-right: 8px solid #fff;
98
- left: -8px;
99
- top: 27px;
100
- }
101
-
102
- .yit-container.product-licence-activation h2,
103
- .yit-container.product-licence-activation h3 {
104
- text-transform: uppercase;
105
- font-weight: 800;
106
- margin-bottom: 30px;
107
- }
108
-
109
- .yit-container.product-licence-activation h2 {
110
- color: #808a97;
111
- font-size: 25px;
112
- }
113
- .yit-container.product-licence-activation h3 {
114
- color: #313131;
115
- font-size: 15px;
116
- height: 20px;
117
- }
118
-
119
- .yit-container.product-licence-activation h3.to-active {
120
- height: 20px;
121
- position: relative;
122
- vertical-align: top;
123
- }
124
-
125
- .yit-container.product-licence-activation .spinner{
126
- vertical-align: -5px;
127
- float: none;
128
- }
129
-
130
- .yit-container.product-licence-activation .spinner.show{
131
- visibility: visible;
132
- }
133
-
134
- .yit-container.product-licence-activation .licence-check-section{
135
- margin-bottom: 60px;
136
- }
137
-
138
- .yit-container.product-licence-activation span.licence-label {
139
- font-weight: 500;
140
- color: #606060;
141
- margin-bottom: 30px;
142
- }
143
-
144
- .yit-container.product-licence-activation .button-licence {
145
- border: 0;
146
- font-size: 13px;
147
- text-transform: uppercase;
148
- background-color: #808a97;
149
- color: #fff;
150
- font-weight: 700;
151
- border-radius: 3px;
152
- cursor: pointer;
153
- text-decoration: none;
154
- padding: 5px 7px;
155
- -webkit-transition: background-color 0.3s ease;
156
- -moz-transition: background-color 0.3s ease;
157
- -ms-transition: background-color 0.3s ease;
158
- -o-transition: background-color 0.3s ease;
159
- transition: background-color 0.3s ease;
160
- }
161
-
162
- .yit-container.product-licence-activation .button-licence:hover {
163
- background-color: #4d5c6f;
164
- }
165
-
166
- .yit-container.product-licence-activation .button-licence.clicked {
167
- cursor: not-allowed;
168
- background-color: #e2e2e2 !important;
169
- }
170
-
171
- .yit-container.product-licence-activation .button-licence.licence-check {
172
- font-weight: 400;
173
- padding: 12px 19px;
174
- }
175
-
176
- .yit-container.product-licence-activation .button-licence.licence-deactive,
177
- .yit-container.product-licence-activation .button-licence.licence-renew {
178
- text-decoration: none;
179
- padding: 7px 12px;
180
- font-size: 9px;
181
- }
182
-
183
- .yit-container.product-licence-activation table:not(.expired-table) .button-licence.licence-renew {
184
- margin-left: 10px;
185
- }
186
-
187
- .yit-container.product-licence-activation .button-licence.licence-deactive:focus,
188
- .yit-container.product-licence-activation .button-licence.licence-renew:focus {
189
- box-shadow: none;
190
- }
191
-
192
- .yit-container.product-licence-activation table:not(.to-active-table) {
193
- width: auto;
194
- border: 1px solid #dcdcdc;
195
- border-spacing: 0;
196
- border-radius: 5px;
197
- border-collapse: separate;
198
- overflow: hidden;
199
- }
200
-
201
- .yit-container.product-licence-activation table:not(.to-active-table) th {
202
- border-bottom: 1px solid #dcdcdc;
203
- padding: 0 10px;
204
- }
205
-
206
- .yit-container.product-licence-activation table tbody tr td.product-licence-key {
207
- text-transform: lowercase;
208
- }
209
-
210
- .yit-container.product-licence-activation table:not(.to-active-table) td,
211
- .yit-container.product-licence-activation table:not(.to-active-table) th {
212
- border-right: 1px solid #dcdcdc;
213
- }
214
-
215
- .yit-container.product-licence-activation table td:last-child,
216
- .yit-container.product-licence-activation table th:last-child {
217
- border-right: 0;
218
- }
219
-
220
- .yit-container.product-licence-activation table thead tr {
221
- background-color: #f6f4f4;
222
- }
223
-
224
- .yit-container.product-licence-activation table tbody tr {
225
- background-color: #ffffff;
226
- }
227
-
228
- .yit-container.product-licence-activation table tbody tr:nth-child(2n) {
229
- background-color: #f4f4f4;
230
- }
231
-
232
- .yit-container.product-licence-activation table thead tr th {
233
- font-size: 11px;
234
- color: #313131;
235
- text-transform: uppercase;
236
- font-weight: bold;
237
- }
238
-
239
- .yit-container.product-licence-activation table thead tr,
240
- .yit-container.product-licence-activation table tbody tr {
241
- line-height: 60px;
242
- }
243
-
244
- .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-no-alt {
245
- color: #b20015;
246
- }
247
-
248
- .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-yes {
249
- color: #1ca800;
250
- }
251
-
252
- .yit-container.product-licence-activation table tbody tr td{
253
- text-align: center;
254
- line-height: 20px;
255
- padding: 10px 5px;
256
- }
257
-
258
- .yit-container.product-licence-activation .button-licence.licence-activation {
259
- padding: 12px 18px;
260
- }
261
-
262
- .yit-container.product-licence-activation .to-active-table tr {
263
- line-height: 75px;
264
- }
265
-
266
- .yit-container.product-licence-activation .to-active-table tr.product-row {
267
- background-color: transparent;
268
- -webkit-transition: all 0.3s ease;
269
- -moz-transition: all 0.3s ease;
270
- -ms-transition: all 0.3s ease;
271
- -o-transition: all 0.3s ease;
272
- transition: all 0.3s ease;
273
- }
274
-
275
- .yit-container.product-licence-activation .to-active-table tr.product-row.error {
276
- background-color: #ffdcdc;
277
- }
278
-
279
- .yit-container.product-licence-activation .to-active-table td {
280
- padding-right: 12px;
281
- width: 33%;
282
- }
283
-
284
- .yit-container.product-licence-activation td.product-name {
285
- color: #808a97;
286
- font-size: 12px;
287
- text-transform: uppercase;
288
- font-weight: bold;
289
- line-height: 20px;
290
- padding: 10px 20px;
291
- }
292
-
293
- .yit-container.product-licence-activation .to-active-table td.product-name {
294
- width: 20%;
295
- }
296
-
297
- .yit-container.product-licence-activation .to-active-table td.activate-button {
298
- width: 15%;
299
- position: relative;
300
- }
301
-
302
- .yit-container.product-licence-activation input[type=text],
303
- .yit-container.product-licence-activation input[type=email]{
304
- -webkit-transition: all 0.3s ease;
305
- -moz-transition: all 0.3s ease;
306
- -ms-transition: all 0.3s ease;
307
- -o-transition: all 0.3s ease;
308
- transition: all 0.3s ease;
309
-
310
- border: 1px solid #dcdcdc;
311
- padding: 0 15px;
312
- border-radius: 3px;
313
- height: 41px;
314
- width: 100%;
315
- }
316
-
317
- .yit-container.product-licence-activation input[type=text].require,
318
- .yit-container.product-licence-activation input[type=email].require {
319
- border: 1px solid #ff3838;
320
- }
321
-
322
- .yit-container.product-licence-activation input[type=text]:focus,
323
- .yit-container.product-licence-activation input[type=email]:focus{
324
- webkit-box-shadow: 0 0 1px rgba(30,140,190,.8);
325
- box-shadow: 0 0 1px rgba(30,140,190,.8);
326
- }
327
-
328
- .yit-container.product-licence-activation input[type=text],
329
- .yit-container.product-licence-activation input[type=email]{
330
- text-transform: uppercase;
331
- text-align: center;
332
- }
333
-
334
- .yit-container.product-licence-activation input[type=submit]:focus{
335
- outline: 0;
336
- }
337
-
338
- /* Licence FAQ */
339
- .yit-container.product-licence-activation .activation-faq {
340
- background: #ffffff;
341
- margin-bottom: 20px;
342
- border: 1px solid #dcdcdc;
343
- padding: 0 15px;
344
- border-radius: 3px;
345
- }
346
-
347
- .yit-container.product-licence-activation .activation-faq h3{
348
- color: #808a97;
349
- }
350
-
351
- #yith-licence-notice {
352
- margin-left: 0;
353
- visibility: hidden;
354
- min-height: 38px;
355
- }
356
-
357
- #yith-licence-notice.visible {
358
- visibility: visible;
359
- }
360
-
361
- /* === Responsive === */
362
-
363
- @media (max-width: 767px) {
364
- .yit-container.product-licence-activation .activation-faq {
365
- margin-right: 5px;
366
- }
367
- }
368
-
369
- @media (max-width: 480px) {
370
- .yit-container.product-licence-activation .activation-faq {
371
- margin-right: 5px;
372
- }
373
- }
374
-
375
- @media (min-width: 768px) and (max-width: 992px) {
376
- .yit-container.product-licence-activation .button-licence.licence-deactive,
377
- .yit-container.product-licence-activation .button-licence.licence-renew {
378
- margin-bottom: 10px;
379
- display: block;
380
- margin-left: 0;
381
- padding: 5px 7px;
382
- }
383
-
384
- .yit-container.product-licence-activation .button-licence.licence-deactive {
385
- margin-bottom: 10px;
386
- }
387
-
388
- .yit-container.product-licence-activation table:not(.to-active-table) th {
389
- line-height: 20px;
390
- }
391
-
392
- .yit-container.product-licence-activation table tbody tr td {
393
- padding: 5px;
394
- }
395
-
396
- .yit-container.product-licence-activation .activation-faq {
397
- margin-right: 20px;
398
- }
399
- }
400
-
401
- @media (min-width: 980px) and (max-width: 1199px) {
402
- .yit-container.product-licence-activation .button-licence.licence-deactive,
403
- .yit-container.product-licence-activation .button-licence.licence-renew {
404
- display: block;
405
- margin-left: 0;
406
- padding: 5px 7px;
407
- }
408
-
409
- .yit-container.product-licence-activation .button-licence.licence-renew {
410
- margin-top: 10px;
411
- }
412
-
413
- .yit-container.product-licence-activation table:not(.to-active-table) th {
414
- line-height: 20px;
415
- }
416
-
417
- .yit-container.product-licence-activation table tbody tr td {
418
- padding: 5px;
419
- }
420
-
421
- .yit-container.product-licence-activation .activation-faq {
422
- width: 75%;
423
- }
424
- }
425
-
426
- @media (min-width: 1200px) {
427
- .yit-container.product-licence-activation{
428
- width: auto;
429
- }
430
-
431
- .yit-container.product-licence-activation .activation-faq {
432
- width: 50%;
433
- }
434
- }
435
-
436
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
437
- only screen and (-o-min-device-pixel-ratio: 3/2),
438
- only screen and (min--moz-device-pixel-ratio: 1.5),
439
- only screen and (min-device-pixel-ratio: 1.5) {}
1
+ /* === Plugins Upgrader === */
2
+
3
+ .yit-plugin-changelog-wrapper {
4
+ display: none;
5
+ }
6
+
7
+ .yit-plugin-changelog-title {
8
+ text-transform: uppercase;
9
+ }
10
+
11
+ .yit-plugin-changelog {
12
+ background: #fcfcfc;
13
+ height: 97%;
14
+ z-index: 999;
15
+ overflow: auto;
16
+ }
17
+
18
+ /* === Plugins Licence Activation === */
19
+
20
+ .yit-container.product-licence-activation {
21
+ font-family: 'Raleway', sans-serif;
22
+ }
23
+
24
+ .yit-container.product-licence-activation .to-active-wrapper {
25
+ margin-bottom: 60px;
26
+ max-width: 900px;
27
+ }
28
+
29
+ .yit-container.product-licence-activation .to-active-wrapper form.to-active-form {
30
+ position: relative;
31
+ border-color: #e1e1e1;
32
+ border-style: solid;
33
+ border-width: 0;
34
+ }
35
+
36
+ .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:first-child {
37
+ border-top-width: 1px;
38
+ }
39
+
40
+ .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:last-child {
41
+ border-bottom-width: 1px;
42
+ }
43
+
44
+ .yit-container.product-licence-activation .to-active-wrapper table.to-active-table {
45
+ border-width: 0;
46
+ border-spacing: 0;
47
+ width: 100%;
48
+ }
49
+
50
+ .yit-container.product-licence-activation .message {
51
+ display: none;
52
+ line-height: normal;
53
+ background: #ffffff url(../images/licence-error.png) 15px center no-repeat;
54
+ padding-left: 65px;
55
+ padding-right: 15px;
56
+ width: 150px;
57
+ }
58
+
59
+ .yit-container.product-licence-activation .message-wrapper {
60
+ height: 75px;
61
+ display: none;
62
+ position: absolute;
63
+ top: 0;
64
+ right: -250px;
65
+ border: 1px solid #ff3838;
66
+ }
67
+
68
+ .yit-container.product-licence-activation .message-wrapper.visible {
69
+ display: table;
70
+ }
71
+
72
+ .yit-container.product-licence-activation .message {
73
+ display: table-cell;
74
+ vertical-align: middle;
75
+ }
76
+
77
+ .yit-container.product-licence-activation .arrow-left:after,
78
+ .yit-container.product-licence-activation .arrow-left:before {
79
+ content: "";
80
+ display: block;
81
+ width: 0;
82
+ height: 0;
83
+ position: absolute;
84
+ }
85
+
86
+ .yit-container.product-licence-activation .arrow-left:before {
87
+ border-top: 9px solid transparent;
88
+ border-bottom: 9px solid transparent;
89
+ border-right: 9px solid #ff3838;
90
+ top: 26px;
91
+ left: -9px;
92
+ }
93
+
94
+ .yit-container.product-licence-activation .arrow-left:after {
95
+ border-top: 8px solid transparent;
96
+ border-bottom: 8px solid transparent;
97
+ border-right: 8px solid #fff;
98
+ left: -8px;
99
+ top: 27px;
100
+ }
101
+
102
+ .yit-container.product-licence-activation h2,
103
+ .yit-container.product-licence-activation h3 {
104
+ text-transform: uppercase;
105
+ font-weight: 800;
106
+ margin-bottom: 30px;
107
+ }
108
+
109
+ .yit-container.product-licence-activation h2 {
110
+ color: #808a97;
111
+ font-size: 25px;
112
+ }
113
+ .yit-container.product-licence-activation h3 {
114
+ color: #313131;
115
+ font-size: 15px;
116
+ height: 20px;
117
+ }
118
+
119
+ .yit-container.product-licence-activation h3.to-active {
120
+ height: 20px;
121
+ position: relative;
122
+ vertical-align: top;
123
+ }
124
+
125
+ .yit-container.product-licence-activation .spinner{
126
+ vertical-align: -5px;
127
+ float: none;
128
+ }
129
+
130
+ .yit-container.product-licence-activation .spinner.show{
131
+ visibility: visible;
132
+ }
133
+
134
+ .yit-container.product-licence-activation .licence-check-section{
135
+ margin-bottom: 60px;
136
+ }
137
+
138
+ .yit-container.product-licence-activation span.licence-label {
139
+ font-weight: 500;
140
+ color: #606060;
141
+ margin-bottom: 30px;
142
+ }
143
+
144
+ .yit-container.product-licence-activation .button-licence {
145
+ border: 0;
146
+ font-size: 13px;
147
+ text-transform: uppercase;
148
+ background-color: #808a97;
149
+ color: #fff;
150
+ font-weight: 700;
151
+ border-radius: 3px;
152
+ cursor: pointer;
153
+ text-decoration: none;
154
+ padding: 5px 7px;
155
+ -webkit-transition: background-color 0.3s ease;
156
+ -moz-transition: background-color 0.3s ease;
157
+ -ms-transition: background-color 0.3s ease;
158
+ -o-transition: background-color 0.3s ease;
159
+ transition: background-color 0.3s ease;
160
+ }
161
+
162
+ .yit-container.product-licence-activation .button-licence:hover {
163
+ background-color: #4d5c6f;
164
+ }
165
+
166
+ .yit-container.product-licence-activation .button-licence.clicked {
167
+ cursor: not-allowed;
168
+ background-color: #e2e2e2 !important;
169
+ }
170
+
171
+ .yit-container.product-licence-activation .button-licence.licence-check {
172
+ font-weight: 400;
173
+ padding: 12px 19px;
174
+ }
175
+
176
+ .yit-container.product-licence-activation .button-licence.licence-deactive,
177
+ .yit-container.product-licence-activation .button-licence.licence-renew {
178
+ text-decoration: none;
179
+ padding: 7px 12px;
180
+ font-size: 9px;
181
+ }
182
+
183
+ .yit-container.product-licence-activation table:not(.expired-table) .button-licence.licence-renew {
184
+ margin-left: 10px;
185
+ }
186
+
187
+ .yit-container.product-licence-activation .button-licence.licence-deactive:focus,
188
+ .yit-container.product-licence-activation .button-licence.licence-renew:focus {
189
+ box-shadow: none;
190
+ }
191
+
192
+ .yit-container.product-licence-activation table:not(.to-active-table) {
193
+ width: auto;
194
+ border: 1px solid #dcdcdc;
195
+ border-spacing: 0;
196
+ border-radius: 5px;
197
+ border-collapse: separate;
198
+ overflow: hidden;
199
+ }
200
+
201
+ .yit-container.product-licence-activation table:not(.to-active-table) th {
202
+ border-bottom: 1px solid #dcdcdc;
203
+ padding: 0 10px;
204
+ }
205
+
206
+ .yit-container.product-licence-activation table tbody tr td.product-licence-key {
207
+ text-transform: lowercase;
208
+ }
209
+
210
+ .yit-container.product-licence-activation table:not(.to-active-table) td,
211
+ .yit-container.product-licence-activation table:not(.to-active-table) th {
212
+ border-right: 1px solid #dcdcdc;
213
+ }
214
+
215
+ .yit-container.product-licence-activation table td:last-child,
216
+ .yit-container.product-licence-activation table th:last-child {
217
+ border-right: 0;
218
+ }
219
+
220
+ .yit-container.product-licence-activation table thead tr {
221
+ background-color: #f6f4f4;
222
+ }
223
+
224
+ .yit-container.product-licence-activation table tbody tr {
225
+ background-color: #ffffff;
226
+ }
227
+
228
+ .yit-container.product-licence-activation table tbody tr:nth-child(2n) {
229
+ background-color: #f4f4f4;
230
+ }
231
+
232
+ .yit-container.product-licence-activation table thead tr th {
233
+ font-size: 11px;
234
+ color: #313131;
235
+ text-transform: uppercase;
236
+ font-weight: bold;
237
+ }
238
+
239
+ .yit-container.product-licence-activation table thead tr,
240
+ .yit-container.product-licence-activation table tbody tr {
241
+ line-height: 60px;
242
+ }
243
+
244
+ .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-no-alt {
245
+ color: #b20015;
246
+ }
247
+
248
+ .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-yes {
249
+ color: #1ca800;
250
+ }
251
+
252
+ .yit-container.product-licence-activation table tbody tr td{
253
+ text-align: center;
254
+ line-height: 20px;
255
+ padding: 10px 5px;
256
+ }
257
+
258
+ .yit-container.product-licence-activation .button-licence.licence-activation {
259
+ padding: 12px 18px;
260
+ }
261
+
262
+ .yit-container.product-licence-activation .to-active-table tr {
263
+ line-height: 75px;
264
+ }
265
+
266
+ .yit-container.product-licence-activation .to-active-table tr.product-row {
267
+ background-color: transparent;
268
+ -webkit-transition: all 0.3s ease;
269
+ -moz-transition: all 0.3s ease;
270
+ -ms-transition: all 0.3s ease;
271
+ -o-transition: all 0.3s ease;
272
+ transition: all 0.3s ease;
273
+ }
274
+
275
+ .yit-container.product-licence-activation .to-active-table tr.product-row.error {
276
+ background-color: #ffdcdc;
277
+ }
278
+
279
+ .yit-container.product-licence-activation .to-active-table td {
280
+ padding-right: 12px;
281
+ width: 33%;
282
+ }
283
+
284
+ .yit-container.product-licence-activation td.product-name {
285
+ color: #808a97;
286
+ font-size: 12px;
287
+ text-transform: uppercase;
288
+ font-weight: bold;
289
+ line-height: 20px;
290
+ padding: 10px 20px;
291
+ }
292
+
293
+ .yit-container.product-licence-activation .to-active-table td.product-name {
294
+ width: 20%;
295
+ }
296
+
297
+ .yit-container.product-licence-activation .to-active-table td.activate-button {
298
+ width: 15%;
299
+ position: relative;
300
+ }
301
+
302
+ .yit-container.product-licence-activation input[type=text],
303
+ .yit-container.product-licence-activation input[type=email]{
304
+ -webkit-transition: all 0.3s ease;
305
+ -moz-transition: all 0.3s ease;
306
+ -ms-transition: all 0.3s ease;
307
+ -o-transition: all 0.3s ease;
308
+ transition: all 0.3s ease;
309
+
310
+ border: 1px solid #dcdcdc;
311
+ padding: 0 15px;
312
+ border-radius: 3px;
313
+ height: 41px;
314
+ width: 100%;
315
+ }
316
+
317
+ .yit-container.product-licence-activation input[type=text].require,
318
+ .yit-container.product-licence-activation input[type=email].require {
319
+ border: 1px solid #ff3838;
320
+ }
321
+
322
+ .yit-container.product-licence-activation input[type=text]:focus,
323
+ .yit-container.product-licence-activation input[type=email]:focus{
324
+ webkit-box-shadow: 0 0 1px rgba(30,140,190,.8);
325
+ box-shadow: 0 0 1px rgba(30,140,190,.8);
326
+ }
327
+
328
+ .yit-container.product-licence-activation input[type=text],
329
+ .yit-container.product-licence-activation input[type=email]{
330
+ text-transform: uppercase;
331
+ text-align: center;
332
+ }
333
+
334
+ .yit-container.product-licence-activation input[type=submit]:focus{
335
+ outline: 0;
336
+ }
337
+
338
+ /* Licence FAQ */
339
+ .yit-container.product-licence-activation .activation-faq {
340
+ background: #ffffff;
341
+ margin-bottom: 20px;
342
+ border: 1px solid #dcdcdc;
343
+ padding: 0 15px;
344
+ border-radius: 3px;
345
+ }
346
+
347
+ .yit-container.product-licence-activation .activation-faq h3{
348
+ color: #808a97;
349
+ }
350
+
351
+ #yith-licence-notice {
352
+ margin-left: 0;
353
+ visibility: hidden;
354
+ min-height: 38px;
355
+ }
356
+
357
+ #yith-licence-notice.visible {
358
+ visibility: visible;
359
+ }
360
+
361
+ /* === Responsive === */
362
+
363
+ @media (max-width: 767px) {
364
+ .yit-container.product-licence-activation .activation-faq {
365
+ margin-right: 5px;
366
+ }
367
+ }
368
+
369
+ @media (max-width: 480px) {
370
+ .yit-container.product-licence-activation .activation-faq {
371
+ margin-right: 5px;
372
+ }
373
+ }
374
+
375
+ @media (min-width: 768px) and (max-width: 992px) {
376
+ .yit-container.product-licence-activation .button-licence.licence-deactive,
377
+ .yit-container.product-licence-activation .button-licence.licence-renew {
378
+ margin-bottom: 10px;
379
+ display: block;
380
+ margin-left: 0;
381
+ padding: 5px 7px;
382
+ }
383
+
384
+ .yit-container.product-licence-activation .button-licence.licence-deactive {
385
+ margin-bottom: 10px;
386
+ }
387
+
388
+ .yit-container.product-licence-activation table:not(.to-active-table) th {
389
+ line-height: 20px;
390
+ }
391
+
392
+ .yit-container.product-licence-activation table tbody tr td {
393
+ padding: 5px;
394
+ }
395
+
396
+ .yit-container.product-licence-activation .activation-faq {
397
+ margin-right: 20px;
398
+ }
399
+ }
400
+
401
+ @media (min-width: 980px) and (max-width: 1199px) {
402
+ .yit-container.product-licence-activation .button-licence.licence-deactive,
403
+ .yit-container.product-licence-activation .button-licence.licence-renew {
404
+ display: block;
405
+ margin-left: 0;
406
+ padding: 5px 7px;
407
+ }
408
+
409
+ .yit-container.product-licence-activation .button-licence.licence-renew {
410
+ margin-top: 10px;
411
+ }
412
+
413
+ .yit-container.product-licence-activation table:not(.to-active-table) th {
414
+ line-height: 20px;
415
+ }
416
+
417
+ .yit-container.product-licence-activation table tbody tr td {
418
+ padding: 5px;
419
+ }
420
+
421
+ .yit-container.product-licence-activation .activation-faq {
422
+ width: 75%;
423
+ }
424
+ }
425
+
426
+ @media (min-width: 1200px) {
427
+ .yit-container.product-licence-activation{
428
+ width: auto;
429
+ }
430
+
431
+ .yit-container.product-licence-activation .activation-faq {
432
+ width: 50%;
433
+ }
434
+ }
435
+
436
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
437
+ only screen and (-o-min-device-pixel-ratio: 3/2),
438
+ only screen and (min--moz-device-pixel-ratio: 1.5),
439
+ only screen and (min-device-pixel-ratio: 1.5) {}
plugin-fw/licence/assets/js/yit-licence.js CHANGED
@@ -1,196 +1,196 @@
1
- /**
2
- * This file belongs to the YIT Plugin Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
-
10
-
11
- (function ($) {
12
-
13
- /* === Licence API === */
14
-
15
- var licence_activation = function (button) {
16
- button.on('click', function (e, button) {
17
- e.preventDefault();
18
-
19
- var t = $(this),
20
- form_id = t.data('formid'),
21
- form = $('#' + form_id),
22
- data = form.serialize(),
23
- message = $(form).find('.message'),
24
- message_wrapper = $(form).find('.message-wrapper'),
25
- email = form.find('.user-email'),
26
- licence_key = form.find('.licence-key'),
27
- email_val = form.find('.user-email').val(),
28
- licence_key_val = form.find('.licence-key').val(),
29
- error = false,
30
- error_fields = new Array(),
31
- product_row = form.find('.product-row'),
32
- licence_activation = $('.licence-activation'),
33
- spinner = $('#products-to-active').find('.spinner');
34
-
35
- /* Init Input Fields */
36
- message.empty();
37
- message_wrapper.removeClass('visible')
38
- email.removeClass('require');
39
- licence_key.removeClass('require');
40
- product_row.removeClass('error');
41
- spinner.addClass('show');
42
- t.add(licence_activation).prop("disabled", true).addClass('clicked');
43
-
44
- if ('' == email_val) {
45
- error = true;
46
- error_fields[ error_fields.length ] = licence_message.email;
47
- email.addClass('require');
48
- }
49
-
50
- if ('' == licence_key_val) {
51
- error = true;
52
- error_fields[ error_fields.length ] = licence_message.license_key;
53
- licence_key.addClass('require');
54
- }
55
-
56
- if (false == error) {
57
- jQuery.ajax({
58
- type : 'POST',
59
- url : ajaxurl,
60
- data : data,
61
- success: function (response) {
62
-
63
- spinner.removeClass('show');
64
- t.add(licence_activation).prop("disabled", false).removeClass('clicked');
65
-
66
- if (true == response.activated) {
67
- $('.product-licence-activation').empty().replaceWith(response.template);
68
- licence_api();
69
- } else if (false != response) {
70
- message.text(response.error);
71
- message_wrapper.addClass('visible');
72
- product_row.addClass('error');
73
- } else {
74
- message.text(licence_message.server);
75
- message_wrapper.addClass('visible');
76
- product_row.addClass('error');
77
- }
78
- }
79
- });
80
- } else {
81
- if (error_fields.length == 1) {
82
- message.text(licence_message.error.replace('%field%', error_fields[0]));
83
- message_wrapper.addClass('visible');
84
- product_row.addClass('error');
85
- } else {
86
- var message_text = licence_message.errors;
87
- for (var i = 0; i < error_fields.length; i++) {
88
- message_text = message_text.replace('%field_' + ( i + 1) + '%', error_fields[i]);
89
- message_wrapper.addClass('visible');
90
- }
91
- message.text(message_text);
92
- message_wrapper.addClass('visible');
93
- product_row.addClass('error');
94
- }
95
-
96
- spinner.removeClass('show');
97
- t.add(licence_activation).prop("disabled", false).removeClass('clicked');
98
- }
99
- });
100
- };
101
-
102
- var licence_update = function (button) {
103
- button.on('click', function (e) {
104
- e.preventDefault();
105
-
106
- var t = $(this),
107
- form = $('#licence-check-update'),
108
- data = form.serialize();
109
-
110
- t.prop("disabled", true).addClass('clicked');
111
- form.find('div.spinner').addClass('show');
112
-
113
- jQuery.ajax({
114
- type : 'POST',
115
- url : ajaxurl,
116
- data : data,
117
- success: function (response) {
118
- $('.product-licence-activation').empty().replaceWith(response.template);
119
- licence_api();
120
- }
121
- });
122
- });
123
- };
124
-
125
- var licence_deactivate = function (button) {
126
- button.on('click', function (e) {
127
- e.preventDefault();
128
-
129
- var check = script_info.is_debug == true ? true : confirm( licence_message.are_you_sure );
130
-
131
- if( check == true ){
132
- var t = $(this),
133
- licence_key = t.data('licence-key'),
134
- licence_email = t.data('licence-email'),
135
- product_init = t.data('product-init'),
136
- action = t.data('action'),
137
- renew = $('.licence-renew'),
138
- deactive = $('.licence-deactive'),
139
- message = $('#yith-licence-notice'),
140
- activated_table = $('.activated-table');
141
-
142
- t.add(renew).add(deactive).prop("disabled", true).addClass('clicked');
143
- $('#activated-products').find('.spinner').addClass('show');
144
-
145
- jQuery.ajax({
146
- type : 'POST',
147
- url : ajaxurl,
148
- data : {
149
- action: action,
150
- licence_key: licence_key,
151
- email: licence_email,
152
- product_init: product_init
153
- },
154
- success: function (response) {
155
- message.css( 'maxWidth', activated_table.width() );
156
- if (false == response.activated && typeof response.error == 'undefined') {
157
- $('.product-licence-activation').empty().replaceWith(response.template);
158
- licence_api();
159
- }
160
-
161
- if (false == response.activated && typeof response.error != 'undefined') {
162
- message.find('p.yith-licence-notice-message').html(response.error);
163
- message.removeClass('notice-success').addClass('notice-error visible');
164
- t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
165
- $('#activated-products').find('.spinner').removeClass('show');
166
- }
167
-
168
- else if (false == response) {
169
- message.find('p.yith-licence-notice-message').html(licence_message.server);
170
- message.removeClass('notice-success').addClass('notice-error visible');
171
- t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
172
- $('#activated-products').find('.spinner').removeClass('show');
173
- }
174
- }
175
- });
176
- }
177
- });
178
- };
179
-
180
- var licence_api = function () {
181
- var button = $('.licence-activation'),
182
- check = $('.licence-check'),
183
- deactivated = $('.licence-deactive');
184
-
185
- licence_activation(button);
186
- licence_update(check);
187
- licence_deactivate(deactivated);
188
- };
189
-
190
- licence_api();
191
-
192
- $('body').on('click', '.yit-changelog-button', function (e) {
193
- $('#TB_window').remove();
194
- });
195
-
1
+ /**
2
+ * This file belongs to the YIT Plugin Framework.
3
+ *
4
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
+ * that is bundled with this package in the file LICENSE.txt.
6
+ * It is also available through the world-wide-web at this URL:
7
+ * http://www.gnu.org/licenses/gpl-3.0.txt
8
+ */
9
+
10
+
11
+ (function ($) {
12
+
13
+ /* === Licence API === */
14
+
15
+ var licence_activation = function (button) {
16
+ button.on('click', function (e, button) {
17
+ e.preventDefault();
18
+
19
+ var t = $(this),
20
+ form_id = t.data('formid'),
21
+ form = $('#' + form_id),
22
+ data = form.serialize(),
23
+ message = $(form).find('.message'),
24
+ message_wrapper = $(form).find('.message-wrapper'),
25
+ email = form.find('.user-email'),
26
+ licence_key = form.find('.licence-key'),
27
+ email_val = form.find('.user-email').val(),
28
+ licence_key_val = form.find('.licence-key').val(),
29
+ error = false,
30
+ error_fields = new Array(),
31
+ product_row = form.find('.product-row'),
32
+ licence_activation = $('.licence-activation'),
33
+ spinner = $('#products-to-active').find('.spinner');
34
+
35
+ /* Init Input Fields */
36
+ message.empty();
37
+ message_wrapper.removeClass('visible')
38
+ email.removeClass('require');
39
+ licence_key.removeClass('require');
40
+ product_row.removeClass('error');
41
+ spinner.addClass('show');
42
+ t.add(licence_activation).prop("disabled", true).addClass('clicked');
43
+
44
+ if ('' == email_val) {
45
+ error = true;
46
+ error_fields[ error_fields.length ] = licence_message.email;
47
+ email.addClass('require');
48
+ }
49
+
50
+ if ('' == licence_key_val) {
51
+ error = true;
52
+ error_fields[ error_fields.length ] = licence_message.license_key;
53
+ licence_key.addClass('require');
54
+ }
55
+
56
+ if (false == error) {
57
+ jQuery.ajax({
58
+ type : 'POST',
59
+ url : ajaxurl,
60
+ data : data,
61
+ success: function (response) {
62
+
63
+ spinner.removeClass('show');
64
+ t.add(licence_activation).prop("disabled", false).removeClass('clicked');
65
+
66
+ if (true == response.activated) {
67
+ $('.product-licence-activation').empty().replaceWith(response.template);
68
+ licence_api();
69
+ } else if (false != response) {
70
+ message.text(response.error);
71
+ message_wrapper.addClass('visible');
72
+ product_row.addClass('error');
73
+ } else {
74
+ message.text(licence_message.server);
75
+ message_wrapper.addClass('visible');
76
+ product_row.addClass('error');
77
+ }
78
+ }
79
+ });
80
+ } else {
81
+ if (error_fields.length == 1) {
82
+ message.text(licence_message.error.replace('%field%', error_fields[0]));
83
+ message_wrapper.addClass('visible');
84
+ product_row.addClass('error');
85
+ } else {
86
+ var message_text = licence_message.errors;
87
+ for (var i = 0; i < error_fields.length; i++) {
88
+ message_text = message_text.replace('%field_' + ( i + 1) + '%', error_fields[i]);
89
+ message_wrapper.addClass('visible');
90
+ }
91
+ message.text(message_text);
92
+ message_wrapper.addClass('visible');
93
+ product_row.addClass('error');
94
+ }
95
+
96
+ spinner.removeClass('show');
97
+ t.add(licence_activation).prop("disabled", false).removeClass('clicked');
98
+ }
99
+ });
100
+ };
101
+
102
+ var licence_update = function (button) {
103
+ button.on('click', function (e) {
104
+ e.preventDefault();
105
+
106
+ var t = $(this),
107
+ form = $('#licence-check-update'),
108
+ data = form.serialize();
109
+
110
+ t.prop("disabled", true).addClass('clicked');
111
+ form.find('div.spinner').addClass('show');
112
+
113
+ jQuery.ajax({
114
+ type : 'POST',
115
+ url : ajaxurl,
116
+ data : data,
117
+ success: function (response) {
118
+ $('.product-licence-activation').empty().replaceWith(response.template);
119
+ licence_api();
120
+ }
121
+ });
122
+ });
123
+ };
124
+
125
+ var licence_deactivate = function (button) {
126
+ button.on('click', function (e) {
127
+ e.preventDefault();
128
+
129
+ var check = script_info.is_debug == true ? true : confirm( licence_message.are_you_sure );
130
+
131
+ if( check == true ){
132
+ var t = $(this),
133
+ licence_key = t.data('licence-key'),
134
+ licence_email = t.data('licence-email'),
135
+ product_init = t.data('product-init'),
136
+ action = t.data('action'),
137
+ renew = $('.licence-renew'),
138
+ deactive = $('.licence-deactive'),
139
+ message = $('#yith-licence-notice'),
140
+ activated_table = $('.activated-table');
141
+
142
+ t.add(renew).add(deactive).prop("disabled", true).addClass('clicked');
143
+ $('#activated-products').find('.spinner').addClass('show');
144
+
145
+ jQuery.ajax({
146
+ type : 'POST',
147
+ url : ajaxurl,
148
+ data : {
149
+ action: action,
150
+ licence_key: licence_key,
151
+ email: licence_email,
152
+ product_init: product_init
153
+ },
154
+ success: function (response) {
155
+ message.css( 'maxWidth', activated_table.width() );
156
+ if (false == response.activated && typeof response.error == 'undefined') {
157
+ $('.product-licence-activation').empty().replaceWith(response.template);
158
+ licence_api();
159
+ }
160
+
161
+ if (false == response.activated && typeof response.error != 'undefined') {
162
+ message.find('p.yith-licence-notice-message').html(response.error);
163
+ message.removeClass('notice-success').addClass('notice-error visible');
164
+ t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
165
+ $('#activated-products').find('.spinner').removeClass('show');
166
+ }
167
+
168
+ else if (false == response) {
169
+ message.find('p.yith-licence-notice-message').html(licence_message.server);
170
+ message.removeClass('notice-success').addClass('notice-error visible');
171
+ t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
172
+ $('#activated-products').find('.spinner').removeClass('show');
173
+